/* walk.css — Chapter One's walk down the aisle (behaviour: js/walk.js).
 *
 * .walk is ~4.2 stages tall; .walk__stage is sticky (top 0, one stage tall, the page column
 * wide) so the guest scrolls ~3.2 screens through it. Nothing above it clips (.chapter--day
 * is overflow: visible): a clipping ancestor would silently un-pin it.
 *
 * Stage, bottom -> top: door still < canvas (the frames) < altar still < lit still < paper
 * scrim < light sprites < cue / window button / venue text. Every picture is exactly 9:16
 * with the same object-fit, so the stills and the canvas register to the pixel. js/walk.js
 * writes the stills' and the canvas's opacity from p; the classes below are state:
 *   .is-arrived  the pill, venue, place and Directions enter (and the button is live)
 *   .is-lit      the lit still fades in (1.8 s), the light drifts, glass.line replaces the pill
 *   .is-live     the stage is on screen (the drifting light runs only then)
 *   .is-still    too few frames arrived: no canvas, p cross-fades door -> altar
 */
.walk {
  position: relative;
  height: calc(max(var(--stage-h), var(--stage-min)) * 4.2);
  margin: 56px calc(-1 * var(--gutter)) 0;
}
.walk__stage {
  position: sticky;
  top: 0;
  height: max(var(--stage-h), var(--stage-min));
  overflow: clip;
  display: grid;
  grid-template-rows: 1fr auto;
  text-align: center;
}
@supports not (overflow: clip) { .walk__stage { overflow: hidden; } }

.walk__view { position: absolute; inset: 0; background: var(--lilac-50); }
.walk__layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: 50% 50%;
}
.walk__canvas, .walk__altar, .walk__lit { opacity: 0; }
.walk__canvas { image-rendering: auto; }
.is-still .walk__canvas { display: none; }
.walk__lit { transition: opacity 1800ms cubic-bezier(0.4, 0, 0.2, 1); }
.is-lit .walk__lit { opacity: 1; }

/* the paper the text sits on once arrived: the pale floor + runner, lifted toward paper */
.walk__scrim {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 40%;
  background: linear-gradient(0deg,
    rgba(251, 250, 253, 0.92) 0%, rgba(251, 250, 253, 0.8) 40%,
    rgba(251, 250, 253, 0.3) 72%, rgba(251, 250, 253, 0) 100%);
  opacity: 0;
  transition: opacity 700ms var(--ease-standard);
}
.is-arrived .walk__scrim { opacity: 1; }

/* ---- the light (after the tap): soft coloured patches drifting slowly ------------------------ */
.walk__light { position: absolute; inset: 0; opacity: 0; transition: opacity 2400ms var(--ease-standard) 500ms; }
.is-lit .walk__light { opacity: 1; }
.ray {
  position: absolute;
  max-width: none;
  height: auto;
  pointer-events: none;
  animation: ray-drift var(--dur, 18s) var(--ease-soft) var(--delay, 0s) infinite alternate;
  animation-play-state: paused;
}
.walk__stage.is-live.is-lit .ray, .walk-glow.is-live .ray { animation-play-state: running; }
@keyframes ray-drift {
  from { transform: translate3d(0, 0, 0) rotate(var(--r, 0deg)) scale(var(--s, 1)); }
  to   { transform: translate3d(var(--dx, 18px), var(--dy, 26px), 0) rotate(calc(var(--r, 0deg) + 7deg)) scale(var(--s, 1)); }
}
/* in the chapel: through the window, across the altar, onto the runner and the text */
.ray--1 { left: -8%;  top: 22%; width: 78%; opacity: 0.34; --r: -8deg;  --dur: 19s; --dx: 22px; --dy: 30px; }
.ray--2 { left: 34%;  top: 38%; width: 70%; opacity: 0.28; --r: 172deg; --dur: 15s; --dx: -20px; --dy: 18px; --delay: -6s; }
.ray--3 { left: 8%;   top: 60%; width: 84%; opacity: 0.3;  --r: 12deg;  --dur: 22s; --dx: 14px; --dy: -16px; --delay: -11s; }
.ray--4 { left: 44%;  top: 6%;  width: 52%; opacity: 0.22; --r: -24deg; --dur: 14s; --dx: -12px; --dy: 22px; --delay: -3s; }

/* the light following the guest out of the chapel: fixed, the column wide, one screen tall;
 * its opacity is written by js/walk.js from the scroll (only after the tap) */
.walk-glow {
  position: fixed;
  z-index: 2;
  top: 0;
  left: 50%;
  width: min(100%, var(--column));
  height: var(--stage-h);
  transform: translateX(-50%);
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  display: none;
}
.walk-glow.is-on { display: block; }
.ray--g1 { left: -14%; top: 12%; width: 80%; opacity: 0.2;  --r: -10deg; --dur: 20s; --dx: 20px; --dy: 34px; }
.ray--g2 { left: 40%;  top: 40%; width: 72%; opacity: 0.16; --r: 168deg; --dur: 16s; --dx: -18px; --dy: 22px; --delay: -7s; }
.ray--g3 { left: 4%;   top: 66%; width: 86%; opacity: 0.18; --r: 14deg;  --dur: 22s; --dx: 16px; --dy: -18px; --delay: -12s; }

/* ---- the cue, at rest on the doors ------------------------------------------------------------ */
.walk__cue {
  position: absolute;
  left: 50%;
  bottom: max(26px, 4.5%);
  z-index: 2;
  transform: translateX(-50%);
  white-space: nowrap;
  pointer-events: none;
  background: rgba(251, 250, 253, 0.86);
}
.walk__chev {
  width: 6px; height: 6px;
  margin: -3px 0 0 2px;
  border-right: 1.2px solid var(--lilac-800);
  border-bottom: 1.2px solid var(--lilac-800);
  transform: rotate(45deg);
}

/* ---- the window button (top of the stage down to its pill) + the venue ------------------------- */
.walk__btn {
  position: relative;
  z-index: 2;
  grid-row: 1;
  grid-column: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  width: 100%;
  padding-bottom: 18px;
  pointer-events: none;
  cursor: default;
}
.is-arrived .walk__btn { pointer-events: auto; cursor: pointer; }
.walk__btn:focus-visible { outline: none; }
.walk__btn:focus-visible .walk__hint { outline: 2px solid var(--lilac-800); outline-offset: 4px; }
.walk__hint { background: rgba(251, 250, 253, 0.9); }

.walk__venue {
  position: relative;
  z-index: 2;
  grid-row: 2;
  grid-column: 1;
  margin: 0;
  padding: 0 var(--gutter) max(30px, 5%);
}
.walk__venue .venue__name { font-size: 28px; max-width: 340px; } /* one line: the floor below the altar is short */
.walk__venue .venue__place { margin-top: 8px; }
.walk__venue .btn { margin-top: 20px; background: rgba(251, 250, 253, 0.72); }
/* glass.line takes the pill's place once the window is lit */
.walk__line {
  position: absolute;
  left: var(--gutter); right: var(--gutter);
  bottom: calc(100% + 18px);
  font-family: var(--font-display);
  font-style: italic;
  font-size: 22px;
  line-height: 1.25;
  color: var(--ink);
  text-wrap: balance;
  pointer-events: none; /* it sits over the pill: taps must reach the button */
  /* a soft paper halo where the line crosses the altar flowers (text-shadow, no box, no blur filter) */
  text-shadow: 0 0 10px rgba(251, 250, 253, 0.95), 0 0 3px rgba(251, 250, 253, 0.9);
  opacity: 0;
  transform: translate3d(0, 8px, 0);
  transition: opacity 900ms var(--ease-standard) 700ms, transform 900ms var(--ease-standard) 700ms;
}
.is-lit .walk__line { opacity: 1; transform: none; }

/* arrival: the text enters in order; leaving (scrolling back) it simply fades */
.walk__hint, .walk__venue .venue__name, .walk__venue .venue__place, .walk__venue .btn {
  opacity: 0;
  transform: translate3d(0, 14px, 0);
  transition: opacity 380ms var(--ease-standard), transform 380ms var(--ease-standard);
}
.is-arrived .walk__hint, .is-arrived .walk__venue .venue__name, .is-arrived .walk__venue .venue__place, .is-arrived .walk__venue .btn {
  opacity: 1;
  transform: none;
  transition: opacity 800ms var(--ease-standard), transform 900ms var(--ease-standard);
}
.is-arrived .walk__venue .venue__name { transition-delay: 120ms; }
.is-arrived .walk__venue .venue__place { transition-delay: 220ms; }
.is-arrived .walk__venue .btn { transition-delay: 340ms; }
.is-lit .walk__hint { opacity: 0; transform: none; transition: opacity 400ms var(--ease-standard); }

/* short phones (390x664): the text block tightens so the line clears the altar cross */
@media (max-height: 720px) and (prefers-reduced-motion: no-preference) {
  .walk__btn { padding-bottom: 12px; }
  .walk__venue { padding-bottom: 14px; }
  .walk__venue .venue__name { font-size: 24px; }
  .walk__venue .venue__place { margin-top: 6px; }
  .walk__venue .btn { margin-top: 12px; min-height: 44px; }
  .walk__line { font-size: 19px; bottom: calc(100% + 12px); }
}

/* ---- reduced motion: not pinned; the altar still in an arch, a plain cross-fade -------------- */
@media (prefers-reduced-motion: reduce) {
  .chapter--day { padding-bottom: 120px; } /* the usual section gap before the passage's rail */
  .walk { height: auto; margin: 64px 0 0; }
  .walk__stage {
    position: relative;
    height: auto;
    overflow: visible;
    grid-template-rows: auto 100px auto; /* room for the pill, or for glass.line >= 20px below the arch */
    justify-items: center;
  }
  .walk__view {
    position: relative;
    inset: auto;
    grid-row: 1;
    grid-column: 1;
    width: min(74vw, 304px);
    aspect-ratio: 1 / var(--arch-ratio);
    border-radius: 2000px 2000px 0 0;
    overflow: hidden;
    transform: translateZ(0);
  }
  .walk__door, .walk__canvas, .walk__scrim, .walk__light, .walk__cue, .walk-glow { display: none; }
  .walk__altar { opacity: 1 !important; }
  .walk__altar, .walk__lit { object-position: 50% 28%; }
  .walk__lit { transition: opacity 300ms linear; }
  .walk__btn { grid-row: 1 / 3; padding-bottom: 14px; }
  .walk__venue { grid-row: 3; padding-bottom: 0; }
  .walk__venue .btn { background: transparent; }
  .walk__line { transition: none; transform: none; bottom: calc(100% + 14px); text-shadow: none; }
  .walk__hint, .walk__venue .venue__name, .walk__venue .venue__place, .walk__venue .btn { opacity: 1; transform: none; transition: none; }
  .is-lit .walk__hint { transition: none; }
}
