:root {
  --lime: #b6fa0c;            /* median lime of the reference mockup */
  --ink: #111111;
  --white: #ffffff;
  --sans: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --tech: "Play", "Eurostile", "Bank Gothic", var(--sans);
  --display: "Titan One", var(--sans);
  /* one reference unit: the mockup is a 1448-wide canvas, scaled down to fit narrower viewports */
  --u: min(1px, calc(100vw / 1448));
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--lime);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body.is-gated { overflow: hidden; }
img { display: block; max-width: 100%; height: auto; }
button { font: inherit; color: inherit; cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- PAGE 1 — GATE ---------- */
.gate {
  position: fixed; inset: 0; z-index: 20;
  background: var(--lime);
  display: grid; place-items: center;
  overflow: hidden;
}
.gate__texture { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.gate__inner {
  position: relative;
  display: flex; flex-direction: column; align-items: center;
  gap: clamp(28px, 5vh, 56px);
  padding: 24px;
}
.gate__logo { margin: 0; width: min(1240px, 68vw); }
.gate__logo img { width: 100%; }
/* the splash itself sits on the page centre line; the cue hangs off its right edge */
.gate__tap { position: relative; display: flex; justify-content: center; align-items: center; width: 100%; }
.gate__splash {
  background: none; border: 0; padding: 0;
  --splash-w: clamp(120px, 16vw, 190px);
  width: var(--splash-w);
  transform-origin: 50% 55%;
  transition: transform .18s cubic-bezier(.34,1.56,.64,1);
  border-radius: 50%;
}
.gate__splash:hover { transform: scale(1.06) rotate(-3deg); }
.gate__splash:focus-visible { outline: 4px solid var(--ink); outline-offset: 8px; }
.gate__splash.is-squash { transform: scale(1.18, .82); transition-duration: .13s; }

/* slime front pouring down over the gate: white sheet with the mockup's glossy drip edge (animated in app.js) */
.pour { position: absolute; inset: 0; z-index: 5; pointer-events: none; overflow: hidden; }
.pour__front {
  position: absolute; left: 0; right: 0; top: 0;
  height: calc(100% + 340px);
  background:
    url(assets/pour-edge.webp?v=8) left bottom / auto 305px repeat-x,
    linear-gradient(var(--white), var(--white)) left top / 100% calc(100% - 290px) no-repeat;
  transform: translateY(-100%);
  will-change: transform;
}

/* squig burst layer sits above the bubble, below nothing else */
.burst { position: fixed; inset: 0; z-index: 21; pointer-events: none; overflow: hidden; }
.burst img { position: absolute; max-width: none; height: auto; image-rendering: pixelated; will-change: transform, opacity; }

.gate.is-leaving { pointer-events: none; }
.gate.is-leaving .gate__logo,
.gate.is-leaving .gate__cue { opacity: 0; transition: opacity .3s; }
.gate.is-gone { display: none; }

.veil {
  position: fixed; inset: 0; z-index: 19; background: var(--white);
  opacity: 0; pointer-events: none; transition: opacity .25s ease;
}
.veil.is-on { opacity: 1; }

/* ---------- PAGE 2 — COLLECTION ---------- */
main { position: relative; }
.collection { position: relative; overflow: hidden; container-type: inline-size; }
/* 100vw counts the classic scrollbar gutter; the container width does not, so the stage stays centred on Windows */
@supports (width: 1cqw) {
  .stage, .corner { --u: min(1px, calc(100cqw / 1448)); }
}

/* corner slime hugs the viewport edges */
.corner { position: absolute; top: 0; pointer-events: none; z-index: 1; }
.corner--left  { left: 0;  width: calc(360 * var(--u)); }
.corner--right { right: 0; width: calc(428 * var(--u)); }

/* the reference canvas: 1448 x 1086 units, centred */
.stage {
  position: relative;
  width: calc(1448 * var(--u));
  height: calc(1086 * var(--u));
  margin: 0 auto;
}
.collection__logo {
  position: absolute; margin: 0;
  left: calc(340 * var(--u)); top: calc(70 * var(--u));
  width: calc(755 * var(--u));
}

.cards {
  list-style: none; margin: 0; padding: 0;
  position: absolute; left: 0; top: calc(372 * var(--u));
  width: 100%; height: calc(500 * var(--u));
  transition: opacity .3s ease;
}
/* shuffle crossfade: incoming row starts invisible, outgoing ghost row sits on top and fades */
.cards.is-entering { opacity: 0; transition: none; }
.cards.cards--ghost { position: absolute; z-index: 2; pointer-events: none; margin: 0; }
.cards.cards--ghost.is-leaving { opacity: 0; }

/* card body = 270 x 391 units; the frame image (330 x 500) carries 30u side / 41u top margins for the slime.
   The frame is a fixed slot; only the art inside its punched-out hole changes on SHUFFLE. */
.card {
  position: absolute; top: calc(41 * var(--u));
  width: calc(270 * var(--u)); height: calc(391 * var(--u));
  left: calc(var(--x) * var(--u));
}
.card:nth-child(1) { --x: 15; }
.card:nth-child(2) { --x: 301.25; }
.card:nth-child(3) { --x: 587.5; }
.card:nth-child(4) { --x: 873.75; }
.card:nth-child(5) { --x: 1160; }
.card__frame {
  position: absolute; max-width: none; pointer-events: none; z-index: 1;
  left: calc(-30 * var(--u)); top: calc(-41 * var(--u));
  width: calc(330 * var(--u)); height: calc(500 * var(--u));
}
.card__hole { position: absolute; left: 0; top: 0; width: 100%; height: calc(331 * var(--u)); overflow: hidden; border-radius: calc(20 * var(--u)) calc(20 * var(--u)) 0 0; background: #dfe3d6; }
.card__art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; image-rendering: auto; transition: opacity .35s ease; }
.card__art.is-entering { opacity: 0; }
.card__id, .card__sub {
  position: absolute; margin: 0; left: calc(23 * var(--u));
  font-family: var(--tech); line-height: 1; white-space: nowrap; color: var(--ink);
}
/* sizes/tracking solved against the mockup's glyph boxes (cap 14 / width 128, cap 9 / width 122) */
.card__id  { top: calc(335 * var(--u)); font-size: calc(20 * var(--u)); font-weight: 700; letter-spacing: calc(-.5 * var(--u)); }
.card__sub { top: calc(362 * var(--u)); font-size: calc(13 * var(--u)); font-weight: 400; letter-spacing: calc(2.8 * var(--u)); text-transform: uppercase; -webkit-text-stroke: calc(.3 * var(--u)) var(--ink); }
.card__badge {
  position: absolute; left: calc(195 * var(--u)); top: calc(337 * var(--u));
  width: calc(68 * var(--u)); height: calc(36 * var(--u));
  border: calc(2 * var(--u)) solid var(--ink); border-radius: 999px;
  display: grid; place-items: center;
  font-family: var(--tech); font-weight: 700; font-size: calc(17 * var(--u)); line-height: 1;
  letter-spacing: calc(-1.5 * var(--u)); text-indent: calc(-1.5 * var(--u));
}

/* living slime: the card's own top band + drips (card-N-top) and hanging drips (card-N-bottom) sit on top of
   the card image and slowly stretch downward, then the stretched tips fade back onto the baked shape */
.card__flow {
  position: absolute; left: calc(-30 * var(--u)); width: calc(330 * var(--u)); max-width: none;
  pointer-events: none; z-index: 2; will-change: transform;
  animation: flow var(--dur, 12s) cubic-bezier(.4,.05,.6,.95) var(--delay, 0s) infinite;
}
.card__flow--top    { top: calc(-41 * var(--u)); height: calc(360 * var(--u)); transform-origin: 50% 0; }
.card__flow--bottom { top: calc(359 * var(--u)); height: calc(100 * var(--u)); transform-origin: 50% 32%; }  /* origin = card bottom edge */
@keyframes flow {
  0%   { transform: scaleY(1);    opacity: 1; }
  80%  { transform: scaleY(1.22); opacity: 1; }
  100% { transform: scaleY(1.26); opacity: 0; }
}
.card__id, .card__sub, .card__badge { z-index: 4; }

/* the slime pool at the bottom of the page; drops from the frames land on its surface */
.pool {
  position: relative; height: calc(200 * var(--u)); width: 100%;
  background: url(assets/pool.webp?v=8) left top / auto 100% repeat-x;
  pointer-events: none;
}
.drops { position: absolute; inset: 0; pointer-events: none; z-index: 6; overflow: hidden; }
.drop { position: absolute; max-width: none; height: auto; will-change: transform; }
.ripple {
  position: absolute; width: calc(96px * var(--s, 1)); height: calc(30px * var(--s, 1));
  border-radius: 50%;
  border: calc(1.5px * var(--s, 1)) solid rgba(90, 96, 70, .30);
  box-shadow: inset 0 0 0 calc(1.5px * var(--s, 1)) rgba(255, 255, 255, .9), 0 0 calc(4px * var(--s, 1)) rgba(90, 96, 70, .12);
}

/* shuffle: the PNG is the button */
.shuffle {
  position: absolute; border: 0; padding: 0; margin: 0;
  left: calc(470 * var(--u)); top: calc(872 * var(--u));
  width: calc(505 * var(--u)); height: calc(188 * var(--u));
  background: url(assets/shuffle.webp?v=8) center / 100% 100% no-repeat;
}
.shuffle:focus-visible { outline: 4px solid var(--ink); outline-offset: 6px; border-radius: 60px; }
.shuffle__label {
  position: absolute; left: 0; right: 0; top: calc(70.5 * var(--u));
  transform: translateY(-50%);
  font-family: var(--tech); font-weight: 700; font-size: calc(41 * var(--u));
  letter-spacing: calc(-1.2 * var(--u)); line-height: 1; color: var(--ink);
}

/* ---------- RESPONSIVE ---------- */
/* Below 1100px the stage stops scaling: cards keep their 1:1 size and reflow 3+2 / 2 / 1 */
@media (max-width: 1100px) {
  .corner--left  { width: 30vw; }
  .corner--right { width: 34vw; }
  .stage {
    width: 100%; height: auto;
    padding: 24vw 24px 60px;
    display: flex; flex-direction: column; align-items: center;
  }
  .collection__logo { position: static; width: min(600px, 76vw); margin-bottom: 44px; }
  /* cards keep the 270-unit body; --u shrinks only when the columns would not fit.
     flex-wrap, not grid: Chromium's mobile emulation painted phantom copies of the card
     images in neighbouring grid tracks. */
  .cards {
    --u: min(1px, calc((100vw - 112px) / 3 / 270));   /* 112 = side padding + gaps + scrollbar slack */
    position: static; height: auto; width: 100%;
    display: flex; flex-wrap: wrap; justify-content: center;
    gap: calc(60 * var(--u)) 16px;
  }
  .card { position: relative; left: auto; top: auto; flex: none; }
  .shuffle { --u: 1px; position: relative; left: auto; top: auto; margin-top: 40px; }
}
@media (max-width: 640px) {
  .gate__tap { flex-direction: column; }
  .gate__cue { position: static; transform: none; padding-top: 0; }
  .gate__arrow { transform: rotate(80deg) scaleX(-1); width: 60px; }
  .cards { --u: min(1px, calc((100vw - 88px) / 2 / 270)); }
  .shuffle { --u: min(1px, calc((100vw - 48px) / 505)); }
}
@media (max-width: 440px) {
  .cards { --u: min(1px, calc((100vw - 48px) / 270)); }
}

@media (prefers-reduced-motion: reduce) {
  .gate__splash, .cards, .veil, .shuffle { transition: none !important; }
  .card__flow { animation: none; }
}
