/* ============================================================
   Homepage beats (v2 — "Gallery Light").
   One light page; every beat shows work a different way:
   01 hero showcase · 02 two-up · 03 scattered gallery ·
   04 drifting band · 05 asymmetric split · 06 close.
   ============================================================ */

main { display: block; }

/* Shared container for the framed beats. */
.duo, .moyola, .split {
  width: min(var(--wide), calc(100% - 2 * var(--gutter)));
  margin-inline: auto;
}

.duo, .scatter, .moyola, .split, .about { margin-top: var(--beat); }

/* Anchored sections clear the fixed nav. */
.duo, .scatter, .moyola, .split, .about { scroll-margin-top: 4.5rem; }

/* ---- 01 · hero: the game, mounted ---------------------------- */

.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(5.5rem, 12vh, 8rem) 0 0;
}

/* A soft haze behind the showcase, in the game's own weather:
   causeway sky, sea teal, a touch of coin gold. */
.hero::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 44%;
  transform: translate(-50%, -50%);
  width: min(1250px, 96vw);
  height: min(72svh, 740px);
  background:
    radial-gradient(42% 52% at 32% 38%, rgba(130, 195, 240, 0.55), transparent 70%),
    radial-gradient(40% 55% at 70% 60%, rgba(52, 165, 160, 0.40), transparent 72%),
    radial-gradient(30% 40% at 55% 28%, rgba(248, 216, 130, 0.22), transparent 75%);
  filter: blur(clamp(40px, 7vw, 90px));
  z-index: -1;
  pointer-events: none;
}

/* The grow effect owns the stage's transform (scale with scroll),
   so its reveal is opacity-only, and quick. */
.js .stage.reveal {
  transform: none;
  transition: opacity 900ms var(--ease-fade);
  will-change: transform;
}

/* The card stays hidden until the live game has painted (or a short
   fallback shows the poster), so it fades in once, already moving —
   never a still that then cuts to a differently-framed game. */
.js .stage.reveal.in:not(.ready) { opacity: 0; }

.hero { --mount: clamp(10px, 1.1vw, 16px); }

/* The card hugs the media, so the white mount reads equal on all
   four sides at every viewport size. */
.stage {
  position: relative;
  width: fit-content;
  max-width: calc(100vw - 2 * var(--gutter));
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: var(--mount);
  box-shadow: var(--shadow-lift);
}

.stage-media {
  display: block;
  position: relative;
  border-radius: calc(var(--r-lg) * 0.62);
  overflow: hidden;
  background: var(--well);
  aspect-ratio: 1.9 / 1;
  width: min(
    calc(100vw - 2 * var(--gutter) - 2 * var(--mount)),
    calc(1500px - 2 * var(--mount)),
    calc(min(62svh, 790px) * 1.9)
  );
}

/* The game canvas is sized in whole device pixels by rua-stage —
   never clamp it (base.css's canvas max-width would squash the
   pixel grid); the frame crops the overflow instead. */
.stage-live canvas { max-width: none; }

/* The still: covers the frame until the live game takes over. */
.stage-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 100%;   /* crop sky, keep the ground */
  transition: opacity 900ms var(--ease-fade);
}

.stage-media.live .stage-poster { opacity: 0; }
.stage-media.instant .stage-poster { transition: none; }

/* The real game mounts here (shared/rua-stage.js): a canvas in whole
   device pixels, bottom-anchored so the ground always shows. */
.stage-live {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.video-toggle {
  position: absolute;
  right: calc(var(--mount) + 14px);
  bottom: calc(var(--mount) + 14px);
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background var(--dur-quick) ease, transform var(--dur-quick) ease;
}

.video-toggle:hover { background: #fff; transform: scale(1.06); }
.video-toggle svg { width: 13px; height: 13px; fill: var(--ink); }
.video-toggle .ic-play { display: none; }
.video-toggle.paused .ic-pause { display: none; }
.video-toggle.paused .ic-play { display: block; }

.stage-caption {
  width: min(
    calc(100vw - 2 * var(--gutter)),
    1500px,
    calc(min(62svh, 790px) * 1.9 + 2 * var(--mount))
  );
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  margin-top: 1rem;
  font-size: var(--size-caption);
  letter-spacing: var(--tracking-caption);
  color: var(--muted);
}

.stage-links { display: flex; gap: 1.5rem; white-space: nowrap; }

.stage-links a {
  color: var(--ink);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: transparent;
  transition: text-decoration-color 300ms ease;
}

.stage-links a:hover,
.stage-links a:focus-visible { text-decoration-color: currentColor; }

.hero-line {
  font-size: var(--size-hero);
  text-align: center;
  max-width: min(92vw, 17em);
  margin: clamp(2.5rem, 6.5vh, 5rem) auto 0;
  text-wrap: balance;
}

.hero-sub {
  margin-top: 1.2rem;
  text-align: center;
  font-size: 1.0625rem;
  color: var(--muted);
}

.hero-sub a {
  color: var(--ink);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--hairline);
  transition: text-decoration-color var(--dur-quick) ease;
}

.hero-sub a:hover,
.hero-sub a:focus-visible { text-decoration-color: var(--ink); }

/* ---- 02 · two-up grid ----------------------------------------- */

.row-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1.2rem;
}

.cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(1.25rem, 2.2vw, 2.25rem);
}

.card { display: block; }

.card-media {
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-rest);
  aspect-ratio: 4 / 3;
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 1100ms var(--ease-out);
}

.card:hover .card-media img,
.card:focus-visible .card-media img { transform: scale(1.025); }

.card-caption {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-top: 0.85rem;
  font-size: var(--size-caption);
  letter-spacing: var(--tracking-caption);
}

.card-caption span:first-child { font-weight: 500; color: var(--ink); }
.card-caption .meta { color: var(--muted); text-align: right; }

/* ---- 03 · Ceefax, scattered ------------------------------------ */

.scatter-field {
  position: relative;
  max-width: 1700px;
  margin-inline: auto;
  height: clamp(960px, 125vh, 1340px);
}

.sc {
  position: absolute;
  will-change: transform;
}

.sc img {
  width: 100%;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-rest);
}

.sc-1 { left: 2%;   top: 4%;     width: 34%; }
.sc-2 { right: 3%;  top: 0;      width: 26%; }
.sc-3 { left: 6%;   bottom: 6%;  width: 24%; }
.sc-4 { right: 6%;  bottom: 3%;  width: 22%; }
.sc-5 { left: 40%;  top: 0;      width: 19%; }
.sc-6 { right: 34%; bottom: 0;   width: 19%; }

.scatter-core {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(420px, 86vw);
  text-align: center;
}

.js .scatter-core.reveal { transform: translate(-50%, calc(-50% + var(--reveal-rise))); }
.scatter-core.reveal.in { transform: translate(-50%, -50%); }

.state { font-size: var(--size-state); }

.scatter-core .state { margin-top: 0.9rem; }

.note {
  color: var(--muted);
  font-size: 0.9375rem;
  margin-top: 0.9rem;
}

.quiet {
  display: inline-block;
  margin-top: 1.1rem;
  font-size: var(--size-caption);
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--hairline);
  transition: color var(--dur-quick) ease, text-decoration-color var(--dur-quick) ease;
}

.quiet:hover,
.quiet:focus-visible { color: var(--ink); text-decoration-color: var(--ink); }

/* ---- 04 · Moyola band ------------------------------------------ */

.band {
  display: block;
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-rest);
  padding: clamp(2.4rem, 5vw, 4.2rem) 0;
  overflow: hidden;
}

.marquee { overflow: hidden; }

.track {
  display: flex;
  align-items: center;
  width: max-content;
  animation: drift 52s linear infinite;
}

.track img {
  height: clamp(120px, 13.5vw, 210px);
  width: auto;
  margin-right: clamp(2.6rem, 5.5vw, 5rem);
}

@keyframes drift { to { transform: translateX(-50%); } }

.band:hover .track,
.band:focus-visible .track { animation-play-state: paused; }

@media (prefers-reduced-motion: reduce) {
  .track { animation: none; }
}

.reduced .track { animation: none; }

/* On touch there's no hover to pause it, so it barely moves. */
@media (hover: none) {
  .track { animation-duration: 140s; }
}

.under { margin-top: 0.85rem; }

/* ---- 05 · Footi split ------------------------------------------ */

.cols {
  display: grid;
  /* 0.2735 = (2/3) × (640/1560): the phone column's exact share, so
     both cards land at the same height with NEITHER image cropped —
     UI screenshots don't tolerate cropping. */
  grid-template-columns: 1fr 0.2735fr;
  gap: clamp(1.25rem, 2.2vw, 2.25rem);
  align-items: start;
}

.wide-card .card-media { aspect-ratio: 3 / 2; }

.tall-card .card-media { aspect-ratio: 640 / 1560; }

/* ---- 06 · about / contact -------------------------------------- */

.about {
  text-align: center;
  padding-inline: var(--gutter);
  margin-bottom: clamp(1rem, 4vh, 2rem);
}

.portrait {
  width: min(640px, 100%);
  margin-inline: auto;
}

.portrait img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-rest);
}

.about .state {
  max-width: 21ch;
  margin: clamp(2.6rem, 6vh, 4rem) auto 0;
  text-wrap: balance;
}

.about .note { margin-top: 1.1rem; }

.contact { margin-top: clamp(2.2rem, 5vh, 3.2rem); }

.mail {
  font-size: clamp(1.55rem, 3.4vw, 2.6rem);
  font-style: italic;
  text-decoration: underline;
  text-underline-offset: 6px;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--hairline);
  transition: text-decoration-color var(--dur-quick) ease;
}

.mail:hover,
.mail:focus-visible { text-decoration-color: var(--ink); }

.avail {
  margin-top: 1.7rem;
  font-size: var(--size-caption);
  color: var(--muted);
}

.avail .dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 0.55rem;
}

/* ---- responsive -------------------------------------------------- */

/* Mid widths: a shallower field, so the pieces stay close. */
@media (max-width: 1200px) and (min-width: 901px) {
  .scatter-field { height: clamp(780px, 92vh, 980px); }
}

@media (max-width: 900px) {
  /* The scattered gallery becomes a tidy two-column set. */
  .scatter-field {
    height: auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.9rem;
    padding-inline: var(--gutter);
  }

  .sc { position: static; width: auto !important; transform: none !important; }

  .scatter-core,
  .scatter-core.reveal {
    position: static;
    grid-column: 1 / -1;
    order: -1;
    transform: none;
    width: min(420px, 100%);
    margin: 0 auto 1.8rem;
  }

  .js .scatter-core.reveal { transform: translateY(var(--reveal-rise)); }

  .js .scatter-core.reveal.in,
  .scatter-core.reveal.in { transform: none; }
}

@media (max-width: 860px) {
  .cards { grid-template-columns: 1fr; }

  .stage-media { aspect-ratio: 16 / 9; }

  .cols { grid-template-columns: 1fr; }

  /* Stacked: the phone shot sits centred at phone width, whole. */
  .tall-card {
    width: min(64%, 300px);
    margin-inline: auto;
  }

  .stage-caption { flex-direction: column; gap: 0.5rem; }
}
