/* ============================================================
   scene.css — Shell for every scene in the scroll spine.
   Templates that need more layout (map, rankings) bring their
   own files.
   ============================================================ */

.scene {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-7) var(--space-5);
  position: relative;
}

.scene-inner {
  width: 100%;
  max-width: var(--content-width);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.scene-inner.center { align-items: center; text-align: center; }

.scene > .eyebrow { margin-bottom: var(--space-3); }

/* ── Hero ──────────────────────────────────────────────── */
.scene--hero {
  min-height: 100vh;
  padding-top: clamp(var(--space-7), 15vh, 18vh);
  padding-bottom: clamp(var(--space-6), 11vh, 14vh);
}
/* gap:0 so each child owns its spacing — a tight "statement" group
   (eyebrow → headline → lede), a generous break, then the action. */
.scene--hero .scene-inner { max-width: 1100px; gap: 0; align-items: flex-start; }
.scene--hero h1 { font-size: clamp(48px, 7vw, 104px); }
.scene--hero .hero-headline { margin-top: var(--space-3); }

/* ── Hero headline — staircase composition ────────────── */
.hero-headline {
  font-family: var(--font-body);
  font-weight: 900;
  letter-spacing: -0.015em;
  line-height: 1;
  color: var(--text);
  margin: 0;
  padding: 0;
  font-size: clamp(72px, 13vw, 256px);
  width: 100%;
  display: block;
}
.hero-headline .hh-line {
  display: block;
  position: relative;
}
.hero-headline .hh-word { display: inline-block; }
.hero-headline em { font-style: normal; }

.hero-headline .hh-small {
  font-family: var(--font-body);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--muted);
  font-size: clamp(13px, 1.1vw, 16px);
  margin-bottom: var(--space-3);
  padding-left: 0.4em;
}

.hero-headline .hh-figure {
  font-family: var(--font-display);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  font-size: clamp(72px, 13vw, 196px);
  letter-spacing: -0.05em;
  line-height: 0.9;
  color: var(--primary);
  /* Optical breathing room so the figure's descenders + comma never collide
     with the ascenders of "traffic signals" on the line below. */
  margin-bottom: clamp(var(--space-3), 2vw, var(--space-6));
}
.hero-headline .hh-counter .hh-dim,
.scene--big-number .figure .counter .hh-dim { opacity: 0; }

.hero-headline .hh-counter .hh-letter { color: var(--text-soft); }

/* Fixed-width per-character cells: gives tabular-figure behavior for the
   count-up without dropping to a monospace font. */
.hero-headline .hh-counter .hh-cell,
.scene--big-number .figure .counter .hh-cell {
  display: inline-block;
  width: 0.58em;
  text-align: center;
}
.hero-headline .hh-counter .hh-cell--punct,
.scene--big-number .figure .counter .hh-cell--punct {
  width: 0.14em;
}

/* Counter cells stay at full opacity throughout the count-up. */

.hero-headline .hh-counter .hh-comma,
.hero-headline .hh-counter .hh-dot,
.scene--big-number .figure .counter .hh-comma,
.scene--big-number .figure .counter .hh-dot {
  font-size: 0.55em;
  color: var(--gold);
  vertical-align: baseline;
}

.hero-headline .hh-display {
  font-family: var(--font-display);
  font-weight: 900;
  font-style: italic;
  font-size: clamp(48px, 8.4vw, 124px);
  letter-spacing: -0.045em;
  line-height: 0.9;
  color: var(--text);
  padding-left: clamp(var(--space-3), 4vw, 56px);
  margin-bottom: var(--space-3);
}

.hero-headline .hh-mid {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: clamp(22px, 2.4vw, 34px);
  letter-spacing: -0.005em;
  color: var(--text-soft);
  padding-left: clamp(var(--space-4), 6vw, 96px);
  margin-bottom: var(--space-2);
}
.hero-headline .hh-mid em {
  color: var(--text);
  font-weight: 700;
}

.hero-headline .hh-accent {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: clamp(24px, 2.8vw, 40px);
  letter-spacing: -0.005em;
  line-height: 1.1;
  color: var(--text-soft);
  padding-left: clamp(var(--space-3), 4vw, 56px);
}
.hero-headline .hh-accent em {
  color: var(--text);
  font-weight: 700;
  font-style: normal;
}
/* "analyzed" — the thesis word. It pops through the display serif + italic,
   not color: accent (blue) is reserved for the data figure, keeping the
   sentence one ivory voice. */
.hero-headline .hh-italic {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 900;
  color: var(--text);
  font-size: 1.25em;
  letter-spacing: -0.02em;
  margin-left: 0.1em;
}
.hero-headline .hh-stop {
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.2em;
  line-height: 0;
  margin-left: -0.02em;
  vertical-align: -0.05em;
}

.hero-figure-cap { display: none; }

@media (max-width: 720px) {
  .hero-headline .hh-display,
  .hero-headline .hh-accent { padding-left: var(--space-2); }
  .hero-headline .hh-display { font-size: clamp(44px, 12vw, 84px); }
  .hero-headline .hh-figure  { font-size: clamp(56px, 16vw, 96px); }
}
.scene--hero .hero-figure {
  display: flex;
  align-items: baseline;
  gap: var(--space-4);
  flex-wrap: wrap;
}
.scene--hero .hero-figure .figure {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(56px, 9vw, 144px);
  letter-spacing: -0.04em;
  line-height: 0.95;
  color: var(--primary);
}
.scene--hero .hero-figure .figure-cap {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: clamp(22px, 2.6vw, 36px);
  letter-spacing: -0.01em;
  color: var(--text);
  line-height: 1.15;
}
.scene--hero .lede {
  color: var(--text-soft);
  font-size: clamp(var(--text-lg), 1.7vw, 22px);
  max-width: var(--reading-width);
  margin-top: var(--space-4);   /* headline → lede (still the statement group) */
  text-wrap: pretty;            /* avoid orphans on the last line */
}
/* Keep tap targets ≥44px on touch. */
@media (pointer: coarse) {
  .locate-clear-link { display: inline-block; padding-block: 10px; }
}
.scene--hero .scroll-cue {
  position: absolute;
  bottom: var(--space-6);
  left: 50%;
  transform: translateX(-50%);
  color: var(--muted);
  font-size: var(--text-xs);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

/* ── Big-number scene ──────────────────────────────────── */
/* Tight base gap so eyebrow + figure + label read as one statement;
   the dek gets its own breath below (rule further down). */
.scene--big-number .scene-inner { align-items: center; text-align: center; gap: var(--space-2); }
.scene--big-number .figure {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(72px, 12vw, 200px);
  letter-spacing: -0.04em;
  line-height: 0.95;
  color: var(--primary);
}
.scene--big-number .figure .unit { color: var(--muted); font-size: 0.4em; margin-left: 0.1em; letter-spacing: 0; }
.scene--big-number .figure--padded {
  font-size: clamp(36px, 9vw, 132px);
  letter-spacing: -0.05em;
}
.scene--big-number .figure-label {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: clamp(16px, 1.6vw, 22px);
  letter-spacing: 0;
  color: var(--text-soft);
}
.scene--big-number .dek { text-align: center; margin-top: var(--space-3); }
.scene--big-number .dek strong { color: var(--text); font-weight: 700; }

/* ── Scene rhythm: break the 100vh + space-7 metronome ─────
   The scroll spine is a sequence of scenes. Equal spacing
   between every scene reads as a stutter; varying it gives
   the page an editorial pulse (pair · breath · sequence · rest). */

/* Adjacent big-number scenes pair visually — tighten the top
   gap so the second reads as a follow-up, not a new beat. */
.scene--big-number + .scene--big-number {
  padding-top: var(--space-5);
}

/* The "paired" big-number breaks the centered template into a
   left-anchored reading column — same data, different cadence. */
.scene--big-number.is-paired .scene-inner {
  align-items: flex-start;
  text-align: left;
  max-width: var(--reading-width);
}
.scene--big-number.is-paired .figure { font-size: clamp(72px, 9vw, 144px); }
.scene--big-number.is-paired .dek,
.scene--big-number.is-paired .figure-label { text-align: left; }

/* After the long pinned-map sequence, give the next scene a
   real breath so the map narrative closes and the chart
   chapter opens — instead of butting straight against a chart. */
.scene--map-pinned + .scene {
  padding-top: clamp(var(--space-7), 9vh, var(--space-8));
}

/* Closing is a "where to next" — not another full act. Compress
   it so it doesn't echo the weight of the hero/scale scenes. */
.scene--closing {
  min-height: auto;
  padding-top: var(--space-6);
  padding-bottom: var(--space-7);
}

/* ── Headline + chart scene ────────────────────────────── */
.scene--chart .scene-inner { gap: var(--space-5); align-items: stretch; }
.scene--chart h2 { max-width: var(--reading-width); }
.scene--chart .chart-host {
  background: var(--card-grad);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}

/* ── Closing scene ─────────────────────────────────────── */
.scene--closing .scene-inner { gap: var(--space-5); align-items: flex-start; }
.scene--closing .closing-actions { display: flex; gap: var(--space-3); flex-wrap: wrap; margin-top: var(--space-3); }

/* ── Progress dots (right rail) ────────────────────────── */
.scroll-progress {
  position: fixed;
  right: var(--space-5);
  top: 50%;
  transform: translateY(-50%);
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.scroll-progress .dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: transparent;
  cursor: pointer;
  padding: 0;
}
.scroll-progress .dot[aria-current="true"] {
  background: var(--primary);
  border-color: var(--primary);
}

/* Pre-hide elements that animate in, but ONLY for users
   who haven't requested reduced motion.
   This is the single anti-FOUC guard for the whole site. */
@media (prefers-reduced-motion: no-preference) {
  .scene [data-animate] { opacity: 0; }
  /* IntersectionObserver-driven cascade: sections tagged .is-cascade by
     revealOnScroll() fade + rise their [data-animate] children top-to-bottom
     (stagger via per-item transition-delay) when scrolled into view. */
  .is-cascade [data-animate] {
    transform: translateY(16px);
    transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
  }
  .is-cascade [data-animate].is-revealed { opacity: 1; transform: none; }
}


/* ── Chart section (peak-hour, AOG, quarterly in one chapter) ── */
.scene--chart-section {
  /* Not a full-viewport scene — a single stacked chapter of charts. */
  min-height: auto;
  display: block;
  padding-bottom: var(--space-8);
}
.chart-stack {
  display: flex;
  flex-direction: column;
  gap: clamp(var(--space-7), 11vh, var(--space-8));
  width: 100%;
  max-width: var(--content-width);
  margin: 0 auto;
}
.chart-block .scene-inner {
  gap: var(--space-6);
}

.scene-copy {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-width: var(--reading-width);
}

.metric-chart-grid,
.quarterly-layout {
  display: grid;
  grid-template-columns: minmax(220px, 0.34fr) minmax(0, 1fr);
  gap: var(--space-5);
  align-items: stretch;
}

.chart-host--framed,
.scene-lead-card,
.mover-card {
  background: var(--card-grad);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  backdrop-filter: blur(8px);
}

.scene-lead-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--space-3);
  /* Size the big figure off the card's own width (below), not the viewport,
     so long values like "58.1%" never overflow on a narrow grid column. */
  container-type: inline-size;
}

.scene-lead-card .figure {
  font-family: var(--font-display);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  font-size: clamp(40px, 32cqi, 112px);
  letter-spacing: -0.04em;
  line-height: 0.95;
  color: var(--primary);
  max-width: 100%;
}

.scene-lead-card p,
.mover-card p {
  margin: 0;
  color: var(--text-soft);
  font-size: var(--text-md);
}

.aog-chart-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

.aog-chart-pair h3,
.mover-card h3 {
  margin-bottom: var(--space-3);
}

.quarterly-layout {
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.34fr);
}

.mover-list {
  list-style: none;
  padding: 0;
  margin: var(--space-4) 0 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.mover-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-2) var(--space-3);
  align-items: center;
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--line);
}

.mover-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.mover-state { font-weight: 700; color: var(--text); }
.mover-values { color: var(--muted); font-size: var(--text-sm); }
.mover-list .delta { grid-row: span 2; justify-self: end; }

/* ── Hero personalization controls (primary CTA) ───────── */
/* Beat break: the action sits clearly apart from the statement above. */
.hero-locate { margin: var(--space-6) 0 0; width: 100%; }
.hero-locate-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}
/* The typeahead's own "Find your state" label duplicates the masthead
   eyebrow; the placeholder already labels the field, so hide it visually. */
.hero-locate .nav-search__label {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.hero-locate-or {
  color: var(--muted);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}
/* Cap the field so it reads as the secondary option, not heavier than the
   primary "Use my location" button it sits beside. */
.hero-locate-search { flex: 0 1 320px; min-width: 200px; }
.locate-search { width: 100%; max-width: 440px; }

/* Small screens: stack the CTA (button → or → field), each full width, and
   tighten the vertical rhythm so the hero doesn't sprawl on a phone. */
@media (max-width: 560px) {
  /* Keep the top padding (it clears the fixed two-row header); just trim the
     foot and the statement→action break so the hero doesn't sprawl. */
  .scene--hero { padding-bottom: var(--space-6); }
  .scene--hero .hero-locate { margin-top: var(--space-5); }
  .hero-locate-row { flex-direction: column; align-items: stretch; gap: var(--space-3); }
  .hero-locate-or { align-self: center; }
  .hero-locate-search { flex: 1 1 auto; min-width: 0; }
}
.locate-lead {
  color: var(--text-soft);
  font-size: var(--text-md);
  /* max-width: 54ch; */
  margin: var(--space-3) 0 0;
  text-wrap: pretty;
}
.locate-note {
  color: var(--muted);
  font-size: var(--text-sm);
  margin: var(--space-2) 0 0;
  text-wrap: pretty;
}
.locate-note.is-error { color: var(--gold-bright); }
.locate-clear-link {
  background: none;
  border: 0;
  padding: 0;
  color: var(--primary-bright);
  font: inherit;
  font-size: var(--text-sm);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.locate-clear-link:hover { color: var(--text); }
.locate-current {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--card-grad);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  margin-right: var(--space-3);
}
.locate-current-name { font-weight: 700; font-size: var(--text-lg); color: var(--text); }
.locate-current-rank { color: var(--muted); font-family: var(--font-mono); font-size: var(--text-sm); }
.locate-current .locate-clear-link { margin-left: var(--space-2); }

/* "See how {State} compares ↓" — beckons the visitor to scroll on once a
   state is set. The arrow bobs (reduced-motion users get a static arrow). */
.locate-continue {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-4);
  padding: var(--space-2) 0;
  background: none;
  border: 0;
  color: var(--primary-bright);
  font: inherit;
  font-weight: 700;
  font-size: var(--text-md);
  cursor: pointer;
}
.locate-continue:hover { color: var(--text); }
.locate-continue-arrow { display: inline-block; }
@media (prefers-reduced-motion: no-preference) {
  .locate-continue-arrow { animation: locate-bob 1.5s ease-in-out infinite; }
}
@keyframes locate-bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(4px); }
}

/* ── Personalized line under a big-number — sized up to pull the eye ── */
.bignum-personal {
  color: var(--text-soft);
  font-size: clamp(var(--text-lg), 2.2vw, 28px);
  line-height: 1.4;
  max-width: var(--reading-width);
  margin: var(--space-4) auto 0;
}
.bignum-personal strong { color: var(--text); font-weight: 700; }

/* ── Grade scene (A–F scorecard) ───────────────────────── */
.scene--grade-distribution .scene-inner { gap: var(--space-5); align-items: stretch; }
.grade-grid {
  display: grid;
  grid-template-columns: minmax(220px, 0.34fr) minmax(0, 1fr);
  gap: var(--space-5);
  align-items: stretch;
}
.grade-grid--solo { grid-template-columns: minmax(0, 1fr); }
.grade-card { gap: var(--space-3); align-items: flex-start; }
.grade-hero {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: clamp(64px, 26cqi, 108px);
  aspect-ratio: 1;
  border-radius: var(--radius-lg);
  background: var(--grade-color, var(--primary));
  color: var(--bg);
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(38px, 17cqi, 72px);
  line-height: 1;
}
.grade-card-name { color: var(--text-soft); font-size: var(--text-md); font-weight: 700; }
.grade-card-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin: var(--space-2) 0 0;
}
.grade-card-split dt { color: var(--muted); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.06em; }
.grade-card-split dd {
  margin: 2px 0 0;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: var(--text-xl);
  color: var(--text);
}
.grade-card-split .unit { color: var(--muted); font-size: 0.6em; margin-left: 1px; }
.grade-card-foot { color: var(--muted); font-size: var(--text-sm); margin: var(--space-2) 0 0; }

@media (max-width: 900px) {
  .metric-chart-grid,
  .quarterly-layout,
  .aog-chart-pair,
  .grade-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .chart-host--framed,
  .scene-lead-card,
  .mover-card {
    padding: var(--space-4);
  }
  .chart-block .chart { height: 340px; }

  /* The right-rail scene dots overlap content on narrow viewports and
     mobile users already have a scrollbar — hide them. The hero-mode CTA
     ("Skip to map") still provides quick-jump affordance. */
  .scroll-progress { display: none; }
}
