:root {
  color-scheme: light;
  --bg: #f3f5f0;
  --surface: #fbfcf7;
  --surface-raised: #ffffff;
  --ink: #15191c;
  --muted: #5f6765;
  --line: #c6d0c8;
  --accent: #0f766e;
  --accent-strong: #075e59;
  --accent-soft: #d8ebe6;
  --rain: #3f8fbc;
  --heat: #e66f2a;
  --heat-soft: #f7dccd;
  --night: #24313d;
  --shadow: 0 26px 70px rgba(36, 49, 61, 0.14);
  --radius: 14px;
  --max: 1180px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background:
    linear-gradient(90deg, rgba(21, 25, 28, 0.045) 1px, transparent 1px) 0 0 / 52px 52px,
    linear-gradient(180deg, #f8faf5 0%, var(--bg) 54%, #eef2eb 100%);
  color: var(--ink);
  line-height: 1.5;
}

body::selection {
  background: var(--accent-soft);
  color: var(--ink);
}

a {
  color: inherit;
}

button,
input,
select,
textarea {
  font: inherit;
}

.hero {
  min-height: 86dvh;
  padding: 0 1.25rem 3.5rem;
  border-bottom: 1px solid var(--line);
}

.topbar {
  max-width: var(--max);
  margin: 0 auto;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand-mark,
.topbar a {
  text-decoration: none;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--night);
  font-size: 0.9rem;
  font-weight: 850;
  letter-spacing: -0.01em;
}

.brand-mark span:first-child {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: var(--surface);
  font-size: 0.78rem;
  letter-spacing: 0.03em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.24rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(251, 252, 247, 0.78);
  backdrop-filter: blur(16px);
}

.nav-links a {
  color: var(--muted);
  padding: 0.48rem 0.78rem;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 780;
}

.nav-links a:hover,
.nav-links a:focus-visible {
  color: var(--ink);
  background: var(--surface);
  outline: none;
}

.hero-grid {
  max-width: var(--max);
  margin: 5.4rem auto 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 4rem);
  align-items: end;
}

.hero-copy {
  max-width: 900px;
}

.eyebrow {
  margin: 0 0 0.8rem;
  color: var(--accent-strong);
  font-size: 0.76rem;
  font-weight: 920;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 1rem;
  max-width: 980px;
  font-size: clamp(3.2rem, 8vw, 7.35rem);
  line-height: 0.88;
  letter-spacing: -0.075em;
}

h2 {
  margin-bottom: 0.65rem;
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 0.96;
  letter-spacing: -0.055em;
}

h3 {
  margin-bottom: 0.42rem;
  font-size: 1.12rem;
  line-height: 1.18;
  letter-spacing: -0.025em;
}

h4 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}

.lede {
  max-width: 740px;
  color: var(--muted);
  font-size: clamp(1.14rem, 2vw, 1.42rem);
}

.takeaway {
  max-width: 760px;
  margin: 1.2rem 0 0;
  padding-left: 1rem;
  border-left: 4px solid var(--heat);
  color: var(--ink);
  font-size: clamp(1.02rem, 1.7vw, 1.18rem);
  font-weight: 760;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.65rem;
}

.primary-link,
.secondary-link {
  display: inline-flex;
  align-items: center;
  min-height: 46px;
  padding: 0.78rem 1rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 850;
}

.primary-link {
  background: var(--ink);
  color: var(--surface);
  box-shadow: 0 14px 30px rgba(21, 25, 28, 0.2);
}

.secondary-link {
  color: var(--ink);
  border: 1px solid var(--line);
  background: rgba(251, 252, 247, 0.78);
}

.result-section .summary-card {
  max-width: 620px;
  margin: 1.2rem 0 0;
}

.summary-card {
  position: relative;
  min-height: 285px;
  padding: 1.25rem;
  border: 1px solid rgba(198, 208, 200, 0.9);
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, rgba(15, 118, 110, 0.12), rgba(255, 255, 255, 0.74) 42%),
    var(--surface-raised);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.summary-card::before {
  content: "";
  position: absolute;
  inset: auto -24px -34px auto;
  width: 160px;
  height: 160px;
  border: 22px solid rgba(230, 111, 42, 0.16);
  border-radius: 50%;
}

.summary-card .label,
.badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0.32rem 0.62rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.7rem;
  font-weight: 920;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  white-space: nowrap;
}

.summary-card strong {
  position: relative;
  display: block;
  margin: 1.25rem 0 0.7rem;
  font-size: clamp(1.5rem, 3vw, 2.32rem);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.summary-card p {
  position: relative;
  margin-bottom: 0;
  color: var(--muted);
}

.intro-section,
.story-shell,
.info-section,
footer {
  max-width: var(--max);
  margin: 0 auto;
  padding: 4.2rem 1.25rem;
}

.intro-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(280px, 0.58fr);
  gap: 2rem;
  align-items: start;
}

.intro-grid p,
.section-heading p,
.info-section > p,
.method-note p {
  color: var(--muted);
}

.section-heading {
  max-width: 820px;
  margin-bottom: 1.8rem;
}

.story-shell {
  max-width: 1320px;
  border-top: 1px solid var(--line);
}

.story-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.46fr) minmax(0, 0.88fr);
  gap: clamp(1.25rem, 3vw, 2.4rem);
  align-items: start;
}

.story-steps {
  display: grid;
  gap: 16vh;
  padding-bottom: 32vh;
}

.story-step {
  min-height: 70vh;
  padding: 1.4rem 1.4rem 1.4rem 1.15rem;
  border-left: 3px solid var(--line);
  color: var(--muted);
  opacity: 0.48;
  transform: translateX(-8px);
  transition: border-color 300ms ease, color 300ms ease, background 300ms ease, opacity 300ms ease, transform 300ms ease, box-shadow 300ms ease;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.story-step.is-active {
  border-color: var(--heat);
  color: var(--ink);
  background: rgba(251, 252, 247, 0.82);
  opacity: 1;
  transform: translateX(0);
  box-shadow: 0 8px 28px rgba(36, 49, 61, 0.08);
}

.story-step h3 {
  color: var(--ink);
}

.story-steps {
  padding-top: 30vh;
  padding-bottom: 60vh;
}

.step-kicker {
  display: block;
  margin-bottom: 0.6rem;
  color: var(--accent-strong);
  font-size: 0.72rem;
  font-weight: 920;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.story-step h3 {
  font-size: clamp(1.5rem, 3vw, 2.4rem);
  color: var(--ink);
}

.story-step p {
  margin-bottom: 0;
  font-size: 1.02rem;
}

.story-step ul {
  display: grid;
  gap: 0.5rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.story-step li {
  padding: 0.62rem 0.8rem;
  border-left: 3px solid var(--heat);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.55);
  color: var(--ink);
  font-size: 0.96rem;
  font-weight: 700;
}

.sticky-stage {
  position: sticky;
  top: 1rem;
  height: calc(100dvh - 2rem);
  display: flex;
  flex-direction: column;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(251, 252, 247, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  transition: box-shadow 280ms ease, border-color 280ms ease;
  overflow: hidden;
}

.sticky-stage[data-view="trajectory"],
.sticky-stage[data-view="ranking"],
.sticky-stage[data-view="map"],
.sticky-stage[data-view="fingerprint"],
.sticky-stage[data-view="difference"] {
  border-color: rgba(15, 118, 110, 0.34);
  box-shadow: 0 30px 80px rgba(36, 49, 61, 0.18);
}

.sticky-stage[data-view="trajectory"] #selectedTwinBadge {
  display: none;
}

.sticky-stage[data-view="trajectory"] .weight-field {
  display: none;
}

.stage-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.8rem;
}

.stage-header h3 {
  margin-bottom: 0;
  font-size: clamp(1.35rem, 2vw, 2rem);
  transition: color 220ms ease;
}

.control-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.6rem;
  margin: 0 0 0.6rem;
  padding: 0.7rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.66);
  flex-shrink: 0;
}

.metric-field {
  display: none;
}

/* Show map-color picker only on the map step */
.sticky-stage[data-view="map"] .metric-field {
  display: block;
}

.weight-field {
  min-width: 196px;
  flex: 1 1 196px;
}
.weight-sliders {
  display: flex;
  flex-direction: column;
  gap: 0.32rem;
}
.weight-row {
  display: grid;
  grid-template-columns: 92px 1fr 32px;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.74rem;
  color: var(--night);
}
.weight-name {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 700;
  white-space: nowrap;
}
.weight-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
  flex-shrink: 0;
}
.weight-row input[type="range"] {
  width: 100%;
  min-width: 56px;
  accent-color: var(--accent);
  margin: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.weight-pct {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  color: var(--muted);
}

.video-embed {
  position: relative;
  width: 100%;
  max-width: 880px;
  aspect-ratio: 16 / 9;
  margin-top: 0.8rem;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.video-embed iframe,
.video-embed video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--ink);
}
.video-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.5rem;
  background: var(--bg);
  color: var(--muted);
  font-weight: 700;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

legend {
  display: block;
  margin-bottom: 0.45rem;
  color: var(--night);
  font-size: 0.78rem;
  font-weight: 900;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.42rem;
}

.stacked-buttons {
  display: flex;
  flex-wrap: wrap;
}

button,
.control-button {
  min-height: 38px;
  padding: 0.52rem 0.72rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-weight: 820;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease, border-color 150ms ease;
}

button:hover,
.control-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(36, 49, 61, 0.12);
}

button:focus-visible,
.control-button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.28);
  outline-offset: 3px;
}

.control-button[aria-pressed="true"] {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.scenario-button {
  display: grid;
  gap: 0.05rem;
  border-radius: 12px;
  text-align: left;
  min-width: 92px;
}

.scenario-button small {
  font-size: 0.7rem;
  font-weight: 760;
  opacity: 0.82;
}

.metric-button {
  font-size: 0.76rem;
}

.ghost-button {
  background: var(--night);
  color: #ffffff;
  border-color: var(--night);
}

.annotation {
  min-height: 48px;
  margin: 0 0 0.85rem;
  padding: 0.8rem 0.9rem;
  border-left: 4px solid var(--heat);
  border-radius: 10px;
  background: rgba(247, 220, 205, 0.46);
  color: #5b3422;
  font-weight: 720;
  transition: background 240ms ease, border-color 240ms ease, transform 240ms ease;
}

.viz-stack {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
}

.viz-panel {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: translateY(18px) scale(0.985);
  filter: blur(3px);
  pointer-events: none;
  transition: opacity 420ms ease, transform 420ms ease, filter 420ms ease;
}

.viz-panel.is-active {
  /* Switch to flow layout so it creates real scroll height in the viz-stack */
  position: relative;
  inset: auto;
  opacity: 1;
  transform: translateY(0) scale(1);
  filter: blur(0);
  pointer-events: auto;
  z-index: 2;
}

.viz {
  display: block;
  width: 100%;
  min-height: 320px;
  overflow: visible;
}

.tall-viz {
  min-height: 360px;
}

/* Inside the sticky stage, let SVGs be naturally sized by their viewBox aspect ratio */
.sticky-stage .viz,
.sticky-stage .tall-viz {
  min-height: 0;
  height: auto;
}

.explainer-panel {
  min-height: 610px;
  padding: clamp(1rem, 2vw, 1.4rem);
  border-radius: 18px;
  background: #eef5ef;
}

.panel-insight {
  display: grid;
  gap: 0.25rem;
  margin-top: 0.75rem;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
}

.panel-insight strong {
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 920;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.panel-insight p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.formula-card {
  display: grid;
  gap: 0.8rem;
  max-width: 560px;
  margin: 1rem auto 1.5rem;
  padding: 1.2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-raised);
}

.formula-title {
  margin-bottom: 0.25rem;
  color: var(--accent-strong);
  font-size: 0.8rem;
  font-weight: 920;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.formula-line {
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 0.8rem;
  align-items: center;
  padding: 0.75rem 0;
  border-top: 1px solid var(--line);
}

.formula-line strong {
  font-size: 1.8rem;
  letter-spacing: -0.04em;
}

.score-scale {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.5rem;
}

.score-scale span {
  min-height: 92px;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.86rem;
}

.score-scale strong {
  display: block;
  color: var(--ink);
  font-size: 1.45rem;
}

.scenario-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
}

.scenario-grid article {
  min-height: 240px;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.scenario-grid span {
  display: inline-block;
  margin-bottom: 0.85rem;
  padding: 0.28rem 0.5rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 900;
}

.scenario-grid p {
  color: var(--muted);
}

.takeaway-list {
  display: grid;
  gap: 0.8rem;
  max-width: 680px;
  margin: 0 auto;
  padding: 0;
  list-style: none;
}

.takeaway-list li {
  padding: 1rem;
  border-left: 4px solid var(--heat);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 720;
}

.axis text,
.map-label,
.chart-label {
  fill: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

.selected-label {
  fill: var(--ink);
  font-weight: 900;
}

.today-label {
  fill: var(--muted);
  font-size: 11px;
  font-weight: 640;
}

.decay-city {
  font-size: 10px;
}

.grid-line {
  stroke: var(--line);
  stroke-width: 1;
}

.zero-line {
  stroke: var(--ink);
  stroke-width: 1.4;
}

.city-dot,
.rank-bar {
  cursor: pointer;
  transition: opacity 160ms ease, r 160ms ease, stroke-width 160ms ease, filter 160ms ease;
}

.city-dot:hover,
.rank-bar:hover {
  opacity: 0.9;
  filter: drop-shadow(0 6px 10px rgba(36, 49, 61, 0.22));
}

.state-label {
  fill: #8aa194;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  pointer-events: none;
}

.ghost-halo {
  animation: ghostPulse 2.4s ease-in-out infinite;
  transform-origin: center;
}

@keyframes ghostPulse {
  0%, 100% { opacity: 0.12; }
  50% { opacity: 0.30; }
}

/* ── Tooltip ── */
.chart-tooltip {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  background: var(--night);
  color: #f4f8f3;
  padding: 0.5rem 0.7rem;
  border-radius: 10px;
  font-size: 0.82rem;
  line-height: 1.35;
  box-shadow: 0 12px 30px rgba(20, 25, 28, 0.32);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 120ms ease, transform 120ms ease;
  max-width: 220px;
}

.chart-tooltip.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.chart-tooltip strong {
  display: block;
  font-weight: 800;
  margin-bottom: 2px;
}

.chart-tooltip span {
  display: block;
  color: #cdd9d2;
  font-weight: 600;
}

/* ── Time-travel controls (map signature interaction) ── */
.travel-controls {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-top: 0.85rem;
}

.play-button {
  flex: none;
  border: none;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 0.86rem;
  padding: 0.5rem 0.95rem;
  border-radius: 999px;
  box-shadow: 0 6px 16px rgba(15, 118, 110, 0.28);
  transition: background 150ms ease, transform 120ms ease;
}

.play-button:hover { transform: translateY(-1px); }
.play-button.is-playing { background: var(--heat); box-shadow: 0 6px 16px rgba(230, 111, 42, 0.32); }

.travel-slider { flex: 1; }

.travel-slider input[type="range"] {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-soft), var(--heat-soft));
  outline: none;
}

.travel-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--heat);
  border: 3px solid #fff;
  box-shadow: 0 3px 8px rgba(36, 49, 61, 0.3);
  cursor: grab;
}
.travel-slider input[type="range"]::-webkit-slider-thumb:active { cursor: grabbing; }
.travel-slider input[type="range"]::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--heat); border: 3px solid #fff; cursor: grab;
  box-shadow: 0 3px 8px rgba(36, 49, 61, 0.3);
}

.travel-scale {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  margin-top: 0.25rem;
}
.travel-scale .year-now { color: var(--heat); font-weight: 900; font-size: 0.85rem; }

.travel-readout {
  margin: 0.7rem 0 0;
  font-size: 0.98rem;
  font-weight: 640;
  color: var(--ink);
  min-height: 1.4em;
}
.travel-readout strong { color: var(--accent-strong); }
.travel-readout .ro-score {
  display: inline-block;
  margin-left: 0.4rem;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--heat);
  background: var(--heat-soft);
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
}

.info-section {
  border-top: 1px solid var(--line);
}

.info-section h2 {
  max-width: 920px;
}

.method-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1.4rem;
}

.method-grid article,
.method-note {
  padding: 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(251, 252, 247, 0.88);
}

.method-grid p:last-child,
.method-note p:last-child,
.data-section p:last-child {
  margin-bottom: 0;
}

.method-grid p {
  color: var(--muted);
}

.method-note {
  margin-top: 1rem;
}

.data-section {
  max-width: 900px;
}

footer {
  color: var(--muted);
  border-top: 1px solid var(--line);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media (max-width: 1120px) {
  .story-layout {
    grid-template-columns: 1fr;
  }

  .sticky-stage {
    order: -1;
  }

  .story-steps {
    order: 2;
  }

  .sticky-stage {
    position: sticky;
    top: 0.75rem;
    z-index: 10;
    min-height: 0;
  }

  .story-steps {
    gap: 26vh;
    padding-bottom: 28vh;
  }

  .story-step {
    min-height: 42vh;
  }

  .viz-stack {
    min-height: 610px;
  }
}

@media (max-width: 980px) {
  .hero {
    min-height: auto;
  }

  .hero-grid,
  .intro-grid,
  .method-grid {
    grid-template-columns: 1fr;
  }

  .hero-grid {
    margin-top: 3rem;
  }

  .control-panel {
    grid-template-columns: 1fr 1fr;
  }

  .score-scale,
  .scenario-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .hero {
    padding-inline: 1rem;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding-top: 1rem;
  }

  .nav-links {
    width: 100%;
    justify-content: space-between;
  }

  .nav-links a {
    flex: 1;
    text-align: center;
  }

  h1 {
    font-size: clamp(3rem, 16vw, 4.6rem);
    letter-spacing: -0.065em;
  }

  .hero-actions {
    flex-direction: column;
  }

  .primary-link,
  .secondary-link {
    justify-content: center;
    width: 100%;
  }

  .intro-section,
  .story-shell,
  .info-section,
  footer {
    padding: 3rem 1rem;
  }

  .sticky-stage {
    padding: 0.75rem;
    top: 0;
    max-height: 72dvh;
    overflow: hidden;
    border-radius: 0 0 var(--radius) var(--radius);
  }

  .stage-header {
    flex-direction: row;
    align-items: flex-start;
    margin-bottom: 0.45rem;
  }

  .stage-header .eyebrow {
    margin-bottom: 0.25rem;
  }

  .stage-header h3 {
    font-size: 1.05rem;
    line-height: 1.05;
  }

  .badge {
    min-height: 24px;
    padding: 0.24rem 0.46rem;
    font-size: 0.62rem;
  }

  .control-panel {
    display: flex;
    align-items: end;
    gap: 0.55rem;
    margin-bottom: 0.45rem;
    padding: 0.55rem;
    overflow-x: auto;
    overscroll-behavior-x: contain;
  }

  .control-panel fieldset,
  .control-panel .ghost-button {
    flex: 0 0 auto;
  }

  .stacked-buttons,
  .button-row {
    flex-wrap: nowrap;
  }

  .scenario-button {
    min-width: 96px;
  }

  .metric-button {
    min-width: 128px;
  }

  legend {
    font-size: 0.68rem;
    margin-bottom: 0.25rem;
  }

  button,
  .control-button {
    min-height: 34px;
    padding: 0.43rem 0.62rem;
    font-size: 0.86rem;
  }

  .scenario-button small {
    font-size: 0.62rem;
  }

  .annotation {
    min-height: 0;
    max-height: 54px;
    margin-bottom: 0.45rem;
    padding: 0.55rem 0.65rem;
    overflow: hidden;
    font-size: 0.78rem;
    line-height: 1.3;
  }

  .viz-stack,
  .explainer-panel {
    min-height: 250px;
  }

  .viz-panel {
    position: relative;
    display: none;
    inset: auto;
    opacity: 1;
    transform: none;
    filter: none;
  }

  .viz-panel.is-active {
    display: block;
  }

  .viz,
  .tall-viz {
    min-height: 245px;
  }

  .panel-insight {
    display: none;
  }

  .story-steps {
    gap: 32vh;
    padding-bottom: 30vh;
  }

  .story-step {
    min-height: 48vh;
    padding: 1rem;
    background: rgba(251, 252, 247, 0.72);
  }
}

/* Full-page scrollytelling mode */
.global-control-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(170px, 0.36fr) auto;
  gap: 0.75rem 1rem;
  align-items: start;
  margin: 0 0 2rem;
  padding: 0.7rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(251, 252, 247, 0.94);
  box-shadow: 0 20px 55px rgba(36, 49, 61, 0.14);
  backdrop-filter: blur(18px);
}

.global-control-bar {
  grid-template-columns: minmax(112px, auto) minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.6rem;
}

.global-control-copy h3,
.global-control-bar .annotation {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.global-control-bar .global-control-copy {
  min-width: 112px;
}

.global-control-bar .global-control-copy .eyebrow {
  margin: 0;
  font-size: 0.68rem;
}

.global-control-bar .badge {
  justify-self: end;
}

.global-control-bar .control-panel {
  grid-column: auto;
  display: flex;
  align-items: end;
  min-width: 0;
  overflow-x: auto;
}

.global-control-bar .control-panel fieldset,
.global-control-bar .control-panel .ghost-button {
  flex: 0 0 auto;
}

.global-control-bar legend {
  font-size: 0.65rem;
  margin-bottom: 0.18rem;
}

.global-control-copy h3 {
  margin-bottom: 0;
  font-size: clamp(0.95rem, 1.25vw, 1.15rem);
  line-height: 1.05;
}

.global-control-bar .control-panel {
  grid-column: 1 / -1;
  margin: 0;
  display: grid;
  grid-template-columns: minmax(290px, 1fr) minmax(136px, 0.35fr) minmax(360px, 1fr) auto;
  gap: 0.55rem;
  padding: 0.58rem;
}

.global-control-bar .annotation {
  grid-column: 1 / -1;
  margin: 0;
  min-height: 0;
  padding: 0.48rem 0.65rem;
  font-size: 0.82rem;
  line-height: 1.2;
}

.global-control-bar .metric-field {
  display: block;
}

.global-control-bar .button-row,
.global-control-bar .stacked-buttons,
.global-control-bar .metric-buttons {
  flex-wrap: nowrap;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
}

.global-control-bar .scenario-button {
  min-width: 92px;
}

.global-control-bar .metric-button {
  min-width: 126px;
}

.global-control-bar button,
.global-control-bar .control-button {
  min-height: 34px;
  padding: 0.42rem 0.58rem;
  font-size: 0.82rem;
}

.global-control-bar .scenario-button small {
  font-size: 0.6rem;
}

.story-pages {
  display: grid;
  gap: 3rem;
}

.story-page {
  min-height: calc(100dvh - 96px);
  display: grid;
  grid-template-columns: minmax(260px, 0.42fr) minmax(0, 0.82fr);
  gap: clamp(1.2rem, 3vw, 2.4rem);
  align-items: center;
  padding: clamp(1rem, 2vw, 1.25rem);
  border: 1px solid rgba(198, 208, 200, 0.72);
  border-radius: var(--radius);
  background: rgba(251, 252, 247, 0.68);
  opacity: 0.72;
  transform: translateY(18px);
  transition: opacity 420ms ease, transform 420ms ease, border-color 420ms ease, box-shadow 420ms ease;
}

.story-page.is-active {
  opacity: 1;
  transform: translateY(0);
  border-color: rgba(15, 118, 110, 0.38);
  box-shadow: 0 24px 70px rgba(36, 49, 61, 0.12);
}

.page-copy {
  align-self: center;
}

.page-copy h3 {
  font-size: clamp(2rem, 4vw, 4.1rem);
  line-height: 0.96;
  letter-spacing: -0.055em;
}

.page-copy p {
  color: var(--muted);
  font-size: 1.05rem;
}

.page-copy ul {
  display: grid;
  gap: 0.55rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.page-copy li {
  padding: 0.68rem 0.8rem;
  border-left: 3px solid var(--heat);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--ink);
  font-weight: 700;
}


.state-label {
  opacity: 0.56;
  font-size: 11px;
  text-transform: uppercase;
}

@media (max-width: 980px) {
  .global-control-bar {
    grid-template-columns: 1fr;
  }

  .story-page {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .global-control-bar .control-panel {
    display: flex;
    overflow-x: auto;
  }

  .global-control-bar .control-panel fieldset,
  .global-control-bar .control-panel .ghost-button {
    flex: 0 0 auto;
  }
}

@media (max-width: 680px) {
  .global-control-bar {
    top: 0;
    margin-inline: -1rem;
    border-radius: 0 0 var(--radius) var(--radius);
  }

  .story-pages {
    gap: 2rem;
  }

  .story-page {
    padding: 1rem 0;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
  }

  .page-copy h3 {
    font-size: clamp(1.85rem, 10vw, 3rem);
  }

  .story-page .viz,
  .story-page .tall-viz,
  .map-page .viz {
    min-height: 340px;
  }

  .story-page .panel-insight {
    display: grid;
  }
}

/* Keep the global controls compact after all responsive overrides. */
.global-control-bar {
  grid-template-columns: minmax(112px, auto) minmax(0, 1fr) auto;
  align-items: center;
}

.global-control-bar .control-panel {
  grid-column: auto;
  display: flex;
  align-items: end;
  min-width: 0;
  overflow-x: auto;
}

.global-control-bar .annotation,
.global-control-copy h3 {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 680px) {
  .global-control-bar {
    grid-template-columns: 1fr auto;
  }

  .global-control-copy {
    display: none;
  }

  .global-control-bar .control-panel {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .global-control-bar .badge {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .global-control-bar .control-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.5rem;
    overflow: visible;
  }

  .global-control-bar .control-panel fieldset:first-child {
    grid-column: 1 / -1;
  }

  .global-control-bar .metric-field {
    display: none;
  }

  .global-control-bar .stacked-buttons {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    overflow: visible;
  }

  .global-control-bar .button-row {
    overflow: visible;
  }

  .global-control-bar .scenario-button {
    min-width: 0;
  }
}
