/*
 * The individual scenes' figures.
 *
 * web/public/css/scenes.css carries the register - the stage, the pin, the reveal
 * contract. This file carries what each scene draws. The split is by lifetime: the
 * register is stable, a scene's figure changes whenever its argument does.
 *
 * The one rule from the register that governs every selector here: NOTHING is
 * hidden except under `html.scenes`. That class is stamped before first paint by
 * web/public/js/scene-ready.js and only when the page will animate, so with no
 * JavaScript every initial state below is inert and each figure renders finished.
 */

/* `minmax(0, 1fr)`, never a bare `1fr`.
 *
 * `1fr` is shorthand for `minmax(auto, 1fr)`, and the `auto` minimum of an SVG
 * with a viewBox is its INTRINSIC height - 694px for a 1000x560 box at 1240px
 * wide. So the row could not shrink below its own content and the scene overflowed
 * a stage that had 424px to give it. Measured, not reasoned about: this is the one
 * declaration that was clipping four scenes.
 */

/* ============================================================= scene 02 value
 * Three apps, a router, a split. The figure takes the width of the stage; the
 * headline and the counters bracket it.
 */
.value { grid-template-rows: auto minmax(0, 1fr) auto; gap: var(--banx-space-5); }
.value-head { max-width: 52ch; }
/* The figure fills its row and is not allowed to define it.
 *
 * A viewBox SVG with `width: 100%` has a definite intrinsic HEIGHT from its aspect
 * ratio, and that height wins over `height: 100%` - so even `minmax(0, 1fr)` could
 * not shrink the row below 694px on a 1000x560 box. Taking the svg out of flow
 * removes it from the row's size calculation entirely, which is the only reliable
 * way to make a ratio-bearing element fit a box rather than set it. */
.value-figure { position: relative; align-self: stretch; min-height: 0; }

/* `overflow: visible` on purpose: the leak paths end outside the viewBox, because
 * value leaving the ecosystem is the one thing in this design that should not
 * resolve into a tidy shape. */
.value-figure svg {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.value-foot {
  display: flex;
  flex-wrap: wrap;
  gap: var(--banx-space-4) var(--banx-space-6);
  align-items: baseline;
  padding-top: var(--banx-space-4);
  border-top: 1px solid var(--banx-line);
}

.value-stat { display: flex; flex-wrap: wrap; gap: var(--banx-space-2) var(--banx-space-3); align-items: baseline; }
.value-stat small { color: var(--banx-subtle); font-family: var(--banx-font-mono); font-size: var(--banx-text-2xs); }

.value-stat .k {
  color: var(--banx-subtle);
  font-family: var(--banx-font-mono);
  font-size: var(--banx-text-2xs);
  letter-spacing: var(--banx-tracking-caps);
  text-transform: uppercase;
}

.value-stat .v {
  color: var(--banx-rose);
  font-size: var(--banx-text-xl);
  font-variant-numeric: tabular-nums;
}

.value-stat .v.is-kept { color: var(--banx-accent-text); }

/* Height-aware, like the stage headline: a foot sized only in rem is the thing
 * that pushes a scene past its frame on a short viewport. */
.value-note {
  flex: 1 1 26rem;
  color: var(--banx-subtle);
  font-size: clamp(.68rem, 1.6svh, .74rem);
  line-height: 1.55;
}

html.scenes .value [data-problem],
html.scenes .value [data-answer] { opacity: 0; transform: translateY(14px); }
html.scenes .value [data-app] { opacity: 0; transform: translateX(-16px); }
html.scenes .value [data-router] { opacity: 0; transform: translateY(24px); }
html.scenes .value [data-sink],
html.scenes .value [data-drain] { opacity: 0; }
html.scenes .value [data-lost-row],
html.scenes .value [data-kept-row] { opacity: 0; }
/* The gap is 200 and not 100 - see the note beside the same rule in scenes.css.
 * At `100 100` the pattern repeats, so the next dash began at exactly 100, which
 * on a pathLength of 100 is the path's own end; round caps paint that
 * zero-length dash as a disc. This scene was showing a rose dot on the off-chain
 * box and a mint dot on the router before the streams had drawn at all. */
html.scenes .value [data-leak],
html.scenes .value [data-feed],
html.scenes .value [data-split] { stroke-dasharray: 100 200; stroke-dashoffset: 100; }

/* ---- the phone layout of the same diagram ------------------------------
 * Hidden above 700px, and it is the only version below. See the comment in
 * SceneValue.jsx for why growing the SVG text was not an option.
 */
.value-mobile { display: none; }

.vm-row { display: flex; flex-wrap: wrap; gap: var(--banx-space-2); margin: 0; padding: 0; list-style: none; }

.vm-chip {
  padding: 6px 12px;
  color: var(--banx-text);
  font-size: var(--banx-text-sm);
  background: rgb(255 255 255 / 4%);
  border: 1px solid var(--banx-line);
  border-radius: var(--banx-radius);
}

/* The connectors are drawn, not typed: a glyph would need a font that carries it,
 * and no face here does. */
.vm-flow,
.vm-fork {
  height: var(--banx-space-5);
  margin-inline: auto;
  border-left: 1px solid var(--banx-mint-line);
}

.vm-fork { width: 60%; border-inline: 1px solid var(--banx-mint-line); border-left-color: var(--banx-mint-line); }

.vm-card {
  display: grid;
  gap: 2px;
  padding: var(--banx-space-4);
  background: rgb(255 255 255 / 3%);
  border: 1px solid var(--banx-line);
  border-radius: var(--banx-radius);
}

.vm-card b { color: var(--banx-text); font-size: var(--banx-text-md); font-weight: 600; }
.vm-card small { color: var(--banx-muted); font-family: var(--banx-font-mono); font-size: var(--banx-text-2xs); }

.vm-card.is-router { background: rgb(0 231 136 / 8%); border-color: var(--banx-mint-line); }
.vm-card.is-pkl { background: rgb(0 231 136 / 10%); border-color: var(--banx-mint-line); }

.vm-tag {
  margin-top: 4px;
  color: var(--banx-accent-text);
  font-family: var(--banx-font-mono);
  font-size: var(--banx-text-2xs);
  letter-spacing: var(--banx-tracking-caps);
  text-transform: uppercase;
}

.vm-out { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--banx-space-3); margin: 0; padding: 0; list-style: none; }

@media (max-width: 699px) {
  .value-figure { display: none; }
  .value-mobile { display: grid; gap: 0; align-content: center; }
}

/* ========================================================= scene 03 waterfall */

.fall { grid-template-rows: auto minmax(0, 1fr) auto; gap: var(--banx-space-5); }
.fall-head { max-width: 52ch; }
.fall-figure { display: grid; gap: var(--banx-space-4); align-self: center; }

.fall-inflow,
.fall-row {
  display: grid;
  grid-template-columns: minmax(0, 20rem) minmax(0, 1fr) 4.5rem;
  gap: var(--banx-space-4);
  align-items: center;
}

.fall-row-label { color: var(--banx-muted); font-size: var(--banx-text-base); }

.fall-inflow .k {
  color: var(--banx-subtle);
  font-family: var(--banx-font-mono);
  font-size: var(--banx-text-2xs);
  letter-spacing: var(--banx-tracking-caps);
  text-transform: uppercase;
}

.fall-inflow .v {
  color: var(--banx-text);
  font-size: var(--banx-text-xl);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.fall-bar { position: relative; height: 10px; background: rgb(255 255 255 / 6%); }

/* Grown from the left, so a bar emerges from the split point rather than
 * appearing at its final width. */
.fall-fill {
  display: block;
  height: 100%;
  background: var(--banx-mint);
  transform-origin: left center;
}

.fall-fill.is-in { width: 100%; background: #ffffff; }

/* Widths by utility class. The CSP is style-src 'self' with no unsafe-inline, and
 * tests/ui-invariants.test.mjs greps the export for a style attribute - so a
 * percentage can never be an inline style here. */
.fall-fill.w60 { width: 60%; }
.fall-fill.w40 { width: 40%; }
.fall-fill.w20 { width: 20%; }
.fall-fill.w10 { width: 10%; }

.fall-row.is-plain .fall-fill { background: rgb(255 255 255 / 34%); }

.fall-row-pct {
  color: var(--banx-text);
  font-size: var(--banx-text-md);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.fall-row.is-sub { grid-template-columns: minmax(0, 20rem) minmax(0, 1fr) 4.5rem 9rem; }

.fall-row-of {
  color: var(--banx-subtle);
  font-family: var(--banx-font-mono);
  font-size: var(--banx-text-2xs);
}

.fall-stage {
  margin-top: var(--banx-space-4);
  color: var(--banx-subtle);
  font-family: var(--banx-font-mono);
  font-size: var(--banx-text-2xs);
  letter-spacing: var(--banx-tracking-caps);
  text-transform: uppercase;
}

.fall-stage small {
  display: block;
  margin-top: 4px;
  letter-spacing: 0;
  text-transform: none;
}

.fall-rows {
  display: grid;
  gap: var(--banx-space-3);
  margin: var(--banx-space-3) 0 0;
  padding: 0;
  list-style: none;
}

.fall-note { color: var(--banx-subtle); font-size: clamp(.68rem, 1.6svh, .74rem); line-height: 1.55; }

html.scenes .fall [data-reveal],
html.scenes .fall [data-note] { opacity: 0; transform: translateY(14px); }
html.scenes .fall [data-one],
html.scenes .fall [data-two] { opacity: 0; }

/* ============================================================ scene 04 supply */

.supply { grid-template-rows: auto minmax(0, 1fr) auto; gap: var(--banx-space-5); }
.supply-head { max-width: 56ch; }
.supply-head em { color: var(--banx-accent-text); font-style: normal; }
.supply-figure { position: relative; align-self: stretch; min-height: 0; }

.supply-figure svg {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

/* A font-size on SVG text inside a viewBox is in USER UNITS, so it scales with
 * the box. On a 343px-wide phone a 1000-unit box scales by 0.34 and a 12-unit
 * axis label renders at 4.1px. Measured, on every one of the eight labels.
 *
 * These are free-standing ticks rather than text inside a shape, so simply
 * declaring a bigger size in user units fixes them: 34 units renders at ~11.6px.
 * Scene 02 could not be fixed this way, because its labels sit inside boxes that
 * would not grow with them. */
@media (max-width: 699px) {
  .supply-figure text { font-size: 34px; }
}

.supply-foot {
  display: flex;
  flex-wrap: wrap;
  gap: var(--banx-space-4) var(--banx-space-6);
  align-items: flex-start;
  padding-top: var(--banx-space-4);
  border-top: 1px solid var(--banx-line);
}

.supply-stat { display: grid; gap: 2px; }

.supply-stat .k {
  color: var(--banx-subtle);
  font-family: var(--banx-font-mono);
  font-size: var(--banx-text-2xs);
  letter-spacing: var(--banx-tracking-caps);
  text-transform: uppercase;
}

.supply-stat .v {
  color: #ffffff;
  font-size: var(--banx-text-2xl);
  font-variant-numeric: tabular-nums;
}

.supply-stat.is-float .v { color: var(--banx-accent-text); }
.supply-stat small { color: var(--banx-subtle); font-size: var(--banx-text-2xs); }

.supply-caveat {
  flex: 1 1 30rem;
  color: var(--banx-muted);
  font-size: clamp(.68rem, 1.6svh, .74rem);
  line-height: 1.55;
}

.supply-caveat code { color: var(--banx-accent-text); font-size: .95em; }
.supply-caveat em { color: #ffffff; font-style: normal; font-weight: 600; }

html.scenes .supply [data-reveal],
html.scenes .supply [data-caveat] { opacity: 0; transform: translateY(14px); }
html.scenes .supply [data-grid] { opacity: 0; }
/* Gap of 200 for the same reason, and these two are the case that reproduces
 * most readily: both lines are polylines, where the dash walker's arithmetic is
 * exact and the repeat therefore lands dead on the path's end. */
html.scenes .supply [data-line-supply],
html.scenes .supply [data-line-float] { stroke-dasharray: 100 200; stroke-dashoffset: 100; }

/* ============================================================ scene 05 phases
 * A spine, and five rows hanging off it.
 *
 * Nothing here overlaps and nothing is ever hidden after it arrives, which is
 * the difference from the version this replaced: that one stacked five panels in
 * one space and crossfaded, so the last frame of the scroll showed Phase 4 alone
 * and the reader never saw a roadmap. See web/lib/scenes/phases.js.
 *
 * Because the rows are a plain grid in document order, every degraded path is
 * free: no JavaScript, reduced motion, or a viewport too narrow to pin the stage
 * all land on the same readable five-row table. Only the rest states at the
 * bottom of this section are gated on html.scenes.
 */
/* THE ONE SCENE THAT IS NOT HELD.
 *
 * Everything below assumes this section scrolls like any other. It used to be a
 * pinned 100svh stage, and the contents outgrew it: measured, the five phases
 * wanted 836px of a 747px track at 1440x900, and 565px of 547px at 1024x700
 * with the item type down at 9.8px. Three height-budget media queries were
 * already holding the old contents up and a fourth would have been the point at
 * which the scene was being made smaller rather than better.
 *
 * So the pin is gone (see the #roadmap rules at the end of this block) and with
 * it every height budget. The type in here goes UP rather than down, and adding
 * a sixth phase is now an edit rather than a measuring session.
 *
 * Two columns still: copy left, roadmap right, which is the composition scene 01
 * already speaks in. The head and the note share one cell, one pinned to its top
 * and one to its bottom, so the note lands level with the last phase instead of
 * directly under the lede. */
.road {
  grid-template-columns: minmax(0, 0.5fr) minmax(0, 1fr);
  grid-template-rows: auto;
  gap: var(--banx-space-7);
}

/* Sticky, because the column it sits in is as tall as five phases and its copy
 * is four lines. Pinned to the top of the viewport it travels beside the phases
 * as they pass, which is what the 680px of empty column underneath it was asking
 * for - and it means the roadmap's premise is still on screen at Phase 4.
 *
 * This is the whole reason unpinning the scene did not cost the composition: the
 * head behaves as it did on a held stage, and only the phases scroll. */
.road-head {
  grid-area: 1 / 1;
  align-self: start;
  position: sticky;
  top: calc(var(--banx-nav-h) + var(--banx-space-6));
  max-width: 38ch;
}

/* The rows and the spine share one grid, so the spine can be an overlay that
 * spans exactly the rows rather than a viewBox kept in step with them by hand.
 *
 * `grid-auto-rows` is deliberately NOT 1fr any more. Equal rows were what let
 * the two coloured spine segments be a flat 20% each, and they were safe only
 * while every phase had five items. With five, nine, nine, seven and five, an
 * equal track makes Phase 1 exceed its row and land on Phase 2 - and `1fr` is
 * `minmax(auto, 1fr)`, so it grows rather than clipping, pushing the whole stack
 * past the stage. Content-sized rows cannot do that, and each row now draws its
 * own coloured segment, so nothing depends on the rows being equal.
 *
 * `stretch`, never `center`. Centred, this box takes its 1fr track and then
 * overflows it EQUALLY IN BOTH DIRECTIONS when its content is taller, which put
 * the standfirst on top of Phase 0's numeral and the closing note on top of
 * Phase 4: measured at 46px of overlap above and 43px below on a 1440x900
 * viewport. Stretching pins it to the track, so the only way content can collide
 * is by exceeding the whole stack, and the height budgets below are what keep it
 * from doing that.
 *
 * `align-content: start` and no row gap: the per-row rails have to be contiguous
 * or the line they form has holes in it. */
.road-rows {
  grid-area: 1 / 2;
  position: relative;
  align-self: stretch;
  display: grid;
  grid-auto-rows: auto;
  align-content: start;
  row-gap: 0;
  width: 100%;
  padding-left: var(--banx-space-6);
}

/* The spine itself. One pixel, drawn top to bottom by the scroll.
 *
 * A div and a scaleY rather than an SVG line and a dash: the line has to be
 * exactly as tall as five CSS grid rows, and a transform on a box that the grid
 * already sized cannot drift out of step with them. It also keeps this scene out
 * of the dasharray rule that the other four have to obey. */
.road-spine {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 1px;
  transform-origin: top center;
  pointer-events: none;
  background: var(--banx-line);
}

/* One segment per row, exactly as tall as the row, drawn over the hairline. This
 * is what replaced two absolutely positioned segments at a flat 20%: the
 * coloured length is now correct whatever the rows weigh, and the mint stops
 * where Phase 0 stops because it IS Phase 0's box.
 *
 * A planned phase leaves its segment transparent rather than drawing it in
 * --banx-line: two hairlines at the same place is a heavier line, not the same
 * one, and the seam showed. */
.road-rail {
  position: absolute;
  left: calc(var(--banx-space-6) * -1);
  top: 0;
  bottom: 0;
  width: 1px;
  transform-origin: top center;
  pointer-events: none;
  background: transparent;
}

.road-row.is-live .road-rail { background: var(--banx-mint); }
.road-row.is-soon .road-rail { background: var(--banx-amber); }

/* Two columns: the numeral, then the phase. The status sits at the end of the
 * heading line rather than in a column of its own - a third column cost 132px of
 * the width the chips wrap in, and in the narrower column that two columns above
 * buys, that width is worth more than the alignment. After the title it still
 * reads as qualifying the title, which is the thing the old order got wrong: the
 * pill used to sit between the phase number and its name, where it scanned as
 * the first of the phase's deliverables. */
.road-row {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--banx-space-5);
  align-items: baseline;
  padding: var(--banx-space-5) 0;
}

/* A hairline between phases, not around them. Five rows with no separation read
 * as one list of thirty-five things; a rule per boundary is what makes them five
 * phases. It is on the row rather than on the gap so it cannot fall out of step
 * with the rails beside it. */
.road-row + .road-row { border-top: 1px solid var(--banx-line); }

/* The phase that is actually running gets a faint ground, so "where we are now"
 * survives a reader who takes in nothing but the shape. Bled out to the line on
 * the left so it reads as attached to it.
 *
 * A pseudo-element, NOT a negative margin. `margin-left: -32px` with a matching
 * padding bled the tint correctly and moved the row's box with it, and the rail
 * and the node are positioned against that box: Phase 0's segment of the line
 * sat 32px to the left of the other four, so the spine had a jog in it. Measured
 * at left 519 against 551. An absolutely positioned ground reaches past the box
 * without moving it. */
.road-row.is-live::before {
  content: "";
  position: absolute;
  left: calc(var(--banx-space-6) * -1);
  right: 0;
  top: 0;
  bottom: 0;
  pointer-events: none;
  background: linear-gradient(90deg, rgb(0 231 136 / 6%), transparent 62%);
}

/* Pushed to the end of the heading line when there is room for it, so the pills
 * still form a column the eye can follow down. `margin-left: auto` inside a
 * wrapping flex, which collapses to a normal gap on the line where it wraps. */
.road-status { margin-left: auto; }

/* The node sits ON the spine, which is at the padding edge of .road-rows.
 *
 * Aligned to the row's FIRST LINE, in em, rather than to its vertical midpoint.
 * With rows that no longer share a height, a node at 50% drifts away from the
 * heading it marks - it landed beside Phase 1's fifth item - and an em offset
 * tracks the type through all three height budgets below. */
.road-node {
  position: absolute;
  left: calc(var(--banx-space-6) * -1);
  top: 1.35em;
  width: 9px;
  height: 9px;
  margin-left: -4px;
  background: var(--banx-bg);
  border: 1px solid var(--banx-line);
  /* The timeline used to land it here on its last frame. Nothing animates it any
   * more, so the diamond is declared rather than arrived at. */
  transform: rotate(45deg);
}

.road-row.is-live .road-node { background: var(--banx-mint); border-color: var(--banx-mint); }
.road-row.is-soon .road-node { background: var(--banx-amber); border-color: var(--banx-amber); }

/* No longer sized against the viewport's height. Every `svh` term in this scene
 * was there to keep five rows inside one stage, and there is no stage to stay
 * inside: a numeral is now as big as a numeral should be. */
.road-n {
  min-width: 2.2ch;
  margin: 0;
  font-family: var(--banx-font-display);
  font-size: clamp(1.9rem, 3.4vw, 2.8rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: var(--banx-tracking-display);
  color: #ffffff;
}

.road-row.is-live .road-n { color: var(--banx-accent-text); }
.road-row.is-soon .road-n { color: var(--banx-amber); }

/* Outlined, not dimmed. A planned phase is not a quieter version of a shipped
 * one; it is a drawing of one, and an outline says that without a legend. */
.road-row.is-planned .road-n {
  color: transparent;
  -webkit-text-stroke: 1px var(--banx-subtle);
}

.road-body { display: grid; gap: var(--banx-space-2); min-width: 0; }

/* line-height 1.1: the default 1.5 gave this one line a 36px box for 21.6px of
 * type, and five phases paid it. */
.road-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px var(--banx-space-3);
  align-items: center;
  margin: 0;
  line-height: 1.2;
}

.road-meta .mono {
  color: var(--banx-subtle);
  font-size: var(--banx-text-2xs);
  letter-spacing: var(--banx-tracking-caps);
  text-transform: uppercase;
}

.road-title {
  font-family: var(--banx-font-display);
  font-size: clamp(1.1rem, 1.7vw, 1.5rem);
  font-weight: 600;
  letter-spacing: -.015em;
}

.road-gate {
  margin: 0;
  color: var(--banx-amber);
  font-family: var(--banx-font-mono);
  font-size: var(--banx-text-2xs);
  letter-spacing: var(--banx-tracking-caps);
  text-transform: uppercase;
}

/* The items wrap rather than stack: thirty-five of them on one stage cannot each
 * have a line. What changed is that each one is now BOUNDED.
 *
 * They used to flow as one run separated by a small dot, which was legible while
 * every phase had five short items. Several of the current ones carry their own
 * commas and hyphens - "Pepper DEX live on testnet - every fee split visible,
 * routed through the FeeRouter" - and in a dot-separated run beside "Two audit
 * engagements" there is no way to tell where one deliverable ends. A chip keeps
 * the wrapping flow and makes the boundary unambiguous. */
.road-items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
}

/* A fixed size, not a fraction of the viewport's height. While this scene was
 * pinned these were `clamp(.62rem, 1.5svh, .74rem)`, which put them at 9.8px on
 * a 700px-tall laptop - and a deliverable nobody can read is not on the roadmap.
 * Off the stage they can simply be the size the rest of the page's small print
 * is. */
.road-items li {
  padding: 3px 9px;
  color: var(--banx-muted);
  font-size: var(--banx-text-sm);
  line-height: 1.45;
  background: var(--banx-surface-1);
  border: 1px solid var(--banx-line);
  border-radius: var(--banx-radius-sm);
}

/* The running phase's deliverables are done, so they are stated in the accent
 * rather than in the muted grey the drawings use. The tint is on the border and
 * the text, not the ground: a filled mint chip at this size is a button. */
.road-row.is-live .road-items li {
  color: var(--banx-accent-text);
  border-color: var(--banx-mint-line);
}

.road-close {
  grid-area: 1 / 1;
  align-self: end;
  max-width: 38ch;
  margin: 0;
  padding-top: var(--banx-space-4);
  color: var(--banx-subtle);
  border-top: 1px solid var(--banx-line);
  font-size: var(--banx-text-sm);
  line-height: 1.6;
}

/* ---- one column below a desktop ---------------------------------------
 * The two columns above were added without this rule, and at 390px the grid was
 * still splitting: 95px for the head and 191px for five phases. A layout that
 * only works at one width is not a layout.
 *
 * Stacked, the head goes back to a full measure and stops being sticky - a
 * sticky head on a phone spends a third of the viewport restating a headline the
 * reader has already read. */
@media (max-width: 1023px) {
  .road {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    gap: var(--banx-space-6);
  }

  .road-head {
    grid-area: auto;
    position: static;
    max-width: 60ch;
  }

  .road-rows { grid-area: auto; }

  .road-close {
    grid-area: auto;
    align-self: auto;
    max-width: 74ch;
  }
}

/* ---- the unpin ---------------------------------------------------------
 * Three height-budget media queries used to live here, stepping the type down at
 * 880px and 760px of viewport height so five phases would not be clipped by the
 * stage's overflow. They are gone with the pin, and so is the class of bug they
 * existed to patch.
 *
 * The id is the selector because the pin is declared on `html.scenes .scene` and
 * `html.scenes .scene-stage`, and this has to beat both. `min-height: 0` gives
 * back the 300vh track that made the scroll long enough to scrub, and the stage
 * stops being sticky and stops being exactly one viewport tall. */
html.scenes .scene#roadmap { min-height: 0; }

html.scenes .scene#roadmap .scene-stage {
  position: static;
  height: auto;
  padding-top: var(--banx-space-7);
  padding-bottom: var(--banx-section);
}

/* ---- no rest states in this scene -------------------------------------
 * There were eight, one per timeline target. A rest state is a promise that
 * something will animate it, and with the pin gone nothing here scrubs: every
 * one of them would have been an element hidden for good. The two hooks that
 * remain - `data-rise` on the head, each row and the note, and `data-grow-y` on
 * each rail - are animated by mountReveals with fromTo, which supplies its own
 * from-state and needs no CSS.
 *
 * `data-rise` is hidden by one global rule in flow.css, under html.scenes, so
 * the no-JavaScript path is still the markup exactly as written. */

/* ================================================= reduced motion, scenes 2-5
 * One block for all four. scene-ready.js already declines to stamp the class
 * under reduced motion, so normally none of the states above apply - this is the
 * case where a reader turns it on after load and the class is already there.
 */
@media (prefers-reduced-motion: reduce) {
  html.scenes .value [data-problem],
  html.scenes .value [data-answer],
  html.scenes .value [data-app],
  html.scenes .value [data-router],
  html.scenes .value [data-sink],
  html.scenes .value [data-drain],
  html.scenes .value [data-lost-row],
  html.scenes .value [data-kept-row],
  html.scenes .fall [data-reveal],
  html.scenes .fall [data-note],
  html.scenes .fall [data-one],
  html.scenes .fall [data-two],
  html.scenes .supply [data-reveal],
  html.scenes .supply [data-caveat],
  html.scenes .supply [data-grid] { opacity: 1; transform: none; }

  /* Nothing for the roadmap: it is not pinned, it has no timeline, and its
   * only hidden element is a `data-rise` block, which the rule above the
   * scenes already covers. */

  /* Nothing to put back into flow. The rows never left it: they are a plain
   * grid in document order, which is why this scene needs no layout override on
   * any of its degraded paths. The panels this replaced were absolutely
   * positioned and did. */

  html.scenes .value [data-feed],
  html.scenes .value [data-split],
  html.scenes .supply [data-line-supply],
  html.scenes .supply [data-line-float] { stroke-dasharray: none; stroke-dashoffset: 0; }

  /* The leak paths are the one thing that must NOT show at rest. Without the
   * animation that redirects them they are three red curves flying off the frame
   * with no explanation, which reads as a rendering fault rather than as an
   * argument. The static scene is the answer, not the problem. */
  html.scenes .value [data-leak] { display: none; }
}

/* ======================================================= narrow, scenes 2-5 */

@media (max-width: 1023px) {
  /* Scene 05 needs no layout change here, only its rest states undone: no
   * timeline runs below this width (web/lib/scenes/runtime.js returns before
   * building one), so anything left at opacity 0 or scaleY(0) would stay there.
   * That reset is at the bottom of this block with the other four scenes.
   *
   * The version this replaced also had to be put back into normal flow, because
   * its five panels were absolutely positioned and a `display: block` stack of
   * those collapses to zero height. Measured then on a 375px viewport: stack
   * 0px, every panel 0px. Rows in a grid cannot do that. */
  .road-rows { padding-left: var(--banx-space-5); }
  .road-node { left: calc(var(--banx-space-5) * -1); }
  .road-n { font-size: clamp(1.8rem, 9vw, 2.8rem); }

  .fall-inflow,
  .fall-row,
  .fall-row.is-sub { grid-template-columns: minmax(0, 1fr) 4.5rem; }

  .fall-bar,
  .fall-row-of { grid-column: 1 / -1; }

}

@media (max-width: 639px) {
  /* One column on a phone: a numeral beside five wrapped items leaves too little
   * width for either. */
  .road-row { grid-template-columns: minmax(0, 1fr); gap: var(--banx-space-2); }
  .road-node { top: var(--banx-space-3); }
}


/* ===================================== below a landscape desktop: reset it all
 * No scene timeline runs under 1024px - web/lib/scenes/runtime.js returns before
 * building one, because a scrubbed timeline on an in-flow section is worse than
 * none: its content is tied to the section's own scroll progress, so it is
 * invisible at the top of the section and fades back out as the reader scrolls
 * past. On a phone that showed as a large empty gap where a headline should be.
 *
 * So every initial state has to come back on here, and this block is GENERATED
 * from the declarations above rather than written by hand. The hand-written
 * version missed five elements for two reasons worth remembering: it lived in
 * scenes.css while half the states live in this file, which loads later; and it
 * used shorter selectors than the states it was trying to beat. Deriving the
 * list from the real rules makes both classes of mistake impossible.
 *
 * Arrival is handled by mountReveals on the [data-rise] wrappers instead, which
 * is why those are deliberately absent from this list.
 */
@media (max-width: 1023px) {
  /* ============================================================ initial states
 * Everything below is scoped to html.scenes and nothing below is scoped to
 * anything else. This is the boundary the whole design rests on.
 */

/* A reveal: present in the markup,
  transparent until its scene reaches it. */
html.scenes [data-reveal],
  /* ---- initial states,
  under the class only ------------------------------ */

html.scenes .clocks [data-reveal],
  html.scenes .clocks [data-row],
  html.scenes .clocks [data-tag],
  html.scenes .clocks [data-mid],
  html.scenes .value [data-problem],
  html.scenes .value [data-answer],
  html.scenes .value [data-app],
  html.scenes .value [data-router],
  html.scenes .value [data-sink],
  html.scenes .value [data-drain],
  html.scenes .value [data-lost-row],
  html.scenes .value [data-kept-row],
  html.scenes .fall [data-reveal],
  html.scenes .fall [data-note],
  html.scenes .fall [data-one],
  html.scenes .fall [data-two],
  html.scenes .supply [data-reveal],
  html.scenes .supply [data-caveat],
  html.scenes .supply [data-grid] { opacity: 1; transform: none; }

  /* Nothing for the roadmap: it is not pinned, it has no timeline, and its
   * only hidden element is a `data-rise` block, which the rule above the
   * scenes already covers. */

  /* Both halves of the dash,
  always.
 *
 * `stroke-dasharray: 1` with no offset means the dash covers the whole path,
  so
 * every ring was FULLY DRAWN before its timeline started and then jumped to
 * hidden when GSAP set its from-state. Declaring the offset here is what makes
 * the rest state actually undrawn. Every rule in this file that sets a dasharray
 * must set an offset with it; tests/design-language.test.mjs now fails otherwise.
 *
 * Scoped to html.scenes,
  so with no JavaScript there is no dash at all and a
 * reader sees four complete rings. */
html.scenes .clocks [data-trail],
  html.scenes .value [data-leak],
  html.scenes .value [data-feed],
  html.scenes .value [data-split],
  html.scenes .supply [data-line-supply],
  html.scenes .supply [data-line-float] { stroke-dasharray: none; stroke-dashoffset: 0; }

  /* The exception, as under reduced motion: with no animation to redirect them
   * the leak paths are three red curves to an off-chain box with no story
   * attached. The phone layout tells that story in words instead. */
  html.scenes .value [data-leak] { display: none; }
}
