/*
 * GO HAUNTED landing page.
 *
 * Loads after tokens.css (colours, type, spacing) and buttons.css (the app's own buttons,
 * pins and tab bar). Everything here is the page: layout, the hero, each section, motion.
 *
 * Contents
 *   1. Base and scroll values    6. How it plays      11. Collect
 *   2. Coloured sheets           7. A legend          12. Your ghost
 *   3. Navigation                8. The map           13. Download
 *   4. Hero and phone            9. Together          14. Footer
 *   5. Kinds of haunt (ribbon)  10. Cards             15. Motion preferences
 *
 * Scroll motion. site.js writes a few numbers as CSS variables while the page scrolls, and
 * the styles here turn them into movement. Without scripts they keep the values set in
 * :root, which is every element in its finished place.
 *   --hp  on .hero                    0 at the top of the page, 1 when the hero has scrolled away
 *   --e   on [data-scroll]            0 as the element enters the bottom of the screen, 1 near the top
 *   --p   on [data-scroll="through"]  0 to 1 across its whole trip up the screen
 *   --f   on each .play__step         0 to 1 while that step of the story is the current one
 * Most rules that use them start with .scrolly, a class site.js puts on <html> when motion is welcome.
 */

/* ───────────────────────── 1. Base and scroll values ───────────────────────── */

@font-face {
  font-family: 'Fraunces';
  src: url('../assets/fonts/fraunces-latin-wght-normal.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --font-brand: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --wrap: 1180px;
  --pad: clamp(20px, 5vw, 56px);
  --nav-h: 68px;
  --sheet: clamp(28px, 4.4vw, 56px);

  /* Section colours: the brand's night, the green of the map button's glyph, plum, the cards' indigo,
     and a candle-lit violet for the stories. */
  --c-night: #030a1e;
  --c-green: #06231b;
  --c-plum: #241d3f;
  --c-indigo: #17143f;
  --c-dusk: #1b1030;

  /* Settles without a bounce: text, panels, anything that is read. */
  --out: cubic-bezier(0.22, 1, 0.36, 1);
  /* Lands with a small overshoot: ghosts, pins and cards, the things with weight. */
  --spring: cubic-bezier(0.34, 1.45, 0.64, 1);

  --hp: 0;
  --e: 1;
  --p: 0.5;
}

@supports (transition-timing-function: linear(0, 1)) {
  :root {
    --spring: linear(0, 0.008 1.1%, 0.034 2.3%, 0.134 4.9%, 0.264 7.3%, 0.683 14.3%, 0.797 16.5%, 0.89 18.6%, 0.967 20.7%, 1.027 22.8%, 1.073 25%, 1.104 27.3%, 1.123 30.6%, 1.119 34.3%, 1.018 49.5%, 0.988 58.6%, 0.985 65.2%, 1 84.5%, 1);
  }
}

/* --k is --e arriving a little sooner: finished when the element is about halfway up the screen. */
[data-scroll] {
  --k: clamp(0, calc(var(--e) * 1.45), 1);
}

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

html {
  /* The tilted ribbon is wider than the screen on purpose: the page must never scroll sideways for it. */
  overflow-x: hidden;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 12px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: #000;
  color: var(--label);
  font: 400 1.0625rem / 1.5 var(--font-ui);
  overflow-x: clip;
}

img,
svg {
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* Every line icon: drawn on a 24 grid with a 1.6 stroke, in the colour of the text around it. */
.icon {
  flex: none;
  width: 1.25em;
  height: 1.25em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.skip {
  position: fixed;
  left: 12px;
  top: 12px;
  z-index: 100;
  padding: 12px 16px;
  border-radius: var(--r-md);
  background: var(--accent);
  color: #000;
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-200%);
}

.skip:focus {
  transform: none;
}

.wrap {
  width: min(var(--wrap), 100% - 2 * var(--pad));
  margin-inline: auto;
}

.section {
  --gap: clamp(76px, 9.5vw, 132px);
  /* Extra room at the bottom: the next sheet slides over it. */
  padding-block: var(--gap) calc(var(--gap) + var(--sheet));
}

.section__head {
  display: grid;
  justify-items: center;
  margin-bottom: clamp(40px, 6vw, 72px);
  text-align: center;
}

.kicker {
  margin: 0 0 14px;
  color: var(--accent);
  font: 600 0.875rem / 1 var(--font-ui);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h2 {
  margin: 0;
  color: var(--ghost-cream);
  font: 700 clamp(2.1rem, 5.2vw, 4rem) / 1.02 var(--font-brand);
  letter-spacing: -0.018em;
  text-wrap: balance;
}

/* Headings light up a word at a time as they travel up the screen. */
.scrolly [data-words] .w {
  --t: clamp(0, calc((var(--e) - 0.1) / 0.55), 1);
  --lit: clamp(0, calc(var(--t) * ((var(--n) - 1) * 0.6 + 1) - var(--w) * 0.6), 1);
  display: inline-block;
  opacity: calc(0.14 + var(--lit) * 0.86);
  transform: translateY(calc((1 - var(--lit)) * 0.16em));
}

.lede {
  max-width: 46ch;
  margin: 20px 0 0;
  color: var(--label-2);
  font: 400 clamp(1.06rem, 1.35vw, 1.22rem) / 1.5 var(--font-ui);
  text-wrap: pretty;
}

.section__head .lede {
  max-width: 44ch;
}

.fine {
  max-width: 46ch;
  margin: 22px 0 0;
  color: rgba(235, 235, 245, 0.56);
  font: 400 0.875rem / 1.5 var(--font-ui);
}

/* Two columns that become one. */
.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr);
  align-items: center;
  gap: clamp(32px, 6vw, 96px);
}

.split--flip {
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
}

@media (max-width: 900px) {
  .split,
  .split--flip {
    grid-template-columns: minmax(0, 1fr);
    gap: 44px;
  }

  /* Words before pictures on a phone. */
  .split--flip .split__copy {
    order: -1;
  }
}

/* Things that arrive once, as they scroll into view. Only hidden when scripts are running. */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity 0.7s var(--out),
    transform 0.9s var(--out);
  transition-delay: calc(var(--i, 0) * 80ms);
}

.js [data-reveal].is-in {
  opacity: 1;
  transform: none;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
}

/* Gentle floating. These use translate and rotate, so they never fight a transform. */
@keyframes floaty {
  from {
    translate: 0 -6px;
  }
  to {
    translate: 0 8px;
  }
}

@keyframes bob {
  from {
    translate: 0 -7px;
    rotate: -2deg;
  }
  to {
    translate: 0 7px;
    rotate: 2deg;
  }
}

/*
 * A pin falling out of the sky and landing with a squash and one small bounce.
 * --fall is how far it drops. The pin keeps its own translate for placement.
 */
@keyframes pin-fall {
  0% {
    opacity: 0;
    transform: translateY(var(--fall, -70vh)) scale(0.96, 1.12);
    animation-timing-function: cubic-bezier(0.5, 0, 1, 0.62);
  }
  10% {
    opacity: 1;
  }
  56% {
    opacity: 1;
    transform: translateY(0) scale(1.14, 0.8);
    animation-timing-function: cubic-bezier(0.2, 0.7, 0.4, 1);
  }
  72% {
    transform: translateY(-15px) scale(0.97, 1.05);
    animation-timing-function: cubic-bezier(0.5, 0, 0.9, 0.6);
  }
  86% {
    transform: translateY(0) scale(1.05, 0.94);
  }
  100% {
    opacity: 1;
    transform: none;
  }
}

/* ───────────────────────── 2. Coloured sheets ───────────────────────── */

/* Each section is a sheet with rounded top corners, laid over the one before it. */
.sheet {
  position: relative;
  z-index: 1;
  margin-top: calc(var(--sheet) * -1);
  border-radius: var(--sheet) var(--sheet) 0 0;
}

.sheet--night {
  background:
    radial-gradient(60% 40% at 20% 0%, rgba(106, 240, 191, 0.09), rgba(106, 240, 191, 0) 70%),
    var(--c-night);
}

.sheet--green {
  background:
    radial-gradient(55% 50% at 82% 34%, rgba(106, 240, 191, 0.16), rgba(106, 240, 191, 0) 70%),
    linear-gradient(180deg, #051a14 0%, var(--c-green) 100%);
}

.sheet--plum {
  background:
    radial-gradient(70% 42% at 50% 0%, rgba(153, 104, 198, 0.28), rgba(153, 104, 198, 0) 72%),
    linear-gradient(180deg, #2c2350 0%, var(--c-plum) 60%, #1b1532 100%);
}

.sheet--indigo {
  isolation: isolate;
  overflow: clip;
  background: var(--c-indigo);
}

/* A painting behind a whole sheet. */
.sheet__art {
  position: absolute;
  inset: -6% 0;
  z-index: -1;
  width: 100%;
  height: 112%;
  object-fit: cover;
  opacity: 0.85;
}

/* It drifts a little slower than the page (--p runs 0 to 1 as the sheet crosses the screen). */
.scrolly .sheet__art {
  transform: translateY(calc((var(--p) - 0.5) * 9%));
}

/* ───────────────────────── 3. Navigation ───────────────────────── */

.nav {
  position: fixed;
  inset: 0 0 auto;
  z-index: 50;
  padding-top: env(safe-area-inset-top, 0px);
  transition:
    background-color 0.3s ease,
    box-shadow 0.3s ease;
}

.nav.is-stuck {
  background: var(--material-bar);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  box-shadow: inset 0 -0.5px 0 var(--edge-bar);
}

.nav__in {
  display: flex;
  align-items: center;
  gap: 24px;
  width: min(1320px, 100% - 2 * var(--pad));
  height: var(--nav-h);
  margin-inline: auto;
}

.nav__brand {
  display: block;
  border-radius: 8px;
}

.nav__brand img {
  display: block;
  width: auto;
  height: 30px;
}

.nav__links {
  display: flex;
  gap: clamp(16px, 2.2vw, 28px);
  margin-left: auto;
}

.nav__links a {
  padding: 12px 2px;
  color: var(--label-2);
  font: 500 0.9375rem / 1 var(--font-ui);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s ease;
}

.nav__links a:hover {
  color: var(--label);
}

.nav__cta {
  min-height: 40px;
  margin-left: 8px;
  padding: 0 16px;
  border-radius: 999px;
  font-size: 0.9375rem;
  white-space: nowrap;
}

@media (hover: hover) {
  .gh-btn--primary:hover {
    background: var(--accent-light);
  }
}

@media (max-width: 900px) {
  .nav__links {
    display: none;
  }

  .nav__cta {
    margin-left: auto;
  }
}

/* ───────────────────────── 4. Hero and phone ───────────────────────── */

.hero {
  position: relative;
  isolation: isolate;
  display: grid;
  justify-items: center;
  align-content: start;
  min-height: min(100svh, 1080px);
  padding: calc(var(--nav-h) + clamp(44px, 8vh, 104px)) var(--pad) 0;
  overflow: clip;
}

/* The phone dissolves into the page below it. */
.hero::after {
  content: '';
  position: absolute;
  inset: auto 0 0;
  z-index: 3;
  height: 150px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0), #000);
  pointer-events: none;
}

/*
 * The painted map. It fills the first screen and a little more, then melts into the black
 * the rest of the phone stands on, so most of the painting is in view at once however tall
 * the hero grows.
 */
.hero__bg {
  position: absolute;
  inset: 0 0 auto;
  z-index: -2;
  height: min(100%, max(118vh, 700px));
  height: min(100%, max(118svh, 700px));
  container-type: size;
  overflow: hidden;
  background: #050716;
  -webkit-mask-image: linear-gradient(180deg, #000 0, #000 84%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 0, #000 84%, transparent 100%);
}

/*
 * A picture that always covers its box, with the pins riding on it.
 * The box must be a size container; the picture keeps its own shape (16:10 for the app's map),
 * so a pin placed at a percentage of the picture stays on the right spot at any screen size.
 */
.mapfit {
  position: absolute;
  left: 50%;
  top: 50%;
  width: max(100cqw, 160cqh);
  aspect-ratio: 16 / 10;
  translate: -50% -50%;
}

.mapfit__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* The hero's wide painting is 16:9. */
.hero .mapfit {
  width: max(100cqw, 177.78cqh);
  aspect-ratio: 16 / 9;
  animation: settle 2.2s var(--out) both;
}

/* Its tall painting is 1520 × 2688, hung from the top so the castle and the lighthouse always show. */
@media (orientation: portrait) {
  .hero .mapfit {
    top: 0;
    width: max(100cqw, 56.55cqh);
    aspect-ratio: 1520 / 2688;
    translate: -50% 0;
    transform-origin: 50% 0;
  }

  .pins--wide,
  .spooks--wide {
    display: none;
  }
}

@media (orientation: landscape) {
  .pins--tall,
  .spooks--tall {
    display: none;
  }
}

/* On a phone the words and the phone cover the middle of the tall painting: fewer pins, no small ghosts. */
@media (max-width: 699px) {
  .pin--roomy,
  .spooks--tall {
    display: none;
  }
}

@keyframes settle {
  from {
    opacity: 0;
    scale: 1.08;
  }
}

/* The map, pins and all, swells a little as the hero scrolls away.
   Performance: everything moved by --hp in the hero carries will-change, so the browser paints it once
   and then only moves it. Without it the painting, the pins' shadows and the phone's glows are repainted
   on every scroll frame, which drops slower machines well below 60 fps. */
.scrolly .hero .mapfit {
  transform: scale(calc(1 + var(--hp) * 0.16));
  will-change: transform;
}

.hero__shade {
  position: absolute;
  inset: 0;
  background:
    /* A pool of night behind the words, so they read over the painting. */
    radial-gradient(44% 310px at 50% 370px, rgba(4, 6, 22, 0.9) 0, rgba(4, 6, 22, 0.7) 50%, rgba(4, 6, 22, 0) 100%),
    /* The phone's glow on the ground. */
    radial-gradient(38% 26% at 50% 84%, rgba(106, 240, 191, 0.14), rgba(106, 240, 191, 0) 100%),
    /* A little dark under the navigation. */
    linear-gradient(180deg, rgba(3, 5, 18, 0.6) 0, rgba(3, 5, 18, 0) 15%);
}

/* Pins. The same drawing as the app's map. */
.pins {
  position: absolute;
  inset: 0;
}

.pin {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--pin, 30px);
  aspect-ratio: 36 / 46;
  padding: 0;
  border: 0;
  background: none;
  translate: -50% -100%;
  transform-origin: 50% 100%;
  filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.45));
}

.pin svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.pin__body {
  fill: var(--accent);
  stroke: rgba(0, 0, 0, 0.55);
  stroke-width: 1.5;
}

.pin__ghost {
  fill: #05130e;
}

.pin__eye {
  fill: var(--accent);
}

/* On the paintings a pin is sized from its painting, so it stays in scale with the landmarks. */
.pins--wide > .pin {
  --pin: clamp(26px, 2.05%, 46px);
}

.pins--tall > .pin {
  --pin: clamp(24px, 6.4%, 44px);
}

/* Every pin waits out of sight, then they all rain down, each after its own --delay. */
.js .pins:not(.is-in) > .pin {
  opacity: 0;
}

.js .pins.is-in > .pin {
  animation: pin-fall 0.95s var(--delay, 0s) both;
}

/* The small ghosts out exploring. They ride on the painting like the pins do. */
.spooks {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.spook {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--w);
  /* --w is a share of the painting's width; a margin in percent is measured against that same width. */
  margin: calc(var(--w) * -0.6) 0 0 calc(var(--w) / -2);
  /* Nudged by the pointer, and lifted away on scroll: the nearer the ghost, the further it goes. */
  translate: calc(var(--mx, 0) * var(--depth, 1) * 14px) calc(var(--my, 0) * var(--depth, 1) * 14px + var(--hp) * var(--depth, 1) * -240px);
  animation: float-in 1.1s var(--d, 0.5s) var(--spring) both;
  will-change: transform;
}

@keyframes float-in {
  from {
    opacity: 0;
    scale: 0.2;
  }
}

.spook img {
  display: block;
  width: 100%;
  height: auto;
  transform: rotate(var(--lean, 0deg));
  filter: drop-shadow(0 16px 18px rgba(0, 0, 0, 0.55));
  animation: bob var(--t, 6s) ease-in-out infinite alternate;
}

.hero__copy {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  max-width: 920px;
  text-align: center;
}

/* The words sink back as the hero scrolls away. */
.scrolly .hero__copy {
  opacity: calc(1 - var(--hp) * 1.7);
  transform: translateY(calc(var(--hp) * -60px)) scale(calc(1 - var(--hp) * 0.08));
  will-change: transform, opacity;
}

.hero__copy > *,
.hero__title .line > span {
  animation: rise 0.9s var(--out) both;
  animation-delay: calc(0.15s + var(--i, 0) * 0.09s);
}

.hero__copy > .hero__title {
  animation: none;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 9px 16px 9px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.2);
  font: 500 0.9375rem / 1 var(--font-ui);
}

.eyebrow .icon {
  width: 18px;
  height: 18px;
  color: var(--accent);
}

.hero__title {
  margin: 22px 0 0;
  color: var(--ghost-cream);
  text-shadow: 0 2px 34px rgba(4, 6, 22, 0.7);
  font: 700 clamp(2.375rem, 11.5vw, 7.5rem) / 0.94 var(--font-brand);
  letter-spacing: -0.022em;
}

/* Each line slides up out of its own slot. */
.hero__title .line {
  display: block;
  margin: -0.06em -0.05em -0.12em;
  padding: 0.06em 0.05em 0.12em;
  overflow: hidden;
}

.hero__title .line > span {
  display: inline-block;
  animation-name: lift;
  animation-duration: 1.1s;
}

@keyframes lift {
  from {
    transform: translateY(108%) rotate(3deg);
  }
}

.hero__lede {
  max-width: 44ch;
  margin: 26px 0 0;
  /* A touch brighter than elsewhere, with a dark edge: it sits on a painting. */
  color: rgba(235, 235, 245, 0.78);
  text-shadow:
    0 0 4px rgba(4, 6, 22, 0.9),
    0 1px 16px rgba(4, 6, 22, 0.95);
  font: 400 clamp(1.06rem, 1.5vw, 1.3rem) / 1.45 var(--font-ui);
  text-wrap: balance;
}

/* Store buttons. Plain and dark: swap in the official badges before launch. */
.stores {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 30px;
}

.store {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 0 22px 0 14px;
  border-radius: 16px;
  background: #0d0d0f;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.16),
    0 10px 30px rgba(0, 0, 0, 0.5);
  color: #fff;
  font: 600 1.1875rem / 1.1 var(--font-ui);
  letter-spacing: -0.01em;
  text-align: left;
  text-decoration: none;
  transition:
    transform 0.1s ease-out,
    background-color 0.2s ease,
    box-shadow 0.2s ease;
}

.store small {
  display: block;
  margin-bottom: 2px;
  color: var(--label-2);
  font: 500 0.6875rem / 1.2 var(--font-ui);
  letter-spacing: 0.01em;
}

.store .icon {
  width: 30px;
  height: 30px;
  padding: 6px;
  border-radius: 50%;
  background: var(--accent);
  color: #000;
  stroke-width: 2.2;
  rotate: 180deg;
}

@media (hover: hover) {
  .store:hover {
    background: #17171a;
    box-shadow:
      inset 0 0 0 1px rgba(255, 255, 255, 0.32),
      0 10px 30px rgba(0, 0, 0, 0.5),
      0 0 34px rgba(106, 240, 191, 0.2);
  }
}

.store:active {
  transform: scale(0.97);
}

/* The phone. */
.hero__phone {
  position: relative;
  z-index: 1;
  margin-top: clamp(40px, 6vh, 72px);
  /* The hero crops it: the rest of the phone is below the fold on purpose. */
  margin-bottom: -200px;
  animation: phone-rise 1.2s 0.35s var(--out) both;
}

@keyframes phone-rise {
  from {
    opacity: 0;
    transform: translateY(120px);
  }
}

/* The main ghost leans in at the phone's shoulder, in front of it. */
.hero__ghost {
  position: absolute;
  left: 79%;
  top: -5%;
  z-index: 2;
  width: 66%;
  pointer-events: none;
  /* It lifts away faster than the phone as the hero scrolls off. */
  translate: calc(var(--hp) * 70px) calc(var(--hp) * -260px);
  animation: float-in 1s 1.25s var(--spring) both;
  will-change: transform;
}

.hero__ghost img {
  display: block;
  width: 100%;
  height: auto;
  transform: rotate(8deg);
  filter: drop-shadow(0 22px 26px rgba(0, 0, 0, 0.55));
  animation: bob 5.6s ease-in-out infinite alternate;
}

.phone {
  /* Change these two together: --s is (width - 2 × bezel) ÷ 390, the app's design width. */
  --pw: 312px;
  --s: calc((312 - 22) / 390);
  --bezel: 11px;
  position: relative;
  width: var(--pw);
  padding: var(--bezel);
  border-radius: 54px;
  background: #0a0a0c;
  box-shadow:
    0 0 0 1.5px #3c3c42,
    0 0 0 3px #121215,
    0 50px 90px rgba(0, 0, 0, 0.7),
    0 0 140px rgba(106, 240, 191, 0.18);
}

/* It comes up to meet you as you scroll. */
.scrolly .phone {
  transform: translateY(calc(var(--hp) * -120px)) scale(calc(1 + var(--hp) * 0.1));
  will-change: transform;
}

.phone__island {
  position: absolute;
  left: 50%;
  top: calc(var(--bezel) + 9px);
  z-index: 3;
  width: 28%;
  height: 22px;
  border-radius: 999px;
  background: #000;
  translate: -50% 0;
}

.phone__screen {
  position: relative;
  width: calc(var(--pw) - 2 * var(--bezel));
  height: calc((var(--pw) - 2 * var(--bezel)) * 844 / 390);
  overflow: hidden;
  border-radius: 43px;
  background: #15171b;
}

/* The app screen is laid out at its real size, 390 × 844, then scaled to fit the phone. */
.app {
  position: absolute;
  left: 0;
  top: 0;
  width: 390px;
  height: 844px;
  transform: scale(var(--s));
  transform-origin: 0 0;
  pointer-events: none;
}

/* The same map picture, zoomed so Bolsover Castle sits under the chosen pin. */
.app__map {
  position: absolute;
  inset: 0;
  background: url('../assets/img/phone-map.webp') -0.25px 0 / 390.75px auto no-repeat;
  filter: brightness(1.28) contrast(1.06);
}

.app__time {
  position: absolute;
  left: 34px;
  top: 19px;
  font: 600 16px / 1 var(--font-ui);
}

.app__bars {
  position: absolute;
  right: 30px;
  top: 19px;
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 13px;
}

.app__bars i {
  width: 3.5px;
  border-radius: 1px;
  background: #fff;
}

.app__bars i:nth-child(1) {
  height: 6px;
}

.app__bars i:nth-child(2) {
  height: 9px;
}

.app__bars i:nth-child(3) {
  height: 12px;
}

.app__chip {
  position: absolute;
  left: 12px;
  top: 62px;
}

.app__pin {
  --fall: -360px;
  position: absolute;
  translate: -50% -100%;
  scale: var(--to, 1);
  animation: pin-fall 0.9s calc(1.5s + var(--i, 0) * 0.16s) both;
}

.app__pin img {
  display: block;
  width: 36px;
  height: 46px;
}

.app__pin--here {
  --to: 1.28;
  z-index: 1;
}

/* A ring spreading from the place you are standing at. */
.app__ping {
  position: absolute;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--accent);
  opacity: 0;
  animation: ping 2.4s 2.8s ease-out infinite;
}

@keyframes ping {
  0% {
    opacity: 0.9;
    transform: scale(0.4);
  }
  100% {
    opacity: 0;
    transform: scale(5.5);
  }
}

.app__stack {
  position: absolute;
  right: 12px;
  bottom: 218px;
  display: grid;
  gap: 8px;
}

.app .gh-round .icon {
  width: 22px;
  height: 22px;
}

.app__sheet {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 112px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 22px;
  background: var(--bg-elevated);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.55);
  animation: rise 0.8s 2.4s var(--out) both;
}

.app__thumb {
  display: grid;
  flex: none;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--accent-wash);
  color: var(--accent);
}

.app__thumb .icon {
  width: 26px;
  height: 26px;
}

.app__place {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.app__place strong {
  font: 600 16px / 1.2 var(--font-ui);
}

.app__place span {
  color: var(--label-2);
  font: 400 13px / 1.3 var(--font-ui);
}

.app__go {
  min-height: 38px;
  margin-left: auto;
  padding: 0 15px;
  border-radius: 999px;
  font-size: 15px;
  white-space: nowrap;
}

.app__tabs {
  position: absolute;
  inset: auto 0 0;
  box-sizing: content-box;
  padding-bottom: 26px;
  background: #161618;
}

/* The home indicator. */
.app__tabs::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 8px;
  width: 134px;
  height: 5px;
  border-radius: 3px;
  background: #fff;
  translate: -50% 0;
}

.app .gh-tab .icon {
  width: 26px;
  height: 26px;
  stroke-width: 1.7;
}

.app .gh-disc .icon {
  width: 32px;
  height: 32px;
  stroke-width: 2;
}

/* Small round pictures of a ghost: the phone's player chip, feed posts, the leaderboard. */
.post__face,
.board__face {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 30%, #2b2a55, #12122a);
}

.gh-chip__face img,
.post__face img,
.board__face img {
  position: absolute;
  left: 50%;
  top: 8%;
  width: 92%;
  max-width: none;
  translate: -50% 0;
}

/* A short, wide screen (a small laptop): tighten the words, so the phone and the ghost still make the first screen. */
@media (min-width: 901px) and (max-height: 780px) {
  .hero {
    padding-top: calc(var(--nav-h) + clamp(20px, 4vh, 44px));
  }

  .hero__title {
    margin-top: 16px;
    font-size: clamp(4rem, 13.5vh, 6.5rem);
  }

  .hero__lede {
    margin-top: 18px;
  }

  .hero .stores {
    margin-top: 22px;
  }

  .hero__phone {
    margin-top: 30px;
  }
}

@media (max-width: 520px) {
  .phone {
    --pw: 272px;
    --s: calc((272 - 22) / 390);
    border-radius: 48px;
  }

  .phone__screen {
    border-radius: 38px;
  }

  .hero__phone {
    margin-bottom: -170px;
  }

  /* The main ghost is smaller beside a smaller phone, and stays on the screen. */
  .hero__ghost {
    left: 70%;
    top: -6.5%;
    width: 42%;
  }

  .stores {
    flex-wrap: nowrap;
    gap: 8px;
  }

  .store {
    gap: 9px;
    min-height: 52px;
    padding: 0 14px 0 10px;
    font-size: 1rem;
  }

  .store .icon {
    width: 26px;
    height: 26px;
    padding: 5px;
  }
}

/* ───────────────────────── 5. Kinds of haunt (ribbon) ───────────────────────── */

/* A mint ribbon laid across the join between the hero and the first sheet, at a slight tilt. */
.types {
  position: relative;
  z-index: 3;
  margin-top: -18px;
  padding: 20px 0;
  background: var(--accent);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.5);
  color: #04130e;
  rotate: -1.4deg;
  scale: 1.04 1;
}

.marquee {
  display: flex;
  overflow: hidden;
}

.marquee__track {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px 44px;
  margin: 0;
  padding: 0 22px;
  list-style: none;
}

.marquee__track li {
  display: flex;
  align-items: center;
  gap: 10px;
  font: 700 1.0625rem / 1 var(--font-ui);
  white-space: nowrap;
}

.marquee__track .icon {
  width: 24px;
  height: 24px;
  stroke-width: 1.9;
}

/* With scripts running, the list becomes one line that slides for ever. */
.marquee.is-live .marquee__track {
  flex: none;
  flex-wrap: nowrap;
  animation: slide 46s linear infinite;
}

.marquee.is-live:hover .marquee__track {
  animation-play-state: paused;
}

/* Scrolling hurries it along. */
.scrolly .marquee.is-live .marquee__track {
  translate: calc(var(--p) * -360px) 0;
}

@keyframes slide {
  to {
    transform: translateX(-100%);
  }
}

/* ───────────────────────── 6. How it plays ───────────────────────── */

/*
 * Two forms.
 * Plain: four steps listed beside the first painting. With scripts, tapping a step shows its painting.
 * Story: site.js adds .is-story when motion is welcome and the screen is tall enough. The section
 * becomes four screens tall, its inside holds still, and the steps play in turn as you scroll.
 */
.play__sticky {
  --gap: clamp(76px, 9.5vw, 132px);
  padding-block: var(--gap) calc(var(--gap) + var(--sheet));
}

/*
 * The paintings sit straight on the page, with no frame. For that to work the page behind
 * must be the painting's own night colour, so the sheet takes it from the step that is
 * showing: three near-black navies, then the indigo of the card sky.
 */
.play.sheet {
  --ground: #01081b;
  background: var(--ground);
  transition: background-color 0.8s ease;
}

.play.sheet[data-step='1'],
.play.sheet[data-step='2'] {
  --ground: #01071f;
}

.play.sheet[data-step='3'] {
  --ground: #15103d;
}

.play.is-story {
  height: 400svh;
  /* A link to #play lands with the story pinned, not a nav-height short of it. */
  scroll-margin-top: calc((var(--nav-h) + 12px) * -1);
}

.play.is-story .play__sticky {
  position: sticky;
  top: 0;
  display: grid;
  align-items: center;
  height: 100svh;
  /* The next sheet slides up over the bottom edge: keep the words clear of it. */
  padding-block: calc(var(--nav-h) + 16px) calc(var(--sheet) + 8px);
  overflow: hidden;
}

.play__in {
  display: grid;
  /* A little wider than the other sections, so the painting can be big. */
  width: min(1320px, 100% - 2 * var(--pad));
  grid-template: 'head stage' auto 'steps stage' 1fr / minmax(0, 0.8fr) minmax(0, 1.32fr);
  align-items: center;
  gap: 26px clamp(28px, 5vw, 72px);
}

/* The words stay in front of the painting's faded edges. */
.play__head,
.play__steps {
  position: relative;
  z-index: 1;
}

.play__head {
  grid-area: head;
  align-self: end;
}

.play__head h2 {
  font-size: clamp(1.8rem, 3.2vw, 2.9rem);
}

.play__steps {
  grid-area: steps;
  align-self: start;
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.play__step {
  --pt: 10px;
  position: relative;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 16px;
  padding: var(--pt) 14px calc(var(--pt) + 2px) 10px;
  border-radius: 20px;
  transition:
    background-color 0.4s ease,
    opacity 0.4s ease;
}

.js .play__step {
  cursor: pointer;
}

.play__step.is-on {
  background: rgba(255, 255, 255, 0.07);
}

/* The dotted footpath from one number to the next. In the story it fills with mint as you scroll (--f). */
.play__step:not(:last-child)::before,
.play__step:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 28.5px;
  top: calc(var(--pt) + 46px);
  bottom: calc(2px - var(--pt));
  border-left: 3px dotted rgba(255, 255, 255, 0.24);
}

.play__step:not(:last-child)::after {
  border-left-color: var(--accent);
  clip-path: inset(0 0 calc((1 - var(--f, 0)) * 100%) 0);
}

.play__num {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: #04130e;
  font: 700 1.05rem / 1 var(--font-brand);
  transition:
    background-color 0.4s ease,
    color 0.4s ease,
    scale 0.6s var(--spring);
}

.play__step h3 {
  margin: 7px 0 0;
  color: var(--ghost-cream);
  font: 700 1.25rem / 1.2 var(--font-brand);
  letter-spacing: -0.01em;
}

.play__step p {
  margin: 6px 0 0;
  color: var(--label-2);
  font: 400 1rem / 1.5 var(--font-ui);
}

/* In the story only the step you are on is open. Every open step is the same height, so nothing jumps. */
.play.is-story .play__step {
  opacity: 0.5;
}

.play.is-story .play__step.is-done {
  opacity: 0.78;
}

.play.is-story .play__step.is-on {
  opacity: 1;
}

.play.is-story .play__step p {
  height: 0;
  margin-top: 0;
  overflow: hidden;
  opacity: 0;
  transition:
    height 0.6s var(--out),
    margin-top 0.6s var(--out),
    opacity 0.4s ease;
}

.play.is-story .play__step.is-on p {
  height: var(--open, 4.5em);
  margin-top: 6px;
  opacity: 1;
}

.play.is-story .play__step:not(.is-on):not(.is-done) .play__num {
  background: #1a2338;
  color: var(--label-2);
}

.play.is-story .play__step.is-on .play__num {
  scale: 1.12;
}

/*
 * The painting. No box: it is bigger than its column, reaching towards the edge of the screen
 * (--edge is the page margin beside the column, up to 220px of it) and a little into the gap
 * on its other side.
 */
.play__stage {
  --edge: min(max(var(--pad), (100vw - 1320px) / 2), 220px);
  position: relative;
  grid-area: stage;
  justify-self: center;
  width: calc(104% + var(--edge) * 0.9);
  margin-inline: -4% calc(var(--edge) * -0.9);
  aspect-ratio: 3 / 2;
  container-type: inline-size;
}

/* Never taller than the screen can show. */
.play.is-story .play__stage {
  width: min(calc(104% + var(--edge) * 0.9), calc((100svh - var(--nav-h) - 28px - var(--sheet)) * 1.5));
}

/* All four edges of the paintings fade out. Pins, labels and the ghost are outside this, so they stay crisp. */
.play__art {
  position: absolute;
  inset: 0;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 9%, #000 91%, transparent), linear-gradient(180deg, transparent, #000 10%, #000 90%, transparent);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(90deg, transparent, #000 9%, #000 91%, transparent), linear-gradient(180deg, transparent, #000 10%, #000 90%, transparent);
  mask-composite: intersect;
}

.play__scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  scale: 1.08;
  transition:
    opacity 0.7s ease,
    scale 1.6s var(--out);
}

.play[data-step='0'] [data-scene='0'],
.play[data-step='1'] [data-scene='1'],
.play[data-step='2'] [data-scene='2'],
.play[data-step='3'] [data-scene='3'] {
  opacity: 1;
  scale: 1;
}

/* What appears on top of each painting. Everything is hidden until its step comes round. */
.play__layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.play__pin {
  --fall: -62cqw;
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 4.6%;
  height: auto;
  opacity: 0;
  translate: -50% -100%;
  transform-origin: 50% 100%;
  filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.5));
  transition: opacity 0.25s ease;
}

.play__pin--glow {
  width: 6.6%;
  filter: drop-shadow(0 0 16px rgba(106, 240, 191, 0.95));
}

.play[data-step='0'] [data-layer='0'] .play__pin,
.play[data-step='1'] [data-layer='1'] .play__pin {
  opacity: 1;
  transition: none;
  animation: pin-fall 0.9s calc(0.3s + var(--i, 0) * 0.1s) backwards;
}

.play__pill {
  position: absolute;
  left: var(--x);
  top: var(--y);
  padding: 0.7em 1em;
  border-radius: 999px;
  background: rgba(22, 22, 24, 0.88);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow:
    inset 0 0 0 0.5px var(--edge-bar),
    0 8px 24px rgba(0, 0, 0, 0.45);
  color: var(--label);
  font: 600 clamp(0.72rem, 1.9cqw, 1rem) / 1 var(--font-ui);
  white-space: nowrap;
  opacity: 0;
  translate: -50% -50%;
  scale: 0.5;
  transition:
    opacity 0.25s ease,
    scale 0.3s ease;
}

.play__pill--mint {
  background: var(--accent);
  box-shadow: 0 8px 28px rgba(106, 240, 191, 0.45);
  color: #04130e;
  font-weight: 700;
}

.play__pill--xp {
  color: var(--accent);
}

.play__pill--gold {
  color: #ffd24a;
}

.play[data-step='0'] [data-layer='0'] .play__pill,
.play[data-step='1'] [data-layer='1'] .play__pill,
.play[data-step='2'] [data-layer='2'] .play__pill,
.play[data-step='3'] [data-layer='3'] .play__pill {
  opacity: 1;
  scale: 1;
  transition:
    opacity 0.3s 0.9s ease,
    scale 0.7s 0.9s var(--spring);
}

.play[data-step='2'] [data-layer='2'] .play__pill--xp {
  transition-delay: 1.25s;
}

/* In the story the first pins wait until the painting is on screen (site.js adds .is-live). */
.play.is-story:not(.is-live) .play__layer .play__pin,
.play.is-story:not(.is-live) .play__layer .play__pill {
  opacity: 0;
  scale: 0.5;
  animation: none;
}

.play__medal {
  position: absolute;
  left: 27%;
  top: 47%;
  width: 15%;
  height: auto;
  opacity: 0;
  translate: -50% -50%;
  rotate: -40deg;
  scale: 0.2;
  filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.5));
  transition:
    opacity 0.25s ease,
    scale 0.3s ease,
    rotate 0.3s ease;
}

.play[data-step='2'] .play__medal {
  opacity: 1;
  rotate: -8deg;
  scale: 1;
  transition:
    opacity 0.3s 1.1s ease,
    scale 0.8s 1.1s var(--spring),
    rotate 0.8s 1.1s var(--spring);
}

.play__cards {
  position: absolute;
  left: 50%;
  top: 20%;
  width: 24%;
  aspect-ratio: 2 / 3;
}

.play__cards .ccard {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: translateY(18%) scale(0.7);
  transform-origin: 50% 120%;
  transition:
    opacity 0.25s ease,
    transform 0.3s ease;
}

.play[data-step='3'] .play__cards .ccard {
  opacity: 1;
  transform: translate(var(--x), var(--y)) rotate(var(--r));
  transition:
    opacity 0.3s 0.5s ease,
    transform 0.9s 0.5s var(--spring);
}

/* The ghost: one walker, four stops, a new face at each. */
.play__ghost {
  position: absolute;
  left: 49%;
  top: 76%;
  width: 20%;
  aspect-ratio: 62 / 76;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 14px 16px rgba(0, 0, 0, 0.5));
  transition:
    left 1s var(--out),
    top 1s var(--out),
    width 1s var(--out);
  animation: floaty 3.6s ease-in-out infinite alternate;
}

.play[data-step='1'] .play__ghost {
  left: 23%;
  top: 66%;
  width: 23%;
}

.play[data-step='2'] .play__ghost {
  left: 50%;
  top: 62%;
  width: 25%;
}

.play[data-step='3'] .play__ghost {
  left: 20%;
  top: 60%;
  width: 21%;
}

.play__ghost img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.play[data-step='0'] [data-face='0'],
.play[data-step='1'] [data-face='1'],
.play[data-step='2'] [data-face='2'],
.play[data-step='3'] [data-face='3'] {
  opacity: 1;
}

/* Narrower columns need a fourth line for the open step. */
@media (max-width: 1100px) {
  .play.is-story .play__step {
    --open: 6em;
  }
}

/* A short, wide screen: tighten the left column so all four steps fit. */
@media (min-width: 901px) and (max-height: 760px) {
  .play.is-story .play__in {
    row-gap: 14px;
  }

  .play.is-story .play__head h2 {
    font-size: clamp(1.5rem, 2.5vw, 2rem);
  }

  .play.is-story .play__step {
    --pt: 5px;
  }

  .play.is-story .play__step p {
    font-size: 0.9375rem;
  }
}

/* A phone, or any screen taller than it is wide: the painting goes on top, full width. */
@media (max-width: 900px), (max-aspect-ratio: 5/4) {
  .play__in {
    grid-template: 'head' auto 'stage' auto 'steps' auto / minmax(0, 1fr);
    gap: 18px;
  }

  .play__steps {
    width: min(100%, 34rem);
    margin-inline: auto;
  }

  .play__head {
    text-align: center;
  }

  .play__head h2 {
    font-size: clamp(1.5rem, 6.4vw, 2.2rem);
  }

  /* From one side of the screen to the other, its faded top and foot tucked under the words. */
  .play__stage {
    --bleed: 0px;
    width: calc(100% + 2 * var(--pad) + var(--bleed));
    margin: -14px 0 -18px;
  }

  .play.is-story .play__sticky {
    padding-block: calc(var(--nav-h) + 14px) calc(var(--sheet) + 4px);
  }

  .play.is-story .play__in {
    gap: 14px;
  }

  /* 324px, plus the sheet's overlap, is everything else on the screen: the bar, the heading, the numbers
     and the words, less the 32px the painting tucks under them. */
  .play.is-story .play__stage {
    width: min(calc(100% + 2 * var(--pad) + var(--bleed)), calc((100svh - 324px - var(--sheet)) * 1.5));
  }

  /* On a phone the numbers sit in a row, with only the current step's words beneath. */
  .play.is-story .play__steps {
    grid-template-columns: repeat(4, 36px);
    justify-content: center;
    gap: 10px 18px;
  }

  .play.is-story .play__step {
    display: contents;
  }

  .play.is-story .play__step::before,
  .play.is-story .play__step::after {
    display: none;
  }

  .play.is-story .play__num {
    grid-row: 1;
    width: 36px;
    height: 36px;
  }

  .play.is-story .play__step > div {
    grid-area: 2 / 1 / 3 / -1;
    justify-self: center;
    width: min(100vw - 2 * var(--pad), 30rem);
    opacity: 0;
    text-align: center;
    visibility: hidden;
    transition:
      opacity 0.4s ease,
      visibility 0s 0.4s;
  }

  .play.is-story .play__step.is-on > div {
    opacity: 1;
    visibility: visible;
    transition:
      opacity 0.4s 0.15s ease,
      visibility 0s;
  }

  .play.is-story .play__step h3 {
    margin-top: 0;
  }

  .play.is-story .play__step p,
  .play.is-story .play__step.is-on p {
    height: auto;
    margin-top: 6px;
    opacity: 1;
  }
}

/* On a phone the painting runs a little off both sides of the screen, which makes it taller. */
@media (max-width: 600px) {
  .play__stage {
    --bleed: 16vw;
  }

  /* The fan of cards moves in a touch, so the right-hand card stays on the screen. */
  .play__cards {
    left: 42.5%;
  }
}

/* ───────────────────────── 7. A legend ───────────────────────── */

/* A candle-lit violet, for story time. */
.sheet--dusk {
  background:
    radial-gradient(56% 44% at 50% 60%, rgba(252, 221, 183, 0.11), rgba(252, 221, 183, 0) 72%),
    linear-gradient(180deg, #27153f 0%, var(--c-dusk) 52%, #120a22 100%);
}

/* Room above the card for the ghost that peeks over it. */
.legend .section__head {
  margin-bottom: clamp(96px, 13vw, 150px);
}

/* The story card: a page edged in the gold of the collectible cards. */
.tale {
  --gold: 230, 200, 143;
  position: relative;
  width: min(100%, 900px);
  margin-inline: auto;
  padding: clamp(24px, 4.6vw, 54px);
  border-radius: 30px;
  background: linear-gradient(180deg, rgba(13, 7, 27, 0.82), rgba(13, 7, 27, 0.6));
  box-shadow:
    inset 0 0 0 1px rgba(var(--gold), 0.55),
    0 40px 80px rgba(0, 0, 0, 0.45),
    0 0 130px rgba(252, 221, 183, 0.09);
}

/* A second, fainter line inside the first, with a sparkle star in each corner. */
.tale::before {
  --star: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23FCDDB7' d='M12 0c1 7 4 10 12 12-8 2-11 5-12 12-1-7-4-10-12-12 8-2 11-5 12-12z'/%3E%3C/svg%3E");
  content: '';
  position: absolute;
  inset: 9px;
  border: 1px solid rgba(var(--gold), 0.2);
  border-radius: 22px;
  background:
    var(--star) left 9px top 9px / 13px no-repeat,
    var(--star) right 9px top 9px / 13px no-repeat,
    var(--star) left 9px bottom 9px / 13px no-repeat,
    var(--star) right 9px bottom 9px / 13px no-repeat;
  pointer-events: none;
}

/* The card is dealt onto the page as it scrolls in. */
.scrolly .tale {
  opacity: calc(0.25 + var(--k) * 0.75);
  transform: translateY(calc((1 - var(--k)) * 70px)) rotate(calc((1 - var(--k)) * -1.6deg));
}

/*
 * The listener. A window that ends at the card's top edge, so the ghost inside it seems to
 * peek over the card: it rises as the card arrives, and its face changes as the story turns.
 */
.tale__ghost {
  position: absolute;
  right: clamp(22px, 8%, 76px);
  bottom: calc(100% - 1px);
  width: clamp(92px, 15vw, 150px);
  aspect-ratio: 1 / 0.97;
  overflow: hidden;
}

.tale__ghost img {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: auto;
  opacity: 0;
  transform: translateY(calc((1 - var(--k)) * 100%));
  animation: peek 4.4s ease-in-out infinite alternate;
}

@keyframes peek {
  from {
    translate: 0 2%;
  }
  to {
    translate: 0 9%;
  }
}

/* Calm, then uneasy, then a gasp. Without scroll motion the story is all there, so it gasps. */
.tale__ghost img[data-face='2'] {
  opacity: 1;
}

.scrolly .tale__ghost img[data-face='0'] {
  opacity: clamp(0, calc((0.52 - var(--e)) * 50), 1);
}

.scrolly .tale__ghost img[data-face='1'] {
  opacity: clamp(0, min(calc((var(--e) - 0.52) * 50), calc((0.72 - var(--e)) * 50)), 1);
}

.scrolly .tale__ghost img[data-face='2'] {
  opacity: clamp(0, calc((var(--e) - 0.72) * 50), 1);
}

/* While "Tell me another" replays the story, site.js names the beat instead. */
.tale[data-beat] .tale__ghost img[data-face] {
  opacity: 0;
}

.tale[data-beat='0'] .tale__ghost img[data-face='0'],
.tale[data-beat='1'] .tale__ghost img[data-face='1'],
.tale[data-beat='2'] .tale__ghost img[data-face='2'] {
  opacity: 1;
}

.tale__place {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 clamp(18px, 2.8vw, 30px);
}

.tale__icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: rgba(var(--gold), 0.14);
  color: var(--card-gold);
}

.tale__icon .icon {
  width: 25px;
  height: 25px;
}

.tale__names {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.tale__name {
  color: var(--ghost-cream);
  font: 600 1.0625rem / 1.25 var(--font-ui);
}

.tale__where {
  color: var(--label-2);
  font: 400 0.875rem / 1.3 var(--font-ui);
}

.tale__tag {
  flex: none;
  margin-left: auto;
  padding: 7px 12px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(var(--gold), 0.55);
  color: var(--card-gold);
  font: 600 0.75rem / 1 var(--font-ui);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tale__line {
  margin: 0;
  color: var(--ghost-cream);
  font: 500 clamp(1.3rem, 2.55vw, 2rem) / 1.27 var(--font-brand);
  letter-spacing: -0.012em;
  text-wrap: pretty;
}

.tale__line + .tale__line {
  margin-top: 0.68em;
}

/* The last line is the cliffhanger. */
.tale__line--cliff {
  color: var(--star);
  font-weight: 700;
}

/* Each line lights up in turn as the card travels up the screen. */
.scrolly .tale__line {
  --lit: clamp(0, calc((var(--e) - 0.3 - var(--i) * 0.17) / 0.16), 1);
  opacity: calc(0.13 + var(--lit) * 0.87);
  transform: translateY(calc((1 - var(--lit)) * 10px));
}

/* "Tell me another": the new story arrives a line at a time. */
.tale.is-telling .tale__place,
.tale.is-telling .tale__line {
  animation: tale-in 0.6s var(--out) both;
  animation-delay: calc(0.12s + var(--i, 0) * 0.5s);
}

.tale.is-telling .tale__place {
  animation-delay: 0s;
}

@keyframes tale-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

.tale__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 24px;
  margin-top: clamp(24px, 3.6vw, 42px);
  padding-top: clamp(18px, 2.6vw, 28px);
  border-top: 1px solid rgba(var(--gold), 0.22);
}

.tale__more {
  margin: 0;
  color: var(--accent);
  font: 600 1.0625rem / 1.35 var(--font-ui);
}

.tale__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tale__actions .gh-btn {
  min-height: 48px;
  border-radius: 999px;
}

.tale__next .icon {
  width: 20px;
  height: 20px;
}

@media (max-width: 520px) {
  .tale {
    border-radius: 26px;
  }

  .tale__tag {
    display: none;
  }

  .tale__actions,
  .tale__actions .gh-btn {
    width: 100%;
  }
}

/* ───────────────────────── 8. The map ───────────────────────── */

.stats {
  display: grid;
  grid-template-columns: repeat(3, auto);
  justify-content: start;
  gap: 16px clamp(20px, 4vw, 44px);
  margin: 34px 0 0;
}

.stats div {
  display: grid;
  gap: 6px;
}

.stats dt {
  color: var(--label-2);
  font: 500 0.875rem / 1.3 var(--font-ui);
}

.stats dd {
  order: -1;
  margin: 0;
  color: var(--accent);
  font: 700 clamp(2.2rem, 4vw, 3.2rem) / 1 var(--font-brand);
  font-variant-numeric: tabular-nums;
}

.mapcard {
  position: relative;
  overflow: hidden;
  border-radius: 32px;
  background: #15171b;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 40px 80px rgba(0, 0, 0, 0.55),
    0 0 120px rgba(106, 240, 191, 0.12);
}

/* The card tips up into place, like a map being unfolded. */
.scrolly .mapcard {
  transform: perspective(1400px) rotateX(calc((1 - var(--k)) * 22deg)) translateY(calc((1 - var(--k)) * 70px)) scale(calc(0.88 + var(--k) * 0.12));
  transform-origin: 50% 100%;
}

.mapcard__map {
  position: relative;
  container-type: size;
  aspect-ratio: 16 / 11;
  overflow: hidden;
}

/* The picture is the app's night map as it is. At this size it wants a little more light. */
.mapcard .mapfit__img {
  filter: brightness(1.6) contrast(1.1);
}

.mapcard .pin {
  --pin: clamp(17px, 2.1vw, 24px);
  --fall: -340px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: scale 0.5s var(--spring);
}

.mapcard .pin::before {
  /* A bigger target than the drawing. */
  content: '';
  position: absolute;
  inset: -8px;
}

@media (hover: hover) {
  .mapcard .pin:hover {
    z-index: 2;
    scale: 1.25;
  }
}

.mapcard .pin.is-on {
  z-index: 3;
  scale: 1.6;
}

.pin.is-on .pin__body {
  stroke: #fff;
  stroke-width: 2.5;
}

.placecard {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  /* Tall enough for the longest story, so the card never jumps as places change. */
  min-height: 160px;
  padding: 16px 16px 18px;
  background: var(--bg-elevated);
  box-shadow: inset 0 0.5px 0 var(--edge-bar);
}

.placecard__icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--accent-wash);
  color: var(--accent);
}

.placecard__icon .icon {
  width: 26px;
  height: 26px;
}

.placecard__text {
  min-width: 0;
  transition:
    opacity 0.2s ease,
    transform 0.3s var(--out);
}

.placecard.is-swapping .placecard__text {
  opacity: 0;
  transform: translateY(6px);
}

.placecard__name {
  display: block;
  font: 600 1.0625rem / 1.25 var(--font-ui);
}

.placecard__where {
  display: block;
  margin-top: 2px;
  color: var(--accent);
  font: 500 0.8125rem / 1.3 var(--font-ui);
}

.placecard__story {
  display: -webkit-box;
  margin: 6px 0 0;
  overflow: hidden;
  color: var(--label-2);
  font: 400 0.875rem / 1.42 var(--font-ui);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  line-clamp: 4;
}

@media (max-width: 520px) {
  .placecard {
    min-height: 200px;
  }

  /* On a phone the story runs the full width of the card, under the picture and the arrow. */
  .placecard__story {
    width: calc(100% + 116px);
    margin: 12px -56px 0 -60px;
    -webkit-line-clamp: 5;
    line-clamp: 5;
  }
}

.placecard__next {
  display: grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-left: auto;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--fill-3);
  color: var(--label);
  cursor: pointer;
  transition: transform 0.1s ease-out;
}

.placecard__next:active {
  transform: scale(0.94);
}

/* Find my nearest haunt. */
.finder {
  margin-top: 30px;
  padding-top: 28px;
  border-top: 1px solid rgba(106, 240, 191, 0.2);
}

.finder__title {
  margin: 0 0 16px;
  color: var(--ghost-cream);
  font: 700 clamp(1.4rem, 2.3vw, 1.8rem) / 1.1 var(--font-brand);
  letter-spacing: -0.012em;
}

.finder__go {
  min-height: 54px;
  padding: 0 24px 0 18px;
  border-radius: 999px;
  box-shadow: var(--glow-accent);
}

.finder__go .icon {
  width: 22px;
  height: 22px;
  stroke-width: 2;
}

/* Looking for you: the target ticks round. */
.finder__go.is-busy .icon {
  animation: seek 1.1s linear infinite;
}

@keyframes seek {
  to {
    rotate: 360deg;
  }
}

.finder__or {
  margin: 20px 0 10px;
  color: var(--label-2);
  font: 600 0.75rem / 1 var(--font-ui);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.finder__cities {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.city {
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.13);
  color: var(--label);
  font: 500 0.9375rem / 1 var(--font-ui);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition:
    transform 0.1s ease-out,
    background-color 0.15s ease,
    box-shadow 0.15s ease,
    color 0.15s ease;
}

@media (hover: hover) {
  .city:hover {
    background: rgba(255, 255, 255, 0.15);
  }
}

.city:active {
  transform: scale(0.95);
}

.city[aria-pressed='true'] {
  background: var(--accent-wash);
  box-shadow: inset 0 0 0 1.5px var(--accent);
  color: var(--accent);
}

.finder__note {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 16px 0 0;
  color: rgba(235, 235, 245, 0.56);
  font: 400 0.8125rem / 1.4 var(--font-ui);
}

.finder__note .icon {
  width: 15px;
  height: 15px;
}

.finder__note.is-warn {
  color: var(--star);
}

.finder__note.is-warn .icon {
  display: none;
}

/* The three nearest, dealt out under both columns. */
.near {
  margin-top: clamp(44px, 6vw, 76px);
}

.near__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 24px;
  margin-bottom: 20px;
}

.near__title {
  margin: 0;
  outline: none;
  color: var(--ghost-cream);
  font: 700 clamp(1.7rem, 3.2vw, 2.5rem) / 1.05 var(--font-brand);
  letter-spacing: -0.016em;
}

.near__sub {
  margin: 0;
  color: var(--label-2);
  font: 400 1.0625rem / 1.4 var(--font-ui);
}

.near__list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.haunt {
  --i: 0;
  padding: 20px 20px 24px;
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(2, 14, 10, 0.78), rgba(2, 14, 10, 0.52));
  box-shadow:
    inset 0 0 0 1px rgba(106, 240, 191, 0.22),
    0 24px 50px rgba(0, 0, 0, 0.35);
  animation: deal 0.75s calc(0.05s + var(--i) * 0.11s) var(--spring) both;
}

/* Dealt like cards: each lands a little after the one before, from a slight tilt. */
@keyframes deal {
  from {
    opacity: 0;
    transform: translateY(40px) rotate(calc((var(--i) - 1) * 3deg)) scale(0.94);
  }
}

.haunt__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.haunt__icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: var(--accent-wash);
  color: var(--accent);
}

.haunt__icon .icon {
  width: 25px;
  height: 25px;
}

.haunt__miles {
  padding: 8px 13px;
  border-radius: 999px;
  background: var(--accent);
  color: #000;
  font: 700 0.9375rem / 1 var(--font-ui);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.haunt__name {
  margin: 0;
  color: var(--ghost-cream);
  font: 700 1.35rem / 1.14 var(--font-brand);
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.haunt__where {
  margin: 7px 0 0;
  color: var(--accent);
  font: 500 0.8125rem / 1.3 var(--font-ui);
}

.haunt__story {
  margin: 12px 0 0;
  color: rgba(235, 235, 245, 0.72);
  font: 400 0.9375rem / 1.46 var(--font-ui);
  text-wrap: pretty;
}

.near__cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  margin-top: 26px;
}

.near__cta .gh-btn {
  border-radius: 999px;
}

/* Nothing close by: say where you are, and we will come looking. */
.ask {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr);
  align-items: center;
  gap: 16px 36px;
  margin-top: 18px;
  padding: clamp(20px, 3vw, 30px);
  border-radius: 26px;
  background: rgba(106, 240, 191, 0.08);
  box-shadow: inset 0 0 0 1px rgba(106, 240, 191, 0.3);
  animation: deal 0.75s 0.4s var(--spring) both;
}

.ask__title {
  margin: 0;
  color: var(--ghost-cream);
  font: 700 clamp(1.35rem, 2.3vw, 1.75rem) / 1.1 var(--font-brand);
  letter-spacing: -0.012em;
  text-wrap: balance;
}

.ask__lede {
  margin: 8px 0 0;
  color: var(--label-2);
  font: 400 1rem / 1.45 var(--font-ui);
}

.ask__fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr) auto;
  align-items: end;
  gap: 10px;
}

.ask__field {
  display: grid;
  gap: 7px;
}

.ask__field span {
  color: var(--label-2);
  font: 500 0.8125rem / 1 var(--font-ui);
}

.ask__field input {
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--r-md);
  background: rgba(0, 0, 0, 0.4);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
  color: var(--label);
  /* 17px: anything smaller makes an iPhone zoom in when the box is tapped. */
  font: 400 17px / 22px var(--font-ui);
}

.ask__field input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.ask__field input[aria-invalid='true'] {
  box-shadow: inset 0 0 0 1.5px var(--star);
}

.ask__send {
  border-radius: 999px;
  white-space: nowrap;
}

.ask__fine,
.ask__status {
  grid-column: 1 / -1;
  margin: 0;
  color: rgba(235, 235, 245, 0.56);
  font: 400 0.8125rem / 1.45 var(--font-ui);
}

.ask__status {
  color: var(--accent);
  font: 600 0.9375rem / 1.45 var(--font-ui);
}

.ask__status:empty {
  display: none;
}

.ask__status.is-warn {
  color: var(--star);
}

/* Sent: the boxes go, the thank-you stays. */
.ask.is-done .ask__fields,
.ask.is-done .ask__fine,
.ask.is-done .ask__lede {
  display: none;
}

@media (max-width: 900px) {
  .ask {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  .near__list {
    grid-template-columns: minmax(0, 1fr);
  }

  .ask__fields {
    grid-template-columns: minmax(0, 1fr);
  }

  .ask__send {
    margin-top: 4px;
  }
}

/* ───────────────────────── 9. Together ───────────────────────── */

.trio {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

@media (max-width: 980px) {
  .trio {
    grid-template-columns: minmax(0, 1fr);
    max-width: 520px;
    margin-inline: auto;
  }
}

.tile {
  padding: 12px 12px 28px;
  border-radius: 32px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* The three tiles swing up into line, the outer two from a slight tilt. */
.scrolly .tile {
  opacity: calc(0.15 + var(--k) * 0.85);
  transform: translateY(calc((1 - var(--k)) * 90px)) rotate(calc((1 - var(--k)) * var(--tilt, 0deg)));
}

.tile__art {
  position: relative;
  /* A set width, so the minimum height below can never push a tile's picture wider than the tile. */
  width: 100%;
  aspect-ratio: 1100 / 855;
  overflow: hidden;
  border-radius: 22px;
  background:
    radial-gradient(80% 70% at 50% 100%, rgba(106, 240, 191, 0.15), rgba(106, 240, 191, 0) 70%),
    var(--c-night);
}

.tile h3 {
  margin: 24px 16px 0;
  color: var(--ghost-cream);
  font: 700 1.5rem / 1.15 var(--font-brand);
  letter-spacing: -0.01em;
}

.tile > p {
  margin: 10px 16px 0;
  color: rgba(235, 235, 245, 0.72);
  font: 400 1rem / 1.5 var(--font-ui);
}

.tile__note {
  position: absolute;
  right: 14px;
  bottom: 10px;
  color: rgba(235, 235, 245, 0.55);
  font: 500 0.6875rem / 1 var(--font-ui);
  letter-spacing: 0.02em;
}

/* Crew: the right-hand side of the "go there" painting, with four ghosts on its dotted path. */
.crew {
  background: var(--c-night) url('../assets/img/scenes/go.webp') 94.9% 37.6% / 186.2% auto no-repeat;
}

.crew__ghost {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--w);
  height: auto;
  /* Feet on the path. On the way in they hurry up from further down the hill. */
  transform: translate(calc(-50% - (1 - var(--k)) * 46%), calc(-100% + (1 - var(--k)) * 40%));
  filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.5));
  animation: hop 1.1s var(--h, 0s) ease-in-out infinite;
}

@keyframes hop {
  0%,
  100% {
    translate: 0 0;
    rotate: -2deg;
  }
  50% {
    translate: 0 -9px;
    rotate: 3deg;
  }
}

/* The posts and the board need a certain height however narrow the phone. */
.feed,
.board {
  min-height: 252px;
}

/* Feed: three posts in a pile; the front one lifts away and the next steps up. */
.feed {
  display: grid;
  place-items: center;
  padding: 0 20px 30px;
}

.post {
  grid-area: 1 / 1;
  width: 100%;
  max-width: 310px;
  min-height: 132px;
  padding: 14px 16px;
  border-radius: 20px;
  background: var(--bg-elevated-2);
  box-shadow:
    0 14px 30px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
  transition:
    transform 0.7s var(--out),
    opacity 0.5s ease;
}

.post > * {
  transition: opacity 0.35s ease;
}

.post[data-pos='0'] {
  z-index: 3;
}

.post[data-pos='1'] {
  z-index: 2;
  opacity: 0.7;
  transform: translateY(20px) scale(0.93);
}

.post[data-pos='2'] {
  z-index: 1;
  opacity: 0.4;
  transform: translateY(38px) scale(0.86);
}

/* The posts waiting behind are blank cards: only the front one is read. */
.post[data-pos='1'] > *,
.post[data-pos='2'] > * {
  opacity: 0;
}

.post[data-pos='out'] {
  z-index: 4;
  opacity: 0;
  transform: translateY(-40px) scale(1.03) rotate(-3deg);
}

.post.is-jump {
  transition: none;
}

.post__top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.post__face {
  flex: none;
  width: 38px;
  height: 38px;
}

.post__who strong {
  display: block;
  font: 600 0.9375rem / 1.2 var(--font-ui);
}

.post__who span {
  color: var(--label-2);
  font: 400 0.75rem / 1.3 var(--font-ui);
}

.post p {
  margin: 10px 0 0;
  color: var(--label);
  font: 400 0.9375rem / 1.4 var(--font-ui);
}

.post__foot {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  color: var(--label-2);
  font: 500 0.8125rem / 1 var(--font-ui);
  font-variant-numeric: tabular-nums;
}

.post__foot span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.post__foot .icon {
  width: 16px;
  height: 16px;
}

.post__foot span:first-child .icon {
  color: var(--ghost-blush);
}

/* Board: four rows; yours earns 500 XP and climbs a place. */
.board {
  display: grid;
  align-content: center;
  padding: 0 16px 14px;
}

.board__list {
  position: relative;
  height: 216px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.board__list li {
  position: absolute;
  inset: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 0 14px 0 6px;
  border-radius: 16px;
  background: #121a30;
  transform: translateY(calc(var(--row) * 56px));
  transition: transform 0.9s var(--spring);
}

.board__list li::before {
  content: attr(data-rank);
  width: 24px;
  color: var(--label-2);
  font: 700 0.875rem / 1 var(--font-ui);
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.board__face {
  flex: none;
  width: 34px;
  height: 34px;
}

.board__list strong {
  font: 600 0.9375rem / 1 var(--font-ui);
}

.board__xp {
  margin-left: auto;
  color: var(--label-2);
  font: 600 0.8125rem / 1 var(--font-ui);
  font-variant-numeric: tabular-nums;
}

.board__list .board__you {
  z-index: 1;
  background: #1d3a31;
}

.board__you strong,
.board__you .board__xp {
  color: var(--accent);
}

.board__gain {
  margin-left: auto;
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--accent);
  color: #000;
  font: 700 0.6875rem / 1 var(--font-ui);
  opacity: 0;
  scale: 0.6;
  transition:
    opacity 0.3s ease,
    scale 0.5s var(--spring);
}

.board__gain + .board__xp {
  margin-left: 8px;
}

.board.is-up .board__gain {
  opacity: 1;
  scale: 1;
}

/* ───────────────────────── 10. Cards ───────────────────────── */

[data-rarity='common'] {
  --rarity: #a7aebb;
  --rarity-glow: rgba(167, 174, 187, 0.3);
}

[data-rarity='uncommon'] {
  --rarity: #4da3ff;
  --rarity-glow: rgba(77, 163, 255, 0.4);
}

[data-rarity='rare'] {
  --rarity: #ff4f62;
  --rarity-glow: rgba(255, 79, 98, 0.42);
}

[data-rarity='ultra'] {
  --rarity: #ffd24a;
  --rarity-glow: rgba(255, 210, 74, 0.55);
}

/*
 * A card is two boxes. .ccard is its place in a fan: it turns and slides, and it is what the
 * pointer touches. .ccard__in is the card you see. Hovering lifts only the inner box, so the
 * part under the pointer never moves away and the card cannot flicker.
 */
.ccard {
  aspect-ratio: 2 / 3;
}

/* The card as the app draws it: art, numeral, name plate, rarity. Its text scales with it. */
.ccard__in {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 7% / 4.67%;
  background: #17143f;
  outline: 2px solid var(--rarity, #3a3470);
  outline-offset: -2px;
  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.55),
    0 0 34px var(--rarity-glow, transparent);
  container-type: inline-size;
  color: #fff;
  text-align: center;
  transition:
    transform 0.3s var(--out),
    box-shadow 0.3s ease;
}

.ccard__in img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ccard__numeral {
  position: absolute;
  left: 50%;
  top: 3.6cqw;
  padding: 0.6cqw 3.4cqw;
  border-radius: 99cqw;
  background: rgba(15, 13, 46, 0.78);
  color: var(--rarity);
  font: 600 5.6cqw / 1.3 var(--font-brand);
  transform: translateX(-50%);
}

.ccard__plate {
  position: absolute;
  inset: auto 0 0;
  display: grid;
  gap: 0.6cqw;
  padding: 10cqw 4cqw 6cqw;
  background: linear-gradient(0deg, rgba(15, 13, 46, 0.96) 58%, rgba(15, 13, 46, 0));
}

.ccard__name {
  font: 600 8.6cqw / 1.12 var(--font-brand);
}

.ccard__rarity {
  color: var(--rarity);
  font: 700 4.3cqw / 1.3 var(--font-ui);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Gold cards catch the light. */
.ccard[data-rarity='ultra'] .ccard__in::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 55%;
  background: linear-gradient(90deg, transparent, rgba(255, 244, 200, 0.42), transparent);
  animation: foil-sweep 3.4s ease-in-out infinite;
  pointer-events: none;
}

@keyframes foil-sweep {
  0%,
  55% {
    transform: translateX(-130%) skewX(-18deg);
  }
  100% {
    transform: translateX(230%) skewX(-18deg);
  }
}

/* ───────────────────────── 11. Collect ───────────────────────── */

.fan {
  position: relative;
  width: min(100%, 560px);
  aspect-ratio: 1 / 0.88;
  margin-inline: auto;
}

/* The five open out from one pile as the fan travels up the screen (--k goes from 0 to 1). */
.fan .ccard {
  position: absolute;
  left: 50%;
  top: 5%;
  /* Outer cards sit behind inner ones, as in a hand of cards. */
  z-index: var(--z, 0);
  width: 32%;
  translate: -50% 0;
  transform: translate(calc(var(--x) * var(--k)), calc(var(--y) * var(--k))) rotate(calc(var(--r) * var(--k)));
  transform-origin: 50% 120%;
}

/* Pick a card: it slides up out of the hand, smoothly, and slides back the same way. */
@media (hover: hover) {
  .fan .ccard:hover .ccard__in {
    box-shadow:
      0 30px 50px rgba(0, 0, 0, 0.6),
      0 0 54px var(--rarity-glow, transparent);
    transform: translateY(-9%);
  }
}

.fan__pack,
.fan__medal {
  position: absolute;
  z-index: 3;
  height: auto;
  filter: drop-shadow(0 20px 30px rgba(0, 0, 0, 0.6));
  opacity: var(--k);
}

.fan__pack {
  left: 7%;
  bottom: 0;
  width: 25%;
  transform: translate(calc((1 - var(--k)) * -70px), calc((1 - var(--k)) * 60px)) rotate(calc(-10deg - (1 - var(--k)) * 24deg));
  animation: floaty 6s ease-in-out infinite alternate;
}

.fan__medal {
  right: 9%;
  bottom: 4%;
  width: 22%;
  transform: translate(calc((1 - var(--k)) * 70px), calc((1 - var(--k)) * 60px)) rotate(calc(8deg + (1 - var(--k)) * 30deg));
  animation: floaty 7s -2s ease-in-out infinite alternate;
}

.ticks {
  display: grid;
  gap: 12px;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
}

.ticks li {
  display: flex;
  align-items: center;
  gap: 12px;
  font: 500 1.02rem / 1.35 var(--font-ui);
}

.ticks .icon {
  box-sizing: content-box;
  width: 20px;
  height: 20px;
  padding: 7px;
  border-radius: 50%;
  background: rgba(106, 240, 191, 0.2);
  color: var(--accent);
}

.rarities {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
}

.rarities li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  font: 600 0.8125rem / 1 var(--font-ui);
}

.rarities li::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--rarity);
  box-shadow: 0 0 10px var(--rarity-glow);
}

/* The sky painting is busiest at its edges: calm it behind the words. */
.sheet--indigo::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(70% 60% at 50% 50%, rgba(23, 20, 63, 0.86), rgba(23, 20, 63, 0.3) 100%);
}

/* ───────────────────────── 12. Your ghost ───────────────────────── */

.maker {
  display: grid;
  justify-items: center;
  gap: 22px;
}

/* The moonlit hilltop from the app's profile screen, cropped square around the moon and the ring. */
.maker__stage {
  position: relative;
  width: min(100%, 480px);
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 40px;
  background: var(--c-night);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 40px 80px rgba(0, 0, 0, 0.5),
    0 0 110px rgba(106, 240, 191, 0.12);
}

.scrolly .maker__stage {
  transform: scale(calc(0.9 + var(--k) * 0.1));
}

.maker__scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
}

/* The ghost stands in the painted ring, in front of the moon. It rises into place on scroll. */
.maker__ghost {
  position: absolute;
  left: 27%;
  bottom: 18%;
  width: 46%;
  transform: translateY(calc((1 - var(--k)) * 34%)) scale(calc(0.82 + var(--k) * 0.18));
  transform-origin: 50% 100%;
  opacity: var(--k);
  animation: floaty 4.6s ease-in-out infinite alternate;
}

.maker__ghost img,
.maker__ghost svg {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 18px 22px rgba(0, 0, 0, 0.45));
}

/* The fallback picture has no room above its head; the drawn ghost does. Sit them the same. */
.maker__ghost img {
  width: 82%;
  margin: 0 auto;
}

.maker__ghost.is-pop svg {
  animation: pop-in 0.5s var(--spring);
}

@keyframes pop-in {
  from {
    rotate: -5deg;
    scale: 0.84;
  }
}

.maker__controls {
  display: grid;
  gap: 14px;
  margin-top: 30px;
}

.opt {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.opt__label {
  color: var(--label-2);
  font: 600 0.8125rem / 1 var(--font-ui);
  letter-spacing: 0.02em;
}

/* A row you can swipe sideways when it does not fit. */
.opt__row {
  display: flex;
  gap: 8px;
  margin: -4px;
  padding: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.opt__row.is-scrolly {
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent);
  mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent);
}

.opt__row::-webkit-scrollbar {
  display: none;
}

.opt__btn {
  display: grid;
  flex: none;
  place-items: center;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition:
    transform 0.1s ease-out,
    background-color 0.15s ease,
    box-shadow 0.15s ease;
}

.opt__btn svg {
  width: 34px;
  height: auto;
  pointer-events: none;
}

@media (hover: hover) {
  .opt__btn:hover {
    background: rgba(255, 255, 255, 0.14);
  }
}

.opt__btn:active {
  transform: scale(0.93);
}

.opt__btn[aria-pressed='true'] {
  background: var(--accent-wash);
  box-shadow: inset 0 0 0 2px var(--accent);
}

.opt__row--swatch .opt__btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.2);
}

.opt__row--swatch .opt__btn[aria-pressed='true'] {
  background: var(--c);
  box-shadow:
    0 0 0 2px var(--c-night),
    0 0 0 4px var(--accent);
}

.maker__count {
  margin: 26px 0 0;
  color: var(--label-2);
  font: 400 1rem / 1.4 var(--font-ui);
}

.maker__count strong {
  color: var(--accent);
  font: 700 1.3rem / 1 var(--font-brand);
  font-variant-numeric: tabular-nums;
}

.maker__shuffle {
  min-height: 46px;
  border-radius: 999px;
  font-size: 1rem;
}

.maker__shuffle .icon {
  width: 20px;
  height: 20px;
}

/* ───────────────────────── 13. Download ───────────────────────── */

.cta {
  /* The painting is sized from this height, so the ghost always lands on the moon. */
  --h: clamp(560px, 62vw, 820px);
  --ax: 67%;
  isolation: isolate;
  display: grid;
  align-items: center;
  height: var(--h);
  overflow: clip;
  background: var(--c-night);
}

.cta__art {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
}

/* The moon is 63.9% across the painting. --ax says where on the page that should fall. */
.cta__scene {
  --w: calc(var(--h) * 1.7684);
  position: absolute;
  top: 0;
  left: calc(var(--ax) - var(--w) * 0.639);
  width: var(--w);
  height: var(--h);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
}

.cta__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
}

/* The ghost floats up in front of the moon as the section arrives. */
.cta__ghost {
  position: absolute;
  left: 64.4%;
  top: 55.4%;
  width: auto;
  height: 41.4%;
  max-width: none;
  transform: translate(-50%, calc(-50% + (1 - var(--k)) * 34%));
  filter: drop-shadow(0 20px 24px rgba(0, 0, 0, 0.4));
  animation: bob 5s ease-in-out infinite alternate;
}

.cta__shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(3, 10, 30, 0.96) 0, rgba(3, 10, 30, 0.86) 30%, rgba(3, 10, 30, 0) 54%),
    linear-gradient(180deg, rgba(3, 10, 30, 0) 84%, var(--c-night) 100%);
}

.cta__copy {
  display: grid;
  justify-items: start;
}

.cta__copy > * {
  max-width: min(46%, 520px);
}

.cta h2 {
  font-size: clamp(2.6rem, 6.4vw, 5.2rem);
  line-height: 0.96;
}

.cta .stores {
  justify-content: flex-start;
}

.cta .fine {
  color: rgba(235, 235, 245, 0.66);
}

@media (max-width: 760px) {
  /* Words on top, moon and ghost beneath. */
  .cta {
    --h: 900px;
    --ax: 50%;
    align-items: start;
    padding-top: 72px;
  }

  .cta__scene {
    --w: calc(var(--h) * 0.66 * 1.7684);
    top: 34%;
    height: 66%;
  }

  .cta__shade {
    background:
      linear-gradient(180deg, var(--c-night) 0, rgba(3, 10, 30, 0.92) 30%, rgba(3, 10, 30, 0) 52%),
      linear-gradient(180deg, rgba(3, 10, 30, 0) 86%, var(--c-night) 100%);
  }

  .cta__copy {
    justify-items: center;
    text-align: center;
  }

  .cta__copy > * {
    max-width: 100%;
  }

  .cta .stores {
    justify-content: center;
  }
}

/* ───────────────────────── 14. Footer ───────────────────────── */

.foot {
  position: relative;
  z-index: 1;
  padding: 56px 0 calc(40px + env(safe-area-inset-bottom, 0px));
  background: var(--c-night);
}

.foot__in {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 24px 40px;
}

.foot__brand img {
  display: block;
  width: auto;
  height: 34px;
}

.foot__brand p {
  margin: 12px 0 0;
  color: var(--label-2);
  font: 400 0.9375rem / 1.4 var(--font-ui);
}

.foot__links {
  display: flex;
  gap: 24px;
}

.foot__links a {
  padding: 10px 0;
  color: var(--label);
  font: 500 0.9375rem / 1 var(--font-ui);
  text-decoration: none;
}

.foot__links a:hover {
  color: var(--accent);
}

.foot__fine {
  grid-column: 1 / -1;
  margin: 0;
  padding-top: 24px;
  border-top: 0.5px solid var(--separator);
  color: rgba(235, 235, 245, 0.56);
  font: 400 0.8125rem / 1.5 var(--font-ui);
}

.foot__fine a {
  color: inherit;
}

@media (max-width: 600px) {
  .foot__in {
    grid-template-columns: 1fr;
    align-items: start;
  }
}

/* ───────────────────────── 15. Motion preferences ───────────────────────── */

/* Reduce Motion: nothing loops, nothing slides, nothing follows the scroll. Things simply appear. */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }

  .js [data-reveal] {
    transform: none;
  }

  .js .pins:not(.is-in) > .pin {
    opacity: 1;
  }

  .app__ping {
    display: none;
  }
}

/* Reduce Transparency: the frosted layers turn solid. */
@media (prefers-reduced-transparency: reduce) {
  .nav.is-stuck,
  .play__pill,
  .eyebrow {
    background: #161618;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}
