:root {
  --bg: #f7f5f0;
  --surface: #ffffff;
  --surface-2: #f1eee7;
  --text: #1f1d1a;
  --muted: #6b665d;
  --line: #e3ded3;
  --accent: #c2410c;
  --accent-soft: #fde9dc;
  --sol: #d97706;
  --sol-soft: #fef3c7;
  --holiday: #b91c1c;
  --holiday-soft: #fde2e2;
  --special: #4338ca;
  --special-soft: #e5e7fb;
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15140f;
    --surface: #1e1d18;
    --surface-2: #27261f;
    --text: #eeeae0;
    --muted: #a39e92;
    --line: #34322a;
    --accent: #fb923c;
    --accent-soft: #3b2415;
    --sol: #fbbf24;
    --sol-soft: #3a2c0c;
    --holiday: #f87171;
    --holiday-soft: #3b1a1a;
    --special: #a5b4fc;
    --special-soft: #23264a;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1rem; }

.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }

.top { border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 5; }
.top-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; flex-wrap: wrap; }
.brand { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.logo { background: var(--sol); color: #fff; border-radius: 6px; font-size: .8rem; padding: 2px 6px; }
nav { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
nav a { color: var(--muted); text-decoration: none; font-size: .95rem; }
nav a:hover { color: var(--text); }
.country { font-size: .85rem; color: var(--muted); display: flex; gap: 6px; align-items: center; }

select, input, button {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px;
}
button { cursor: pointer; }
button:hover { background: var(--surface-2); }
button:focus-visible, select:focus-visible, input:focus-visible, .day:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.country select { max-width: 180px; padding: 4px 8px; }

main { padding: 24px 16px 8px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }

/* Today */
.hero {
  background: linear-gradient(135deg, var(--accent-soft), var(--surface) 70%);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 24px;
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px;
}
.eyebrow { margin: 0 0 6px; text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; color: var(--muted); font-weight: 600; }
.hero h1 { font-size: clamp(1.6rem, 4.5vw, 2.4rem); letter-spacing: -.01em; }
.greg { color: var(--muted); margin: 8px 0 0; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 0; }
.stats div { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px; min-width: 0; }
.stats dt { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.stats dd { margin: 2px 0; font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stats span { font-size: .8rem; color: var(--muted); }
.progress { grid-column: 1 / -1; height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress div { height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .4s; }

.hol-tags { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.hol-tags li { background: var(--holiday-soft); color: var(--holiday); border-radius: 99px; padding: 2px 10px; font-size: .85rem; font-weight: 600; }

/* Calendar */
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cal-title { text-align: center; }
.cal-title h2 { font-size: 1.6rem; }
.cal-title p { margin: 4px 0 0; color: var(--muted); font-size: .9rem; }
.icon { font-size: 1.4rem; width: 42px; height: 42px; padding: 0; border-radius: 50%; line-height: 1; }

.cal-tools { display: flex; gap: 12px; align-items: center; justify-content: space-between; margin: 16px 0; flex-wrap: wrap; }
.month-strip { display: flex; gap: 4px; flex-wrap: wrap; }
.month-strip button { padding: 4px 8px; font-size: .8rem; border-color: transparent; background: var(--surface-2); }
.month-strip button.sol { color: var(--sol); font-weight: 700; }
.month-strip button[aria-selected="true"] { background: var(--accent); color: #fff; }
.cal-jump { display: flex; gap: 6px; }
.cal-jump input { width: 90px; }

.grid { display: grid; grid-template-columns: 2.2rem repeat(7, minmax(0, 1fr)); gap: 4px; }
.grid .dow { text-align: center; font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 4px 0; }
.grid .wk { display: flex; align-items: center; justify-content: center; font-size: .75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.day {
  border: 1px solid var(--line); border-radius: 10px; min-height: 84px; padding: 6px 8px;
  display: flex; flex-direction: column; gap: 2px; background: var(--surface); text-align: left;
  min-width: 0;
}
.day .n { font-weight: 700; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.day .g { font-size: .72rem; color: var(--muted); }
.day .h { font-size: .7rem; color: var(--holiday); font-weight: 600; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.day.weekend { background: var(--surface-2); }
.day.holiday { border-color: var(--holiday); background: var(--holiday-soft); }
.day.holiday .n { color: var(--holiday); }
.day.today { outline: 2px solid var(--accent); outline-offset: -2px; }
.day.today .n::after { content: "today"; font-size: .6rem; font-weight: 700; text-transform: uppercase; background: var(--accent); color: #fff; border-radius: 4px; padding: 1px 4px; margin-left: 6px; vertical-align: middle; }
.grid .q-start { border-top: 3px solid var(--sol); }
.grid .wk.q-start { flex-direction: column; border-top: 0; }
.grid .wk .q { font-size: .65rem; font-weight: 700; color: var(--sol); }
.sol-month .day:not(.holiday):not(.weekend) { background: var(--sol-soft); }

.special {
  margin-top: 10px; border: 1px dashed var(--special); background: var(--special-soft); color: var(--text);
  border-radius: 10px; padding: 12px 14px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: baseline;
}
.special strong { color: var(--special); }
.special .g { color: var(--muted); font-size: .9rem; }
.special.today { outline: 2px solid var(--accent); }

.month-hols { margin-top: 18px; }
.month-hols ul { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 4px; }
.month-hols li { display: flex; gap: 12px; font-size: .92rem; padding: 6px 0; border-bottom: 1px solid var(--line); }
.month-hols li:last-child { border-bottom: 0; }
.month-hols .d { color: var(--holiday); font-weight: 600; min-width: 9.5rem; }
.month-hols .gd { color: var(--muted); margin-left: auto; white-space: nowrap; }
.month-hols .empty { color: var(--muted); }

/* Quarters */
.muted { color: var(--muted); margin: 6px 0 14px; }
.quarters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.quarter {
  text-align: left; display: flex; flex-direction: column; gap: 4px; padding: 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
}
.quarter .qn { font-weight: 700; font-size: 1.2rem; }
.quarter .qr { font-size: .9rem; }
.quarter .qg, .quarter .qw { font-size: .8rem; color: var(--muted); }
.quarter.current { border-color: var(--accent); background: var(--accent-soft); }
.quarter.current .qn::after { content: "now"; font-size: .6rem; font-weight: 700; text-transform: uppercase; background: var(--accent); color: #fff; border-radius: 4px; padding: 1px 4px; margin-left: 6px; vertical-align: middle; }

/* Convert */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.two-col h2 { margin-bottom: 12px; }
.row { display: flex; gap: 6px; flex-wrap: wrap; }
.row input { width: 90px; }
.result { margin: 12px 0 0; font-weight: 600; min-height: 1.5em; }
.result small { display: block; font-weight: 400; color: var(--muted); }

.about ul { margin: 12px 0 0; padding-left: 1.2em; display: grid; gap: 6px; }

/* API */
#api p { color: var(--muted); }
table.api { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.api td { padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.api td:first-child { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; overflow-wrap: anywhere; }
pre { background: var(--surface-2); border-radius: 10px; padding: 14px; overflow-x: auto; font-size: .8rem; margin: 16px 0 0; max-height: 340px; }

.foot { color: var(--muted); font-size: .85rem; padding: 16px 16px 40px; }

@media (max-width: 720px) {
  .hero { grid-template-columns: minmax(0, 1fr); padding: 18px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats dd { font-size: 1.25rem; }
  .two-col { grid-template-columns: minmax(0, 1fr); }
  .quarters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
  .grid .wk, .grid .wk-head { display: none; }
  .day { min-height: 58px; padding: 4px; border-radius: 8px; }
  .day .n { font-size: .95rem; }
  .day .g { font-size: .62rem; }
  .day .h { display: none; }
  .day.holiday .n::before { content: "•"; color: var(--holiday); margin-right: 1px; }
  .day.today .n::after { display: none; }
  .month-hols .d { min-width: 0; }
  .cal-title h2 { font-size: 1.3rem; }
  nav { gap: 12px; }
}
