/* Page motion, "the walk, animated" (owned by the landing page builder). Plan: ../STYLE.md "Motion plan v3", Page 1-8.
   How: the owner's web-animation-design guide. ease-out to enter, ease-in-out to move or draw, ease for hover and colour,
   linear only for constant motion (the spine is scroll-linked 1:1, rain falls at a steady speed).
   Progressive enhancement: every hide-for-animation state sits under html.a2b-motion, which a tiny inline script in <head>
   sets only when motion is wanted (not reduced) and which motion.js removes if it can't run. Without JS, or with reduced
   motion, the page is the static v2 design. Only transform, opacity and stroke-dashoffset are animated.
   The hero map (.hero-map) is not touched here. */

:root {
  --walk-at: 68%;                         /* the walker's line, from the top of the viewport (motion.js reads this too) */
  --walk-track: rgba(255, 79, 26, 0.22);  /* the route not yet walked */
}

/* ---------- Header glyph: the route slides up through the gold arch ---------- */
.wordmark svg { overflow: hidden; }   /* the stroke enters from below the tile, clipped by it */
.wordmark svg path:last-child { will-change: transform; }
.a2b-motion .wordmark svg path:last-child:not(.is-in) { transform: translateY(13px); }

/* ---------- The walk spine: a vermilion fill over a faint track, a walker dot on its tip ---------- */
.spine { display: none; }
.a2b-motion .stop::before { background: var(--walk-track); }
.a2b-motion .spine {
  display: block;
  position: absolute; top: 0; bottom: 0;
  left: calc(var(--gutter) + var(--line-x) - 1px);
  width: 2px;
  pointer-events: none;
  view-timeline-name: --walk;
  view-timeline-axis: block;
  view-timeline-inset: var(--walk-at) calc(100% - var(--walk-at));   /* the scrollport, collapsed to the walker's line */
}
.a2b-motion .stop-start .spine { top: calc(var(--pt) + 11px); }
.a2b-motion .stop-end .spine { bottom: auto; height: calc(var(--pt) + 11px); }
.spine-fill {
  position: absolute; inset: 0;
  background: var(--route);
  transform-origin: 50% 0;
  transform: scaleY(0);
  will-change: transform;
}
.spine-walker {
  position: absolute; top: 0; left: -6px;
  width: 14px; height: 100%;            /* translateY(100%) = the length of this spine */
  opacity: 0;
  will-change: transform, opacity;
}
.spine-walker::after {
  content: "";
  position: absolute; left: 0; top: -7px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--route);
  box-shadow: 0 0 0 3px var(--white);   /* a white ring that parts the walker from the line, not a shadow */
}

/* Scroll-driven (Chrome, Safari 26+). motion.js sets .a2b-sda only when supported; otherwise it drives the same transforms. */
.a2b-sda .stop:not(.stop-start) .spine-fill {
  animation: spine-fill linear both;
  animation-timeline: --walk;
}
.a2b-sda .stop:not(.stop-start) .spine-walker {
  animation: spine-walk linear none;    /* fill-mode none: visible only while the walker's line is inside this spine */
  animation-timeline: --walk;
}
.a2b-sda .stop.from-map .spine-walker { animation-name: spine-walk-in; animation-timeline: --walk; }
@keyframes spine-fill { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes spine-walk { from { transform: translateY(0); opacity: 1; } to { transform: translateY(100%); opacity: 1; } }
@keyframes spine-walk-in {
  from { transform: translateY(0); opacity: 0; }
  4% { opacity: 1; }
  to { transform: translateY(100%); opacity: 1; }
}

/* Flinders St: on load the walker sets off down the hero line and into the map. */
.a2b-motion .stop-start.is-go .spine-fill { animation: spine-fill var(--t-draw) var(--ease-in-out) 520ms both; }
.a2b-motion .stop-start.is-go .spine-walker { animation: spine-set-off var(--t-draw) var(--ease-in-out) 520ms both; }
@keyframes spine-set-off {
  from { transform: translateY(0); opacity: 0; }
  8% { opacity: 1; }
  86% { opacity: 1; }
  to { transform: translateY(100%); opacity: 0; }
}

/* ---------- Stops: the dot fills and the name slides in when the walker reaches it ---------- */
.a2b-motion .stop-name:not(.is-ready) { opacity: 0; }
.stop-label { display: inline-block; }
.a2b-motion .stop-name .stop-dot {
  transform: scale(0.6); opacity: 0.35;
  transition: transform var(--t-ui) var(--ease-out), opacity var(--t-ui) ease;
}
.a2b-motion .stop.is-reached .stop-dot {
  transform: none; opacity: 1;
  transition: transform 250ms var(--ease-spring), opacity var(--t-ui) ease;
}
.a2b-motion .stop-label {
  opacity: 0; transform: translateX(-10px);
  transition: opacity var(--t-ui) var(--ease-out), transform var(--t-ui) var(--ease-out);
}
.a2b-motion .stop.is-named .stop-label {   /* once the walker has been there, the name stays */
  opacity: 1; transform: none;
  transition: opacity 400ms var(--ease-out) 60ms, transform 400ms var(--ease-out) 60ms;
}
/* Bourke St Mall: the walker arrives and the stop pulses once */
.stop-dot::after {
  content: "";
  position: absolute; inset: -3px;
  border: 2px solid var(--route); border-radius: 50%;
  opacity: 0;
  pointer-events: none;
}
.stop-dot.is-pulse::after { animation: stop-pulse 600ms var(--ease-out) both; }
@keyframes stop-pulse {
  from { transform: scale(1); opacity: 0.9; }
  to { transform: scale(1.6); opacity: 0; }
}

/* ---------- Headings rise from a mask, line by line (motion.js splits them, then puts the text back) ---------- */
.a2b-motion :is(.hero-title, #what-title, #dry-title, #hours-title, #app-title, #join-title):not(.is-in) { opacity: 0; }
/* flex column: the lines' negative margins mustn't collapse, so a split heading has exactly its natural line positions */
.is-split { display: flex; flex-direction: column; }
.ln { display: block; overflow: hidden; white-space: nowrap; margin: -0.12em 0 -0.18em; }
.ln-i { display: block; padding: 0.12em 0 0.18em; will-change: transform; }

/* ---------- Copy and figures fade up as the walker arrives ---------- */
.a2b-motion :is(.hero-lead, .hero .wl, #what .split-text > p, .dry-lead, .trip, #dry > .fig-note,
  #hours .split-chart .t-body, .hours, .app-sub, .plate-fig, .join-lead, .wl-end, .ask):not(.is-in) { opacity: 0; }

/* ---------- Block Arcade: strips draw, roofs fill, rain falls on the open parts ---------- */
.trip { position: relative; isolation: isolate; }
.trip-rain {
  position: absolute; left: 0; top: 0; z-index: -1;
  pointer-events: none;
}
.a2b-motion .strip::before { transform: scaleX(0); transform-origin: 0 50%; }
.a2b-motion .strip { border-right-color: transparent; }
.a2b-motion .strip::after {
  content: "";
  position: absolute; top: 0; bottom: 0; right: -2px; width: 2px;
  background: var(--bluestone);
  opacity: 0;
}
.a2b-motion .strip i { transform: scaleX(0); transform-origin: 0 50%; }
.a2b-motion .trip.is-drawn .strip::before {
  transform: none;
  transition: transform calc(var(--sd, 900) * 1ms) var(--ease-in-out) calc(var(--sdl, 0) * 1ms);
}
.a2b-motion .trip.is-drawn .strip::after {
  opacity: 1;
  transition: opacity var(--t-press) ease calc((var(--sdl, 0) + var(--sd, 900) - 40) * 1ms);
}
.a2b-motion .trip.is-drawn .strip i {
  transform: none;
  transition: transform 180ms var(--ease-out) calc((var(--sdl, 0) + var(--sd, 900) + var(--k, 0) * 60) * 1ms);
}

/* ---------- Royal Arcade: the hours playhead (built by motion.js in every mode; it's also a slider) ---------- */
.h-read { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 18px; margin: 0 0 18px; }
.h-clock {
  min-width: 4.4em;
  font-size: var(--fs-36); font-weight: 750; font-stretch: var(--w-wide); line-height: 1.05; letter-spacing: -0.01em;
}
.h-count { font-size: var(--fs-16); font-weight: 600; font-stretch: var(--w-semi); color: var(--bluestone-2); }
.h-count b { font-weight: 650; color: var(--bluestone); }
.h-play {
  grid-column: 2; grid-row: 1 / 6; align-self: stretch;
  position: relative; z-index: 2;
  touch-action: pan-y;                  /* phones still scroll the page over the chart; sideways drags move the playhead */
  cursor: ew-resize;
  user-select: none; -webkit-user-select: none;
}
.h-head {
  position: absolute; left: 0; top: 24px; bottom: -6px; width: 0;
  pointer-events: none;
  will-change: transform;
}
.h-head::before {
  content: "";
  position: absolute; left: -1px; top: 0; bottom: 0; width: 2px;
  background: var(--bluestone);
}
.h-knob {
  position: absolute; left: -11px; bottom: -11px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--bluestone);
  box-shadow: 0 0 0 3px var(--white);
  pointer-events: auto;
  touch-action: none;
  cursor: grab;
}
.h-knob::before { content: ""; position: absolute; inset: -11px; }   /* 44px target */
.h-track .h-shut {
  background-color: var(--stone);
  background-image: repeating-linear-gradient(45deg, var(--closed) 0 1.1px, transparent 1.1px 3.2px);
  opacity: 0;
  transition: opacity 250ms ease;
}
.h-track .h-shut.is-shut { opacity: 1; }
.hours.is-instant .h-shut { transition: none; }

/* ---------- The app: hover lifts a plate (fine pointers only) ---------- */
@media (hover: hover) and (pointer: fine) {
  .plate { transition: transform var(--t-ui) ease; }
  .plate-fig:hover .plate { transform: translateY(-6px); }
}

/* ---------- Print: whatever hasn't arrived yet still prints ---------- */
@media print {
  .a2b-motion :is(.hero-title, #what-title, #dry-title, #hours-title, #app-title, #join-title, .hero-lead, .hero .wl, #what .split-text > p,
    .dry-lead, .trip, #dry > .fig-note, #hours .split-chart .t-body, .hours, .app-sub, .plate-fig, .join-lead, .wl-end, .ask,
    .stop-name, .stop-label, .stop-name .stop-dot) { opacity: 1; transform: none; }
  .a2b-motion .strip::before, .a2b-motion .strip i { transform: none; }
  .a2b-motion .strip::after { opacity: 1; }
  .spine, .trip-rain { display: none; }
  .a2b-motion .stop::before { background: var(--route); }
}

/* ---------- Reduced motion: final states, nothing moves ---------- */
@media (prefers-reduced-motion: reduce) {
  .a2b-motion .wordmark svg path:last-child:not(.is-in) { transform: none; }
  .spine, .a2b-motion .spine { display: none; }
  .a2b-motion .stop::before { background: var(--route); }
  .a2b-motion .stop-name:not(.is-ready), .a2b-motion .stop-name .stop-dot, .a2b-motion .stop-label { opacity: 1; transform: none; transition: none; }
  .stop-dot.is-pulse::after { animation: none; }
  .a2b-motion :is(.hero-title, #what-title, #dry-title, #hours-title, #app-title, #join-title):not(.is-in) { opacity: 1; }
  .a2b-motion :is(.hero-lead, .hero .wl, #what .split-text > p, .dry-lead, .trip, #dry > .fig-note,
    #hours .split-chart .t-body, .hours, .app-sub, .plate-fig, .join-lead, .wl-end, .ask):not(.is-in) { opacity: 1; }
  .a2b-motion .strip::before, .a2b-motion .strip i { transform: none; transition: none; }
  .a2b-motion .strip { border-right-color: var(--bluestone); }
  .a2b-motion .strip::after { display: none; }
  .trip-rain { display: none; }
  .h-track .h-shut { transition: none; }
  .plate, .plate-fig:hover .plate { transition: none; transform: none; }
  .ln-i { will-change: auto; }
}
