/* ==========================================================================
   journey.css — shared scroll-journey primitives
   Concept-agnostic. Each concept stylesheet layers art direction on top.
   Pinning uses native position:sticky (rock solid on iOS Safari).
   Progress is exposed by journey.js as --p / --in / --out on each chapter.
   ========================================================================== */

*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

::selection { background: var(--j-accent, #c9a227); color: #fff; }

/* --------------------------------------------------------------------------
   Chapter + stage
   A chapter is a tall scroll runway. The stage inside is pinned to the
   viewport for the whole runway, so content can animate in place.
   -------------------------------------------------------------------------- */

.j-journey { position: relative; }

.j-chapter {
  position: relative;
  /* svh, to match the stage exactly — mixing vh here leaves gaps between
     stages whenever browser chrome is on screen. */
  height: var(--span, 220svh);
  --p: 0;      /* raw scroll progress through this chapter, 0 -> 1 */
  --in: 0;     /* eased entry ramp, 0 -> 1 over the first band */
  --out: 0;    /* eased exit ramp, 0 -> 1 over the last band */
  --live: 0;   /* 1 while the chapter is on screen */
}

/* Short chapters that don't need a long runway */
.j-chapter[data-span="short"] { height: 150svh; }
.j-chapter[data-span="tall"]  { height: 320svh; }

.j-stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  display: grid;
  place-items: center;
  isolation: isolate;
}

/* Padding that respects notches and home indicators */
.j-safe {
  padding-inline: clamp(1.25rem, 6vw, 3.5rem);
  padding-block: max(2rem, env(safe-area-inset-top)) max(2rem, env(safe-area-inset-bottom));
  width: min(100%, 46rem);
  margin-inline: auto;
}

/* Offscreen chapters cost nothing to composite */
.j-chapter:not(.is-live) .j-stage { content-visibility: auto; }

/* --------------------------------------------------------------------------
   Art layers
   -------------------------------------------------------------------------- */

.j-layer {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-size: cover;
  background-position: center;
  will-change: transform;
}

/* Parallax depths — each drifts at a different rate against --p */
.j-layer[data-depth="back"]  { transform: translate3d(0, calc(var(--p) * -4%),  0) scale(1.12); }
.j-layer[data-depth="mid"]   { transform: translate3d(0, calc(var(--p) * -9%),  0) scale(1.08); }
.j-layer[data-depth="front"] { transform: translate3d(0, calc(var(--p) * -16%), 0) scale(1.04); }

.j-veil {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

/* Fine film grain — kills gradient banding on big dark washes */
.j-grain::after {
  content: "";
  position: absolute;
  inset: -50%;
  z-index: 0;
  pointer-events: none;
  opacity: .05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* --------------------------------------------------------------------------
   Reveal utilities — driven by --in / --out, not by transition timing
   -------------------------------------------------------------------------- */

.j-rise {
  opacity: var(--in);
  transform: translate3d(0, calc((1 - var(--in)) * 2.2rem), 0);
}

.j-fade { opacity: var(--in); }

/* Fades back out as the chapter leaves, so scenes hand over cleanly */
.j-hold {
  opacity: calc(var(--in) * (1 - var(--out)));
  transform: translate3d(0, calc((1 - var(--in)) * 2rem + var(--out) * -1.5rem), 0);
}

/* Per-child stagger. Set --i on each child. */
.j-stagger > * {
  --d: calc(var(--i, 0) * 0.12);
  --sp: clamp(0, calc((var(--in) - var(--d)) / (1 - var(--d))), 1);
  opacity: var(--sp);
  transform: translate3d(0, calc((1 - var(--sp)) * 1.6rem), 0);
}

/* Text that wipes in behind a moving mask */
.j-wipe {
  --w: calc(var(--in) * 108%);
  -webkit-mask-image: linear-gradient(100deg, #000 0, #000 var(--w), transparent calc(var(--w) + 9%));
          mask-image: linear-gradient(100deg, #000 0, #000 var(--w), transparent calc(var(--w) + 9%));
}

/* SVG ornament that draws itself. Set pathLength + --len to the same number
   for predictable timing, and --i to stagger one stroke behind another. */
.j-draw {
  --d: calc(var(--i, 0) * .13);
  --t: clamp(0, calc((var(--in) - var(--d)) / (1 - var(--d))), 1);
  stroke-dasharray: var(--len, 1000);
  stroke-dashoffset: calc(var(--len, 1000) * (1 - var(--t)));
}

/* --------------------------------------------------------------------------
   Card hero — the centrepiece moment
   -------------------------------------------------------------------------- */

.j-card-stage { perspective: 1400px; width: min(78vw, 21rem); }

.j-card {
  position: relative;
  border-radius: .55rem;
  overflow: hidden;
  cursor: zoom-in;
  transform-style: preserve-3d;
  transform:
    translate3d(0, calc((1 - var(--in)) * 14vh), 0)
    rotateX(calc((1 - var(--in)) * 26deg))
    scale(calc(.86 + var(--in) * .14));
  opacity: calc(.15 + var(--in) * .85);
  box-shadow:
    0 calc(var(--in) * 2.5rem) calc(var(--in) * 5rem) rgba(0, 0, 0, .45),
    0 0 0 1px var(--j-card-edge, rgba(255, 255, 255, .14));
  transition: box-shadow .4s ease;
}

.j-card img { width: 100%; height: auto; }

/* Gold light sweeping across the card as it settles */
.j-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    104deg,
    transparent 38%,
    var(--j-sheen, rgba(255, 236, 190, .55)) 50%,
    transparent 62%
  );
  background-size: 260% 100%;
  background-position: calc(140% - var(--in) * 190%) 0;
  mix-blend-mode: screen;
  opacity: calc(var(--in) * (1 - var(--in)) * 3.2);
}

.j-card:hover  { box-shadow: 0 3rem 6rem rgba(0, 0, 0, .55), 0 0 0 1px var(--j-accent, #c9a227); }
.j-card:focus-visible { outline: 2px solid var(--j-accent, #c9a227); outline-offset: 6px; }

.j-card-hint {
  margin: 1rem 0 0;
  text-align: center;
  font-size: .72rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  opacity: calc(var(--in) * .6);
}

/* --------------------------------------------------------------------------
   Lightbox — tap a card to inspect it full screen
   -------------------------------------------------------------------------- */

.j-lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  background: rgba(6, 8, 14, .94);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  touch-action: none;
  overscroll-behavior: contain;
}

.j-lightbox[open] { display: block; }

.j-lightbox figure {
  margin: 0;
  height: 100%;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.j-lightbox img {
  max-width: 94vw;
  max-height: 84vh;
  border-radius: .4rem;
  box-shadow: 0 2rem 5rem rgba(0, 0, 0, .6);
  transform-origin: center;
  cursor: grab;
  user-select: none;
  -webkit-user-drag: none;
}

.j-lightbox img.is-panning { cursor: grabbing; }

.j-lightbox-bar {
  position: absolute;
  left: 50%;
  bottom: max(1.25rem, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  gap: .5rem;
  padding: .4rem;
  border-radius: 999px;
  background: rgba(18, 20, 28, .82);
  border: 1px solid rgba(255, 255, 255, .12);
}

.j-lightbox-close {
  position: absolute;
  top: max(1rem, env(safe-area-inset-top));
  right: 1rem;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(18, 20, 28, .82);
  border: 1px solid rgba(255, 255, 255, .14);
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
}

/* --------------------------------------------------------------------------
   Progress rail + chapter dots
   -------------------------------------------------------------------------- */

.j-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 60;
  background: color-mix(in srgb, var(--j-accent, #c9a227) 18%, transparent);
}

.j-progress i {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--j-accent, #c9a227);
  transition: width .1s linear;
}

.j-rail {
  position: fixed;
  right: max(.75rem, env(safe-area-inset-right));
  top: 50%;
  transform: translateY(-50%);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: .55rem;
}

.j-rail a {
  width: 2.25rem;
  height: 1.5rem;
  display: grid;
  place-items: center;
  cursor: pointer;
  /* Without this the dots take the UA link colour instead of the rail's. */
  color: inherit;
  text-decoration: none;
}

.j-rail a span {
  width: .4rem;
  height: .4rem;
  border-radius: 999px;
  background: currentColor;
  opacity: .3;
  transition: transform .35s cubic-bezier(.2, .8, .2, 1), opacity .35s ease;
}

.j-rail a.is-active span { opacity: 1; transform: scale(1.9); }
.j-rail a:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; border-radius: .3rem; }

/* --------------------------------------------------------------------------
   Buttons + venue map
   -------------------------------------------------------------------------- */

.j-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: 2.875rem;             /* 46px — above the 44px touch floor */
  padding: .7rem 1.25rem;
  border-radius: 999px;
  border: 1px solid currentColor;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: .8rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background .25s ease, color .25s ease, transform .25s ease;
}

.j-btn:hover { transform: translateY(-1px); }
.j-btn:active { transform: translateY(0); }
.j-btn:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }

.j-btn svg { width: 1rem; height: 1rem; flex: none; }

.j-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  justify-content: center;
}

.j-map {
  margin-top: 1.5rem;
  border-radius: .5rem;
  overflow: hidden;
  border: 1px solid var(--j-hairline, rgba(255, 255, 255, .16));
}

.j-map-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: var(--j-map-bg, rgba(255, 255, 255, .05));
}

.j-map-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  filter: var(--j-map-filter, none);
}

/* Shown until the embed loads, and left in place if it never does */
.j-map-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  gap: .5rem;
  padding: 1rem;
  text-align: center;
  font-size: .82rem;
  line-height: 1.5;
}

.j-map-links {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  padding: .75rem;
  justify-content: center;
  background: var(--j-map-bar, rgba(255, 255, 255, .04));
}

.j-toast {
  position: fixed;
  left: 50%;
  bottom: max(1.5rem, env(safe-area-inset-bottom));
  transform: translate(-50%, 1rem);
  z-index: 95;
  padding: .6rem 1.1rem;
  border-radius: 999px;
  background: rgba(18, 20, 28, .92);
  color: #fff;
  font-size: .8rem;
  letter-spacing: .04em;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}

.j-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* --------------------------------------------------------------------------
   Scroll cue
   -------------------------------------------------------------------------- */

.j-cue {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  font-size: .68rem;
  letter-spacing: .28em;
  text-transform: uppercase;
  text-decoration: none;
  color: inherit;
  opacity: calc(var(--in) * (1 - var(--out)));
}

.j-cue b {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  border: 1px solid currentColor;
  font-weight: 400;
  animation: j-bob 2.4s ease-in-out infinite;
}

@keyframes j-bob {
  0%, 100% { transform: translateY(0);     opacity: .55; }
  50%      { transform: translateY(.35rem); opacity: 1; }
}

/* --------------------------------------------------------------------------
   Utility
   -------------------------------------------------------------------------- */

.j-sr {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.j-skip {
  position: fixed;
  top: .5rem;
  left: .5rem;
  z-index: 100;
  padding: .6rem 1rem;
  border-radius: .4rem;
  background: #101319;
  color: #fff;
  text-decoration: none;
  transform: translateY(-150%);
  transition: transform .2s ease;
}

.j-skip:focus { transform: translateY(0); }

.j-badge {
  position: fixed;
  top: max(.6rem, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  padding: .3rem .8rem;
  border-radius: 999px;
  max-width: calc(100vw - 1.5rem);
  font-size: .56rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  background: rgba(10, 12, 18, .55);
  border: 1px solid rgba(255, 255, 255, .16);
  color: #fff;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* --------------------------------------------------------------------------
   Reduced motion — collapse the whole choreography to plain, readable fades.
   Chapters shrink to a single viewport so nothing depends on scrub position.
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  .j-chapter,
  .j-chapter[data-span="short"],
  .j-chapter[data-span="tall"] { height: auto; min-height: 100svh; }

  .j-stage { position: static; height: auto; min-height: 100svh; }

  .j-layer[data-depth] { transform: none; }

  .j-rise,
  .j-fade,
  .j-hold,
  .j-stagger > *,
  .j-cue { opacity: 1; transform: none; }

  .j-wipe { -webkit-mask-image: none; mask-image: none; }
  .j-draw { stroke-dashoffset: 0; }
  .j-stagger > * { opacity: 1; transform: none; }

  .j-card { transform: none; opacity: 1; box-shadow: 0 1rem 3rem rgba(0, 0, 0, .4); }
  .j-card::after { display: none; }
  .j-card-hint { opacity: .6; }

  .j-cue b { animation: none; }
}
