/* economy — journalism palette and chart styles
 * Rebuilt 2026-04-08 to FT/NYT chart-grammar bar.
 */
:root {
  /* checkpoint-1 warm palette */
  --bg: #FAF8F4;              /* warmer paper white */
  --bg-alt: #F1ECE2;          /* warm off-white for alternating sections */
  --ink: #0A0A0A;             /* deeper than the body, for display headlines */
  --text: #1F1F1B;            /* warm body text */
  --muted: #5C5A52;           /* warm grey for captions, secondary */
  --rule: rgba(10,10,10,0.12);
  --teal: #0F766E;            /* slightly deeper than the old #0D9488 */
  --teal-pale: #CCFBF1;
  --clay: #B45309;            /* warm earth, reserved second accent */
  --rust: #9F1239;            /* deeper red for the welfare bar */

  /* legacy aliases so downstream rules keep working unchanged */
  --fg: var(--text);
  --soft: #9CA3AF;
  --line: var(--rule);
  --line-strong: rgba(10,10,10,0.20);
  --teal-soft: rgba(15,118,110,0.12);
  --teal-deep: var(--teal);
  --red: var(--rust);
  --panel: #F4F0E6;
  --panel-light: #FBF8F1;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --display: "Newsreader", Georgia, serif;
  --serif: "Source Serif 4", "Newsreader", Georgia, serif;
  --body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 0;
}

main { max-width: 100%; overflow-x: hidden; }

/* magazine layout: every section is a 3-column grid. The centre column is
   a 1080px frame centred in the viewport. ALL children sit in that column,
   left-aligned, sharing the same left edge. Prose elements clip to 640px
   via max-width; chart breakouts and the headline use the full 1080. */
section {
  display: grid;
  grid-template-columns: 1fr min(1080px, calc(100% - 48px)) 1fr;
  padding: 128px 0;
  opacity: 1;
  transform: none;
  position: relative;
}
@media (prefers-reduced-motion: no-preference) {
  section:not(.visible):not(.hero):not(.snapshot) {
    opacity: 0;
    transform: scale(0.98);
    transition: opacity 377ms var(--ease), transform 377ms var(--ease);
  }
}
section > * {
  grid-column: 2;
  justify-self: start;
  width: 100%;
  max-width: 640px;
  min-width: 0;
}
section > h1,
section > h2,
section > .bignum-row,
section > .chart-wrap,
section > .cobb,
section > .dashboard,
section > .cards,
section > .tiles,
section > .breakout {
  max-width: 100%;
}
section.visible { opacity: 1; transform: scale(1); }

/* alternating warm background tint via data-bg attribute.
   the section itself stays centred at 640px, but a pseudo-element paints
   the full viewport width behind it so the tint bleeds edge to edge. */
section[data-bg="alt"]::before,
footer[data-bg="alt"]::before {
  content: "";
  position: absolute;
  inset: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100vw;
  background: var(--bg-alt);
  z-index: -1;
}
section { z-index: 0; }

/* kicker — small-caps label above every scene title */
.kicker {
  font-family: var(--body);
  font-size: 12px;
  font-weight: 500;
  color: var(--teal);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin: 0 0 24px 0;
  display: block;
}

h1 {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(48px, 6vw, 72px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0 0 32px 0;
  text-wrap: balance;
}
/* hero h1 and bignum-row use the full grid cell (1080px max);
   the global section rule already handles grid placement. */
h2 {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(36px, 5.2vw, 68px);
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0 0 48px 0;
  text-wrap: balance;
}
h3 {
  font-family: var(--body);
  font-weight: 600;
  font-size: 20px;
  color: var(--ink);
  margin: 32px 0 16px 0;
}
p {
  margin: 0 0 24px 0;
  max-width: 640px;
  color: var(--text);
  text-wrap: pretty;
  hanging-punctuation: first;
}
p.lede { font-size: 22px; line-height: 1.55; color: var(--text); }

/* hero dek — the subtitle under the headline in Scene 1 */
.hero .dek {
  font-family: var(--body);
  font-size: clamp(20px, 2.2vw, 24px);
  font-weight: 400;
  line-height: 1.45;
  color: var(--muted);
  margin: 0 0 56px 0;
  max-width: 560px;
  text-wrap: balance;
}
.hero hr.rule {
  border: 0;
  border-top: 1px solid var(--teal);
  opacity: 0.6;
  margin: 56px 0 40px 0;
  max-width: 80px;
  margin-left: 0;
}

/* drop cap on flagged paragraphs. 4-line via font-size + line-height tuning */
p.dropcap::first-letter {
  font-family: var(--display);
  font-weight: 500;
  font-size: 88px;
  line-height: 0.85;
  float: left;
  color: var(--teal);
  padding: 8px 14px 0 0;
  margin-top: 4px;
}

/* charts use the breakout grid columns (defined on section) — no margin
   hacks needed. width auto-fills the breakout span; max-width caps at 1080. */
section > .chart-wrap,
section > .cobb {
  width: 100%;
  max-width: 1080px;
  justify-self: center;
}

/* captions + source credits under charts get serif italic + small caps */
.chart-wrap .cap {
  font-family: var(--display);
  font-style: italic;
  font-size: 15px;
  color: var(--muted);
  margin-top: 16px;
  line-height: 1.5;
  max-width: 60ch;
}

/* number spans get mono tabular */
.num, .numbers {
  font-family: var(--mono);
  font-feature-settings: "tnum" 1;
}

code, .mono { font-family: var(--mono); font-size: 0.92em; }
pre {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 16px 20px;
  font-family: var(--mono);
  font-size: 15px;
  overflow-x: auto;
  line-height: 1.6;
}

/* receipt tooltips */
.receipt {
  border-bottom: 1px dotted var(--teal);
  cursor: help;
  position: relative;
  color: inherit;
}
.receipt::after {
  content: attr(data-receipt);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  transform: translateX(-50%);
  background: var(--fg);
  color: var(--bg);
  font-family: var(--mono);
  font-size: 12px;
  padding: 6px 10px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 89ms var(--ease);
  z-index: 10;
}
.receipt:hover::after, .receipt:focus::after { opacity: 1; }

/* scene 1 three-up big numbers — magazine hero */
.bignum-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 32px;
  margin: 56px 0 40px;
}
@media (max-width: 900px) {
  .bignum-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .bignum-row { grid-template-columns: 1fr; }
}
.bignum { text-align: left; }
.bignum .n {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(40px, 5.5vw, 72px);
  line-height: 1;
  letter-spacing: -0.025em;
  color: var(--ink);
  display: block;
  font-feature-settings: "tnum" 1;
}
.bignum .lbl {
  font-family: var(--body);
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 20px;
  display: block;
  line-height: 1.4;
  hyphens: none;
  text-wrap: balance;
}
.bignum .src {
  font-family: var(--display);
  font-style: italic;
  font-size: 13px;
  color: var(--muted);
  margin-top: 6px;
  display: block;
  opacity: 0.85;
}

/* ============================================================
 * COBB-DOUGLAS interactive (Scene 3)
 * ============================================================ */
.cobb {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 28px;
  margin: 40px 0;
  display: block;
  font-family: var(--body);
}
.cobb .knob-stack { display: block; min-width: 0; max-width: 100%; }
.cobb .mini { margin-top: 24px; }
/* (knob-stack rules consolidated above) */
.cobb .knob {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr) 60px;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
  min-width: 0;
}
.cobb .knob input[type="range"] { min-width: 0; width: 100%; }
.cobb .knob label {
  font-size: 13px;
  color: var(--fg);
  font-weight: 500;
}
.cobb .knob .val {
  font-family: var(--mono);
  font-size: 15px;
  font-feature-settings: "tnum" 1;
  text-align: right;
  color: var(--teal-deep);
}
.cobb .output {
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--line-strong);
}
.cobb .output .y-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 4px;
}
.cobb .output .y {
  font-family: var(--display);
  font-size: 56px;
  line-height: 1;
  display: inline-block;
  margin-right: 14px;
  font-feature-settings: "tnum" 1;
}
.cobb .arith {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--muted);
  margin-top: 14px;
  font-feature-settings: "tnum" 1;
}
.cobb .arith .factor { color: var(--teal-deep); }
.cobb .arith .result { color: var(--fg); font-weight: 600; }

.cobb .mini {
  background: var(--panel-light);
  border: 1px solid var(--line);
  padding: 14px 14px 8px;
}
.cobb .mini .mini-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 8px;
  display: block;
}
.cobb canvas {
  width: 100%;
  height: 200px;
  display: block;
}

/* ghost gdp tiles */
.tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 32px 0;
  font-family: var(--body);
}
.tile {
  background: var(--panel);
  border-left: 3px solid var(--teal);
  padding: 20px;
}
.tile .tn { font-family: var(--display); font-size: 32px; display: block; }
.tile .tl { font-size: 13px; color: var(--muted); }
.arith-line {
  font-family: var(--mono);
  font-size: 16px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  margin: 16px 0;
}

/* ============================================================
 * Generic chart-wrap (Scenes 2, 5, 6)
 * ============================================================ */
canvas { display: block; max-width: 100%; }
.chart-wrap {
  margin: 28px 0;
  background: var(--panel-light);
  border: 1px solid var(--line);
  padding: 28px 28px 22px;
}
.chart-wrap canvas { width: 100%; }
.chart-wrap .cap {
  font-size: 13px;
  color: var(--muted);
  margin-top: 10px;
  line-height: 1.5;
}

/* ============================================================
 * SCENE 7 dashboard — slider grid + chart grid
 * ============================================================ */
.dashboard { max-width: 1080px; margin: 0 auto; font-family: var(--body); }
.presets {
  display: flex;
  gap: 10px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.presets button {
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--fg);
  font-family: var(--body);
  font-size: 13px;
  font-weight: 500;
  padding: 9px 18px;
  cursor: pointer;
  transition: all 144ms var(--ease);
  letter-spacing: 0.01em;
}
.presets button:hover, .presets button:focus {
  border-color: var(--teal);
  color: var(--teal);
  outline: none;
}
.presets button.active {
  background: var(--teal);
  color: #fff;
  border-color: var(--teal);
}

.slider-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px 36px;
  margin: 0 0 32px;
  padding: 26px 30px;
  background: var(--panel);
  border: 1px solid var(--line);
}
.slider-row { min-width: 0; }
.slider-row label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg);
  margin-bottom: 4px;
  gap: 12px;
}
.slider-row label .val {
  font-family: var(--mono);
  font-size: 14px;
  font-feature-settings: "tnum" 1;
  color: var(--teal-deep);
  font-weight: 500;
}
.slider-row .desc {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.45;
}

/* custom range input — teal thumb, teal track */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 24px;
  background: transparent;
  cursor: pointer;
  margin: 0;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  background: linear-gradient(to right, var(--teal) 0%, var(--teal) var(--pct,50%), rgba(26,26,26,0.14) var(--pct,50%), rgba(26,26,26,0.14) 100%);
  border-radius: 2px;
  border: none;
}
input[type="range"]::-moz-range-track {
  height: 4px;
  background: rgba(26,26,26,0.14);
  border-radius: 2px;
  border: none;
}
input[type="range"]::-moz-range-progress {
  height: 4px;
  background: var(--teal);
  border-radius: 2px;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--teal);
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(13,148,136,0.4);
  margin-top: -8px;
  cursor: pointer;
  transition: transform 89ms var(--ease);
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.12); }
input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--teal);
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(13,148,136,0.4);
  cursor: pointer;
}
input[type="range"]:focus-visible {
  outline: none;
}
input[type="range"]:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 3px rgba(13,148,136,0.5);
}

/* dashboard chart grid */
.chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  margin-top: 4px;
}
.chart-grid .span-2 { grid-column: 1 / -1; }
.chart-grid .panel {
  background: var(--panel-light);
  border: 1px solid var(--line);
  padding: 24px 26px 18px;
}
.chart-grid .panel canvas {
  width: 100%;
  display: block;
}
.chart-grid .panel.intel canvas { height: 320px; }
.chart-grid .panel.labor canvas { height: 260px; }
.chart-grid .panel.welfare canvas { height: 260px; }

.dash-foot {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 22px;
  line-height: 1.55;
}

/* scene 8 big callout */
.callout {
  font-family: var(--display);
  font-style: italic;
  font-size: 32px;
  line-height: 1.35;
  color: var(--ink);
  padding: 48px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  margin: 48px 0;
  max-width: 640px;
}
.callout .big {
  display: block;
  font-size: 64px;
  color: var(--teal);
  margin-bottom: 8px;
  font-feature-settings: "tnum" 1;
}

/* scene 9 cards */
.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin: 40px 0;
  font-family: var(--body);
}
.card {
  background: var(--panel-light);
  border: 1px solid var(--line);
  padding: 22px;
  transition: border-color 233ms var(--ease);
}
.card:hover { border-color: var(--teal); }
.card h4 { margin: 0 0 8px; font-size: 15px; font-weight: 600; }
.card p { font-size: 14px; color: var(--muted); margin: 0; }

/* scene 10 bullets */
ul.plain { list-style: none; padding: 0; }
ul.plain li {
  padding: 10px 0 10px 24px;
  border-bottom: 1px solid var(--line);
  position: relative;
}
ul.plain li::before {
  content: "";
  position: absolute;
  left: 0; top: 19px;
  width: 12px; height: 1px;
  background: var(--teal);
}

/* old footer rule removed — see FOOTER redesigned section below */

/* focus rings */
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

/* mobile */
@media (max-width: 900px) {
  .chart-grid { grid-template-columns: 1fr; }
  .chart-grid .span-2 { grid-column: 1; }
  .slider-grid { grid-template-columns: 1fr; gap: 16px; padding: 22px; }
  .cobb { grid-template-columns: 1fr; gap: 24px; padding: 24px; }
  .cobb .knob { grid-template-columns: 110px 1fr 50px; }
}
@media (max-width: 720px) {
  body { font-size: 18px; }
  section { padding: 64px 20px; }
  .bignum-row, .tiles, .cards { grid-template-columns: 1fr; }
  .bignum-row { gap: 32px; margin: 40px 0 24px; }
  .hero .dek { margin-bottom: 40px; }
  .hero hr.rule { margin: 40px 0 32px 0; }
  .callout .big { font-size: 48px; }
  .callout { font-size: 24px; padding: 32px 0; margin: 32px 0; }
  .chart-wrap { padding: 20px 16px 16px; }
  .chart-grid .panel { padding: 18px 14px 14px; }
  .chart-grid .panel.intel canvas { height: 260px; }
  .chart-grid .panel.labor canvas { height: 220px; }
  .chart-grid .panel.welfare canvas { height: 220px; }
  p.dropcap::first-letter { font-size: 64px; padding: 4px 10px 0 0; }
  .kicker { margin-bottom: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  section { opacity: 1; transform: none; transition: none; }
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ============================================================
 * Checkpoint 3: interactivity polish
 * ============================================================ */

/* Scene 3 preset row */
.cobb-presets {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 14px 0;
}
.cobb-presets button {
  font-family: var(--body);
  font-size: 13px;
  font-weight: 500;
  color: var(--fg);
  background: var(--panel-light);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 7px 14px;
  cursor: pointer;
  transition: background 144ms var(--ease), border-color 144ms var(--ease);
}
.cobb-presets button:hover { background: var(--teal-soft); border-color: var(--teal); }
.cobb-presets button:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

/* Scene 5 hover tooltips on bar names */
.bar-tips {
  display: flex;
  gap: 24px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}
.bar-tip {
  position: relative;
  cursor: help;
  border-bottom: 1px dotted var(--soft);
  padding-bottom: 1px;
}
.bar-tip:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.bar-tip::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  width: 280px;
  padding: 10px 12px;
  background: var(--fg);
  color: var(--bg);
  font-size: 12px;
  line-height: 1.5;
  border-radius: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 144ms var(--ease);
  z-index: 20;
}
.bar-tip:hover::after, .bar-tip:focus::after { opacity: 1; }

/* Scene 6 play forward */
.metr-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 6px;
  flex-wrap: wrap;
}
#metrPlay {
  font-family: var(--body);
  font-size: 12px;
  font-weight: 500;
  background: var(--panel-light);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 6px 12px;
  cursor: pointer;
  color: var(--teal-deep);
}
#metrPlay:hover { background: var(--teal-soft); border-color: var(--teal); }
#metrPlay.playing { background: var(--teal); color: #fff; border-color: var(--teal); }

/* Scene 7 chart explainers */
.panel { position: relative; }
.explainer {
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 12px;
}
.explainer summary {
  list-style: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--panel-light);
  border: 1px solid var(--line-strong);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 600;
  user-select: none;
}
.explainer summary::-webkit-details-marker { display: none; }
.explainer summary:hover { background: var(--teal-soft); color: var(--teal-deep); border-color: var(--teal); }
.explainer[open] summary { background: var(--teal); color: #fff; border-color: var(--teal); }
.explainer > div {
  position: absolute;
  top: 28px;
  right: 0;
  width: 280px;
  padding: 12px 14px;
  background: var(--panel-light);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--fg);
  z-index: 15;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

/* Scene 7 keyboard shortcut overlay */
.kbd-hint {
  display: inline-block;
  margin-left: 12px;
  color: var(--muted);
  font-size: 13px;
}
kbd {
  font-family: var(--mono);
  font-size: 11px;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  padding: 1px 6px;
}
.kbd-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26,26,26,0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.kbd-overlay[aria-hidden="false"] { display: flex; }
.kbd-card {
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 24px 28px;
  min-width: 280px;
  max-width: 360px;
  font-family: var(--body);
}
.kbd-card h3 { margin: 0 0 12px 0; font-family: var(--display); font-weight: 500; font-size: 20px; }
.kbd-card ul { list-style: none; padding: 0; margin: 0 0 14px 0; }
.kbd-card li { margin: 6px 0; font-size: 14px; }
.kbd-card li kbd { margin-right: 10px; }
.kbd-card button {
  font-family: var(--body);
  font-size: 13px;
  background: var(--panel-light);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 6px 14px;
  cursor: pointer;
}
.kbd-card button:hover { background: var(--teal-soft); border-color: var(--teal); }

/* Scene 9 click-to-expand cards */
details.card {
  background: var(--panel-light);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 14px 18px;
  margin: 0;
  cursor: pointer;
}
details.card summary {
  list-style: none;
  font-family: var(--body);
  font-weight: 600;
  font-size: 16px;
  color: var(--fg);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
  cursor: pointer;
}
details.card summary::-webkit-details-marker { display: none; }
details.card summary::after {
  content: "+";
  margin-left: auto;
  color: var(--muted);
  font-weight: 400;
  font-size: 18px;
}
details.card[open] summary::after { content: "−"; }
details.card .card-num { color: var(--teal); font-family: var(--mono); font-size: 14px; }
details.card .summary-tag {
  font-weight: 400;
  font-size: 13px;
  color: var(--muted);
  flex-basis: 100%;
}
details.card p {
  margin: 12px 0 0 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--fg);
  max-width: none;
}
details.card[open] { background: var(--bg); border-color: var(--teal); }

/* -------- Growth-shape toggle (Scene 7) -------- */
.shape-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
  padding: 10px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  flex-wrap: wrap;
}
.shape-toggle .toggle-label {
  font-family: var(--body);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-right: 4px;
}
.shape-toggle button {
  background: transparent;
  border: 1px solid var(--teal);
  color: var(--teal);
  font-family: var(--body);
  font-size: 13px;
  font-weight: 500;
  padding: 7px 16px;
  cursor: pointer;
  border-radius: 4px;
  transition: all 144ms var(--ease);
  letter-spacing: 0.01em;
}
.shape-toggle button:hover,
.shape-toggle button:focus-visible {
  background: var(--teal-soft);
  outline: none;
}
.shape-toggle button.active {
  background: var(--teal);
  color: #fff;
  border-color: var(--teal);
}

/* Dim the doubling-time slider when the growth shape doesn't use it. */
.slider-row.is-dim {
  opacity: 0.45;
  transition: opacity 233ms var(--ease);
}
.slider-row.is-dim label::after {
  content: " — inactive for this growth shape";
  font-size: 11px;
  color: var(--muted);
  font-style: italic;
}

@media (max-width: 560px) {
  .shape-toggle { padding: 10px; gap: 8px; }
  .shape-toggle button { padding: 6px 12px; font-size: 12px; }
  .shape-toggle .toggle-label { width: 100%; }
}

/* ============================================================
 * UPSHOT-STYLE additions: scenario table, big equation,
 * fig numbers, standfirst, metr step row, snapshot section
 * ============================================================ */

.standfirst {
  font-family: var(--serif);
  font-size: 22px;
  line-height: 1.55;
  color: var(--text);
  font-style: italic;
  margin-top: 40px;
  max-width: 720px;
}

.fig-num {
  font-family: var(--body);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}

/* Scene 1b — scenario snapshot table */
section.snapshot {
  background: var(--bg-alt);
  padding: 96px 0;
}
.snap-title {
  font-size: clamp(28px, 4vw, 44px);
  margin-bottom: 32px;
}
section.snapshot > .snap-grid { max-width: 100%; }
.snap-grid {
  width: 100%;
}
.scenario-table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  font-family: var(--body);
  background: var(--bg);
  border: 1px solid var(--rule);
}
.scenario-table thead th {
  font-family: var(--body);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  padding: 20px 18px 16px;
  text-align: left;
  border-bottom: 1px solid var(--rule);
  vertical-align: bottom;
  line-height: 1.4;
}
.scenario-table thead th.col-flat,
.scenario-table thead th.col-lin,
.scenario-table thead th.col-exp {
  text-align: right;
  width: 18%;
}
.scenario-table thead th.active {
  color: var(--teal);
}
.scenario-table tbody th[scope="row"] {
  font-family: var(--body);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  padding: 18px;
  text-align: left;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}
.scenario-table tbody th .rh {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  margin-top: 4px;
  text-transform: none;
  letter-spacing: 0;
}
.scenario-table tbody td {
  font-family: var(--mono);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  padding: 18px;
  text-align: right;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}
.scenario-table tbody td.active {
  background: #FFFBF0;
  color: var(--ink);
}
.scenario-table tbody td.neg { color: var(--rust); }
.scenario-table tbody td.pos { color: #166534; }
.scenario-table tbody tr:last-child th,
.scenario-table tbody tr:last-child td { border-bottom: 0; }
.snap-caption {
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  color: var(--muted);
  margin-top: 20px;
  max-width: 720px;
}
.snap-caption a { color: var(--teal); border-bottom: 1px solid var(--teal); }

/* Big inline equation */
pre.big-eq {
  font-family: var(--display);
  font-size: clamp(28px, 4.5vw, 48px);
  font-weight: 400;
  letter-spacing: 0.01em;
  color: var(--ink);
  background: transparent;
  border: 0;
  padding: 32px 0 24px;
  margin: 32px 0;
  text-align: left;
  line-height: 1.2;
}
pre.big-eq sup { font-size: 0.55em; vertical-align: super; }

/* Smaller callout — used for "the upshot" beats under charts */
.callout-small {
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  border-left: 3px solid var(--teal);
  padding: 20px 24px;
  margin: 32px 0;
  max-width: 720px;
}
section[data-bg="alt"] .callout-small { background: var(--bg-alt); }
.callout-small strong { color: var(--ink); }

/* METR step row — three-column sparkstat */
.metr-stat {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  margin: 32px 0 40px;
  padding: 24px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.metr-step {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.metr-year {
  font-family: var(--body);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.metr-val {
  font-family: var(--display);
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 500;
  color: var(--ink);
  line-height: 1.1;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
section > .metr-stat { max-width: 100%; }

/* Ghost GDP tile sub-label */
.tile .ts {
  display: block;
  font-family: var(--body);
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  margin-top: 4px;
  letter-spacing: 0;
  text-transform: none;
  line-height: 1.4;
}

/* Mobile */
@media (max-width: 760px) {
  .scenario-table { font-size: 12px; }
  .scenario-table thead th,
  .scenario-table tbody th[scope="row"],
  .scenario-table tbody td { padding: 12px 10px; }
  .metr-stat { grid-template-columns: 1fr; gap: 16px; }
  pre.big-eq { font-size: 24px; }
}

/* chart canvas heights — since width=attr was stripped so CSS drives sizing */
#chart-divergence { height: 440px; }
#chart-capex { height: 320px; }
#chart-metr { height: 440px; }
@media (max-width: 720px) {
  #chart-divergence, #chart-metr { height: 340px; }
  #chart-capex { height: 260px; }
}

/* ============================================================
 * FOOTER — redesigned 2026-04-08
 * ============================================================ */
footer {
  display: block;
  background: var(--ink);
  color: #F5F3EE;
  padding: 80px 24px 56px;
  margin-top: 96px;
}
.foot-inner {
  max-width: 1080px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.2fr 1fr 1.8fr;
  gap: 80px;
  align-items: start;
}
.foot-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.foot-mark {
  font-family: var(--display);
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: #FAF8F4;
}
.foot-tagline {
  font-family: var(--serif);
  font-size: 14px;
  font-style: italic;
  color: rgba(245,243,238,0.55);
  line-height: 1.4;
}
.foot-h {
  font-family: var(--body);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 18px;
}
.foot-mid .foot-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(245,243,238,0.08);
  font-size: 13px;
}
.foot-mid .foot-row:last-child { border-bottom: 0; }
.foot-mid .foot-k {
  font-family: var(--body);
  color: rgba(245,243,238,0.55);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.foot-mid .foot-v {
  color: #FAF8F4;
  font-feature-settings: "tnum" 1;
}
.foot-right p {
  font-family: var(--serif);
  font-size: 14px;
  line-height: 1.55;
  color: rgba(245,243,238,0.75);
  margin: 0 0 12px;
  max-width: 100%;
}
.foot-right a {
  color: var(--teal);
  border-bottom: 1px solid rgba(15,118,110,0.4);
  text-decoration: none;
}
.foot-right a:hover { border-bottom-color: var(--teal); }
.foot-why {
  font-style: italic;
  color: rgba(245,243,238,0.5) !important;
  margin-top: 18px !important;
  padding-top: 18px;
  border-top: 1px solid rgba(245,243,238,0.1);
}
@media (max-width: 900px) {
  .foot-inner { grid-template-columns: 1fr; gap: 48px; }
}

/* ============================================================
 * SCENE 9 cards — 2+3 row layout (3 top, 2 bottom centred)
 * ============================================================ */
.cards {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 20px;
}
.cards > .card:nth-child(1),
.cards > .card:nth-child(2),
.cards > .card:nth-child(3) { grid-column: span 2; }
.cards > .card:nth-child(4) { grid-column: 2 / span 2; }
.cards > .card:nth-child(5) { grid-column: 4 / span 2; }
@media (max-width: 900px) {
  .cards { grid-template-columns: 1fr 1fr; }
  .cards > .card:nth-child(n) { grid-column: span 1; }
}
@media (max-width: 560px) {
  .cards { grid-template-columns: 1fr; }
}

/* tighter card summary typography — avoid wraps on card titles */
details.card summary {
  font-size: 16px;
  line-height: 1.3;
}
details.card .card-num {
  display: inline-block;
  margin-right: 6px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--teal);
  font-weight: 500;
}

/* ============================================================
 * MICRODELIGHT layer — subtle hover, reveal, depth
 * Written for a dad reading this on a Macbook at 1440
 * ============================================================ */

/* chart-wrap gets a subtle depth ring */
.chart-wrap {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 24px 28px 32px;
  transition: border-color 233ms var(--ease), transform 377ms var(--ease);
}
section[data-bg="alt"] .chart-wrap { background: var(--bg); }
.chart-wrap:hover { border-color: rgba(10,10,10,0.2); }

/* figure number badge floats top-left */
.chart-wrap .fig-num {
  position: absolute;
  top: 16px;
  left: 24px;
  margin: 0;
  color: var(--muted);
}

/* bignums — subtle lift on hover */
.bignum {
  transition: transform 233ms var(--ease);
}
.bignum:hover { transform: translateY(-2px); }
.bignum .n {
  transition: color 233ms var(--ease);
}
.bignum:hover .n { color: var(--teal); }

/* scenario table rows highlight on hover */
.scenario-table tbody tr {
  transition: background 144ms var(--ease);
}
.scenario-table tbody tr:hover th[scope="row"],
.scenario-table tbody tr:hover td:not(.active) {
  background: rgba(15,118,110,0.04);
}

/* tile lift on hover */
.tile {
  transition: transform 233ms var(--ease), border-color 233ms var(--ease);
}
.tile:hover {
  transform: translateY(-3px);
}

/* cards get depth on hover + when open */
details.card {
  transition: transform 233ms var(--ease), box-shadow 233ms var(--ease), border-color 144ms var(--ease);
}
details.card:hover {
  transform: translateY(-2px);
  border-color: var(--teal);
}
details.card[open] {
  border-color: var(--teal);
}

/* slider hover lifts thumb */
input[type="range"] {
  accent-color: var(--teal);
  transition: filter 144ms var(--ease);
}
input[type="range"]:hover { filter: brightness(0.95); }

/* buttons */
button {
  transition: background 144ms var(--ease), color 144ms var(--ease), transform 144ms var(--ease);
}
button:hover { transform: translateY(-1px); }
button:active { transform: translateY(0); }

/* all interactive elements get a crisp focus ring */
button:focus-visible,
input[type="range"]:focus-visible,
a:focus-visible,
details summary:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 3px;
  border-radius: 2px;
}

/* receipt dotted underline is more visible on hover */
.receipt {
  transition: color 144ms var(--ease);
}
.receipt:hover { color: var(--teal); }

/* reduce motion */
@media (prefers-reduced-motion: reduce) {
  .chart-wrap, .bignum, .tile, details.card,
  input[type="range"], button, .receipt, .scenario-table tbody tr {
    transition: none !important;
    transform: none !important;
  }
}

/* ============================================================
 * BIG STAT — Scene 8 closer
 * Three-cell row: today → 2029 → "which is" with subcaption
 * ============================================================ */
.big-stat {
  margin: 56px 0 48px;
  padding: 40px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
section > .big-stat { max-width: 100%; }
.bs-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr 1fr;
  gap: 32px;
  align-items: start;
}
.bs-cell .bs-lbl {
  font-family: var(--body);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}
.bs-cell .bs-val {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(48px, 6vw, 88px);
  line-height: 1;
  letter-spacing: -0.025em;
  color: var(--ink);
  font-feature-settings: "tnum" 1;
}
.bs-cell .bs-u {
  font-family: var(--body);
  font-size: 0.28em;
  font-weight: 500;
  color: var(--muted);
  margin-left: 10px;
  letter-spacing: 0.04em;
  vertical-align: 0.55em;
  text-transform: uppercase;
}
.bs-cell.bs-trans .bs-val { color: var(--teal); }
.bs-cell .bs-sub {
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  color: var(--muted);
  margin-top: 10px;
  max-width: 240px;
  line-height: 1.5;
}
.bs-arrow {
  font-family: var(--display);
  font-size: 40px;
  color: rgba(10,10,10,0.25);
  align-self: center;
  transform: translateY(8px);
}
.bs-caption {
  font-family: var(--serif);
  font-style: italic;
  font-size: 13px;
  color: var(--muted);
  margin-top: 32px;
  max-width: 720px;
  line-height: 1.5;
}
.bs-caption code {
  font-family: var(--mono);
  font-size: 12px;
  background: rgba(15,118,110,0.08);
  padding: 1px 6px;
  border-radius: 2px;
  color: var(--teal);
}
@media (max-width: 820px) {
  .bs-row {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .bs-arrow { display: none; }
}

/* ============================================================
 * CLOSER — Scene 9 final paragraph block
 * ============================================================ */
.closer {
  margin-top: 96px;
  padding-top: 64px;
  border-top: 2px solid var(--ink);
}
section > .closer { max-width: 640px; }
.closer h3 {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(28px, 3.4vw, 40px);
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0 0 32px;
}
.closer p {
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.7;
  color: var(--text);
  margin: 0 0 22px;
  max-width: 640px;
}
.closer p strong {
  color: var(--ink);
  font-family: var(--body);
  font-weight: 600;
  font-size: 18px;
}
.closer-receipt {
  margin-top: 40px !important;
  padding-top: 28px;
  border-top: 1px solid var(--rule);
  font-family: var(--display) !important;
  font-style: italic;
  font-size: 22px !important;
  color: var(--ink) !important;
}

/* ============================================================
 * FOOTER refinement — better typography, tighter layout
 * ============================================================ */
footer {
  padding: 96px 24px 72px;
  margin-top: 0;
}
.foot-inner {
  grid-template-columns: 1.1fr 0.9fr 1.6fr;
  gap: 96px;
  align-items: start;
}
.foot-mark {
  font-size: 32px;
  letter-spacing: -0.015em;
}
.foot-tagline {
  margin-top: 8px;
  font-size: 15px;
  max-width: 220px;
}
.foot-left::before {
  content: "";
  display: block;
  width: 32px;
  height: 2px;
  background: var(--teal);
  margin-bottom: 20px;
}
.foot-h {
  font-size: 10px;
  letter-spacing: 0.16em;
  margin-bottom: 22px;
}
.foot-mid .foot-row {
  padding: 8px 0;
  font-size: 14px;
}
.foot-mid .foot-v {
  font-size: 14px;
  font-weight: 500;
}
.foot-right p {
  font-size: 15px;
  line-height: 1.65;
}
.foot-why {
  font-size: 16px !important;
  margin-top: 24px !important;
  padding-top: 24px;
}
/* tiny meta strip at the very bottom */
.foot-meta {
  max-width: 1080px;
  margin: 48px auto 0;
  padding-top: 28px;
  border-top: 1px solid rgba(245,243,238,0.08);
  display: flex;
  justify-content: space-between;
  font-family: var(--body);
  font-size: 11px;
  color: rgba(245,243,238,0.45);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.foot-meta a {
  color: rgba(245,243,238,0.55);
  text-decoration: none;
  border-bottom: 1px solid rgba(245,243,238,0.15);
}
.foot-meta a:hover { color: var(--teal); border-bottom-color: var(--teal); }
@media (max-width: 900px) {
  .foot-meta { flex-direction: column; gap: 12px; text-align: left; }
}

/* ============================================================
 * MOBILE fixes — 2026-04-08 review pass
 * ============================================================ */

/* Scenario table: horizontal scroll on narrow viewports */
/* Scenario table at narrow widths: compact typography that fits all 3 scenarios */
@media (max-width: 760px) {
  .scenario-table { table-layout: fixed; width: 100%; }
  .scenario-table thead th {
    padding: 12px 6px 10px;
    font-size: 9px;
    letter-spacing: 0.06em;
    line-height: 1.25;
  }
  .scenario-table tbody th[scope="row"] {
    padding: 12px 6px;
    font-size: 12px;
    line-height: 1.25;
    width: 30%;
  }
  .scenario-table tbody th[scope="row"] .rh {
    display: none;
  }
  .scenario-table tbody td {
    padding: 12px 4px;
    font-size: 11px;
    text-align: right;
  }
  .scenario-table tbody td strong { font-size: 12px; }
  section.snapshot > .snap-grid {
    overflow-x: hidden;
  }
}
@media (max-width: 420px) {
  .scenario-table thead th { font-size: 8px; padding: 10px 4px 8px; }
  .scenario-table tbody th[scope="row"] { font-size: 11px; padding: 10px 4px; }
  .scenario-table tbody td { font-size: 10px; padding: 10px 3px; }
}

/* Dashboard charts: tighter padding at narrow widths so text doesnt clip */
@media (max-width: 560px) {
  .chart-grid .panel { padding: 16px 12px; }
  .chart-grid .panel canvas { max-width: 100%; }
  #chart-intel, #chart-labor, #chart-welfare { max-width: 100%; }
}

/* Big-stat block: arrow hides, rows stack (already in base but make sure) */
@media (max-width: 820px) {
  .bs-row { grid-template-columns: 1fr; }
  .bs-arrow { display: none; }
  .bs-cell .bs-val { font-size: 48px; }
}

/* Hero bignum mobile stacking + tighter gap */
@media (max-width: 480px) {
  .bignum-row { gap: 32px; margin: 40px 0 32px; }
  .bignum .n { font-size: 44px; }
  .bignum .lbl { font-size: 11px; }
}

/* Scene 9 cards always stack on narrow */
@media (max-width: 560px) {
  .cards > .card:nth-child(n) {
    grid-column: 1 / -1 !important;
  }
}

/* Epistemic note — subtle callout between hero and snapshot */
.epistemic-note {
  margin-top: 48px;
  padding: 24px 28px;
  background: var(--bg-alt);
  border-left: 3px solid var(--clay);
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  max-width: 720px;
}
.epistemic-note strong {
  display: block;
  font-family: var(--body);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--clay);
  margin-bottom: 10px;
}
.epistemic-note em { font-style: italic; color: var(--ink); }

/* Restoration polish for static legacy delivery. */
html {
  scroll-padding-top: 21px;
}

button,
a,
input[type="range"],
summary {
  touch-action: manipulation;
}

@media (hover: none) {
  .bignum:hover,
  .tile:hover,
  details.card:hover,
  button:hover {
    transform: none;
  }
}

@media (max-width: 560px) {
  .presets button,
  .cobb-presets button,
  .shape-toggle button {
    min-height: 40px;
  }

  .bar-tip::after,
  .receipt::after {
    max-width: min(280px, calc(100vw - 32px));
    white-space: normal;
  }
}
