/* Layout: a full-bleed "conditions" hero that thaws from frost to festive red as
   the index rises (driven by --heat, 0..1, set from JS), then a quiet data column. */
:root {
  --bg: #e8eff5;          /* frost */
  --surface: #f6f9fc;
  --ink: #0e1a2b;         /* midnight */
  --ink-2: #3a4a5e;
  --ink-3: #66778c;
  --rule: #cad7e2;
  --ice: #7fa8c9;
  --red: #c8102e;         /* the Santa-dress red */
  --gold: #a87a06;
  --past-1: #4f6d8c;
  --past-2: #7591ad;
  --past-3: #98afc6;
  --past-4: #b5c7d8;
  --past-5: #ccd9e5;
  --flake: #ffffff;

  --display: "Bricolage Grotesque", "Arial Narrow", system-ui, sans-serif;
  --body: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "DM Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --heat: 0;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #09111e; --surface: #0f1a2b; --ink: #e9f1f8; --ink-2: #b2c2d3; --ink-3: #7c8fa4;
    --rule: #1f3049; --ice: #5d88ae; --red: #ff4f61; --gold: #f2c14e;
    --past-1: #8fa9c4; --past-2: #6f8aa7; --past-3: #57708c; --past-4: #455b74; --past-5: #374a60;
    --flake: #dfeaf5; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #09111e; --surface: #0f1a2b; --ink: #e9f1f8; --ink-2: #b2c2d3; --ink-3: #7c8fa4;
  --rule: #1f3049; --ice: #5d88ae; --red: #ff4f61; --gold: #f2c14e;
  --past-1: #8fa9c4; --past-2: #6f8aa7; --past-3: #57708c; --past-4: #455b74; --past-5: #374a60;
  --flake: #dfeaf5; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.6 var(--body);
}
a { color: inherit; text-decoration-color: var(--red); text-underline-offset: 3px; }
a:focus-visible, summary:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; border-radius: 2px; }

.wrap {
  max-width: 1040px; margin: 0 auto;
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
}

/* ---------- top bar ---------- */
.topbar {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 16px;
  padding-block: 18px;
}
.brand {
  font: 700 20px/1 var(--display); font-stretch: 85%; letter-spacing: -.01em; text-decoration: none;
}
.stamp { font: 13px var(--mono); color: var(--ink-3); }

/* ---------- hero: the bold part ---------- */
.hero {
  position: relative; overflow: hidden; isolation: isolate;
  background:
    radial-gradient(120% 90% at 85% 110%,
      color-mix(in oklab, var(--red) calc(var(--heat) * 70%), transparent) 0%, transparent 60%),
    radial-gradient(80% 60% at 100% 100%,
      color-mix(in oklab, var(--gold) calc(var(--heat) * 45%), transparent) 0%, transparent 55%),
    linear-gradient(180deg, var(--surface), color-mix(in oklab, var(--ice) 22%, var(--bg)));
  border-block: 1px solid var(--rule);
}
.snow { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }
.hero-inner {
  display: grid; gap: 28px 40px; align-items: end;
  grid-template-columns: minmax(0, 1fr) auto;
  padding-block: clamp(40px, 7vw, 80px) clamp(28px, 5vw, 48px);
}
.eyebrow {
  margin: 0 0 10px; font: 500 13px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2);
}
.hero h1 {
  margin: 0;
  font-family: var(--display); font-weight: 800; font-stretch: 80%;
  font-size: clamp(50px, 10.5vw, 124px); line-height: .9; letter-spacing: -.02em;
  color: var(--red);
  text-wrap: balance;
}
.blurb { margin: 18px 0 0; max-width: 56ch; color: var(--ink-2); font-size: 18px; }

.measure { margin: 12px 0 0; max-width: 56ch; font-size: 14px; line-height: 1.5; color: var(--ink-3); }
.measure em { color: var(--ink-2); }

.readout { display: grid; justify-items: end; text-align: right; }
.readout-num {
  font: 800 clamp(72px, 13vw, 148px)/.8 var(--display); font-stretch: 75%; letter-spacing: -.04em;
  font-variant-numeric: tabular-nums;
}
.readout-label { margin-top: 10px; font: 500 13px/1.4 var(--mono); color: var(--ink-2); text-transform: uppercase; letter-spacing: .05em; }
.readout-label span { display: block; text-transform: none; letter-spacing: 0; color: var(--ink-3); }

.thaw { grid-column: 1 / -1; }
.thaw-track {
  position: relative; height: 10px; border-radius: 5px; overflow: hidden;
  background: color-mix(in oklab, var(--ice) 25%, var(--surface));
  box-shadow: inset 0 0 0 1px var(--rule);
}
.thaw-fill {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--ice), var(--red) 70%, var(--gold));
  background-size: var(--track-w, 100%) 100%;
  transition: width 1.4s cubic-bezier(.2, .8, .2, 1);
}
.thaw-ticks { list-style: none; margin: 10px 0 0; padding: 0; position: relative; height: 22px; }
.thaw-ticks li {
  position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap;
  font: 12px var(--mono); color: var(--ink-3);
}
.thaw-ticks li:first-child { transform: none; }
.thaw-ticks li:last-child { transform: translateX(-100%); }
.thaw-ticks li.on { color: var(--ink); font-weight: 500; }
.thaw-ticks li.on::before { content: "▲ "; color: var(--red); }

@media (max-width: 640px) {
  .hero-inner { grid-template-columns: 1fr; }
  .readout { justify-items: start; text-align: left; grid-row: 2; }
  .thaw-ticks li:not(.on):not(:first-child):not(:last-child) { display: none; }
}

/* ---------- stats ---------- */
main { padding-block: 40px 64px; }
.stats {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 28px 32px;
  padding-bottom: 40px;
}
@media (max-width: 760px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat { display: grid; align-content: start; gap: 4px; border-top: 2px solid var(--ink); padding-top: 12px; }
.stat .k { font: 500 12px/1.4 var(--mono); text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); }
.stat .v { font: 700 clamp(30px, 4.5vw, 42px)/1.05 var(--display); font-stretch: 85%; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .s { font-size: 14px; color: var(--ink-2); }
.stat.up .v { color: var(--red); }

/* ---------- chart ---------- */
.chart-sec {
  background: var(--surface); border: 1px solid var(--rule); border-radius: 6px;
  padding: clamp(18px, 3vw, 28px);
}
.sec-head h2, .foot h2 {
  margin: 0; font: 700 26px/1.15 var(--display); font-stretch: 85%; letter-spacing: -.01em; text-wrap: balance;
}
.sec-head {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline;
  gap: 6px 40px; margin-bottom: 20px;
}
.sec-head p { margin: 0; color: var(--ink-2); font-size: 15px; max-width: 46ch; }
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; font-family: var(--mono); }
.chart .grid line { stroke: var(--rule); }
.chart .axis text { fill: var(--ink-3); font-size: 11px; }
.chart .label { font-size: 11px; fill: var(--ink-2); }
.chart .label.now { fill: var(--ink); font-weight: 500; }
.chart .marker line { stroke: var(--ink-3); stroke-dasharray: 2 3; }
.chart .marker text { fill: var(--ink-2); font-size: 11px; }
.chart .crosshair { stroke: var(--ink-3); stroke-width: 1; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 14px; font: 13px var(--mono); color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { display: inline-block; width: 18px; border-radius: 2px; }

.tooltip {
  position: fixed; pointer-events: none; z-index: 10;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--rule); border-radius: 6px;
  box-shadow: 0 6px 20px color-mix(in oklab, var(--ink) 14%, transparent);
  padding: 8px 10px; font: 12px/1.5 var(--mono); min-width: 160px;
}
.tooltip .t { font-weight: 500; margin-bottom: 4px; color: var(--ink-2); }
.tooltip .r { display: flex; justify-content: space-between; gap: 14px; }
.tooltip .r i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }

.numbers { margin-top: 18px; font-size: 14px; }
.numbers summary { cursor: pointer; color: var(--ink-2); font-family: var(--mono); font-size: 13px; }
#table { overflow-x: auto; }
.numbers table { border-collapse: collapse; margin-top: 10px; width: 100%; font: 13px var(--mono); font-variant-numeric: tabular-nums; }
.numbers th, .numbers td { text-align: right; padding: 6px 10px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.numbers th { color: var(--ink-3); font-weight: 500; }
.numbers th:first-child, .numbers td:first-child { text-align: left; }

/* ---------- footer ---------- */
.foot {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 0 40px;
  margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--rule);
  color: var(--ink-2); font-size: 15px;
}
.foot h2 { grid-column: 1; grid-row: 1 / span 2; font-size: 20px; color: var(--ink); margin: 0 0 8px; }
.foot p { grid-column: 2; margin: 0 0 12px; max-width: 66ch; }
@media (max-width: 640px) {
  .foot { grid-template-columns: minmax(0, 1fr); }
  .foot h2, .foot p { grid-column: 1; grid-row: auto; }
}
.foot strong { color: var(--ink); font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
  .thaw-fill { transition: none; }
}
