/*
 * Home "How it works": the pallet journey (FEATURES.palletJourney). Needs
 * tokens.css, site.css and home.css first. Markup: organisms/home/journey.mjs
 * (scenes drawn at build time in journey-scenes.mjs).
 * Laid out like a shipping manifest, in the site's own hand: Jost for the
 * stage names, the page's label face (--font-mono) for numbers and labels,
 * hairlines, a barcode in the corner. Each stage has its color (--stage:
 * 01 ink, then the pallet's brand color): its tab number, its tab's
 * underline, its caption number and its callouts. The six stages are tabs
 * across the top.
 * Default (no JS): the tabs link to the figures stacked below, each scene in
 * its still with numbered dots for the records listed in its caption.
 * html.rv-journey (set in <head> whenever JS runs): each tab's underline
 * fills as its stage is reached and every scene shares one place. From 961px
 * the caption reads beside the drawing (35 / 65, all in one viewport) and
 * the records are drawn on it as callouts; under that the caption stays
 * under the drawing with the numbered list. journey.js (adds .is-live) plays
 * the stage that is picked, the old drawing leaving as the new one draws in.
 * With reduced motion it shows that stage finished. On a phone the tabs
 * scroll sideways.
 */
@property --pallet {
  syntax: '<color>';
  inherits: true;
  initial-value: #757575;
}

/* Ink and surfaces of the line art, per theme: dark lines on the light page,
   light lines on the dark one. --iso-ink is what the pallet's own color is
   mixed with, so its edges stay visible against the page either way. */
.journey {
  --iso-ink: #070707;
  --iso-fill: #fafafa;
  --iso-wall: #f0f0f0;
  --iso-line: rgba(7, 7, 7, 0.62);
  --iso-faint: rgba(7, 7, 7, 0.34);
  --iso-dim: rgba(7, 7, 7, 0.14);
  --iso-stroke: 1.1;
  --journey-gray: #757575;
}
[data-theme='dark'] .journey {
  --iso-ink: #ffffff;
  --iso-fill: #0d0d0d;
  --iso-wall: #131313;
  --iso-line: rgba(255, 255, 255, 0.62);
  --iso-faint: rgba(255, 255, 255, 0.32);
  --iso-dim: rgba(255, 255, 255, 0.12);
}
/* The retailer's gray (Home --ink-muted); #9a9a9a for text on near-black. */
.journey [data-color='gray'] {
  --c: var(--journey-gray);
  --c-light: var(--journey-gray);
  --c-dark: #9a9a9a;
}
/* The stage's color, as text and lines on the page (--c-on is the
   theme-aware shade); stage 01, the retailer's, is the page's ink. */
.journey-step,
.journey-list li {
  --stage: var(--c-on);
}
.journey :is(.journey-step, .journey-list li)[data-color='gray'] {
  --stage: var(--ink);
}

/* Static: head, the tabs, then the figures one after another. */
.journey-grid {
  display: grid;
  gap: clamp(24px, 3vw, 40px);
}
.journey-head {
  display: grid;
  gap: var(--space-4);
}
.journey-steps {
  display: grid;
  gap: clamp(56px, 8vw, 120px);
  margin-top: clamp(16px, 2vw, 32px);
}
.journey-step {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr);
  gap: clamp(24px, 4vw, 72px);
  align-items: center;
  margin: 0;
  /* Clear of the header when a tab jumps to a stacked figure. */
  scroll-margin-top: 96px;
}
.journey-caption {
  display: grid;
  gap: 12px;
  max-width: 30rem;
}
.journey-num {
  margin: 0;
  font: 500 12px / 1.2 var(--font-mono);
  letter-spacing: var(--tracking-mono);
  color: var(--stage);
  font-variant-numeric: tabular-nums;
}
.journey-caption h3 {
  margin: 0;
  font: 600 var(--display-sm) / 1.05 var(--font-display);
  text-wrap: balance;
}
.journey-line {
  max-width: 36ch;
  margin: 0;
  color: var(--ink-muted);
  font-size: var(--text-lg);
}
.journey-art {
  position: relative;
}
.journey-scene svg {
  display: block;
  width: 100%;
  height: auto;
}
/* What the system keeps of a stage (FEATURES.journeySteps), as manifest
   fields: a mono label over a hairline. */
.journey-detail {
  display: grid;
  gap: 22px;
  margin-top: 4px;
  max-width: 34rem;
}
.journey-detail-label {
  margin: 0 0 10px;
  padding-bottom: 8px;
  border-bottom: var(--hairline) solid var(--rule);
  font: 500 11px / 1 var(--font-mono);
  letter-spacing: var(--tracking-mono);
  text-transform: uppercase;
  color: var(--ink-muted);
}
.journey-records {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--ink-muted);
  font-size: var(--text-sm);
  line-height: 1.45;
  counter-reset: journey-record;
}
.journey-records li {
  display: grid;
  grid-template-columns: 2.4em minmax(0, 1fr);
  padding: 7px 0;
  border-bottom: var(--hairline) solid var(--rule);
  counter-increment: journey-record;
}
.journey-records li::before {
  content: counter(journey-record, decimal-leading-zero);
  font: 500 11px / 1.9 var(--font-mono);
  color: var(--stage);
  font-variant-numeric: tabular-nums;
}

/*
 * The records on the drawing (journey.mjs, callouts in journey-scenes.mjs).
 * Stacked (no JS, tablet, phone): a numbered dot on each part, matching
 * the caption's list. From 961px with rv-journey: an anchor dot that
 * pulses, a leader that draws from it and a small label at its end.
 */
.iso .jc-badge circle {
  fill: var(--stage);
}
.iso .jc-badge text {
  font: 600 18px / 1 var(--font-mono);
  font-variant-numeric: tabular-nums;
  text-anchor: middle;
  fill: var(--tone-bg);
}
.iso .jc-badge {
  transform: scale(var(--jc-badge, 0.62));
}
.iso :is(.jc-leader, .jc-dot, .jc-pulse),
.journey-callouts {
  display: none;
}
.iso .jc-leader {
  fill: none;
  stroke: var(--stage);
  stroke-width: 1.2;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.iso .jc-dot {
  fill: var(--stage);
}
.iso .jc-pulse {
  fill: none;
  stroke: var(--stage);
  stroke-width: 1.2;
  vector-effect: non-scaling-stroke;
}
.journey-callouts {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.jc-label {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: max-content;
  max-width: 18cqi;
  margin: 0;
  padding-left: 0.8cqi;
  translate: 0 -50%;
  font: 500 clamp(9px, 1.35cqi, 12px) / 1.35 var(--font-mono);
  letter-spacing: 0.01em;
  color: var(--ink);
  text-wrap: balance;
}
.jc-label[data-side='l'] {
  padding: 0 0.8cqi 0 0;
  translate: -100% -50%;
  text-align: right;
}

/*
 * The manifest's corner: a barcode drawn in CSS (bars of 1–3px on an
 * irregular rhythm, nothing to read) over the pallet and lot numbers.
 */
.journey-manifest {
  display: none;
}
.journey-code {
  display: block;
  width: 132px;
  height: 30px;
  color: var(--ink);
  background:
    linear-gradient(90deg, currentColor 0 2px, transparent 0) 0 0 / 7px 100%,
    linear-gradient(90deg, transparent 0 3px, currentColor 0 4px, transparent 0)
      0 0 / 11px 100%,
    linear-gradient(90deg, transparent 0 5px, currentColor 0 8px, transparent 0)
      0 0 / 17px 100%;
  opacity: 0.85;
}
.journey-ref {
  font: 500 11px / 1 var(--font-mono);
  letter-spacing: var(--tracking-mono);
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

/*
 * The tabs: one ruled row of six cells, each a mono number over the stage's
 * name in Jost, split by hairlines. On a phone the row scrolls sideways.
 */
.journey-list {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(168px, 1fr);
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: var(--hairline) solid var(--rule);
  border-bottom: var(--hairline) solid var(--rule);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
}
.journey-list li {
  display: grid;
  scroll-snap-align: start;
}
.journey-list li + li {
  border-left: var(--hairline) solid var(--rule);
}
.journey-item {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 16px clamp(12px, 1.4vw, 20px) 18px;
  color: var(--ink-muted);
  text-decoration: none;
  transition: color var(--dur-base) var(--ease);
}
.journey-item-n {
  font: 500 11px / 1 var(--font-mono);
  letter-spacing: var(--tracking-mono);
  font-variant-numeric: tabular-nums;
  color: var(--stage);
}
.journey-item-t {
  font: 600 clamp(15px, 1.15vw, 17px) / 1.25 var(--font-display);
  text-wrap: balance;
}
.journey-item:hover,
.journey-list .is-on .journey-item {
  color: var(--ink);
}
.journey-item:focus-visible {
  outline-offset: -4px;
}
/* Both only exist once journey.js drives the stages. */
.journey-nav,
.journey-box,
.journey-progress {
  display: none;
}
.journey-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* Scenes: line art in the page's inks; the pallet is the one solid color. */
.iso {
  overflow: visible;
  shape-rendering: geometricPrecision;
}
.iso :is(.solid, .wall, .ghost, .glass, .pal, .beam, .lot) {
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.iso :is(.ln, .lane, .strap, .count, .tick, .route) {
  fill: none;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}
.iso :is(.solid, .wall, .glass) {
  stroke: var(--iso-line);
  stroke-width: var(--iso-stroke);
}
.iso .solid {
  fill: var(--iso-fill);
}
.iso .wall {
  fill: var(--iso-wall);
}
.iso .glass {
  fill: var(--iso-fill);
  fill-opacity: 0.5;
}
.iso .ghost {
  fill: var(--iso-wall);
  stroke: var(--iso-faint);
  stroke-width: 1;
}
.iso .ln {
  stroke: var(--iso-line);
  stroke-width: var(--iso-stroke);
}
.iso .ln.dim {
  stroke: var(--iso-dim);
}
.iso .ln.faint {
  stroke: var(--iso-faint);
}
.iso .lane {
  stroke: var(--iso-faint);
  stroke-width: 1;
  stroke-dasharray: 6 7;
}
/* The floor and yard lines fade out inside the drawing's own width
   (journey-scenes.mjs, #jr-floor-fade) rather than run to the page edge. */
.iso :is(.lane, .ln.dim) {
  mask: url(#jr-floor-fade);
}
.iso .stencil {
  font: 500 8.5px var(--font-mono);
  letter-spacing: 0.16em;
  fill: var(--ink-muted);
}
.iso-pallet {
  --pallet: var(--c);
  transition: --pallet var(--dur-slow) var(--ease-out);
}
.iso .pal {
  stroke: color-mix(in srgb, var(--pallet) 68%, var(--iso-ink));
  stroke-width: 0.9;
}
.iso .pal.t {
  fill: color-mix(in srgb, var(--pallet) 78%, #fff);
}
.iso .pal.r {
  fill: var(--pallet);
}
.iso .pal.l {
  fill: color-mix(in srgb, var(--pallet) 70%, #000);
}
/* The truck's container (stage 5) has its load inside (containerLoad): the
   side and cab-end walls stay glass so the load shows through them, but the
   roof is solid, so what is behind it is hidden instead of reading as cargo
   stacked on top. */
.iso .iso-truck .glass.accent.t {
  fill-opacity: 1;
}
/* The boxes loaded into the container (stage 5): a firmer edge, so the rows
   read as separate boxes through the container's glass. */
.iso .iso-load .pal {
  stroke: color-mix(in srgb, var(--pallet) 45%, var(--iso-ink));
  stroke-width: 1;
}
.iso .strap {
  stroke: color-mix(in srgb, var(--pallet) 50%, var(--iso-ink));
  stroke-width: 1;
}
.iso .count {
  stroke: color-mix(in srgb, var(--pallet) 45%, #000);
  stroke-width: 1;
}
.iso .lot {
  fill: color-mix(in srgb, var(--c) 10%, transparent);
  stroke-width: 1.2;
  stroke-dasharray: 5 5;
}
.iso .beam {
  fill: color-mix(in srgb, var(--c) 18%, transparent);
  stroke: var(--c);
  stroke-width: 1.2;
}
.iso :is(.sheet, .card, .tag-box, .badge, .pin) {
  fill: var(--tone-bg);
  stroke: var(--iso-line);
  stroke-width: 1.1;
  stroke-linejoin: round;
}
.iso :is(.tag-box, .badge, .pin) {
  stroke: var(--c);
  stroke-width: 1.3;
}
.iso .tick {
  stroke: var(--c, var(--iso-line));
  stroke-width: 1.6;
}
.iso .route {
  stroke: var(--c);
  stroke-width: 1.2;
  stroke-dasharray: 4 6;
}
.iso :is(.dot, .pin-dot, .chip) {
  fill: var(--c);
}
.iso .ring {
  fill: none;
  stroke: var(--c);
  stroke-width: 1;
  opacity: 0.5;
}
.iso .accent {
  stroke: var(--c);
}
.iso :is(.tag-t, .tag-k, .tag-s, .chip-t) {
  font: 500 10px / 1 var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.iso .tag-t {
  fill: var(--ink);
}
.iso .tag-k {
  fill: var(--ink-muted);
}
.iso .tag-s {
  fill: var(--c-on);
  letter-spacing: 0.06em;
}
.iso .chip-t {
  fill: var(--tone-bg);
  letter-spacing: 0.08em;
}
/* Parts that only make sense mid-motion (a closed shutter, a passing check). */
html:not(.rv-journey) .journey .jr-motion {
  display: none;
}
/* Stacked, the yards would run into the next figure. */
html:not(.rv-journey) .journey-scene {
  overflow: hidden;
}

/*
 * The manifest layout (html.rv-journey). One grid; the figures are subgrids
 * of it, so every scene lands in the same place under the tabs and every
 * caption in the same cell. The cells take the tallest caption, so nothing
 * moves when the stage changes.
 * Rows: head (and the manifest corner), tabs, track, scene, caption,
 * Prev/Next; from 961px the caption and Prev/Next share the scene's row.
 */
.rv-journey .journey {
  overflow-x: clip;
}
.rv-journey .journey-grid {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto auto auto auto auto;
  row-gap: 0;
}
.rv-journey .journey-head {
  grid-column: 1;
  grid-row: 1;
  margin-bottom: clamp(28px, 4vw, 56px);
}
.rv-journey .journey-list {
  grid-column: 1 / -1;
  grid-row: 2;
  border-bottom: 0;
}
/* The progress: a hairline track under the tabs, and on each tab an
   underline in its stage's color that fills once the stage is reached
   (is-on, is-done: journey.js), so the row reads 01 → 06 in the stages'
   colors. Only their scale moves. */
.rv-journey .journey-progress {
  grid-column: 1 / -1;
  grid-row: 3;
  display: block;
  position: relative;
  height: 2px;
}
.rv-journey .journey-progress::before {
  content: '';
  position: absolute;
  inset: auto 0 0;
  height: var(--hairline);
  background: var(--rule);
}
.rv-journey .journey-progress-fill {
  display: none;
}
.rv-journey .journey-item {
  position: relative;
}
.rv-journey .journey-item::after {
  content: '';
  position: absolute;
  inset: auto 0 0;
  height: 2px;
  background: var(--stage);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform var(--dur-reveal) var(--ease);
}
.rv-journey .journey-list :is(.is-on, .is-done) .journey-item::after {
  transform: scaleX(1);
}
/* Autoplay (journey.js, `is-auto`, never with reduced motion): the tab on
   show is empty and fills over the stage's 3 s (`is-timed`, restarted by
   the script on every change), then the stage moves on; `is-held` pauses
   the fill with the timer. Stages already passed stay full. */
.rv-journey
  .journey.is-auto
  .journey-list
  .is-on:not(.is-timed)
  .journey-item::after {
  transform: scaleX(0);
}
.rv-journey .journey.is-auto .journey-list .is-timed .journey-item::after {
  transition: none;
  animation: journey-fill var(--journey-auto, 3s) linear both;
}
.rv-journey .journey.is-held .journey-list .is-timed .journey-item::after {
  animation-play-state: paused;
}
@keyframes journey-fill {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}
.rv-journey :is(.journey-steps, .journey-step) {
  grid-column: 1 / -1;
  grid-row: 1 / -1;
  display: grid;
  grid-template-columns: subgrid;
  grid-template-rows: subgrid;
  gap: 0;
  margin: 0;
  /* Spanning the whole grid, they would sit over the tabs and the buttons. */
  pointer-events: none;
}
/* The drawing at the full content width: the scene keeps its shape at the
   height it is given and its yards run out to both edges, where they fade. */
.rv-journey .journey-box,
.rv-journey .journey-scene {
  grid-column: 1 / -1;
  grid-row: 4;
  height: clamp(300px, 54vw, min(74svh, 700px));
  margin-block: clamp(20px, 3vw, 44px);
}
.rv-journey .journey-box {
  display: block;
}
.rv-journey .journey-scene {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: clip;
  -webkit-mask-image: linear-gradient(
    90deg,
    transparent,
    #000 6%,
    #000 94%,
    transparent
  );
  mask-image: linear-gradient(
    90deg,
    transparent,
    #000 6%,
    #000 94%,
    transparent
  );
}
.rv-journey .journey-art {
  flex: none;
  height: 100%;
  aspect-ratio: 700 / 540;
}
.rv-journey .journey-scene svg {
  width: 100%;
  height: 100%;
}
.rv-journey .journey-caption {
  grid-column: 1 / -1;
  grid-row: 5;
  align-self: start;
  align-content: start;
  gap: 10px;
  max-width: none;
  padding-top: clamp(18px, 2vw, 28px);
  border-top: var(--hairline) solid var(--rule);
}
.rv-journey .journey-nav {
  grid-column: 1 / -1;
  grid-row: 6;
  display: flex;
  justify-content: flex-end;
  gap: 0;
  margin-top: clamp(20px, 2.4vw, 32px);
  pointer-events: none;
}

/*
 * Only the stage on show is there, so two captions never overlap. On a
 * pick the drawing being left slides out the way the journey is going
 * (`is-leaving`, --dir: 1 ahead, -1 back) while the new one slides in from
 * the other side and draws itself line by line (`is-entering`, journey.js).
 * Translate and opacity only, so the lines land crisp.
 */
.rv-journey .journey-step > * {
  opacity: 0;
  visibility: hidden;
}
.rv-journey .journey-step.is-on > * {
  opacity: 1;
  visibility: visible;
}
.rv-journey .journey-step.is-leaving > .journey-scene {
  visibility: visible;
  animation: journey-out 480ms var(--ease) both;
}
.rv-journey .journey-step.is-on > .journey-caption {
  pointer-events: auto;
}
/* The caption's lines rise out of their masks one after another each time
   the stage comes on (data-lines="manual", journey.js); where site.js does
   not split them (no observer) the caption fades up as one. */
html.rv-journey:not(.rv-lines) .journey-step.is-on > .journey-caption {
  animation: journey-caption var(--dur-reveal) var(--ease) 120ms both;
}
.rv-journey.rv-lines .journey-step.is-on .journey-kept {
  animation: journey-caption var(--dur-reveal) var(--ease) 400ms both;
}
.rv-journey .is-live .journey-step.is-entering > .journey-scene {
  animation: journey-in var(--dur-reveal) var(--ease) 80ms both;
}
.rv-journey
  .journey-step.is-entering
  .iso
  :is(polygon, polyline, line, path, use):not(.lane, .lot, .route, .jc-leader) {
  stroke-dasharray: 1;
  animation: iso-draw 1.2s var(--ease) both;
}
@keyframes journey-caption {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
}
@keyframes journey-out {
  to {
    opacity: 0;
    transform: translate3d(calc(var(--dir, 1) * -48px), 0, 0);
  }
}
@keyframes journey-in {
  from {
    opacity: 0;
    transform: translate3d(calc(var(--dir, 1) * 48px), 0, 0);
  }
}

/* Prev / Next: two ruled mono cells, like the tabs. */
.journey-step-nav {
  display: grid;
  place-items: center;
  width: 52px;
  height: 40px;
  padding: 0;
  border: var(--hairline) solid var(--rule);
  border-radius: 0;
  background: none;
  color: var(--ink);
  font: 500 15px / 1 var(--font-mono);
  cursor: pointer;
  pointer-events: auto;
  transition:
    color var(--dur-base) var(--ease),
    opacity var(--dur-base) var(--ease);
}
.journey-step-nav + .journey-step-nav {
  border-left: 0;
}
.journey-step-nav:hover {
  color: var(--ink-muted);
}
.journey-step-nav[disabled] {
  opacity: 0.3;
  cursor: default;
}
/* Pause / play, the third ruled cell: the pause bars while the steps run, the
   play triangle once they are paused or stopped (journey.js sets data-state). */
.journey-toggle svg {
  grid-area: 1 / 1;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: square;
}
.journey-toggle .journey-toggle-play {
  fill: currentColor;
  stroke-linejoin: round;
}
.journey-toggle[data-state='playing'] .journey-toggle-play,
.journey-toggle[data-state='paused'] .journey-toggle-pause {
  display: none;
}
.journey-toggle:focus-visible {
  outline-offset: -4px;
}

/*
 * From 961px up: the manifest corner beside the head, the tabs all six
 * across without scrolling, and the stage in one row that fits the
 * viewport under the header and the tabs (--journey-h): its text on the
 * left (35%), Prev / Next at the foot of it, the drawing on the right
 * (65%) with the records drawn on it as callouts.
 */
@media (min-width: 961px) {
  .rv-journey .journey {
    --journey-h: clamp(360px, calc(100svh - 240px), 620px);
  }
  .rv-journey .journey-grid {
    grid-template-columns: minmax(0, 35fr) minmax(0, 65fr);
    column-gap: clamp(28px, 3.4vw, 56px);
  }
  .rv-journey .journey-box,
  .rv-journey .journey-scene {
    grid-column: 2;
    height: var(--journey-h);
    margin-block: clamp(20px, 2.4vw, 36px) 0;
  }
  .rv-journey .journey-scene {
    -webkit-mask-image: none;
    mask-image: none;
  }
  .rv-journey .journey-art {
    width: min(100%, calc(var(--journey-h) * 700 / 540));
    height: auto;
    container-type: inline-size;
  }
  .rv-journey .journey-caption {
    grid-column: 1;
    grid-row: 4;
    align-self: center;
    gap: 12px;
    margin-top: clamp(20px, 2.4vw, 36px);
    /* Room for Prev / Next at the foot of the column. */
    padding: 0 0 72px;
    border-top: 0;
  }
  .rv-journey .journey-nav {
    grid-column: 1;
    grid-row: 4;
    align-self: end;
    justify-content: flex-start;
    margin-top: 0;
  }
  .rv-journey .journey-caption .journey-detail {
    margin-top: 10px;
    max-width: 30rem;
  }
  /* The records are on the drawing; the list stays for assistive tech. */
  .rv-journey .journey-kept {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .rv-journey .iso .jc-badge {
    display: none;
  }
  .rv-journey .iso :is(.jc-leader, .jc-dot, .jc-pulse),
  .rv-journey .journey-callouts {
    display: block;
  }

  /*
   * The callouts: the stage on show carries is-callouts (journey.js) and
   * its records come in one after another once their parts have arrived
   * (--jc-at, per scene): the dot, then the leader drawing out from it,
   * then the label opening from the leader's end. When it goes, all three
   * retract at once, quickly.
   */
  .rv-journey .iso .jc-leader {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    transition: stroke-dashoffset var(--dur-base) var(--ease);
  }
  .rv-journey .iso :is(.jc-dot, .jc-pulse) {
    transform-box: fill-box;
    transform-origin: center;
  }
  .rv-journey .iso .jc-dot {
    opacity: 0;
    transform: scale(0.3);
    transition:
      opacity var(--dur-fast) var(--ease),
      transform var(--dur-base) var(--ease);
  }
  .rv-journey .iso .jc-pulse {
    opacity: 0;
  }
  .rv-journey .jc-label {
    clip-path: inset(0 100% 0 0);
    transition: clip-path var(--dur-base) var(--ease);
  }
  .rv-journey .jc-label[data-side='l'] {
    clip-path: inset(0 0 0 100%);
  }
  .rv-journey .is-callouts .jc,
  .rv-journey .is-callouts .jc-label {
    --jc-d: calc(var(--jc-at, 1s) + var(--i, 0) * 420ms);
  }
  .rv-journey .is-callouts .iso .jc-dot {
    opacity: 1;
    transform: none;
    transition:
      opacity var(--dur-base) var(--ease) var(--jc-d),
      transform var(--dur-slow) var(--ease) var(--jc-d);
  }
  .rv-journey .is-callouts .iso .jc-leader {
    stroke-dashoffset: 0;
    transition: stroke-dashoffset var(--dur-slow) var(--ease)
      calc(var(--jc-d) + 120ms);
  }
  .rv-journey .is-callouts .jc-label,
  .rv-journey .is-callouts .jc-label[data-side='l'] {
    clip-path: inset(0);
    transition: clip-path var(--dur-slow) var(--ease) calc(var(--jc-d) + 560ms);
  }
  .rv-journey .is-callouts .iso .jc-pulse {
    animation: jc-pulse 2.4s var(--ease) calc(var(--jc-d) + 400ms) infinite;
  }
  .rv-journey .journey-manifest {
    grid-column: 2;
    grid-row: 1;
    align-self: end;
    justify-self: end;
    display: grid;
    justify-items: end;
    gap: 8px;
    margin-bottom: clamp(28px, 4vw, 56px);
  }
  .journey-list {
    grid-auto-columns: minmax(0, 1fr);
    overflow-x: visible;
  }
  /* Drawn larger, so the lines get a little more weight to stay crisp. */
  .rv-journey .journey {
    --iso-stroke: 1.3;
  }
}
@keyframes jc-pulse {
  from {
    opacity: 0.7;
    transform: scale(0.6);
  }
  to {
    opacity: 0;
    transform: scale(2.4);
  }
}

/* Draw-in when a new place first appears (scenes 1, 2, 6). The `use` passes
   the dash to its shapes, which all carry pathLength="1". */
@keyframes iso-draw {
  from {
    stroke-dashoffset: 1;
    fill-opacity: 0;
  }
}
.is-live .journey-step:not(.is-drawing) .draw {
  opacity: 0;
}
.rv-journey .journey-step.is-drawing .draw {
  stroke-dasharray: 1;
  animation: iso-draw 1.4s var(--ease-in-out) var(--d, 0s) both;
}

/* Hand-off: the pallet keeps the previous brand's color until data-hand. */
.is-live .journey-step:not(.is-handed) [data-from='gray'] {
  --pallet: var(--journey-gray);
}
.is-live .journey-step:not(.is-handed) [data-from='blue'] {
  --pallet: var(--rv-blue);
}
.is-live .journey-step:not(.is-handed) [data-from='green'] {
  --pallet: var(--rv-green);
}
.is-live .journey-step:not(.is-handed) [data-from='red'] {
  --pallet: var(--rv-red);
}
.is-live .journey-step:not(.is-handed) [data-from='orange'] {
  --pallet: var(--rv-orange);
}

/* Buyer notification ping (scene 6): a message going out, not tracking. */
@keyframes journey-ping {
  from {
    transform: scale(0.6);
    opacity: 0.9;
  }
  to {
    transform: scale(1.5);
    opacity: 0;
  }
}
.rv-journey .journey-step.is-on .ring {
  transform-box: fill-box;
  transform-origin: center;
  animation: journey-ping 1.8s var(--ease-out) infinite;
}
.rv-journey .journey-step.is-on .ring-late {
  animation-delay: 0.6s;
}

/* Tablet and phone, stacked: caption under the scene. */
@media (max-width: 960px) {
  .journey-step {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-5);
  }
  /* The tabs bleed to the screen's edges, so the row reads as scrollable. */
  .journey-list {
    margin-inline: calc(-1 * var(--gutter));
    padding-inline: var(--gutter);
    scroll-padding-inline: var(--gutter);
  }
}

/* Phone: lighter scenes and a compact caption. */
@media (max-width: 639px) {
  .iso :is(.dim, .stencil, .tag) {
    display: none;
  }
  .journey-caption h3 {
    font-size: 22px;
  }
  .journey-line {
    font-size: 15px;
  }
  .journey-list {
    grid-auto-columns: minmax(150px, 46vw);
  }
  .rv-journey .journey-box,
  .rv-journey .journey-scene {
    height: auto;
    aspect-ratio: 700 / 540;
  }
  .rv-journey .journey-art {
    width: 100%;
    height: auto;
  }
  .rv-journey .journey-scene svg {
    height: auto;
  }
  /* The drawing is about half size here: the numbered dots stay legible. */
  .journey {
    --jc-badge: 1;
  }
}

/*
 * Real photos for a stage (journey.mjs: public/assets/journey-container-*.webp,
 * only when the files exist). They fill the drawing's box and replace the
 * drawing and its callouts; on a desktop the records list, which the callouts
 * normally carry, is shown in the caption instead. With several photos they
 * crossfade in order while the stage is on show; reduced motion keeps the first.
 */
.journey-photos {
  display: none;
}
.journey-step.has-photos .journey-photos {
  display: block;
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: var(--radius-lg, 12px);
}
.journey-step.has-photos .journey-art > svg,
.journey-step.has-photos .journey-callouts {
  display: none;
}
.journey-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
}
.journey-photo:first-child {
  opacity: 1;
}
/* The art box keeps its size (it was set by the svg), so give it one. */
.journey-step.has-photos .journey-art {
  aspect-ratio: 700 / 540;
}
/*
 * One cycle is n slots of 3.2s; photo i starts i slots in and is on for its
 * own slot plus a 0.6s fade out that overlaps the next one's fade in. The
 * percentages depend on n, so each count has its own keyframes.
 */
@keyframes journey-photo-2 {
  0% {
    opacity: 0;
  }
  9.4%,
  50% {
    opacity: 1;
  }
  59.4%,
  100% {
    opacity: 0;
  }
}
@keyframes journey-photo-3 {
  0% {
    opacity: 0;
  }
  6.3%,
  33.3% {
    opacity: 1;
  }
  39.6%,
  100% {
    opacity: 0;
  }
}
@keyframes journey-photo-4 {
  0% {
    opacity: 0;
  }
  4.7%,
  25% {
    opacity: 1;
  }
  29.7%,
  100% {
    opacity: 0;
  }
}
@media (prefers-reduced-motion: no-preference) {
  .journey-photos.is-fading .journey-photo {
    animation-duration: calc(var(--n) * 3.2s);
    animation-timing-function: linear;
    animation-iteration-count: infinite;
    animation-fill-mode: both;
    animation-delay: calc(var(--i) * 3.2s);
  }
  .journey-photos[data-n='2'] .journey-photo {
    animation-name: journey-photo-2;
  }
  .journey-photos[data-n='3'] .journey-photo {
    animation-name: journey-photo-3;
  }
  .journey-photos[data-n='4'] .journey-photo {
    animation-name: journey-photo-4;
  }
  .rv-journey .journey-step:not(.is-on) .journey-photo {
    animation-play-state: paused;
  }
}
@media (min-width: 961px) {
  .rv-journey .journey-step.has-photos .journey-kept {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip-path: none;
    white-space: normal;
  }
}

/*
 * Stage 05's camera flash (journey.mjs `snaps`, journey.js `is-shooting`):
 * when the stage comes on a white flash passes over the drawing (opacity
 * 0 → .85 → 0, 180ms), then three snapshot cards drop onto it one by one,
 * each preceded by a small flash, rotated -6°, 4° and -2° and overlapping, as
 * polaroids with a white border and their label under the photo. The whole
 * sequence is over in about 2.3s, inside the 3s the stage is on show; leaving
 * the stage clears it. Only opacity and transform move. The layer is its own
 * size container, so everything in it is sized in cqi of the drawing.
 * Without rv-journey (no JS) the cards are simply there, and with reduced
 * motion they are there too, straight and without a flash.
 */
.journey-snaps {
  position: absolute;
  inset: 0;
  z-index: 3;
  container-type: inline-size;
  pointer-events: none;
}
.journey-flash,
.journey-snap-flash {
  position: absolute;
  opacity: 0;
}
.journey-flash {
  inset: 0;
  background: #fff;
}
.journey-snap {
  position: absolute;
  z-index: calc(var(--i, 0) + 1);
  left: var(--x);
  top: var(--y);
  width: var(--w, 22.4cqi);
  --r: -6deg;
}
/* The first child is the flash, so the cards are the 2nd to 4th. They sit in
   the open ground above the container (the drawing's upper right, right of
   the first callout's leader and above the truck's roof), side by side and
   one above, so no card covers another's label, the truck or a callout. */
.journey-snap:nth-child(2) {
  --x: 52cqi;
  --y: 27cqi;
  --r: -6deg;
}
.journey-snap:nth-child(3) {
  --x: 76cqi;
  --y: 25cqi;
  --r: 4deg;
}
.journey-snap:nth-child(4) {
  --x: 63cqi;
  --y: 2.5cqi;
  --r: -2deg;
}
.journey-snap-card {
  display: block;
  padding: 1.8cqi 1.8cqi 0;
  border-radius: 0.5cqi;
  background: #fff;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.08),
    0 1.3cqi 2.6cqi -0.8cqi rgba(0, 0, 0, 0.45);
  transform: rotate(var(--r));
}
.journey-snap-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}
/* The label is whole at any width: one line where it fits, else it wraps
   (a phone's cards are about 90px) instead of spilling over the border. */
.journey-snap-label {
  display: block;
  padding: 1.4cqi 0 1.6cqi;
  color: #151515;
  font: 500 clamp(7px, 1.3cqi, 11px) / 1.25 var(--font-mono);
  letter-spacing: var(--tracking-mono);
  text-align: center;
  text-wrap: balance;
  overflow-wrap: anywhere;
}
/* The small flash before a card: a soft white burst behind its corner of the
   drawing, over the card, fading as the card lands. */
.journey-snap-flash {
  inset: -14% -10%;
  z-index: 1;
  border-radius: 50%;
  background: radial-gradient(
    closest-side,
    #fff 0,
    rgba(255, 255, 255, 0.85) 38%,
    rgba(255, 255, 255, 0) 100%
  );
}
@media (prefers-reduced-motion: no-preference) {
  /* Out of the way until the stage is shot (is-shooting, journey.js). */
  .rv-journey .journey-snap-card {
    opacity: 0;
  }
  /* Each card's flash starts --t after the stage comes on: 600ms, then
     600ms apart; the card drops 60ms into it. */
  .rv-journey .journey-step.is-shooting .journey-snap {
    --t: calc(600ms + var(--i) * 600ms);
  }
  .rv-journey .journey-step.is-shooting .journey-flash {
    animation: journey-flash 180ms linear 300ms both;
  }
  .rv-journey .journey-step.is-shooting .journey-snap-flash {
    animation: journey-snap-flash 170ms ease-out var(--t) both;
  }
  .rv-journey .journey-step.is-shooting .journey-snap-card {
    animation: journey-drop 420ms var(--ease) calc(var(--t) + 60ms) both;
  }
}
@media (prefers-reduced-motion: reduce) {
  .journey-snap {
    --r: 0deg !important;
  }
}
@keyframes journey-flash {
  0% {
    opacity: 0;
  }
  45% {
    opacity: 0.85;
  }
  100% {
    opacity: 0;
  }
}
@keyframes journey-snap-flash {
  0% {
    opacity: 0;
    transform: scale(0.6);
  }
  40% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: scale(1.2);
  }
}
@keyframes journey-drop {
  from {
    opacity: 0;
    transform: translateY(-9cqi) rotate(calc(var(--r) - 9deg)) scale(1.1);
  }
  to {
    opacity: 1;
    transform: rotate(var(--r));
  }
}

/* Reduced motion: every stage arrives finished, and nothing loops or fades. */
@media (prefers-reduced-motion: reduce) {
  .rv-journey .journey-step > *,
  .rv-journey .journey-step > .journey-caption,
  .rv-journey .journey-progress-fill,
  .rv-journey .journey-item::after,
  .iso-pallet,
  .journey-item,
  .journey-step-nav {
    transition: none;
  }
  .rv-journey .journey-step.is-on > .journey-caption,
  html.rv-journey:not(.rv-lines) .journey-step.is-on > .journey-caption,
  .rv-journey .journey-step.is-leaving > .journey-scene,
  .rv-journey .is-live .journey-step.is-entering > .journey-scene,
  .rv-journey .journey-step.is-entering .iso *,
  .rv-journey .journey-step.is-drawing .draw,
  .rv-journey .journey-step.is-on .ring {
    animation: none;
  }
  /* Callouts: all there at once, nothing drawing or pulsing. */
  .rv-journey .journey .iso :is(.jc-leader, .jc-dot),
  .rv-journey .journey .jc-label {
    transition: none;
  }
  .rv-journey .journey .iso .jc-leader {
    stroke-dashoffset: 0;
  }
  .rv-journey .journey .iso .jc-dot {
    opacity: 1;
    transform: none;
  }
  .rv-journey .journey .jc-label {
    clip-path: none;
  }
  .rv-journey .journey .iso .jc-pulse {
    animation: none;
  }
  .rv-journey .journey-step.is-leaving > .journey-scene {
    visibility: hidden;
  }
}
