/* Palette pulled from the freelancer illustrations. */
:root {
  --bg: #f5ece2;
  --bg-alt: #ecddce;
  --fg: #2b2326;
  --fg-dim: #6f6066;
  --accent: #e3593d;
  --door-blue: #1e4780;
  --sun: #f9b13a;
  --max-width: 1100px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  /* The start screen's illustrations hang off the window edges. */
  overflow-x: clip;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

.site-header {
  padding: 1.25rem 2rem;
}

.wordmark {
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: 0.02em;
  color: var(--fg);
  text-decoration: none;
}

.accent {
  color: var(--accent);
}

main {
  flex: 1;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1rem;
  /* Intro questions slide out of/in from beyond the top and bottom; clip them
     vertically so they don't add scroll height. (clip, unlike hidden, leaves
     the x axis visible for the full-width illustrations.) */
  overflow-y: clip;
}

.scene {
  padding: 2rem 0 4rem;
  text-align: center;
  animation: rise 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.scene[hidden] {
  display: none;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
}

.title {
  font-size: clamp(1.75rem, 5vw, 3.25rem);
  line-height: 1.1;
  max-width: 900px;
  letter-spacing: -0.02em;
  margin: 0 auto;
  font-weight: 800;
}

.lede {
  color: var(--fg-dim);
  font-size: 1.1rem;
  margin: 1.25rem 0 2.5rem;
}

/* Intro steps: stacked in one grid cell. Clicking "begin" adds .is-advanced
   to the stage: the first question blurs and drifts up out of view while the
   next one scrolls up from below into its place. */
.intro-stage {
  display: grid;
  /* Let the column shrink to the screen instead of growing to fit content. */
  grid-template-columns: minmax(0, 1fr);
}

.intro {
  grid-area: 1 / 1;
  align-self: center;
  transition:
    transform 1s cubic-bezier(0.65, 0, 0.35, 1),
    opacity 1s ease,
    filter 1s ease,
    visibility 0s 1s;
}

.intro-next {
  transform: translateY(60vh);
  opacity: 0;
  visibility: hidden;
}

.intro-next:focus {
  outline: none;
}

.is-advanced .intro-first {
  transform: translateY(-60vh);
  opacity: 0;
  filter: blur(12px);
  visibility: hidden;
}

.is-advanced .intro-next {
  transform: none;
  opacity: 1;
  visibility: visible;
  /* Start rising just after the first question begins to leave. */
  transition-delay: 0.2s, 0.2s, 0.2s, 0s;
}

.begin,
.pick {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 0.25em;
  transition: text-decoration-color 0.2s ease, color 0.2s ease;
}

.begin:hover,
.begin:focus-visible {
  color: var(--fg);
  text-decoration-color: currentColor;
}

/* Scroll cue: three stacked down-chevrons that light up top to bottom on a
   loop, hinting that scrolling (or swiping) moves the story on. Clicking
   works too. */
.scroll-icon {
  width: 0.8em;
  height: 1.2em;
  margin-left: 0.35em;
  vertical-align: -0.3em;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.begin-icon .scroll-icon {
  margin-left: 0;
  width: 1.1em;
  height: 1.65em;
}

.scroll-icon path {
  opacity: 0.25;
  animation: scroll-cue 1.5s ease-in-out infinite;
}

.scroll-icon path:nth-child(2) { animation-delay: 0.2s; }
.scroll-icon path:nth-child(3) { animation-delay: 0.4s; }

@keyframes scroll-cue {
  0%, 100% { opacity: 0.25; }
  30%      { opacity: 1; }
}

/* The two statements in the second question; each picks a path. */
.pick {
  text-decoration-thickness: 0.07em;
  text-underline-offset: 0.12em;
}

/* Side by side, each statement aligned toward the path it picks. */
.statements {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2rem;
  margin-top: 1.75rem;
}

.statement {
  align-self: start; /* top-align, even when one statement runs longer */
}

/* The red "I prefer ..." sentence gets its own line, and its own red
   underline. (inline-block, not block: an inline-block doesn't inherit the
   button's dark underline, which would otherwise paint under the red one.) */
.statement .accent {
  display: inline-block;
  width: 100%;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-decoration-thickness: 0.07em;
  text-underline-offset: 0.12em;
  transition: text-decoration-color 0.2s ease;
}

/* No underline once a statement is picked: it's an answer now, not a link. */
.statement:not([aria-pressed="true"]):hover .accent,
.statement:not([aria-pressed="true"]):focus-visible .accent {
  text-decoration-color: var(--accent);
}

.statement[data-pick="left"] {
  text-align: left;
}

/* Left-aligned text, but the box is shrink-wrapped to its longest line (see
   main.js) and pushed to the column's right edge, so its gap to the right
   image matches the left statement's gap to the left image. The wrapper also
   holds 3b's "Continue", lined up under the statement. */
.statement-col {
  justify-self: end;
  align-self: start;
  text-align: left;
}

.statement[data-pick="right"] {
  text-align: left;
}

/* "Continue" under a picked statement: only shown at its own step. */
.step-next {
  margin: 1.25rem 0 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.6s ease, visibility 0s 0.6s;
}

#start[data-step="3a"] .step-next[data-step-next="3a"],
#start[data-step="3b"] .step-next[data-step-next="3b"] {
  opacity: 1;
  visibility: visible;
  transition-delay: 1.5s, 0s; /* after the statement has risen */
}

/* Story beats (4b, 5b, ...): the next screen after a pick. Same move as the
   intro steps: the previous step blurs up and away and the beat rises in. */
.intro-beat {
  transform: translateY(60vh);
  opacity: 0;
  visibility: hidden;
  text-align: left;
}

.intro-beat:focus {
  outline: none;
}

.intro-stage .intro.is-past {
  transform: translateY(-60vh);
  opacity: 0;
  filter: blur(12px);
  visibility: hidden;
  transition-delay: 0s;
}

.intro-stage .intro-beat.is-current {
  transform: none;
  opacity: 1;
  visibility: visible;
  transition-delay: 0.2s, 0.2s, 0.2s, 0s;
}

/* Keeps a hyphenated word (e.g. "ultra-rich") from breaking at the hyphen. */
.nowrap {
  white-space: nowrap;
}

/* Scroll cue under a beat, lined up with its text. */
.beat-next {
  margin: 1.5rem 0 0;
}

/* 4a, 5a-2, 5a-3, 6b (left path), 9a/9b, 12a/12b, 15b: a line's gap between the lead-in and the heading. */
#step-4a .beat-title,
#step-5a-2 .beat-title,
#step-5a-3 .beat-title,
#step-12a .beat-title,
#step-9b .beat-title,
#step-9a .beat-title,
#step-12b .beat-title,
#step-15b .beat-title,
#start[data-picked="left"][data-step="6b"] #step-6b .beat-title {
  margin-top: 1rem;
}

/* 10b: a single line, centered in the window. */
#step-10b {
  text-align: center;
}

/* 10b-2: the line beneath opens up (the row grows from 0, so the heading
   glides up to make room), then fades in. */
.text-reveal {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows 0.8s cubic-bezier(0.65, 0, 0.35, 1), opacity 0.6s ease;
}

.text-reveal > * {
  min-height: 0;
  overflow: hidden;
}

#start[data-step="10b-2"] .text-reveal {
  grid-template-rows: 1fr;
  opacity: 1;
  transition-delay: 0s, 0.5s;
}

/* 10b-3: falling birth rates. */
.fert-chart {
  margin: 0;
  padding-top: 1rem;
}

.fert-chart svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.fert-chart figcaption {
  margin-top: 0.5rem;
  font-size: 0.7rem;
  line-height: 1.4;
  color: var(--fg-dim);
}

.fert-chart figcaption a {
  color: inherit;
}

.fert-grid {
  stroke: var(--fg);
  stroke-opacity: 0.08;
  stroke-width: 1;
}

.fert-tick,
.fert-axis {
  font-size: 12px;
  font-weight: 600;
  fill: var(--fg-dim);
  font-variant-numeric: tabular-nums;
}

.fert-replacement {
  stroke: var(--fg);
  stroke-opacity: 0.45;
  stroke-width: 1.25;
  stroke-dasharray: 4 4;
}

.fert-replacement-label {
  font-size: 12px;
  font-weight: 700;
  fill: var(--fg-dim);
}

.fert-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

.fert-peer {
  stroke: var(--fg-dim);
  stroke-opacity: 0.3;
  stroke-width: 1.5;
}

.fert-us {
  stroke: var(--accent);
  stroke-width: 3.5;
}

.fert-dot {
  fill: var(--accent);
}

.fert-us-val {
  font-size: 15px;
  font-weight: 800;
  fill: var(--accent);
  font-variant-numeric: tabular-nums;
}

.fert-label {
  font-size: 11px;
  font-weight: 500;
  fill: var(--fg-dim);
  fill-opacity: 0.75;
}

.fert-label-us {
  font-size: 15px;
  font-weight: 700;
  fill: var(--fg);
  fill-opacity: 1;
}

.fert-label-val {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.fert-label-us .fert-label-val {
  font-weight: 800;
  fill: var(--accent);
}

.fert-marks {
  opacity: 0;
  transition: opacity 0.6s ease;
}

/* When 10b-3 opens: the faded peers draw in, then the US line over them,
   then the labels. */
#start[data-step="10b-3"] .fert-line {
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1.6s cubic-bezier(0.45, 0, 0.55, 1) 0.8s;
}

#start[data-step="10b-3"] .fert-us {
  transition-duration: 2.4s;
  transition-delay: 1.4s;
}

#start[data-step="10b-3"] .fert-marks {
  opacity: 1;
  transition-delay: 3.4s;
}

/* 5a-2: costs vs. wages. Costs run warm, wages are the cool, heavy line,
   inflation a dashed reference. */
.cost-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.5;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

.cost-premium { --c: #a8332a; }
.cost-home { --c: var(--accent); }
.cost-care { --c: #c98a3c; }
.cost-wages { --c: #2f6f6a; }
.cost-cpi { --c: var(--fg-dim); }

.cost-line { stroke: var(--c); }
.cost-dot { fill: var(--c); }

.cost-line.cost-wages {
  stroke-width: 4;
}

/* Dashed, so it fades in instead of drawing. */
.cost-line.cost-cpi {
  stroke-width: 1.5;
  stroke-dasharray: 5 4;
  stroke-dashoffset: 0;
  opacity: 0;
}

.cost-label {
  font-size: 12px;
  font-weight: 600;
  fill: var(--c);
}

.cost-label.cost-wages {
  font-size: 14px;
  font-weight: 800;
}

/* When 5a-2 opens: inflation fades in, the three costs draw in one after
   another, then wages, then the labels. */
#start[data-step="5a-2"] .cost-line {
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1.4s cubic-bezier(0.45, 0, 0.55, 1) 0.8s;
}

#start[data-step="5a-2"] .cost-home { transition-delay: 1.1s; }
#start[data-step="5a-2"] .cost-care { transition-delay: 1.4s; }

#start[data-step="5a-2"] .cost-line.cost-wages {
  transition-duration: 2s;
  transition-delay: 1.9s;
}

#start[data-step="5a-2"] .cost-line.cost-cpi {
  opacity: 1;
  transition: opacity 0.8s ease 0.6s;
}

.cost-chart {
  padding-top: 1.25rem;
}

.cost-chart figcaption {
  font-size: 0.6rem;
}

.cost-axis {
  font-size: 10px;
}

#start[data-step="5a-2"] .fert-marks {
  opacity: 1;
  transition-delay: 3.6s;
}

/* 5a-4: the heading on one line, a little smaller so it fits the column. */
#step-5a-4 .beat-title {
  white-space: nowrap;
  font-size: clamp(1.1rem, 1.95vw, 2rem);
}

/* 5a-4: the top tax rate, a staircase in the accent color. */
.tax-chart {
  padding-top: 1rem;
}

.tax-chart figcaption {
  font-size: 0.6rem;
}

.tax-line {
  stroke: var(--accent);
  stroke-width: 3.5;
  stroke-linecap: butt;
}

.tax-label {
  font-size: 15px;
  font-weight: 800;
  fill: var(--accent);
  font-variant-numeric: tabular-nums;
}

.tax-label-muted {
  font-size: 11px;
  font-weight: 600;
  fill: var(--fg-dim);
}

/* When 5a-4 opens: the line draws in, then the labels. */
#start[data-step="5a-4"] .tax-line {
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 2.4s cubic-bezier(0.45, 0, 0.55, 1) 0.8s;
}

#start[data-step="5a-4"] .tax-chart .fert-marks {
  opacity: 1;
  transition-delay: 3s;
}

/* 11b: the sources under the heading, set like 5b's. */
.source-group {
  margin-top: 1.25rem;
}

/* Four sources (vs 5b's two): closer together, so the step fits the window
   at the 1.5x zoom. */
.source-group .source {
  margin-bottom: 0.75rem;
}

.source-group .source figcaption {
  margin-top: 0.2rem;
}

/* 13b: the Family Wage in brief. */
.beat-list {
  padding-left: 1.2em;
}

.beat-list li {
  margin-top: 0.35rem;
}

.beat-list li::marker {
  color: var(--accent);
}

/* 11a: a list, a source and a closing line; smaller and tighter, so the
   step fits the window. */
#step-11a .beat-list {
  font-size: clamp(0.9rem, 1.15vw, 1rem);
  line-height: 1.35;
  margin-top: 0.75rem;
}

#step-11a .beat-list li {
  margin-top: 0.15rem;
}

#step-11a .source {
  margin: 0.75rem 0 0;
  line-height: 1.4;
}

#step-11a .source + .beat-text {
  margin-top: 0.75rem;
}

/* 10a: a heading, paragraph and three sources; smaller and
   tighter, like 11a, so the step fits the window. */
#step-10a .beat-title {
  font-size: clamp(1.1rem, 1.95vw, 2rem);
}

#step-10a .beat-title + .beat-text {
  font-size: clamp(0.9rem, 1.2vw, 1.05rem);
  line-height: 1.4;
  margin-top: 0.6rem;
}

#step-10a .source-group {
  margin-top: 0.9rem;
}

#step-10a .source {
  font-size: clamp(0.8rem, 1vw, 0.9rem);
  line-height: 1.35;
  margin-bottom: 0.5rem;
}

#step-10a .source figcaption {
  margin-top: 0.1rem;
}

/* 15b: the last word, on a line of its own and bigger. */
.beat-punch {
  display: block;
  margin-top: 0.15em;
  font-size: 1.6em;
  line-height: 1.05;
}

/* 6b: a lead-in question above the highlighted answer. */
.beat-lead {
  margin: 0 0 0.75rem;
}

/* 7b/8b: a detail area opens beneath 6b's text (the row grows from 0 to its
   full height, so the text above glides up to make room). It holds two
   panels in one cell: 7b's cash comparison, then 8b's chart. */
.chart-reveal {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows 1s cubic-bezier(0.65, 0, 0.35, 1), opacity 0.6s ease;
}

.chart-reveal > * {
  min-height: 0;
  overflow: hidden;
}

#start[data-step^="7b"] .chart-reveal,
#start[data-step^="8b"] .chart-reveal,
#start[data-step^="9b"] .chart-reveal,
#start[data-step="9a"] .chart-reveal {
  grid-template-rows: 1fr;
  opacity: 1;
  transition-delay: 0s, 0.4s;
}

.detail-panels {
  display: grid;
}

.detail-panel {
  grid-area: 1 / 1;
  opacity: 0;
  visibility: hidden;
  transform: translateY(1.5rem);
  transition: opacity 0.6s ease, transform 0.8s cubic-bezier(0.65, 0, 0.35, 1), visibility 0s 0.8s;
}

#start[data-step^="7b"] .cash-panel,
#start[data-step^="8b"] .ladder-chart,
#start[data-step^="9b"] .ladder-chart,
#start[data-step="9a"] .ladder-chart {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition-delay: 0.3s, 0.3s, 0s;
}

/* From 7b on, 6b's heading gives way to the chart section's. (On 9b the
   6b beat leaves as it was last seen, chart and all.) */
/* Shared steps worded differently per path (e.g. 6b's lead-in). */
#start:not([data-picked="left"]) .path-left,
#start[data-picked="left"] .path-right {
  display: none;
}

.title-swap {
  display: grid;
}

.title-swap > * {
  grid-area: 1 / 1;
  transition: opacity 0.6s ease, visibility 0s;
}

#start[data-step^="7b"] .title-6b,
#start[data-step^="8b"] .title-6b,
#start[data-step^="9b"] .title-6b,
#start[data-step="9a"] .title-6b,
#start:not([data-step^="7b"]):not([data-step^="8b"]):not([data-step^="9b"]):not([data-step="9a"]) .title-7b {
  opacity: 0;
  visibility: hidden;
}

/* The hidden heading stops taking up room, so a one-line heading doesn't
   leave a two-line gap. */
#start[data-step^="7b"] .title-6b,
#start[data-step^="8b"] .title-6b,
#start[data-step^="9b"] .title-6b,
#start[data-step="9a"] .title-6b {
  position: absolute;
}

/* 6b's lead-in question goes too. */
.beat-lead {
  transition: opacity 0.6s ease;
}

#start[data-step^="7b"] .beat-lead,
#start[data-step^="8b"] .beat-lead,
#start[data-step^="9b"] #step-6b .beat-lead,
#start[data-step="9a"] #step-6b .beat-lead {
  position: absolute;
  opacity: 0;
  visibility: hidden;
}

/* 7b: the 1976 comparison in bundles of cash. */
.cash-panel {
  padding-top: 1rem;
}

.cash-text {
  margin: 0;
  font-size: clamp(0.95rem, 1.35vw, 1.15rem);
  font-weight: 600;
  line-height: 1.45;
  text-wrap: pretty;
}

.cash-stacks {
  display: block;
  width: 100%;
  height: auto;
  margin-top: 0.75rem;
  overflow: visible;
}

.bundle-bill {
  fill: #8fae86;
  stroke: #5d7c56;
  stroke-width: 1;
}

.bundle-band {
  fill: #efe6cf;
}

/* Bundles drop in one after another, stack by stack, each time 7b opens
   (but not again on 7b -> 7b-2, where the rule keeps matching). The 2025
   bundles are left out: an animation only starts when it's first applied,
   so if they ran it (invisibly) on 7b, they'd just pop in on 7b-2. */
#start[data-step^="7b"] .bundle:not(.bundle-new) {
  animation: bundle-in 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: calc(0.6s + var(--i) * 18ms);
}

/* 7b-2: the 14 extra 2025 bundles land on the pile the same way. */
.bundle-new {
  visibility: hidden;
}

#start[data-step="7b-2"] .bundle-new {
  visibility: visible;
  animation: bundle-in 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: calc(0.6s + var(--j) * 18ms);
}

/* 1976 vs 2025 versions of the text and labels, swapped by step. */
.cash-swap {
  display: grid;
}

.cash-swap > * {
  grid-area: 1 / 1;
  transition: opacity 0.5s ease, visibility 0s;
}

#start:not([data-step="7b-2"]) .cash-2025,
#start[data-step="7b-2"] .cash-1976 {
  opacity: 0;
  visibility: hidden;
}

#start:not([data-step="7b-2"]) .cash-note .cash-2025,
#start[data-step="7b-2"] .cash-note .cash-1976 {
  display: none;
}

@keyframes bundle-in {
  from {
    opacity: 0;
    transform: translateY(-14px);
  }
}

.cash-name {
  font-size: 15px;
  font-weight: 600;
  fill: var(--fg);
}

.cash-amount {
  font-size: 17px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  fill: var(--fg-dim);
}

.cash-amount-top {
  fill: var(--accent);
}

/* 8b: the side note beside the chart (placed in the right third on wide
   screens; see the media query). Shown on the chart steps only. */
.side-note {
  font-size: clamp(1.05rem, 1.5vw, 1.3rem);
  font-weight: 600;
  line-height: 1.5;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.8s ease, transform 1s cubic-bezier(0.65, 0, 0.35, 1), visibility 0s 1s;
}

.side-note p {
  margin: 0 0 1em;
}

/* One text per stretch of chart steps, 8b..8b-5 then 8b-6, swapped the
   same way as the story beats: the old text blurs up and away while the new
   one rises in from below. */
.side-note {
  display: grid;
}

.side-note-text {
  grid-area: 1 / 1;
  align-self: center;
  transition:
    transform 1s cubic-bezier(0.65, 0, 0.35, 1),
    opacity 1s ease,
    filter 1s ease,
    visibility 0s 1s;
}

main #start:not([hidden])[data-step="8b-7"] ~ .side-note { /* beats the 8b show rule below */
  opacity: 0;
  visibility: hidden;
  transition-delay: 0s, 0s, 0.6s;
}

.side-note .note-8b-6 {
  transform: translateY(60vh);
  opacity: 0;
  visibility: hidden;
}

#start[data-step="8b-6"] ~ .side-note .note-8b {
  transform: translateY(-60vh);
  opacity: 0;
  filter: blur(12px);
  visibility: hidden;
}

#start[data-step="8b-6"] ~ .side-note .note-8b-6 {
  transform: none;
  opacity: 1;
  visibility: visible;
  transition-delay: 0.2s, 0.2s, 0.2s, 0s;
}

#start:not([hidden])[data-step^="8b"] ~ .side-note {
  opacity: 1;
  visibility: visible;
  transition-delay: 0.9s, 0.9s, 0s;
}

@media (min-width: 800px) {
  #start:not([hidden])[data-step^="8b"] ~ .side-note {
    transform: translate(0, -50%);
  }
}

@media (max-width: 799px) {
  .side-note {
    display: none;
    padding: 0 1rem;
  }

  #start:not([hidden])[data-step^="8b"] ~ .side-note {
    display: grid;
  }
}

/* 14b: the Family Wage calculator, a panel over the page that rises in
   the way the story beats do. */
.wage-calc {
  --wc-card: #fbf5ec;
  --wc-line: #e4d8c9;
  --wc-good: #2f7d54;
  --wc-good-bg: #e6f0e6;
  --wc-bad: #b23a2e;
  --wc-bad-bg: #f6e1dc;
  position: fixed;
  z-index: 20;
  top: 50%;
  left: 50%;
  width: min(60rem, calc(100vw - 4rem));
  max-height: calc(100vh - 5rem);
  overflow-y: auto;
  transform: translate(-50%, calc(-50% + 60vh));
  opacity: 0;
  visibility: hidden;
  transition:
    transform 1s cubic-bezier(0.65, 0, 0.35, 1),
    opacity 1s ease,
    visibility 0s 1s;
}

#start:not([hidden])[data-step="14b"] ~ .wage-calc {
  transform: translate(-50%, -50%);
  opacity: 1;
  visibility: visible;
  transition-delay: 0.2s, 0.2s, 0s;
}

.wc-title {
  margin: 0;
  font-size: clamp(1.75rem, 3.4vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.05;
}

.wc-sub {
  max-width: 50ch;
  margin: 0.6rem 0 0;
  font-size: clamp(0.95rem, 1.2vw, 1.05rem);
  font-weight: 500;
  line-height: 1.5;
  color: var(--fg-dim);
}

.wc-panel {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 2.5rem;
  align-items: start;
  margin-top: 1.75rem;
}

.wc-controls {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.wc-ctrl label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 1rem;
  font-weight: 700;
}

.wc-val {
  color: var(--accent);
  font-weight: 800;
}

.wc-ctrl input[type="range"] {
  width: 100%;
  height: 24px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.wc-hint {
  margin-top: 0.4rem;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--fg-dim);
}

.wc-tierline {
  margin-top: 0.25rem;
  font-size: 1.02rem;
  font-weight: 800;
}

.wc-thr {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--fg-dim);
}

.wc-results {
  padding: 1.4rem;
  border: 1px solid var(--wc-line);
  border-radius: 18px;
  background: var(--wc-card);
}

.wc-verdict {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 800;
  line-height: 1.25;
}

.wc-verdict.is-good {
  background: var(--wc-good-bg);
  color: var(--wc-good);
}

.wc-verdict.is-bad {
  background: var(--wc-bad-bg);
  color: var(--wc-bad);
}

.wc-ico {
  font-size: 1.2rem;
  line-height: 1;
}

.wc-vsub {
  margin: 0.5rem 0 0;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.4;
}

.wc-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  margin-top: 1rem;
  overflow: hidden;
  border-radius: 12px;
  background: var(--wc-line);
}

.wc-stat {
  padding: 0.75rem 1rem;
  background: var(--wc-card);
}

.wc-k {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--fg-dim);
}

.wc-v {
  margin-top: 0.15rem;
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.wc-buys {
  margin: 0.9rem 0 0;
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
}

.wc-buys b {
  color: var(--accent);
}

/* Share: logs the reader's settings, then (to come) shares them. */
.wc-share {
  display: block;
  margin: 1rem auto 0;
  padding: 0.6rem 1.6rem;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease;
}

.wc-share:hover,
.wc-share:focus-visible {
  background: var(--door-blue);
}

/* 15b: centered under the last line, sized down for the 1.5x zoom so it
   matches 14b's. */
.beat-share {
  margin: 1.5rem auto 0;
  font-size: 0.7rem;
}

.wc-foot {
  margin: 1.5rem 0 0;
  padding-top: 0.9rem;
  border-top: 1px solid var(--wc-line);
  font-size: 0.72rem;
  line-height: 1.55;
  color: var(--fg-dim);
}

.wc-foot a {
  color: inherit;
}

/* The way into the advanced settings, an Easter egg: just underlined in
   the fine print, but on hover it lights up. A warm halo breathes behind
   it, a glint sweeps through the letters, and a spark twinkles at its
   corner. */
.wc-more {
  position: relative;
  isolation: isolate;
  padding: 0.05em 0.15em;
  margin: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  cursor: pointer;
  transition: color 0.3s ease, text-decoration-color 0.3s ease;
}

/* The halo, behind the text. */
.wc-more::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: rgba(249, 177, 58, 0.3); /* --sun */
  box-shadow: 0 0 0.5em 0.2em rgba(249, 177, 58, 0.4);
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* The spark. */
.wc-more::after {
  content: "✦";
  position: absolute;
  top: -0.55em;
  right: -0.45em;
  font-size: 0.8em;
  line-height: 1;
  color: var(--sun);
  text-shadow: 0 0 0.4em rgba(249, 177, 58, 0.9);
  opacity: 0;
  transform: scale(0) rotate(0deg);
  pointer-events: none;
}

.wc-more:hover,
.wc-more:focus-visible,
.wc-egg:hover .wc-more,
.wc-egg:focus-within .wc-more {
  /* The glint: a bright band swept through the text. */
  color: transparent;
  background-image: linear-gradient(105deg, var(--fg) 40%, #fff3c4 50%, var(--fg) 60%);
  background-size: 250% 100%;
  background-position: 100% 0;
  -webkit-background-clip: text;
  background-clip: text;
  text-decoration-line: none; /* (a clipped background would show through it) */
  outline: none;
  animation: wc-glint 2.4s ease-in-out infinite;
}

.wc-more:hover::before,
.wc-more:focus-visible::before,
.wc-egg:hover .wc-more::before,
.wc-egg:focus-within .wc-more::before {
  opacity: 1;
  animation: wc-halo 2.4s ease-in-out infinite;
}

.wc-more:hover::after,
.wc-more:focus-visible::after,
.wc-egg:hover .wc-more::after,
.wc-egg:focus-within .wc-more::after {
  animation: wc-spark 2.4s ease-in-out infinite;
}

/* An Easter egg's pop-up: a small card above the phrase with one
   assumption slider. Opens on hover (or focus, e.g. a tap), and stays open
   while the pointer is on it or its slider has focus. */
.wc-egg {
  position: relative;
}

.wc-pop {
  position: absolute;
  right: 0;
  bottom: calc(100% + 0.6rem);
  z-index: 2;
  display: block;
  width: 13rem;
  padding: 0.6rem 0.75rem 0.55rem;
  border-radius: 10px;
  background: var(--wc-card);
  box-shadow: 0 0 0 1px var(--wc-line), 0 8px 24px rgba(43, 35, 38, 0.18);
  color: var(--fg);
  font-size: 0.75rem;
  line-height: 1.35;
  text-align: left;
  opacity: 0;
  visibility: hidden;
  transform: translateY(0.35rem);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s 0.2s;
}

/* A bridge over the gap, so moving up from the phrase doesn't close it. */
.wc-pop::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 0.7rem;
}

.wc-egg:hover .wc-pop,
.wc-egg:focus-within .wc-pop {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition-delay: 0s;
}

.wc-pop-label {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
}

.wc-pop-label output {
  color: var(--accent);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.wc-pop input[type="range"] {
  display: block;
  width: 100%;
  height: 18px;
  margin: 0.2rem 0 0.1rem;
  accent-color: var(--accent);
  cursor: pointer;
}

.wc-pop-note {
  display: block;
  color: var(--fg-dim);
}

#wc-pop-median {
  width: 15rem;
}

/* Reference points under a pop-up slider (e.g. the BLS anchors); each is
   placed with an inline left: as a share of the slider's range. */
.wc-pop-marks {
  position: relative;
  display: block;
  height: 1.5em;
  margin: 0 0 0.3rem;
  font-size: 0.68rem;
  color: var(--fg-dim);
}

.wc-pop-mark {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  white-space: nowrap;
  line-height: 1.15;
}

.wc-pop-mark::before {
  content: "";
  display: block;
  width: 1px;
  height: 4px;
  margin: 0 auto 1px;
  background: currentColor;
}

/* The first mark sits at the slider's left end: align it left instead. */
.wc-pop-mark:first-child {
  transform: none;
}

.wc-pop-mark:first-child::before {
  margin-left: 7px; /* under the thumb's center */
}

@keyframes wc-glint {
  0% { background-position: 100% 0; }
  45%, 100% { background-position: 0 0; }
}

@keyframes wc-halo {
  0%, 100% {
    background: rgba(249, 177, 58, 0.25);
    box-shadow: 0 0 0.4em 0.15em rgba(249, 177, 58, 0.35);
  }
  50% {
    background: rgba(249, 177, 58, 0.45);
    box-shadow: 0 0 1.1em 0.45em rgba(249, 177, 58, 0.6);
  }
}

@keyframes wc-spark {
  0%, 30% { opacity: 0; transform: scale(0) rotate(0deg); }
  45% { opacity: 1; transform: scale(1.2) rotate(90deg); }
  60% { opacity: 1; transform: scale(0.9) rotate(150deg); }
  75%, 100% { opacity: 0; transform: scale(0) rotate(220deg); }
}

@media (max-width: 759px) {
  .wc-panel {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

/* 8b-7: the screen-filling field of bundles, with a card over it. */
.money-field,
.money-card {
  position: fixed;
  z-index: 20;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.6s ease, visibility 0s 0.6s;
}

.money-field {
  inset: 0;
  background: var(--bg);
}

.money-field canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.money-card {
  z-index: 21;
  top: 50%;
  left: 50%;
  width: min(34rem, calc(100vw - 2rem));
  padding: 1.75rem 2rem 1.5rem;
  border-radius: 16px;
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  box-shadow: 0 12px 40px rgba(43, 35, 38, 0.25);
  transform: translate(-50%, calc(-50% + 1.5rem));
  transition: opacity 0.6s ease, transform 0.8s cubic-bezier(0.16, 1, 0.3, 1), visibility 0s 0.8s;
}

#start:not([hidden])[data-step="8b-7"] ~ .money-field,
#start:not([hidden])[data-step="8b-7"] ~ .money-card {
  opacity: 1;
  visibility: visible;
  transition-delay: 0s;
}

#start:not([hidden])[data-step="8b-7"] ~ .money-card {
  transform: translate(-50%, -50%);
  transition-delay: 1.2s, 1.2s, 0s;
}

/* The magnifying glass over the card's top-left corner. */
.money-lens {
  position: absolute;
  top: -160px; /* lens clears the card's top edge by ~25px */
  left: -128px;
  width: 170px;
  height: 170px;
  overflow: visible;
  opacity: 0;
  transform: scale(0.6) rotate(-12deg);
  transform-origin: 60% 40%;
  transition: opacity 0.4s ease, transform 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#start:not([hidden])[data-step="8b-7"] ~ .money-card .money-lens {
  opacity: 1;
  transform: none;
  transition-delay: 2s;
}

.lens-glass {
  fill: var(--bg);
}

.lens-ring {
  fill: none;
  stroke: var(--fg);
  stroke-width: 7;
}

.lens-handle {
  stroke: var(--fg);
  stroke-width: 13;
  stroke-linecap: round;
}

.lens-glare {
  fill: none;
  stroke: #fff;
  stroke-opacity: 0.7;
  stroke-width: 4;
  stroke-linecap: round;
}

.lens-label {
  font-size: 13px;
  font-weight: 800;
  fill: var(--fg);
}

.lens-bill {
  fill: #8fae86;
}

.lens-band {
  fill: #efe6cf;
}

.money-legend {
  display: grid;
  gap: 0.35rem;
  margin: 1rem 0 0.75rem;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}

.money-row {
  display: block;
}

/* Drawn at the field's bundle size (about 6 x 2.4 px at 1440 x 900). */
.money-bundle {
  flex: none;
  width: 6px;
  height: 2.4px;
  margin: 0 0.6rem 0 0.15rem;
  vertical-align: middle;
  fill: #8fae86;
  outline: 1.5px solid var(--accent);
  outline-offset: 2px;
}

/* "In 1976," / "By 2025," */
.cash-when {
  font-size: 1.5em;
  font-weight: 800;
  line-height: 1;
}

.cash-note {
  margin: 0.25rem 0 0;
  font-size: 0.7rem;
  line-height: 1.4;
  color: var(--fg-dim);
}

.cash-note a {
  color: inherit;
}

.ladder-chart {
  margin: 0;
  padding-top: 1rem;
}

.ladder-chart svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.ladder-year {
  font-size: 14px;
  font-weight: 700;
  fill: var(--fg-dim);
}

.ladder-guide {
  stroke: var(--fg);
  stroke-opacity: 0.12;
  stroke-width: 1;
}

.ladder-line {
  stroke-width: 3.5;
  stroke-linecap: round;
}

.ladder-label,
.ladder-val {
  font-size: 15px;
}

.ladder-name {
  font-weight: 600;
  fill: var(--fg);
}

.ladder-val {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.ladder-richer {
  font-weight: 700;
}

.ladder-arrow {
  fill: none;
  stroke: var(--fg-dim);
  stroke-width: 1.75;
  stroke-dasharray: 0.5 5;
  stroke-linecap: round;
}

.ladder-arrowhead {
  fill: none;
  stroke: var(--fg-dim);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ladder-chart figcaption {
  margin-top: 0.5rem;
  font-size: 0.7rem;
  line-height: 1.4;
  color: var(--fg-dim);
}

.ladder-chart figcaption a {
  color: inherit;
}

/* 5b: sources for 4b, smaller and in italics, and tucked in from both
   sides so a quotation step reads as a different kind of step. */
.beat-sources {
  padding-inline: 12%;
}

/* 5b: sources for 4b, smaller and in italics. */
.source {
  margin: 0 0 1.5rem;
  font-size: clamp(0.85rem, 1.15vw, 1rem);
  line-height: 1.5;
}

.source blockquote {
  margin: 0;
  font-style: italic;
  font-weight: 500;
}

.source figcaption {
  margin-top: 0.4rem;
  padding-left: 0.6em; /* about two spaces further in than the quote */
  color: var(--fg-dim);
}

.source a {
  color: inherit;
  text-underline-offset: 0.15em;
}

.source a:hover,
.source a:focus-visible {
  color: var(--accent);
}

.beat-title {
  font-size: clamp(1.35rem, 2.4vw, 2.25rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0;
  text-wrap: balance;
}

.beat-text {
  font-size: clamp(1.05rem, 1.6vw, 1.35rem);
  font-weight: 600;
  line-height: 1.45;
  margin: 1rem 0 0;
  text-wrap: pretty;
}

.statement {
  font-size: clamp(1.05rem, 1.6vw, 1.35rem);
  font-weight: 600;
  line-height: 1.45;
  color: var(--fg);
  text-wrap: balance;
}

.pick:not([aria-pressed="true"]):hover,
.pick:not([aria-pressed="true"]):focus-visible {
  text-decoration-color: currentColor;
}

/* Start screen: the two mornings, side by side. */
.choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
}

.choice {
  display: block;
  color: var(--fg);
  text-decoration: none;
}

/* Pre-Select mode: before the reader picks a path, the illustrations sit
   back (desaturated, blurred, faded edges, tucked toward the margins). The frame
   clips the illustration, so crops are done by offsetting the img inside. */
.choice-frame {
  display: block;
  overflow: hidden;
  border-radius: 20px;
  filter: grayscale(30%) blur(6px);
  transition: filter 0.8s ease;
  /* Soft fade on all four edges into the page background. */
  -webkit-mask-image:
    linear-gradient(to right, transparent, #000 10%, #000 90%, transparent),
    linear-gradient(to bottom, transparent, #000 10%, #000 90%, transparent);
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(to right, transparent, #000 10%, #000 90%, transparent),
    linear-gradient(to bottom, transparent, #000 10%, #000 90%, transparent);
  mask-composite: intersect;
}


/* Picking a path brings that side's illustration into focus. */
[data-picked="left"] .choice-left .choice-frame,
[data-picked="right"] .choice-right .choice-frame {
  filter: grayscale(30%);
}

/* Pre-Select mode, wider screens: the row spans the full window and each morning is pushed
   out to its own edge, partly tucked off-screen, at its original size. */
@media (min-width: 800px) {
  /* The title sits in the gap between the two illustrations, and the whole
     composition is centered vertically in the window. */
  #start {
    /* Full (uncropped) illustration width; all offsets below are in terms of it. */
    --choice-w: min(538px, calc(50vw - 1.75rem));
    display: grid;
    align-items: center;
    min-height: calc(100svh - 10rem); /* window minus header and footer */
    padding: 0;
  }

  #start > * {
    grid-area: 1 / 1; /* intro and illustrations share one cell, overlapping */
  }

  #start .intro-stage {
    position: relative;
    z-index: 1;
    justify-self: center;
    /* Fit between the on-screen parts (60% each) of the illustrations. */
    max-width: calc(100vw - var(--choice-w) * 1.2 - 4rem);
  }

  /* Scale with the gap so the questions fit between the illustrations on
     narrower windows. */
  #start .title {
    font-size: clamp(1.5rem, 3.4vw, 3.25rem);
  }

  /* The second question sits above two statements, so keep it smaller. */
  #start .intro-first .title {
    text-wrap: pretty; /* avoid a lone "it?" on the last line */
  }

  /* Widen the opening question: each side pulls out by this %, so -3% = 6% wider. */
  #start .intro-first {
    margin-inline: -3%;
  }
  #start .intro-next .title {
    font-size: clamp(1.35rem, 2.4vw, 2.25rem);
    text-wrap: balance; /* avoid a lone "more?" on the second line */
  }

  .choices {
    display: flex;
    justify-content: space-between;
    /* Bottom-align: the left is cropped shorter, so this keeps them level. */
    align-items: flex-end;
    width: 100vw;
    margin-left: calc(50% - 50vw);
    /* Clip the tucked-off edges here so the page itself never gets wider than
       the window (otherwise it can scroll sideways and look off-center). */
    overflow: clip;
  }

  .choice {
    width: var(--choice-w);
  }

  /* The img always renders at full illustration size; the frame crops it. */
  .choice-frame img {
    width: var(--choice-w);
    max-width: none;
  }

  /* Left: crop off the rightmost 20% (the door) and the top 10%, then tuck
     20% off-screen. */
  .choice-left {
    width: calc(var(--choice-w) * 0.8);
    transform: translateX(calc(var(--choice-w) * -0.2));
  }

  .choice-left .choice-frame {
    aspect-ratio: 1280.22 / 1798.28; /* 80% wide x 90% tall of the SVG's 1600.28 x 1998.09 viewBox */
  }

  .choice-left img {
    /* 10% of the full illustration's height (1998.09 / 1600.28 of its width). */
    margin-top: calc(var(--choice-w) * 1998.09 / 1600.28 * -0.1);
  }

  /* Right: crop off the leftmost 5% and the top 5%, and slide off-screen so
     the on-screen width matches the left (60% of the full illustration). */
  .choice-right {
    width: calc(var(--choice-w) * 0.95);
    transform: translateX(calc(var(--choice-w) * 0.35));
  }

  .choice-right .choice-frame {
    aspect-ratio: 1514.84 / 1895.73; /* 95% wide x 95% tall of the SVG's 1594.57 x 1995.5 viewBox */
  }

  .choice {
    transition: transform 0.8s cubic-bezier(0.65, 0, 0.35, 1);
  }

  #start .intro-stage {
    transition: transform 0.8s cubic-bezier(0.65, 0, 0.35, 1);
  }

  /* Right-hand flow: instead of re-weighting the two illustrations, the
     "camera" zooms 1.5x about the window's right edge, so the right two-thirds
     of the window fills the screen and the left morning slides off. Then the
     suburban morning drifts slowly inside its frame (Ken Burns). */
  #start {
    transform-origin: calc(50% + 50vw) 50%; /* window's right edge */
    transition: transform 1.8s cubic-bezier(0.65, 0, 0.35, 1);
  }

  #start[data-picked="right"] {
    transform: scale(1.5);
  }

  /* On 7b/8b (and 10b-14b), the camera also pans so the text/chart column sits in the
     middle of the window, and the suburban morning slides off to the right.
     The column's center X, before the zoom: the stage is centered on the
     window at its max width; the column is right-aligned in it (see
     #start .intro-beat). Zooming 1.5x about the right edge puts X at
     1.5X - 50vw, so the pan to bring it to 50vw is 100vw - 1.5X. */
  #start {
    --stage-w: calc(100vw - var(--choice-w) * 1.2 - 4rem);
    --beat-w: min(var(--stage-w), calc(var(--stage-w) / 2 + 100vw / 6 - 2rem));
    --beat-x: calc(50vw + var(--stage-w) / 2 - var(--beat-w) / 2);
  }

  #start[data-step^="7b"],
  #start[data-step^="8b"],
  #start[data-step^="10b"],
  #start[data-step^="11b"],
  #start[data-step^="12b"],
  #start[data-step^="13b"],
  #start[data-step^="14b"] {
    transform: translateX(calc(100vw - var(--beat-x) * 1.5)) scale(1.5);
  }

  #start .choice {
    transition: transform 0.8s cubic-bezier(0.65, 0, 0.35, 1), opacity 0.8s ease;
  }

  #start[data-step^="7b"] .choice-right,
  #start[data-step^="8b"] .choice-right,
  #start[data-step^="10b"] .choice-right,
  #start[data-step^="11b"] .choice-right,
  #start[data-step^="12b"] .choice-right,
  #start[data-step^="13b"] .choice-right,
  #start[data-step^="14b"] .choice-right {
    transform: translateX(calc(var(--choice-w) * 0.35 + 30vw));
    opacity: 0;
    transition-duration: 1.4s, 0.9s;
  }

  /* 8b: the chart column moves into the left two-thirds (centered at
     100vw / 3) to make room for the side note in the right third. */
  #start[data-step^="8b"] {
    transform: translateX(calc(100vw / 3 + 50vw - var(--beat-x) * 1.5)) scale(1.5);
  }

  .side-note {
    position: fixed;
    top: 50%;
    right: 0;
    width: calc(100vw / 3);
    padding: 0 3rem 0 1rem;
    transform: translate(2rem, -50%);
  }

  /* The pan swings the (already off-screen) left morning back toward the
     window's left edge, so fade it out too. */
  #start[data-step^="7b"] .choice-left,
  #start[data-step^="8b"] .choice-left,
  #start[data-step^="10b"] .choice-left,
  #start[data-step^="11b"] .choice-left,
  #start[data-step^="12b"] .choice-left,
  #start[data-step^="13b"] .choice-left,
  #start[data-step^="14b"] .choice-left {
    opacity: 0;
  }

  /* Keep the Pre-Select positions; the zoom does the rest. */
  #start[data-picked="right"] .choice-left {
    transform: translateX(calc(var(--choice-w) * -0.2));
  }

  #start[data-picked="right"] .choice-right {
    transform: translateX(calc(var(--choice-w) * 0.35));
  }

  #start[data-picked="right"] .intro-stage {
    transform: none;
  }

  #start[data-picked="right"] .intro-stage {
    max-width: calc(100vw - var(--choice-w) * 1.2 - 4rem);
  }

  /* The left statement would be cut off by the window edge, so fade it out. */
  .statement[data-pick] {
    transition: opacity 0.6s ease;
  }

  #start[data-picked="right"] .statement[data-pick="left"] {
    opacity: 0;
    pointer-events: none;
  }

  /* The question has been answered: it blurs up and away, and the chosen
     statement rises into its place (--lift, set by main.js, is the distance
     from the question's top to the statements' top). */
  #start .intro-next .title,
  .statement-col,
  .statement-col-left {
    transition:
      transform 1.2s cubic-bezier(0.65, 0, 0.35, 1),
      opacity 0.8s ease,
      filter 0.8s ease;
  }

  #start[data-picked] .intro-next .title {
    transform: translateY(-40%);
    opacity: 0;
    filter: blur(12px);
  }

  #start[data-picked="right"] .statement-col {
    transform: translateY(calc(var(--lift, 0px) * -1));
    transition-delay: 0.3s;
  }

  /* Zoomed in, the stage's left part is off-screen: the 1.5x zoom about the
     window's right edge shows only its right two-thirds (x > 100vw / 3).
     Fill from there to the stage's right edge, keeping a 2rem margin. */
  #start .intro-beat {
    justify-self: end;
    width: min(100%, calc(50% + 100vw / 6 - 2rem));
  }

  #start[data-picked="right"] .choice-right img {
    transform-origin: 30% 40%; /* toward the father */
    animation: ken-burns 20s ease-in-out 1.8s infinite alternate;
  }

  @keyframes ken-burns {
    from { transform: none; }
    to   { transform: scale(1.12) translate(-2%, 1%); }
  }

  .choice-right img {
    margin-left: calc(var(--choice-w) * -0.05);
    /* 5% of the full illustration's height (1995.5 / 1594.57 of its width). */
    margin-top: calc(var(--choice-w) * 1995.5 / 1594.57 * -0.05);
  }

  /* Left-hand flow: the same moves, mirrored. The zoom is about the window's
     left edge instead (written as a 50vw shift on the right-edge zoom, so the
     transform origin never changes), the left two-thirds of the window fill
     the screen, and the beats sit at the stage's left edge. */
  #start[data-picked="left"] {
    transform: translateX(50vw) scale(1.5);
  }

  #start[data-picked="left"] .choice-left {
    transform: translateX(calc(var(--choice-w) * -0.2));
  }

  /* The right morning stays hidden on the left path: unhidden, it would fade
     back in (blurred, being unpicked) mid-pan on the way out of 8b-7, before
     the zoom has carried it off-screen. */
  #start[data-picked="left"] .choice-right {
    transform: translateX(calc(var(--choice-w) * 0.35));
    opacity: 0;
  }

  #start[data-picked="left"] .intro-stage {
    transform: none;
    max-width: calc(100vw - var(--choice-w) * 1.2 - 4rem);
  }

  #start[data-picked="left"] .statement[data-pick="right"] {
    opacity: 0;
    pointer-events: none;
  }

  .statement-col-left {
    align-self: start;
    text-align: left;
  }

  #start[data-picked="left"] .statement-col-left {
    transform: translateY(calc(var(--lift, 0px) * -1));
    transition-delay: 0.3s;
  }

  #start[data-picked="left"] .intro-beat {
    justify-self: start;
  }

  #start[data-picked="left"] .choice-left img {
    transform-origin: 50% 40%;
    animation: ken-burns 20s ease-in-out 1.8s infinite alternate;
  }

  /* The centered pan (5a-2 to 5a-4, 6b-8b, 10a-14b), mirrored: the column's center
     is 100vw - --beat-x. */
  #start[data-picked="left"][data-step="5a-2"],
  #start[data-picked="left"][data-step="5a-3"],
  #start[data-picked="left"][data-step="5a-4"],
  #start[data-picked="left"][data-step="6b"],
  #start[data-picked="left"][data-step^="7b"],
  #start[data-picked="left"][data-step^="10a"],
  #start[data-picked="left"][data-step^="11a"],
  #start[data-picked="left"][data-step^="12a"],
  #start[data-picked="left"][data-step^="13b"],
  #start[data-picked="left"][data-step^="14b"] {
    transform: translateX(calc(var(--beat-x) * 1.5 - 50vw)) scale(1.5);
  }

  #start[data-picked="left"][data-step^="8b"] {
    transform: translateX(calc(var(--beat-x) * 1.5 - 200vw / 3)) scale(1.5);
  }

  #start[data-picked="left"][data-step="5a-2"] .choice-left,
  #start[data-picked="left"][data-step="5a-3"] .choice-left,
  #start[data-picked="left"][data-step="5a-4"] .choice-left,
  #start[data-picked="left"][data-step="6b"] .choice-left,
  #start[data-picked="left"][data-step^="7b"] .choice-left,
  #start[data-picked="left"][data-step^="8b"] .choice-left,
  #start[data-picked="left"][data-step^="10a"] .choice-left,
  #start[data-picked="left"][data-step^="11a"] .choice-left,
  #start[data-picked="left"][data-step^="12a"] .choice-left,
  #start[data-picked="left"][data-step^="13b"] .choice-left,
  #start[data-picked="left"][data-step^="14b"] .choice-left {
    transform: translateX(calc(var(--choice-w) * -0.2 - 30vw));
    opacity: 0;
    transition-duration: 1.4s, 0.9s;
  }

  #start[data-picked="left"][data-step="5a-2"] .choice-right,
  #start[data-picked="left"][data-step="5a-3"] .choice-right,
  #start[data-picked="left"][data-step="5a-4"] .choice-right,
  #start[data-picked="left"][data-step="6b"] .choice-right,
  #start[data-picked="left"][data-step^="7b"] .choice-right,
  #start[data-picked="left"][data-step^="8b"] .choice-right,
  #start[data-picked="left"][data-step^="10a"] .choice-right,
  #start[data-picked="left"][data-step^="11a"] .choice-right,
  #start[data-picked="left"][data-step^="12a"] .choice-right,
  #start[data-picked="left"][data-step^="13b"] .choice-right,
  #start[data-picked="left"][data-step^="14b"] .choice-right {
    opacity: 0;
  }

}

.site-footer {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--fg-dim);
  font-size: 0.85rem;
}

@media (max-width: 640px) {
  .site-header {
    padding: 1rem;
  }

  .choices {
    grid-template-columns: 1fr;
  }

  .statements {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .statement[data-pick],
  .statement-col,
  .statement-col-left {
    text-align: center;
    justify-self: stretch;
  }
}

@media (prefers-reduced-motion: reduce) {
  .scene {
    animation: none;
  }

  .intro,
  .choice,
  .choice-frame,
  #start,
  #start .intro-stage,
  #start .intro-next .title,
  .statement-col,
  .statement-col-left,
  .step-next {
    transition: none;
  }

  #start .choice img,
  .scroll-icon path {
    animation: none !important;
  }

  .chart-reveal,
  .text-reveal,
  .detail-panel,
  .side-note-text {
    transition: none;
  }

  .fert-line,
  .cost-line,
  .fert-marks,
  .wage-calc {
    transition: none !important;
  }

  /* The Easter egg still lights up, just without the motion. */
  .wc-more,
  .wc-more::before,
  .wc-more::after {
    animation: none !important;
  }

  .wc-more:hover,
  .wc-more:focus-visible,
  .wc-egg:hover .wc-more,
  .wc-egg:focus-within .wc-more {
    color: var(--fg);
    background-image: none;
  }

  .bundle {
    animation: none !important;
  }

  .scroll-icon path {
    opacity: 1;
  }
}
