/* Stinklings: a bubblegum sky over a swamp, in the art's own pixels.
   Colours are sampled from the collection (goblins/art.py BG + SKIN, brand.py wordmark). One UI pixel (--b) is 4 px,
   scene pixels (--px) are half an art pixel, so the swamp sits on the same grid as the goblin on the card.
   Motion only ever changes transform, translate or opacity. */

@font-face {
  font-family: 'Jersey 15';
  src: url(/fonts/jersey-15-latin.woff2) format('woff2');
  font-weight: 100 900; /* one face for every weight, so nothing is faux-bolded */
  font-display: swap;
}
@font-face {
  font-family: 'Rubik';
  src: url(/fonts/rubik-latin-var.woff2) format('woff2');
  font-weight: 400 700;
  font-display: swap;
}

:root {
  --ink: #17151d;
  --pink: #f5c2d0;        /* Bubblegum: the sky */
  --pink-d: #e7a3b8;
  --bone: #e8e2d0;        /* Stained Tank */
  --bone-l: #f7f3e8;
  --green: #86b04e;       /* the wordmark's green, lit top, dark shadow */
  --green-l: #a7c96a;
  --green-d: #3f5a26;
  --mud: #9a7a4e;         /* Swamp Brown skin */
  --mud-d: #755c3b;
  --mud-l: #b09774;
  --swamp: #a9b98a;
  --mint: #c8e6d0;
  --lilac: #dcd0f0;
  --butter: #f6e3b0;
  --peach: #f7cdb0;
  --sky: #c8daf0;
  --drizzle: #c9ccd2;
  --gold: #d8b040;
  --gold-l: #f6dc88;
  --rad: #8aff5a;
  --zombie: #8a9a86;
  --dusk: #3a3844;
  --shade: rgba(23, 21, 29, 0.2);

  --b: 4px;               /* one UI pixel */
  --art: 512px;           /* the goblin, 16 px per art pixel */
  --px: 8px;              /* one scene pixel */
  --mat: 12px;
  --gut: 32px;
  --max: 1312px;
  --nav: 76px;
  --slow: 1;              /* reduced motion multiplies every loop duration */

  --pixel: 'Jersey 15', 'Courier New', monospace;
  --body: 'Rubik', system-ui, -apple-system, 'Segoe UI', sans-serif;

  view-transition-name: none;
  color-scheme: light;
}
@media (max-width: 1099px) { :root { --art: 384px; --px: 6px; } }
@media (max-width: 719px) { :root { --art: 320px; --px: 5px; --gut: 16px; --mat: 8px; --nav: 64px; } }
@media (max-width: 389px) { :root { --art: 288px; } }
@media (max-width: 339px) { :root { --art: 256px; } }
@media (prefers-reduced-motion: reduce) { :root { --slow: 5; } }

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--pink); -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--nav) + 16px); }
body { margin: 0; background: var(--pink); color: var(--ink); font: 400 16px/1.5 var(--body); overflow-x: clip; -webkit-font-smoothing: antialiased; font-synthesis: none; font-variant-ligatures: none; }
img { display: block; image-rendering: pixelated; }
a { color: inherit; }
button { font: inherit; color: inherit; }
h1, h2, h3, p, ol, ul, figure { margin: 0; }
[hidden] { display: none !important; }
.wrap { width: min(100% - 2 * var(--gut), var(--max)); margin-inline: auto; }
:focus-visible { outline: 3px dashed var(--ink); outline-offset: 5px; }

/* the notched pixel border: four 1-pixel strips, corners left open */
.card, .btn-face, .count-bar, .tag, .mine, .traits, .sticker, .status[data-tone='info'], .status[data-tone='good'], .status[data-tone='bad'], .step, .grail-pic {
  --bc: var(--ink);
  --edge: 0 calc(-1 * var(--b)) 0 0 var(--bc), 0 var(--b) 0 0 var(--bc), calc(-1 * var(--b)) 0 0 0 var(--bc), var(--b) 0 0 0 var(--bc);
  box-shadow: var(--edge);
}

/* ---------------------------------------------------------------- nav */
.nav { position: sticky; top: 0; z-index: 40; background: var(--pink); box-shadow: 0 var(--b) 0 0 var(--ink); }
.nav-in { display: flex; align-items: center; gap: 24px; height: var(--nav); }
.mark { flex: none; display: block; }
.mark img { width: 244px; height: 36px; }
.count { margin-left: auto; display: flex; align-items: center; gap: 12px; white-space: nowrap; }
.count-bar { position: relative; width: 136px; height: 16px; background: var(--bone-l); overflow: hidden; }
.count-fill { position: absolute; inset: 0; background: var(--green); transform: scaleX(0); transform-origin: 0 50%; transition: transform 0.9s steps(17); box-shadow: inset 0 var(--b) 0 0 var(--green-l); }
.count-num { font: 700 20px/1 var(--pixel); }
.count-of { font-weight: 500; opacity: 0.7; }
.count-of .sep { margin: 0 0.3em; }
.count-lbl { font: 500 14px/1 var(--body); }

/* ---------------------------------------------------------------- buttons: a face that squishes onto its base */
.btn { position: relative; display: inline-flex; padding: 0 0 6px; border: 0; background: none; cursor: pointer; text-decoration: none; -webkit-tap-highlight-color: transparent; }
.btn::before { content: ''; position: absolute; left: 0; right: 0; top: 6px; bottom: 0; background: var(--btn-base, var(--ink)); box-shadow: 0 var(--b) 0 0 var(--ink), calc(-1 * var(--b)) 0 0 0 var(--ink), var(--b) 0 0 0 var(--ink); }
.btn-face { position: relative; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 12px; width: 100%; min-height: 48px; padding: 8px 20px; background: var(--btn, var(--bone-l)); font: 700 18px/1.1 var(--pixel); transform-origin: 50% 100%; transition: transform 0.12s steps(3); }
.btn:hover .btn-face { transform: translateY(-2px); }
.btn:active .btn-face { transform: translateY(6px) scale(1.03, 0.9); transition-duration: 0.05s; }
.btn:disabled { cursor: not-allowed; }
.btn:disabled .btn-face { transform: translateY(6px); --btn: #e6cbd4; color: rgba(23, 21, 29, 0.72); box-shadow: 0 calc(-1 * var(--b)) 0 0 var(--bc), 0 var(--b) 0 0 var(--bc), calc(-1 * var(--b)) 0 0 0 var(--bc), var(--b) 0 0 0 var(--bc); }
.btn:disabled::before { opacity: 0; }
.btn-mint.is-busy:disabled .btn-face { --btn: var(--green); color: var(--ink); box-shadow: var(--edge), inset 0 var(--b) 0 0 var(--green-l); }
.btn-mint.is-busy:disabled { cursor: progress; }

.btn-mint { width: 100%; --btn: var(--green); --btn-base: var(--green-d); }
.btn-mint .btn-face { min-height: 64px; font-size: 24px; box-shadow: var(--edge), inset 0 var(--b) 0 0 var(--green-l); }
.btn-mint:disabled .btn-face { box-shadow: var(--edge); }
.mint-cost { display: inline-block; padding: 5px 10px 3px; background: var(--bone-l); font: 700 17px/1 var(--body); box-shadow: 0 calc(-1 * var(--b)) 0 0 var(--ink), 0 var(--b) 0 0 var(--ink), calc(-1 * var(--b)) 0 0 0 var(--ink), var(--b) 0 0 0 var(--ink); }
.btn-mint.is-free .mint-cost { background: var(--butter); font: 700 22px/1 var(--pixel); padding: 4px 10px 2px; animation: nudge calc(2.4s * var(--slow)) steps(2) infinite; }
.busy { display: none; gap: 5px; align-self: center; }
.is-busy .busy { display: inline-flex; }
.busy i { width: 6px; height: 6px; background: currentColor; animation: blink calc(0.9s * var(--slow)) steps(1) infinite; }
.busy i:nth-child(2) { animation-delay: 0.15s; }
.busy i:nth-child(3) { animation-delay: 0.3s; }

.btn-alt { --btn: var(--bone-l); --btn-base: var(--mud-d); flex: none; }
.btn-alt .btn-face { min-height: 52px; }
.btn-alt .ico { width: 22px; height: 20px; flex: none; }
.btn-alt.is-rolling .ico { animation: roll 0.4s steps(4); }

.btn-sm { --btn: var(--bone-l); flex: none; }
.btn-sm .btn-face { min-height: 44px; padding: 6px 16px; font-size: 16px; gap: 10px; }
.btn-sm .dot { width: 8px; height: 8px; background: var(--pink-d); box-shadow: 0 0 0 2px var(--ink); }
.btn-sm.is-on .dot { background: var(--rad); }
.btn-sm.is-warn { --btn: var(--peach); }
.btn-sm.is-warn .dot { background: #e06a4a; }
.btn-sm:disabled .btn-face { transform: none; --btn: var(--bone-l); color: var(--ink); }
.btn-sm:disabled { cursor: default; }
.btn-sm:disabled::before { opacity: 1; }

/* ---------------------------------------------------------------- the stage */
.stage { position: relative; isolation: isolate; overflow: clip; padding: 36px 0 144px; background: var(--pink); }
.stage-grid {
  position: relative; z-index: 2;
  display: grid;
  grid-template-columns: calc(var(--art) + 2 * var(--mat)) minmax(0, 1fr);
  grid-template-areas: 'peek head' 'peek act';
  grid-template-rows: auto 1fr;
  column-gap: 80px;
}
.peek { grid-area: peek; position: relative; margin-top: 64px; align-self: start; }
.head { grid-area: head; container-type: inline-size; }
.act { grid-area: act; padding-top: 22px; }

.hl { font: 400 64px/0.92 var(--pixel); font-size: clamp(48px, 17cqi, 120px); font-size: round(down, clamp(48px, 17cqi, 120px), 4px); }
.hl span { display: block; }
.hl-a { color: var(--ink); text-shadow: 4px 4px 0 var(--pink-d); }
.hl-b {
  margin-top: 0.08em; color: var(--green);
  text-shadow: 3px 0 var(--ink), -3px 0 var(--ink), 0 3px var(--ink), 0 -3px var(--ink), 3px 3px var(--ink), -3px 3px var(--ink), 3px -3px var(--ink), -3px -3px var(--ink), 7px 7px 0 var(--green-d);
}
.sub { margin-top: 16px; font: 400 32px/1 var(--pixel); }

.controls { display: grid; gap: 14px; max-width: 560px; }
.controls-row { display: flex; align-items: center; gap: 16px; min-height: 58px; }
.status { flex: 1 1 0; min-width: 0; padding: 0; font: 500 15px/1.35 var(--body); }
.status[data-tone='info'], .status[data-tone='good'], .status[data-tone='bad'] { padding: 8px 12px; background: var(--bone-l); animation: pop-in 0.25s steps(3) both; }
.status[data-tone='good'] { background: var(--mint); }
.status[data-tone='bad'] { background: var(--peach); }
.status a { font-weight: 700; white-space: nowrap; text-underline-offset: 3px; }
.status a::after { content: ' \2197'; }
.price-note { margin-top: 10px; max-width: 46ch; font: 400 16px/1.45 var(--body); }
.price-note b { font-weight: 700; }

/* ---------------------------------------------------------------- the card */
.card {
  position: relative; width: calc(var(--art) + 2 * var(--mat)); padding: var(--mat); background: var(--bone);
  view-transition-name: peekcard;
  box-shadow: var(--edge), 16px 20px 0 0 var(--shade);
}
.card-art { width: var(--art); height: var(--art); background: var(--drizzle); overflow: hidden; }
.card-art img { width: 100%; height: 100%; }
.tag { position: absolute; left: -16px; top: -32px; z-index: 2; padding: 8px 14px 6px; background: var(--butter); font: 700 36px/1 var(--pixel); box-shadow: var(--edge), 6px 6px 0 0 var(--shade); }
.tag-hash { color: var(--mud); }
.tag.is-word .tag-hash { display: none; }
.mine { position: absolute; right: -20px; top: -28px; z-index: 2; padding: 8px 12px 6px; background: var(--rad); font: 700 24px/1 var(--pixel); box-shadow: var(--edge), 6px 6px 0 0 var(--shade); animation: slap 0.45s cubic-bezier(0.3, 1.5, 0.5, 1) both; }
.card.is-gone .card-art img { opacity: 0.9; }
.card.is-shuffling { animation: shuffle 0.46s cubic-bezier(0.3, 1.3, 0.5, 1); }
.card.is-hatching { animation: hatch 0.72s steps(9); }

.stink { position: absolute; left: 0; right: 0; top: 0; height: 0; z-index: -1; pointer-events: none; }
.puffs { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.puff { position: absolute; left: 50%; top: 45%; --w: 12; --h: 10; --img: url(/art/scene/puff.png); transform: translate(-50%, -50%) scale(0.4); opacity: 0; animation: puff 1.2s var(--delay, 0ms) cubic-bezier(0.2, 0.8, 0.3, 1) both; }

/* ---------------------------------------------------------------- traits: ??? slots that get stickers slapped on */
.traits { position: relative; margin-top: 22px; margin-left: -40px; padding: 14px 20px 18px; background: var(--bone-l); scroll-margin-bottom: 24px; }
.traits::after { content: ''; position: absolute; inset: 0; transform: translate(12px, 12px); background: var(--shade); z-index: -1; }
.traits-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.traits h2 { font: 700 24px/1 var(--pixel); }
.rarity { font: 500 15px/1 var(--body); white-space: nowrap; }
.rarity b { display: inline-block; margin: 0 8px; font: 700 24px/1 var(--pixel); padding: 2px 6px; }
.rarity.is-stamped b { background: var(--gold); box-shadow: 0 calc(-1 * var(--b)) 0 0 var(--ink), 0 var(--b) 0 0 var(--ink), calc(-1 * var(--b)) 0 0 0 var(--ink), var(--b) 0 0 0 var(--ink); animation: stamp 0.5s cubic-bezier(0.3, 1.6, 0.5, 1) both; }
.slots { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 10px; }
.slot { position: relative; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.slot-k { font: 600 11px/1 var(--body); letter-spacing: 0.08em; text-transform: uppercase; color: var(--mud-d); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot-v { display: flex; align-items: center; height: 30px; padding: 0 8px; font: 400 20px/1 var(--pixel); color: #b3879a; background: repeating-linear-gradient(90deg, transparent 0 6px, rgba(23, 21, 29, 0.05) 6px 12px); outline: 2px dashed rgba(23, 21, 29, 0.3); outline-offset: -2px; animation: shh calc(3s * var(--slow)) steps(2) infinite; }
.slot:nth-child(4n + 2) .slot-v { animation-delay: -1s; }
.slot:nth-child(4n + 3) .slot-v { animation-delay: -2s; }
.slot:nth-child(4n + 4) .slot-v { animation-delay: -0.5s; }
.sticker {
  display: flex; align-items: center; height: 30px; padding: 0 8px; min-width: 0;
  background: var(--fill, var(--butter)); color: var(--text, var(--ink)); font: 600 13px/1.1 var(--body);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  animation: slap 0.42s calc(var(--i, 0) * 110ms) cubic-bezier(0.3, 1.5, 0.5, 1) both;
}

/* ---------------------------------------------------------------- the swamp */
.scene, .layer { position: absolute; inset: 0; pointer-events: none; }
.scene { z-index: 0; }
.l-sky { --d: 0.12; }
.l-far { --d: 0.3; }
.l-mid { --d: 0.55; }
.l-mud { --d: 0.8; }
.l-front { --d: 1.15; z-index: 3; }
.layer { will-change: transform; }
.stage { --mud-top: calc(var(--card-b, 700px) - 72px); }

.sp { position: absolute; display: block; width: calc(var(--w) * var(--px)); height: calc(var(--h) * var(--px)); background: var(--img) 0 0 / 100% 100% no-repeat; image-rendering: pixelated; }
.strip { position: absolute; left: -64px; right: -64px; display: block; image-rendering: pixelated; }

.cloud-a { --w: 46; --h: 20; --img: url(/art/scene/cloud-a.png); }
.cloud-b { --w: 28; --h: 13; --img: url(/art/scene/cloud-b.png); }
.tree { --w: 13; --h: 15; --img: url(/art/scene/tree.png); }
.reeds { --w: 21; --h: 24; --img: url(/art/scene/reeds.png); }
.pipe { --w: 40; --h: 26; --img: url(/art/scene/pipe-l.png); }
.drip { --w: 3; --h: 6; --img: url(/art/scene/drip.png); }
.bubble { --w: 7; --h: 7; --img: url(/art/scene/bubble.png); }
.fume { --w: 3; --h: 16; --img: url(/art/scene/fume.png); }
.j-sock { --w: 7; --h: 11; --img: url(/art/scene/junk-old-sock.png); }
.j-fish { --w: 5; --h: 12; --img: url(/art/scene/junk-fish-bone.png); }
.j-apple { --w: 7; --h: 10; --img: url(/art/scene/junk-rotten-apple.png); }
.j-fry { --w: 5; --h: 10; --img: url(/art/scene/junk-soggy-fry.png); }
.j-chicken { --w: 6; --h: 12; --img: url(/art/scene/junk-rubber-chicken.png); }
.j-ticket { --w: 8; --h: 7; --img: url(/art/scene/junk-losing-ticket.png); }
.j-can { --w: 9; --h: 12; --img: url(/art/scene/junk-can.png); }
.icon-eye { --w: 14; --h: 7; --img: url(/art/scene/icon-eye.png); }
.icon-coin { --w: 12; --h: 11; --img: url(/art/scene/icon-coin.png); }
.icon-lens { --w: 12; --h: 11; --img: url(/art/scene/icon-lens.png); }

/* sky */
.cloud-a, .cloud-b { left: 0; animation: drift calc(var(--t) * var(--slow)) linear infinite; animation-delay: var(--at); }
.c1 { top: 4%; --t: 150s; --at: -40s; }
.c2 { top: 17%; --t: 110s; --at: -85s; }
.c3 { top: 30%; --t: 190s; --at: -150s; opacity: 0.85; }
.c4 { top: 9%; --t: 130s; --at: -20s; opacity: 0.9; }

/* far hills + dead trees, behind everything */
.hills { top: calc(var(--mud-top) - 22 * var(--px)); height: calc(24 * var(--px) + 64px); background: url(/art/scene/hills-far.png) 0 0 / calc(96 * var(--px)) calc(24 * var(--px)) repeat-x, linear-gradient(transparent calc(24 * var(--px) - 2px), var(--lilac) 0); }
.t1 { left: 4%; top: calc(var(--mud-top) - 28 * var(--px)); }
.t2 { left: 83%; top: calc(var(--mud-top) - 30 * var(--px)); }
.t3 { right: 1%; top: calc(var(--mud-top) - 27 * var(--px)); }

/* mid bank + reeds */
.bank { top: calc(var(--mud-top) - 11 * var(--px)); height: calc(18 * var(--px) + 64px); background: url(/art/scene/bank-mid.png) 0 0 / calc(80 * var(--px)) calc(18 * var(--px)) repeat-x, linear-gradient(transparent calc(18 * var(--px) - 2px), var(--swamp) 0); }
.r1 { left: calc(var(--card-l) - 12 * var(--px)); top: calc(var(--mud-top) - 20 * var(--px)); }
.r2 { left: calc(var(--card-r) - 16 * var(--px)); top: calc(var(--mud-top) - 19 * var(--px)); }
.r3 { right: 2%; top: calc(var(--mud-top) - 21 * var(--px)); }

/* the mud */
.mud { top: var(--mud-top); bottom: -120px; background: url(/art/scene/mud-top.png) 0 0 / calc(64 * var(--px)) calc(12 * var(--px)) repeat-x, linear-gradient(transparent calc(12 * var(--px) - 2px), var(--mud) 0); }
.pipe { left: 0; top: calc(var(--card-b) + 5 * var(--px)); }
.drip { left: calc(34 * var(--px)); top: calc(var(--card-b) + 29 * var(--px)); animation: drip calc(1.8s * var(--slow)) cubic-bezier(0.5, 0, 1, 1) infinite; }
.d2 { animation-delay: -0.9s; }
.bubble { animation: bubble calc(3.2s * var(--slow)) steps(8) infinite; animation-delay: var(--at, 0s); }
.b1 { left: 11%; top: calc(var(--mud-top) + 5 * var(--px)); --at: -0.4s; }
.b2 { left: 33%; top: calc(var(--mud-top) + 14 * var(--px)); --at: -1.9s; }
.b3 { left: 58%; top: calc(var(--mud-top) + 22 * var(--px)); --at: -1.1s; }
.b4 { left: 76%; top: calc(var(--mud-top) + 10 * var(--px)); --at: -2.6s; }
.b5 { left: 90%; top: calc(var(--mud-top) + 30 * var(--px)); --at: -0.8s; }
.fume { animation: rise calc(2.6s * var(--slow)) steps(10) infinite; animation-delay: var(--at, 0s); }
.f1 { left: 7%; top: calc(var(--mud-top) - 10 * var(--px)); --at: -0.5s; }
.f2 { left: 41%; top: calc(var(--mud-top) + 2 * var(--px)); --at: -1.6s; }
.f3 { left: 63%; top: calc(var(--mud-top) + 8 * var(--px)); --at: -2.2s; }
.f4 { left: 94%; top: calc(var(--mud-top) - 6 * var(--px)); --at: -1s; }
.junk { animation: bob calc(var(--t, 2.8s) * var(--slow)) steps(2) infinite; animation-delay: var(--at, 0s); }
.j-fish { left: 22%; top: calc(var(--mud-top) + 26 * var(--px)); --t: 3.4s; }
.j-can { left: 47%; top: calc(var(--mud-top) + 30 * var(--px)); --t: 2.6s; --at: -1s; }
.j-apple { left: 66%; top: calc(var(--mud-top) + 34 * var(--px)); --t: 3s; --at: -2s; }
.j-ticket { left: 84%; top: calc(var(--mud-top) + 40 * var(--px)); --t: 3.8s; --at: -0.6s; }
.j-fry { left: 5%; top: calc(var(--mud-top) + 36 * var(--px)); --t: 2.9s; --at: -1.4s; }

/* in front of the card: the mud lip it stands in, and a couple of floaters */
.lip { left: calc(var(--card-l) - 32px); right: auto; width: calc(var(--card-w) + 64px); top: calc(var(--card-b) - 14px - 3 * var(--px)); height: calc(9 * var(--px)); background: url(/art/scene/mud-top.png) 0 0 / calc(64 * var(--px)) calc(12 * var(--px)) repeat-x, linear-gradient(transparent calc(12 * var(--px) - 2px), var(--mud) 0); }
.j-sock { left: calc(var(--card-l) - 11 * var(--px)); top: calc(var(--card-b) - 4 * var(--px)); --t: 2.4s; }
.j-chicken { left: calc(var(--card-r) - 14 * var(--px)); top: calc(var(--card-b) + 1 * var(--px)); --t: 3.1s; --at: -1.2s; }
.b6 { left: calc(var(--card-l) + 18%); top: calc(var(--card-b) + 2 * var(--px)); --at: -1.4s; }
.b7 { left: calc(var(--card-r) - 20%); top: calc(var(--card-b) + 5 * var(--px)); --at: -2.9s; }

/* stink lines rising off the goblin */
.stink .fume { top: calc(-14 * var(--px)); animation-duration: calc(2.2s * var(--slow)); }
.s1 { left: 18%; --at: -0.3s; }
.s2 { left: 52%; --at: -1.4s; }
.s3 { left: 81%; --at: -0.9s; }

.flies { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 4; pointer-events: none; }
.stage.is-paused *, .stage.is-paused *::before, .stage.is-paused *::after { animation-play-state: paused !important; }

/* ---------------------------------------------------------------- how it works: on the mud */
.how { position: relative; background: var(--mud); padding: 24px 0 96px; content-visibility: auto; contain-intrinsic-size: auto 560px; }
.deco { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.deco .x1 { left: 58%; top: 40px; animation-duration: calc(3.4s * var(--slow)); }
.deco .x2 { left: 72%; top: 64px; --at: -1.2s; }
.deco .x3 { left: 84%; top: 28px; --t: 3.2s; }
.deco .x4 { left: 91%; top: 120px; --at: -2.3s; }
.deco .x5 { left: 6%; bottom: 36px; --t: 3.6s; --at: -1s; }
.deco .x6 { left: 26%; bottom: 60px; --at: -0.6s; }
.how .wrap { position: relative; }
.how-h { font: 700 40px/1.1 var(--pixel); color: var(--bone-l); text-shadow: 4px 4px 0 var(--mud-d); max-width: 12ch; }
.steps { list-style: none; padding: 0; margin-top: 40px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; align-items: start; }
.step { position: relative; padding: 24px 24px 28px; background: var(--bone-l); }
.step:nth-child(2) { margin-top: 48px; background: var(--butter); }
.step:nth-child(3) { margin-top: 96px; background: var(--mint); }
.step .sp { position: static; margin-bottom: 18px; --px: 5px; }
.step h3 { display: flex; align-items: center; gap: 12px; font: 700 30px/1 var(--pixel); }
.step h3 span { display: inline-grid; place-items: center; width: 36px; height: 36px; background: var(--ink); color: var(--bone-l); font-size: 22px; }
.step p { margin-top: 10px; font: 400 16px/1.5 var(--body); }

/* ---------------------------------------------------------------- the grail teaser */
.grails { position: relative; background: var(--mud); padding: 16px 0 112px; content-visibility: auto; contain-intrinsic-size: auto 520px; }
.grails-head { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 32px; align-items: end; }
.grails h2 { font: 700 40px/1.1 var(--pixel); color: var(--bone-l); text-shadow: 4px 4px 0 var(--mud-d); }
.grails-head p { color: var(--bone-l); font: 400 17px/1.5 var(--body); max-width: 46ch; }
.grail-row { list-style: none; padding: 0; margin-top: 40px; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 24px; }
.grail { display: grid; justify-items: center; gap: 6px; color: var(--bone-l); text-align: center; }
.grail:nth-child(even) { margin-top: 32px; }
.grail-pic { position: relative; display: block; width: 100%; aspect-ratio: 1; overflow: hidden; background: var(--drizzle); }
.grail-pic img { width: 100%; height: 100%; }
.grail-pic::after { content: ''; position: absolute; top: -20%; bottom: -20%; left: 0; width: 40%; background: rgba(255, 255, 255, 0.35); transform: translateX(-160%) skewX(-18deg); animation: shine calc(4.2s * var(--slow)) steps(14) infinite; animation-delay: var(--at, 0s); }
.g-gold .grail-pic { background: var(--butter); }
.g-rad .grail-pic { background: var(--mint); }
.g-zom .grail-pic { background: var(--drizzle); }
.grail:nth-child(2) { --at: -0.7s; } .grail:nth-child(3) { --at: -1.4s; } .grail:nth-child(4) { --at: -2.1s; } .grail:nth-child(5) { --at: -2.8s; } .grail:nth-child(6) { --at: -3.5s; }
.grail b { margin-top: 10px; font: 700 24px/1 var(--pixel); }
.grail span:last-child { font: 500 14px/1 var(--body); opacity: 0.85; }

/* ---------------------------------------------------------------- footer */
.foot { background: var(--mud-d); color: var(--bone-l); box-shadow: 0 calc(-1 * var(--b)) 0 0 var(--ink); content-visibility: auto; contain-intrinsic-size: auto 120px; }
.foot-in { display: flex; align-items: center; gap: 24px; min-height: 104px; padding-block: 24px; }
.foot-mark { width: 126px; height: 22px; }
.foot p { font: 400 15px/1.4 var(--body); }
.foot-links { margin-left: auto; display: flex; gap: 8px; }
.foot-links a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; font: 700 16px/1 var(--pixel); text-underline-offset: 4px; }
.noscript { position: fixed; left: 16px; bottom: 16px; z-index: 50; padding: 12px 16px; background: var(--bone-l); box-shadow: 0 0 0 var(--b) var(--ink); }
.is-demo .stage::before { content: 'Demo mode'; position: absolute; right: var(--gut); top: 10px; z-index: 5; padding: 4px 8px 3px; background: var(--ink); color: var(--bone-l); font: 400 16px/1 var(--pixel); pointer-events: none; }

/* ---------------------------------------------------------------- motion (transform / translate / opacity only) */
@keyframes drift { from { transform: translateX(-60vw); } to { transform: translateX(130vw); } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(calc(-1 * var(--px))); } }
@keyframes rise { 0% { transform: translateY(0); opacity: 0; } 20% { opacity: 1; } 100% { transform: translateY(calc(-1 * var(--rise, 9) * var(--px))); opacity: 0; } }
@keyframes bubble { 0% { transform: scale(0.2); opacity: 0; } 12% { opacity: 1; } 60% { transform: scale(1); } 80% { transform: scale(1.15); opacity: 1; } 82%, 100% { transform: scale(1.6); opacity: 0; } }
@keyframes drip { 0% { transform: translateY(0) scaleY(0.5); opacity: 0; } 12% { opacity: 1; } 80% { transform: translateY(calc(9 * var(--px))) scaleY(1.2); opacity: 1; } 100% { transform: translateY(calc(11 * var(--px))); opacity: 0; } }
@keyframes shine { 0%, 55% { transform: translateX(-160%) skewX(-18deg); } 100% { transform: translateX(360%) skewX(-18deg); } }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.2; } }
@keyframes nudge { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2px); } }
@keyframes roll { to { transform: rotate(360deg); } }
@keyframes shh { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
@keyframes pop-in { from { transform: translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes slap { 0% { transform: translateY(-16px) scale(1.7) rotate(calc(var(--tilt, 1) * 7deg)); opacity: 0; } 55% { transform: scale(0.9) rotate(calc(var(--tilt, 1) * -2deg)); opacity: 1; } 78% { transform: scale(1.05); } 100% { transform: none; opacity: 1; } }
@keyframes stamp { 0% { transform: scale(2.2) rotate(-10deg); opacity: 0; } 60% { transform: scale(0.92) rotate(2deg); opacity: 1; } 100% { transform: none; opacity: 1; } }
@keyframes shuffle { 0% { transform: none; } 30% { transform: translateX(-36px) rotate(-4deg); opacity: 0.2; } 31% { transform: translateX(44px) rotate(5deg); opacity: 0.2; } 70% { transform: translateX(-6px) rotate(-1deg); opacity: 1; } 100% { transform: none; } }
@keyframes hatch { 0%, 100% { transform: none; } 15% { transform: rotate(-3deg) scale(1.02); } 30% { transform: rotate(3deg) scale(1.04); } 45% { transform: rotate(-2deg) scale(1.02); } 60% { transform: rotate(2deg) scale(1.03, 0.97); } 80% { transform: scale(0.98, 1.02); } }
@keyframes puff { 0% { transform: translate(-50%, -50%) scale(0.4); opacity: 0; } 15% { opacity: 1; } 100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.5); opacity: 0; } }

/* the shuffle, where View Transitions exist: old card flung left, new one slides in and wobbles */
::view-transition-old(peekcard), ::view-transition-new(peekcard) { mix-blend-mode: normal; }
::view-transition-old(peekcard) { animation: card-out 0.3s cubic-bezier(0.5, 0, 0.8, 0.4) both; }
::view-transition-new(peekcard) { animation: card-in 0.52s 0.1s cubic-bezier(0.25, 1.35, 0.45, 1) both; }
@keyframes card-out { to { transform: translateX(-80px) rotate(-6deg); opacity: 0; } }
@keyframes card-in { from { transform: translateX(96px) rotate(7deg); opacity: 0; } 55% { opacity: 1; } 70% { transform: translateX(-8px) rotate(-1.5deg); } to { transform: none; opacity: 1; } }

/* scroll: parallax depth and section entrances straight from the scroll position */
@supports (animation-timeline: scroll()) {
  .stage .layer { animation: depth linear both; animation-timeline: scroll(root block); animation-range: 0 100vh; }
  @keyframes depth { to { translate: 0 calc((1 - var(--d)) * 36vh); } }
  .step, .grail, .how-h, .grails-head { animation: enter linear both; animation-timeline: view(); animation-range: entry 5% entry 70%; }
  @keyframes enter { from { opacity: 0; transform: translateY(48px); } to { opacity: 1; transform: none; } }
}
/* JS fallback for the entrances (scene.js adds .rise and .is-in) */
.rise { opacity: 0; transform: translateY(48px); transition: opacity 0.6s, transform 0.6s cubic-bezier(0.2, 0.9, 0.3, 1); }
.rise.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(peekcard), ::view-transition-new(peekcard) { animation-duration: 0.2s; }
  .btn-face { transition-duration: 0.2s; }
}

/* ---------------------------------------------------------------- tablet: headline across the top, card + controls below */
@media (max-width: 1099px) {
  .stage { padding: 40px 0 128px; }
  .stage-grid { grid-template-areas: 'head head' 'peek act'; grid-template-rows: auto auto; column-gap: 48px; }
  .peek { margin-top: 48px; }
  .act { padding-top: 48px; }
  .traits { margin-left: -24px; }
  .slots { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .steps { gap: 20px; }
  .grail-row { gap: 16px; }
}

/* ---------------------------------------------------------------- phone: one column, still offset */
@media (max-width: 719px) {
  .nav-in { gap: 12px; }
  .mark img { width: 126px; height: 22px; }
  .count { gap: 8px; }
  .count-bar, .count-lbl { display: none; }
  .count-num { font-size: 15px; }
  .count-of .sep { margin: 0 0.1em; }
  .btn-sm .btn-face { padding: 6px 12px; font-size: 15px; gap: 8px; }
  .wide { display: none; }

  .stage { padding: 28px 0 96px; }
  .stage-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: 'head' 'peek' 'act'; }
  .hl-b { text-shadow: 2px 0 var(--ink), -2px 0 var(--ink), 0 2px var(--ink), 0 -2px var(--ink), 2px 2px var(--ink), -2px 2px var(--ink), 2px -2px var(--ink), -2px -2px var(--ink), 5px 5px 0 var(--green-d); }
  .sub { margin-top: 12px; font-size: 22px; }
  .peek { margin-top: 64px; justify-self: end; }
  .card { box-shadow: var(--edge), 10px 12px 0 0 var(--shade); }
  .tag { left: -12px; top: -28px; font-size: 28px; padding: 6px 10px 4px; }
  .mine { right: -8px; top: -24px; font-size: 20px; }
  .act { padding-top: 16px; }
  .pipe, .drip { display: none; }
  .controls-row { flex-direction: column; align-items: stretch; gap: 12px; min-height: 0; }
  .status { order: -1; } /* right under the mint button, so it is on screen */
  .btn-alt { width: 100%; }
  .btn-mint .btn-face { font-size: 22px; }
  .status:empty { display: none; }
  .traits { margin-left: 0; margin-right: 12px; padding: 14px 14px 16px; }
  .traits-head { flex-wrap: wrap; }
  .l-front .junk, .l-front .bubble { display: none; }
  .stink .fume { top: calc(-8 * var(--px)); --rise: 5; }
  .price-note { font-size: 15px; }
  .slots { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .how { padding: 8px 0 72px; }
  .deco .x1, .deco .x2, .deco .x5, .deco .x6 { display: none; }
  .deco .x3 { left: auto; right: 16px; top: 18px; }
  .deco .x4 { left: auto; right: 72px; top: 40px; }
  .j-fish, .j-can, .j-apple, .j-ticket, .j-fry { top: auto; }
  .j-fish { left: 8%; bottom: 40px; }
  .j-can { left: 30%; bottom: 20px; }
  .j-apple { left: 54%; bottom: 44px; }
  .j-ticket { left: 76%; bottom: 24px; }
  .j-fry { display: none; }
  .how-h, .grails h2 { font-size: 32px; }
  .steps { grid-template-columns: minmax(0, 1fr); gap: 20px; margin-top: 28px; }
  .step:nth-child(2) { margin: 0 0 0 24px; }
  .step:nth-child(3) { margin: 0 24px 0 0; }
  .grails-head { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .grail-row { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 28px; }
  .grail:nth-child(even) { margin-top: 0; }
  .grail:nth-child(3n + 2) { margin-top: 24px; }
  .grail b { font-size: 20px; }
  .foot-in { flex-wrap: wrap; gap: 8px 16px; }
  .foot-links { margin-left: -12px; width: 100%; }
}
