:root {
  color-scheme: dark;
  --bg: #0c0809;
  --surface: #120d0f;
  --surface-2: #1a1315;
  --grid: #2a2023;
  --axis: #4d3e42;
  --ink: #f1e9e4;
  --ink-2: #c4b5b0;
  --ink-3: #8f7f7b;
  --crimson: #d42c4c;
  --gold: #b8840f;
  --teal: #2f97c9;
  --fan: 212, 44, 76;
  --fan-teal: 47, 151, 201;
  --gold-brand: #d4a62a;
  --bug: #221a1c;
  --replay: #7d86d9;
  --flash: rgba(150, 10, 40, 0.55);
  --display: "Cormorant Garamond", "EB Garamond", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #ece5d8;
    --surface: #f4efe6;
    --surface-2: #ebe3d6;
    --grid: #ddd3c4;
    --axis: #b3a796;
    --ink: #1b1214;
    --ink-2: #574a4c;
    --ink-3: #7d7072;
    --crimson: #b01e3c;
    --gold: #a87400;
    --teal: #00809a;
    --fan: 176, 30, 60;
    --fan-teal: 0, 128, 154;
    --gold-brand: #b8860b;
    --bug: #1b1214;
    --replay: #4c56b8;
    --flash: rgba(176, 30, 60, 0.35);
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #ece5d8;
  --surface: #f4efe6;
  --surface-2: #ebe3d6;
  --grid: #ddd3c4;
  --axis: #b3a796;
  --ink: #1b1214;
  --ink-2: #574a4c;
  --ink-3: #7d7072;
  --crimson: #b01e3c;
  --gold: #a87400;
  --teal: #00809a;
  --fan: 176, 30, 60;
  --fan-teal: 0, 128, 154;
  --gold-brand: #b8860b;
  --bug: #1b1214;
  --replay: #4c56b8;
  --flash: rgba(176, 30, 60, 0.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14.5px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
button, select, input { font: inherit; color: inherit; }
a { color: inherit; }

/* ------------------------------------------------------------ header */
header {
  padding: 22px 24px 0;
  border-bottom: 1px solid var(--grid);
  background:
    repeating-linear-gradient(45deg, transparent 0 13px, rgba(var(--fan), 0.05) 13px 14px),
    repeating-linear-gradient(-45deg, transparent 0 13px, rgba(var(--fan), 0.05) 13px 14px),
    var(--surface);
}
.brand { display: flex; align-items: center; gap: 14px 18px; flex-wrap: wrap; max-width: 1480px; margin: 0 auto; }
.wordmark { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.wordmark .mark { width: 30px; height: 30px; }
.wordmark span {
  font: 600 34px/1 var(--display); letter-spacing: 0.01em;
  background: linear-gradient(180deg, var(--ink) 30%, var(--gold-brand) 140%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tagline { color: var(--ink-3); font: italic 18px var(--display); }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
nav { display: flex; gap: 2px; margin: 14px auto 0; max-width: 1480px; overflow-x: auto; }
nav button {
  background: none; border: 0; padding: 10px 14px 12px; cursor: pointer; white-space: nowrap;
  color: var(--ink-3); border-bottom: 2px solid transparent; letter-spacing: 0.03em;
}
nav button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--gold-brand); }
@media (max-width: 520px) { nav button { padding: 10px 7px 12px; letter-spacing: 0; font-size: 13.5px; } }
nav button:hover { color: var(--ink); }

main { padding: 22px 24px 40px; max-width: 1480px; margin: 0 auto; }
.view[hidden], .picker[hidden] { display: none; }

/* ---------------------------------------------------------- controls */
.control { display: flex; align-items: center; gap: 8px; color: var(--ink-2); min-width: 0; flex-wrap: wrap; }
.control > span { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.09em; color: var(--ink-3); }
.control.compact > span { text-transform: none; letter-spacing: 0; font-size: 12.5px; }
select, .btn, .chip, .seg button {
  background: var(--surface); border: 1px solid var(--grid); border-radius: 7px; padding: 6px 11px; cursor: pointer;
}
select { max-width: 100%; }
select:hover, .btn:hover, .chip:hover, .seg button:hover { border-color: var(--axis); }
.btn.icon { padding: 5px 10px; }
.btn.big { padding: 10px 18px; font-size: 15px; }
.btn.primary { border-color: var(--gold-brand); }
.btn.primary:hover { background: color-mix(in srgb, var(--gold-brand) 14%, transparent); }
.btn.crimson { border-color: var(--crimson); }
.btn.crimson:hover { background: rgba(var(--fan), 0.12); }
.btn.ghost { border-color: transparent; background: none; color: var(--ink-3); }
.btn.replay { border-color: var(--replay); }
.btn.replay[aria-pressed="true"] { background: color-mix(in srgb, var(--replay) 20%, transparent); }
.btn:disabled { opacity: 0.4; cursor: default; }
.chip { padding: 3px 10px; font-size: 12.5px; color: var(--ink-2); }
.chip[aria-pressed="true"] { border-color: var(--crimson); color: var(--ink); background: rgba(var(--fan), 0.12); }
.chip:disabled { opacity: 0.35; cursor: default; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.seg { display: inline-flex; }
.seg button { border-radius: 0; font-size: 12.5px; padding: 4px 12px; }
.seg button:first-child { border-radius: 7px 0 0 7px; }
.seg button:last-child { border-radius: 0 7px 7px 0; border-left: 0; }
.seg button[aria-pressed="true"] { background: rgba(var(--fan), 0.14); color: var(--ink); border-color: var(--crimson); }
.kbd { font: 11px var(--mono); color: var(--ink-3); border: 1px solid var(--grid); border-radius: 4px; padding: 0 5px; margin-left: 3px; }
.hint { color: var(--ink-3); font-size: 12.5px; }

/* ------------------------------------------------------------ picker */
.picker { margin-bottom: 14px; }
.picker-row { display: flex; flex-wrap: wrap; gap: 10px 22px; align-items: center; margin-bottom: 8px; }
.date-label { font: 500 15px var(--mono); min-width: 104px; text-align: center; }
.navigator { position: relative; background: var(--surface); border: 1px solid var(--grid); border-radius: 10px; padding: 4px 8px; cursor: pointer; touch-action: none; }
.navigator svg { display: block; width: 100%; }

/* ------------------------------------------------------------ layout */
.grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1050px) { .grid { grid-template-columns: minmax(0, 1fr); } }
.card { position: relative; background: var(--surface); border: 1px solid var(--grid); border-radius: 12px; padding: 16px 16px 12px; min-width: 0; }
.card h2 { font: 600 21px/1.2 var(--display); letter-spacing: 0.01em; margin: 0 0 2px; }
.card .sub { color: var(--ink-3); font-size: 13px; margin: 0 0 10px; }
.card-head { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.card-head > div:first-child { flex: 1 1 260px; min-width: 0; }
.head-controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 6px 0 8px; }
.chart { width: 100%; position: relative; }
.chart svg { display: block; width: 100%; overflow: visible; }

/* The readout: one or two sentences that say what the charts show. */
.reading {
  font: 500 21px/1.45 var(--display); color: var(--ink-2); margin: 2px 0 16px; max-width: 76ch; min-height: 2.9em;
}
.reading b { color: var(--ink); font-weight: 600; }
.reading .hi { color: var(--crimson); font-weight: 600; }

svg text { fill: var(--ink-3); font: 11px var(--sans); }
svg .tick line { stroke: var(--grid); }
svg .axis-line { stroke: var(--axis); }
svg .zero { stroke: var(--axis); stroke-dasharray: 2 3; }
svg .label { fill: var(--ink-2); }
svg .direct { font-size: 11.5px; fill: var(--ink-2); }
svg .direct-strong { font-size: 12px; fill: var(--ink); font-weight: 600; }
svg .halo { stroke: var(--surface); stroke-width: 4px; paint-order: stroke; stroke-linejoin: round; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--ink-2); margin: 6px 0 0; }
.legend i { display: inline-block; width: 14px; height: 0; border-top: 2px solid; vertical-align: middle; margin-right: 6px; }
.legend i.band { height: 10px; border: 0; border-radius: 2px; }
.legend i.dash { border-top-style: dashed; }
.legend i.dot { width: 8px; height: 8px; border-radius: 50%; border: 0; }
.legend i.ring { width: 9px; height: 9px; border-radius: 50%; border: 2px solid; }

table.stats { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 10px; }
table.stats th { text-align: left; color: var(--ink-3); font-weight: 500; padding: 5px 6px; border-bottom: 1px solid var(--grid); }
table.stats td { padding: 5px 6px; border-bottom: 1px solid var(--grid); font-family: var(--mono); color: var(--ink-2); white-space: nowrap; }
table.stats td:first-child { font-family: var(--sans); color: var(--ink-2); white-space: normal; }
table.stats td:first-child small { color: var(--ink-3); display: block; font-size: 11.5px; }
table.stats th:not(:first-child), table.stats td:not(:first-child) { text-align: right; }
table.stats tr.em td { color: var(--ink); }
.swatch { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }

.tooltip {
  position: fixed; z-index: 20; pointer-events: none; opacity: 0; transition: opacity 80ms;
  background: var(--surface-2); border: 1px solid var(--axis); border-radius: 8px; padding: 8px 10px;
  font-size: 12px; color: var(--ink-2); box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35); max-width: 300px;
}
.tooltip b { color: var(--ink); font-weight: 600; }
.tooltip .row { display: flex; justify-content: space-between; gap: 14px; font-family: var(--mono); }
.tooltip .row span:first-child { font-family: var(--sans); color: var(--ink-3); }

.notice { color: var(--ink-3); font-size: 12.5px; margin-top: 8px; }
.status { color: var(--ink-3); padding: 40px 0; text-align: center; font: italic 18px var(--display); }
.loading { position: absolute; inset: 0; display: grid; place-items: center; background: color-mix(in srgb, var(--surface) 70%, transparent); border-radius: 12px; font: italic 17px var(--display); color: var(--ink-2); }
.loading[hidden] { display: none; }

/* -------------------------------------------------------------- start */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; align-items: center; margin: 8px 0 34px; }
@media (max-width: 960px) { .hero { grid-template-columns: minmax(0, 1fr); } }
.eyebrow { color: var(--gold-brand); text-transform: uppercase; letter-spacing: 0.14em; font-size: 12px; margin: 0 0 8px; }
.hero-title { font: 600 54px/1.05 var(--display); margin: 0 0 16px; letter-spacing: -0.005em; }
.hero-title.small { font-size: 40px; }
.lede { font-size: 17px; color: var(--ink-2); max-width: 60ch; margin: 0 0 12px; }
.lede.small { font-size: 14.5px; color: var(--ink-3); }
.lede em { font-family: var(--display); font-size: 1.08em; }
.cta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.card-kicker { margin: 0 0 4px; color: var(--ink-3); font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.08em; }
.hero-caption { color: var(--ink-3); font-size: 13px; margin: 6px 0 0; }
.section-title { font: 600 26px/1.2 var(--display); margin: 34px 0 14px; }
.stories { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 860px) { .stories { grid-template-columns: minmax(0, 1fr); } }
.story {
  text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 6px;
  background: var(--surface); border: 1px solid var(--grid); border-radius: 12px; padding: 16px 18px 18px;
  transition: border-color 120ms, transform 120ms;
}
.story:hover { border-color: var(--crimson); transform: translateY(-1px); }
.story-tag { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.09em; color: var(--gold-brand); }
.story-title { font: 600 21px/1.2 var(--display); color: var(--ink); }
.story-text { color: var(--ink-3); font-size: 13.5px; }
.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 860px) { .steps { grid-template-columns: minmax(0, 1fr); } }
.steps li { background: var(--surface); border: 1px solid var(--grid); border-radius: 12px; padding: 16px 18px; }
.steps b { font: 600 19px var(--display); display: block; margin: 6px 0 4px; }
.steps p { margin: 0; color: var(--ink-3); font-size: 13.5px; }
.step-n { font: 500 12px var(--mono); color: var(--crimson); border: 1px solid var(--crimson); border-radius: 50%; width: 24px; height: 24px; display: inline-grid; place-items: center; }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 860px) { .facts { grid-template-columns: minmax(0, 1fr); } }
.fact { border-left: 2px solid var(--gold-brand); padding: 4px 0 4px 14px; }
.fact-num { display: block; font: 600 34px/1.1 var(--display); color: var(--ink); }
.fact-text { color: var(--ink-3); font-size: 13.5px; }

/* -------------------------------------------------------------- guide */
.prose { max-width: 860px; }
.guide-card { margin: 8px 0 8px; }
.glossary { display: grid; grid-template-columns: minmax(150px, 220px) minmax(0, 1fr); gap: 10px 22px; margin: 0; }
@media (max-width: 640px) { .glossary { grid-template-columns: minmax(0, 1fr); gap: 2px; } .glossary dd { margin-bottom: 10px; } }
.glossary dt { font: 600 17px var(--display); color: var(--ink); }
.glossary dd { margin: 0; color: var(--ink-2); }
.notes { color: var(--ink-2); padding-left: 18px; }
.notes li { margin: 4px 0; }
.notes.keys { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 22px; }

/* -------------------------------- the jump: the time between is erased */
.flash { position: absolute; inset: 0; pointer-events: none; border-radius: 12px; opacity: 0; background: radial-gradient(ellipse at center, transparent 20%, var(--flash) 100%); }
.flash.on { animation: erase 650ms ease-out; }
@keyframes erase { 0% { opacity: 0; } 18% { opacity: 1; } 100% { opacity: 0; } }
.toast {
  position: absolute; left: 50%; top: 150px; transform: translateX(-50%); pointer-events: none; white-space: nowrap;
  font: italic 16px var(--display); color: var(--ink); opacity: 0; letter-spacing: 0.03em;
  background: var(--surface-2); border: 1px solid var(--crimson); border-radius: 999px; padding: 4px 14px;
}
.toast.on { animation: toast 2200ms ease-out; }
@keyframes toast { 0%, 100% { opacity: 0; } 12%, 70% { opacity: 1; } }

footer { color: var(--ink-3); text-align: center; padding: 18px 24px 34px; font: italic 15px var(--display); }
footer .dot { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--gold-brand); margin: 0 10px; vertical-align: 3px; }

@media (max-width: 640px) {
  header { padding: 18px 16px 0; }
  main { padding: 16px 16px 32px; }
  .wordmark span { font-size: 26px; letter-spacing: 0.24em; }
  .tagline { display: none; }
  .hero-title { font-size: 40px; }
  .reading { font-size: 18px; }
  .toast { white-space: normal; width: 86%; text-align: center; }
  table.stats { font-size: 12px; }
  table.stats td.range { white-space: normal; }
  table.stats td:first-child small { display: none; }
}
@media (hover: none) { .hint { display: none; } }
@media (prefers-reduced-motion: reduce) {
  .flash.on, .toast.on { animation-duration: 1ms; }
  .story { transition: none; }
}
