/* AFTERIMAGE — playing cards for people who fool people.
   Layering: section backgrounds (static flow) < #gl canvas (fixed, z 1) < section content (z 2) < bar (z 20).
   So every WebGL view paints over its section's colour and under its copy. */

:root {
  --ink: #0C0C0D; --stage: #060607; --paper: #F3F0E9; --stock: #FBF9F4;
  --red: #C8142F; --graphite: #8E8C86; --gilt: #B8935A;
  --fg: var(--ink); --bg: var(--paper); --dim: rgba(12, 12, 13, .58); --rule: rgba(12, 12, 13, .16);
  --f-display: "Bodoni Moda", "Bodoni 72", Didot, "Times New Roman", serif;
  --f-ui: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  --pad: clamp(20px, 4.2vw, 72px);
  --gap: clamp(16px, 2vw, 32px);
  --ease: cubic-bezier(.2, .7, .1, 1);
  --ease-io: cubic-bezier(.65, 0, .35, 1);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: clip; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 17px/1.55 var(--f-ui); font-stretch: 96%;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; overflow-x: clip;
}
::selection { background: var(--ink); color: var(--paper); }
img, svg, canvas { display: block; max-width: 100%; }
[hidden] { display: none !important; }
a { color: inherit; }
button { font: inherit; color: inherit; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: fixed; left: 12px; top: -60px; z-index: 100; background: var(--ink); color: var(--paper); padding: 10px 14px; }
.skip:focus { top: 12px; }
:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }

/* ---- type ---------------------------------------------------------------------------------- */
.display { font-family: var(--f-display); font-weight: 500; font-optical-sizing: auto; letter-spacing: -.018em; line-height: .94; margin: 0; text-wrap: balance; }
.display em { font-style: italic; font-weight: 400; }
h2.display { font-size: clamp(42px, 6.2vw, 104px); margin-bottom: .32em; }
h3.display { font-size: clamp(28px, 3.1vw, 50px); line-height: 1; }
.kicker { font: 500 11.5px/1.4 var(--f-mono); letter-spacing: .14em; text-transform: uppercase; margin: 0 0 18px; opacity: .78; }
.lede { font-size: clamp(17px, 1.35vw, 21px); line-height: 1.5; max-width: 30em; }
p { margin: 0 0 1em; max-width: 36em; }
.mono { font-family: var(--f-mono); font-size: 12.5px; letter-spacing: .02em; }
.small { font-size: 13.5px; }
.dim { opacity: .6; }
.red { color: var(--red); }

/* ---- buttons ---------------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 22px;
  font: 600 14px/1 var(--f-ui); letter-spacing: .02em; text-decoration: none; cursor: pointer;
  border: 1px solid currentColor; border-radius: 999px; background: transparent; color: inherit;
  transition: background .3s var(--ease), color .3s var(--ease), transform .3s var(--ease), opacity .3s;
  position: relative; overflow: hidden; isolation: isolate;
}
.btn::before { content: ""; position: absolute; inset: 0; z-index: -1; background: currentColor; transform: scaleY(0); transform-origin: 50% 100%; transition: transform .45s var(--ease); }
.btn:hover::before, .btn:focus-visible::before { transform: scaleY(1); }
.paper .btn:hover, .paper .btn:focus-visible { color: var(--paper); }
.stage .btn:hover, .stage .btn:focus-visible, #boot .btn:hover, #boot .btn:focus-visible { color: var(--ink); }
.btn.solid { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn.solid::before { background: var(--paper); }
.paper .btn.solid:hover, .paper .btn.solid:focus-visible { color: var(--ink); }
.stage .btn.solid, #boot .btn.solid { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.stage .btn.solid::before, #boot .btn.solid::before { background: var(--ink); }
.stage .btn.solid:hover, .stage .btn.solid:focus-visible, #boot .btn.solid:hover, #boot .btn.solid:focus-visible { color: var(--paper); }
.btn.small { min-height: 40px; padding: 0 16px; font-size: 13px; }
.btn.big { min-height: 60px; padding: 0 34px; font-size: 16px; }
.btn.ghosty { border-color: rgba(243, 240, 233, .35); }
.btn[disabled] { opacity: .35; cursor: default; }
.btn[disabled]::before { display: none; }
.chip { font: 500 12px/1 var(--f-mono); padding: 8px 12px; border-radius: 99px; border: 1px solid rgba(243, 240, 233, .3); background: none; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.link { background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* ---- the wordmark (with its afterimage) ---------------------------------------------------------- */
.wordmark { position: relative; display: inline-block; text-decoration: none; font: 600 15px/1 var(--f-display); letter-spacing: .32em; margin: 0; }
.wordmark .wm { display: block; }
.wordmark .ghost { position: absolute; inset: 0; transform: translate(.16em, .1em); opacity: .22; pointer-events: none; transition: transform .8s var(--ease), opacity .8s; }
.wordmark:hover .ghost { transform: translate(.34em, .2em); opacity: .14; }
.wordmark.big { font-size: clamp(30px, 6.4vw, 92px); letter-spacing: .22em; }

/* ---- canvas & views ------------------------------------------------------------------------------- */
#gl { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 1; pointer-events: none; }
.view-fill { position: absolute; inset: 0; }
html.nogl #gl { display: none; }

/* ---- top bar ---------------------------------------------------------------------------------- */
#bar {
  position: fixed; inset: 0 0 auto 0; z-index: 20; height: 64px; padding: 0 var(--pad);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  color: #fff; mix-blend-mode: difference; pointer-events: none;
}
#bar > * { pointer-events: auto; }
#bar .wordmark { justify-self: start; font-size: 13px; }
.bar-tools { justify-self: end; display: flex; gap: 6px; }
.tool { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px; border-radius: 99px; border: 1px solid rgba(255, 255, 255, .35); background: none; cursor: pointer; font: 500 12px/1 var(--f-mono); letter-spacing: .04em; }
.tool[aria-pressed="true"] { background: #fff; color: #000; }
.tool-ic { width: 15px; height: 15px; display: inline-block; }
.tool-ic svg { width: 100%; height: 100%; }
#rail { display: flex; gap: 2px; align-items: center; }
#rail a { display: grid; place-items: center; width: 26px; height: 34px; text-decoration: none; font: 600 13px/1 var(--f-display); opacity: .45; position: relative; transition: opacity .3s; }
#rail a::after { content: ""; position: absolute; left: 50%; bottom: 3px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: currentColor; transform: scale(0); transition: transform .4s var(--ease); }
#rail a:hover { opacity: .9; }
#rail a[aria-current="true"] { opacity: 1; }
#rail a[aria-current="true"]::after { transform: scale(1); }

/* ---- sections ---------------------------------------------------------------------------------- */
.sec { position: relative; padding: 140px var(--pad) 120px; }
:where(.sec) > :where(*) { position: relative; z-index: 2; }
.sec > .view-fill { position: absolute; z-index: auto; }
.paper { background: var(--paper); color: var(--ink); }
.stage { background: var(--stage); color: var(--paper); --dim: rgba(243, 240, 233, .6); --rule: rgba(243, 240, 233, .16); }
/* the card corner: every section wears its index like a card */
.sec-index { position: absolute; z-index: 3; top: 78px; left: max(12px, calc(var(--pad) * .3)); display: grid; justify-items: center; gap: 2px; pointer-events: none; }
.sec-index .r { font: 600 clamp(26px, 2.4vw, 36px)/1 var(--f-display); }
.sec-index svg { width: clamp(14px, 1.2vw, 18px); fill: currentColor; }
.sec-index.br { top: auto; left: auto; bottom: 22px; right: max(12px, calc(var(--pad) * .3)); transform: rotate(180deg); }
.sec-index { opacity: 0; transform: translateY(-12px) rotate(-8deg); transition: opacity .7s var(--ease), transform .9s var(--ease); }
.sec-index.br { transform: rotate(172deg) translateY(-12px); }
.sec.in .sec-index { opacity: 1; transform: none; }
.sec.in .sec-index.br { transform: rotate(180deg); }
.pin { padding: 0; }
.pin .stick { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; }

/* reveal on entry */
.rv { opacity: 0; transform: translateY(26px); transition: opacity 1s var(--ease), transform 1.1s var(--ease); }
.rv.in { opacity: 1; transform: none; }

/* ============================================================ BOOT */
#boot { position: fixed; inset: 0; z-index: 50; background: var(--stage); color: var(--paper); display: grid; place-items: center; transition: opacity 1s var(--ease), visibility 1s; }
#boot.gone { opacity: 0; visibility: hidden; }
.boot-field { position: absolute; inset: 0; }
.boot-inner { position: relative; z-index: 2; display: grid; justify-items: center; text-align: center; gap: 22px; padding: 24px; max-width: 760px; }
.boot-count { opacity: .7; margin: 0; }
.boot-lede { font-size: 18px; max-width: 28em; margin: 0; opacity: .86; }
.boot-go { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.calm-check { display: flex; gap: 12px; align-items: flex-start; text-align: left; max-width: 34em; font-size: 13.5px; line-height: 1.45; opacity: .78; cursor: pointer; }
.calm-check input { margin-top: 3px; width: 16px; height: 16px; accent-color: #f3f0e9; }
html.booting { overflow: hidden; }
html.gl #boot { background: transparent; }
html.booting main, html.booting #foot { visibility: hidden; }
html.booting #bar { opacity: 0; }

/* ============================================================ A · HERO */
.hero { min-height: 100vh; min-height: 100svh; padding: 0; display: grid; overflow: clip; }
.hero-deck { position: absolute; inset: 0; z-index: 2; cursor: grab; }
.hero-deck:active { cursor: grabbing; }
.hero-copy { position: relative; z-index: 3; align-self: end; padding: 0 var(--pad) clamp(28px, 5vh, 64px); pointer-events: none; display: grid; gap: 22px; }
.hero-copy > * { pointer-events: auto; }
.hero .hero-kicker { position: absolute; top: 96px; left: var(--pad); margin: 0; z-index: 3; }
.hero h1 { font-size: clamp(72px, 12.4vw, 236px); line-height: .82; letter-spacing: -.035em; font-weight: 500; margin: 0 0 0 -.04em; width: max-content; }
.slice::before, .slice::after { white-space: pre-line; }
.hero-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 32px; flex-wrap: wrap; }
.hero .lede { margin: 0; max-width: 25em; }
.hero-ctas { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-hint { position: absolute; z-index: 3; right: var(--pad); top: 96px; margin: 0; opacity: .55; }
/* op-art headline: the type is cut in two, and the lower half slides like a stripe shifting phase */
.slice { position: relative; color: transparent; --slide: 0px; }
.slice::before, .slice::after { content: attr(data-text); position: absolute; inset: 0; color: var(--ink); pointer-events: none; }
.slice::before { clip-path: inset(0 0 49.4% 0); }
.slice::after { clip-path: inset(50.6% 0 0 0); transform: translateX(var(--slide)); }
.stage .slice::before, .stage .slice::after { color: var(--paper); }

/* ============================================================ 2 · THE COUNT */
.count { min-height: 100vh; min-height: 100svh; padding-top: 110px; padding-bottom: 60px; overflow: clip; }
.count-ui { display: grid; grid-template-columns: minmax(280px, 25vw) 1fr; grid-template-rows: auto 1fr auto; gap: 20px 4vw; min-height: calc(100svh - 170px); pointer-events: none; }
.count-ui > * { pointer-events: auto; }
.count-head { grid-column: 1; }
.count-head h2 { font-size: clamp(40px, 4.4vw, 76px); }
.count-steps { grid-column: 1; grid-row: 2; list-style: none; margin: 0; padding: 0; counter-reset: s; display: grid; gap: 14px; align-content: start; font-size: 15px; line-height: 1.45; }
.count-steps li { counter-increment: s; position: relative; padding-left: 30px; opacity: .9; transition: opacity .6s; }
.count-steps li::before { content: counter(s); position: absolute; left: 0; top: 0; font: 600 15px/1.45 var(--f-display); color: var(--paper); opacity: .55; }
.count-steps b { font-weight: 600; }
.count.dealing .count-steps li { opacity: .5; }
.count-ctl { grid-column: 1; grid-row: 3; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.speed { display: flex; gap: 6px; align-items: center; width: 100%; margin-top: 4px; }
.speed .mono { opacity: .6; margin-right: 4px; }
.deal-n { width: 100%; margin: 6px 0 0; opacity: .8; }
.count-reveal { position: absolute; z-index: 4; left: var(--pad); right: var(--pad); bottom: clamp(40px, 9vh, 120px); display: grid; justify-items: start; gap: 18px; pointer-events: auto; }
.count-reveal[hidden] { display: none; }
.count-reveal h3 { font-size: clamp(46px, 7vw, 124px); line-height: .9; }
.count-reveal h3 .rs { color: var(--red); }
.reveal-ctl { display: flex; gap: 10px; flex-wrap: wrap; }
.count.revealed .count-steps, .count.revealed .count-ctl, .count.revealed .count-head { opacity: 0; pointer-events: none; transition: opacity .8s; }

/* ============================================================ 3 · THE SECRET */
.secret-grid { display: grid; grid-template-columns: minmax(300px, 0.9fr) 1.6fr; gap: 4vw; align-items: start; }
.secret-copy h2 { font-size: clamp(40px, 4.6vw, 80px); margin-bottom: 30px; }
.your-card { white-space: nowrap; }
.your-card .rs { color: var(--red); }
.paths { margin-top: 26px; display: grid; gap: 10px; }
.paths .mono { opacity: .7; }
.path-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.path-btns button { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--rule); background: none; font: 600 15px/1 var(--f-display); cursor: pointer; transition: background .25s, color .25s, border-color .25s; }
.path-btns button[aria-pressed="true"], .path-btns button:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.secret-fig { margin: 0; position: sticky; top: 90px; }
.secret-board { position: relative; width: 100%; aspect-ratio: 13 / 5.2; }
.secret-board .sb-card { position: absolute; border-radius: 4%; background: var(--stock); box-shadow: 0 0 0 1px rgba(12, 12, 13, .14), 0 6px 14px -8px rgba(12, 12, 13, .3); display: grid; place-items: center; font: 600 clamp(9px, 0.95vw, 15px)/1 var(--f-display); transition: opacity .4s, transform .4s var(--ease), box-shadow .4s; }
.secret-board .sb-card .su { width: 46%; }
.secret-board .sb-card.red { color: var(--red); }
.secret-board .sb-card.red svg { fill: var(--red); }
.secret-board .sb-card svg { fill: var(--ink); }
.secret-board .sb-card.on { box-shadow: 0 0 0 1.5px var(--ink), 0 8px 18px -8px rgba(12, 12, 13, .45); }
.secret-board .sb-card.final { box-shadow: 0 0 0 2.5px var(--red), 0 10px 24px -8px rgba(200, 20, 47, .5); transform: translateY(-4px); }
.secret-board .sb-card .ix { position: absolute; left: 6%; top: 4%; font: 500 clamp(7px, .6vw, 9px)/1 var(--f-mono); opacity: .45; }
.secret-board svg.paths-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.secret-fig figcaption { margin-top: 14px; opacity: .7; }
.secret-facts { margin-top: 90px; display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); border-top: 1px solid var(--rule); padding-top: 34px; }
.fact .num { font-size: clamp(48px, 5vw, 88px); margin-bottom: 14px; }
.fact p { font-size: 15px; }

/* ============================================================ 4 · THE EYE */
.eye { padding-bottom: 40px; }
.eye-head { max-width: 1100px; margin-bottom: 70px; }
.eye-head h2 { margin-bottom: 26px; }
.illusion { display: grid; grid-template-columns: 1.35fr 1fr; gap: 4vw; align-items: center; min-height: 92vh; padding: 5vh 0; border-top: 1px solid var(--rule); }
.illusion:nth-of-type(even) { grid-template-columns: 1fr 1.35fr; }
.illusion:nth-of-type(even) .ill-view { order: 2; }
.ill-view { aspect-ratio: 1; width: 100%; max-height: 80vh; max-width: 80vh; justify-self: center; border-radius: 2px; }
/* moving (scroll-linked) high-contrast patterns stay under a quarter of the screen */
.ouchi .ill-view { max-width: min(100%, 44vh); }
.cafe .ill-view { max-width: min(100%, 62vh); }
.ill-copy h3 { margin-bottom: 18px; }
.ill-n { opacity: .55; margin: 0 0 12px; }
.ill-note { margin-top: 22px; opacity: .55; }
.ill-timer { min-height: 1.4em; margin-top: 12px; opacity: .8; }

/* ============================================================ 5 · PLAIN SIGHT */
.sight-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5vw; align-items: center; }
.sight-card { position: relative; justify-self: center; width: min(100%, 470px); }
.sight-back { width: 100%; aspect-ratio: 63 / 88; border-radius: 4.6% / 3.3%; box-shadow: 0 0 0 1px rgba(12, 12, 13, .1), 0 40px 70px -40px rgba(12, 12, 13, .55); cursor: none; }
.loupe { position: absolute; width: 190px; height: 190px; border-radius: 50%; left: 0; top: 0; pointer-events: none; opacity: 0; transform: scale(.6); transition: opacity .3s, transform .4s var(--ease); box-shadow: 0 0 0 1.5px var(--ink), 0 0 0 7px rgba(243, 240, 233, .9), 0 0 0 8.5px var(--ink), 0 24px 40px -16px rgba(0, 0, 0, .55); overflow: hidden; z-index: 3; }
.loupe.on { opacity: 1; transform: scale(1); }
.loupe-view { position: absolute; inset: 0; }
.lesson { padding-left: 0; list-style: none; counter-reset: l; display: grid; gap: 12px; margin: 24px 0 28px; }
.lesson li { counter-increment: l; position: relative; padding-left: 28px; font-size: 15.5px; }
.lesson li::before { content: counter(l); position: absolute; left: 0; top: 0; font: 600 15px/1.5 var(--f-display); opacity: .5; }
.quiz { border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); padding: 20px 0; margin-bottom: 26px; }
.quiz-q { margin: 0 0 12px; }
.pick { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.pick button { min-width: 38px; height: 38px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--rule); background: var(--stock); font: 600 15px/1 var(--f-display); cursor: pointer; }
.pick button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.pick.suits button svg { width: 15px; height: 15px; fill: var(--ink); margin: 0 auto; }
.pick.suits button[data-red] svg { fill: var(--red); }
.pick.suits button[aria-pressed="true"] svg { fill: var(--paper); }
.quiz-out { min-height: 1.5em; margin: 8px 0 0; font-weight: 600; }

/* ============================================================ 6 · THE SHUFFLE */
.shuffle { min-height: 100vh; overflow: clip; }
.shuffle-copy { max-width: 560px; min-height: 64vh; }
.shuffle-stage { position: absolute !important; top: 0; right: 0; width: 60%; height: 78vh; cursor: grab; z-index: 2; }
.factorial { font-size: clamp(14px, 2.05vw, 32px); line-height: 1.3; letter-spacing: .02em; margin: 36px 0 30px; max-width: none; color: var(--paper); opacity: .92; }
.shuffle-ctl { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; margin-bottom: 70px; }
.shuffle-ctl p { margin: 0; }
.sigil-wrap { display: grid; grid-template-columns: minmax(260px, 420px) 1fr; gap: 5vw; align-items: start; }
.sigil { margin: 0; }
.sigil svg { width: 100%; aspect-ratio: 1; overflow: visible; }
.sigil figcaption { opacity: .65; margin-top: 10px; }
.order { columns: 4; column-gap: 18px; list-style: none; padding: 0; margin: 22px 0 28px; opacity: .8; }
.order li { break-inside: avoid; line-height: 1.6; }
.order li .r { color: var(--red); }
.order li .n { opacity: .45; display: inline-block; width: 2.2em; }

/* ============================================================ 7 · FARO */
.faro { height: 420vh; }
.faro-copy { position: absolute; z-index: 2; left: var(--pad); top: 110px; max-width: 600px; }
.faro-copy h2 { max-width: 12ch; }
.faro-copy h2 { font-size: clamp(40px, 4.6vw, 80px); margin-bottom: 24px; }
.faro-n { position: absolute; z-index: 2; right: var(--pad); top: 110px; font-size: clamp(80px, 11vw, 190px); line-height: .8; margin: 0; }
.faro-n span { font-size: .35em; opacity: .45; }

/* ============================================================ 8 · THE COURT */
.court-head { max-width: 1100px; margin-bottom: 70px; }
.court-head h2 { margin-bottom: 26px; }
.court-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(14px, 2.2vw, 36px); }
.court-card { position: relative; perspective: 1400px; cursor: pointer; }
.court-card .cc-in { position: relative; aspect-ratio: 63 / 88; transform-style: preserve-3d; transition: transform 1s var(--ease); }
.court-card.flipped .cc-in { transform: rotateY(180deg); }
.court-card .cc-face, .court-card .cc-back { position: absolute; inset: 0; border-radius: 5% / 3.6%; backface-visibility: hidden; overflow: hidden; }
.court-card .cc-face { background: var(--stock); box-shadow: 0 30px 50px -30px rgba(0, 0, 0, .8); }
.court-card .cc-face canvas { width: 100%; height: 100%; }
.court-card .cc-back { transform: rotateY(180deg); background: var(--stock); color: var(--ink); padding: 12%; display: flex; flex-direction: column; justify-content: center; gap: 10px; }
.court-card .cc-back h3 { font: 500 clamp(22px, 2vw, 34px)/1 var(--f-display); margin: 0; }
.court-card .cc-back p { font-size: 13.5px; line-height: 1.45; margin: 0; }
.court-card .cc-back .mono { opacity: .6; font-size: 11px; }
.court-card .cc-cap { margin-top: 12px; display: flex; justify-content: space-between; align-items: baseline; }
.court-card .cc-cap b { font: 500 19px/1 var(--f-display); }
.court-card .cc-cap span { opacity: .55; }

/* ============================================================ 9 · ACE */
.ace-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5vw; align-items: center; }
.ace-card { position: relative; justify-self: center; width: min(100%, 460px); }
#ace-canvas { width: 100%; aspect-ratio: 63 / 88; border-radius: 4.6% / 3.3%; box-shadow: 0 0 0 1px rgba(12, 12, 13, .1), 0 40px 70px -40px rgba(12, 12, 13, .55); cursor: none; }
.ace-loupe { position: absolute; width: 220px; height: 220px; left: 0; top: 0; border-radius: 50%; overflow: hidden; pointer-events: none; opacity: 0; transform: scale(.6); transition: opacity .3s, transform .4s var(--ease); box-shadow: 0 0 0 1.5px var(--ink), 0 0 0 7px rgba(243, 240, 233, .9), 0 0 0 8.5px var(--ink), 0 24px 40px -16px rgba(0, 0, 0, .55); }
.ace-loupe.on { opacity: 1; transform: scale(1); }
.ace-loupe canvas { position: absolute; left: 0; top: 0; }
.ace-tip { text-align: center; margin-top: 16px; }

/* ============================================================ 10 · STOCK */
.stock { height: 240vh; }
.stock .stick { display: grid; grid-template-columns: minmax(300px, 0.8fr) 1.2fr; align-content: space-between; gap: 30px; padding: 110px var(--pad) 36px; }
.stock .stick > *:not(.stock-stage):not(.sec-index):not(.layer-label) { position: relative; z-index: 2; }
.stock-stage { position: absolute; inset: 0 0 0 34%; z-index: 2; cursor: grab; }
.stock-copy { grid-column: 1; }
.stock-specs { grid-column: 1; grid-row: 2; margin: 0; display: grid; gap: 0; align-self: end; }
.stock-specs div { display: grid; grid-template-columns: 90px 1fr; gap: 16px; padding: 16px 0; border-top: 1px solid var(--rule); }
.stock-specs dt { opacity: .6; padding-top: 3px; }
.stock-specs dd { margin: 0; font-size: 15.5px; }
.layer-label { position: absolute; left: 0; top: 0; z-index: 3; pointer-events: none; display: grid; gap: 2px; opacity: 0; padding-left: 14px; border-left: 1px solid rgba(243, 240, 233, .5); }
.layer-label b { font: 500 17px/1.1 var(--f-display); }
.layer-label span { font: 400 11.5px/1.3 var(--f-mono); opacity: .65; }

/* ============================================================ J · EDITIONS */
.ed-grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: 4vw; align-items: center; }
.ed-stage { aspect-ratio: 1 / 1; width: 100%; max-height: 82vh; cursor: grab; }
.ed-list { display: grid; margin: 28px 0 26px; border-top: 1px solid var(--rule); }
.ed-item { display: grid; grid-template-columns: 1fr auto; gap: 4px 14px; padding: 15px 4px 15px 30px; border-bottom: 1px solid var(--rule); cursor: pointer; text-align: left; background: none; border-left: 0; border-right: 0; border-top: 0; position: relative; }
.ed-item::before { content: ""; position: absolute; left: 4px; top: 21px; width: 12px; height: 12px; border-radius: 50%; border: 1px solid currentColor; }
.ed-item[aria-checked="true"]::before { background: currentColor; box-shadow: inset 0 0 0 2.5px var(--paper); }
.ed-item b { font: 500 22px/1.1 var(--f-display); }
.ed-item .p { font: 500 14px/1.6 var(--f-mono); }
.ed-item .d { grid-column: 1 / -1; font-size: 14px; opacity: .7; }
.ed-buy { display: flex; gap: 22px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.ed-price { font-size: 46px; }

/* ============================================================ Q · ORPHEUS */
.orpheus { padding-top: 0; }
.orph-hero { margin: 0 calc(var(--pad) * -1); height: 92vh; }
.ht-view { width: 100%; height: 100%; }
.orph-copy { max-width: 760px; margin: 80px 0 90px; }
.orph-copy h2 { margin-bottom: 30px; }
.orph-pair { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
.orph-pair figure { margin: 0; }
.orph-pair .ht-view { aspect-ratio: 3 / 2; height: auto; }
.orph-pair figcaption { margin-top: 12px; opacity: .65; }
.ames { margin-top: 120px; display: grid; grid-template-columns: 1.4fr 1fr; gap: 4vw; align-items: center; }
.ames-view { aspect-ratio: 4 / 3; width: 100%; cursor: grab; }
.ames-copy h3 { margin-bottom: 20px; }

/* ============================================================ K · YOURS */
.yours { padding-bottom: 0; }
.letters { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap); margin-bottom: 120px; }
.letter { background: var(--stock); padding: 26px 24px 22px; border-radius: 6px; box-shadow: 0 1px 0 rgba(12, 12, 13, .08), 0 24px 40px -30px rgba(12, 12, 13, .5); transform: rotate(var(--r, 0deg)); }
.letter p { font: italic 400 20px/1.3 var(--f-display); }
.letter .sig { font-style: normal; opacity: .6; margin: 0; font-size: 12px; }
.letter:nth-child(1) { --r: -1.2deg; } .letter:nth-child(2) { --r: .9deg; margin-top: 30px; } .letter:nth-child(3) { --r: -.6deg; } .letter:nth-child(4) { --r: 1.4deg; margin-top: 46px; }
.finale { position: relative; margin: 0 calc(var(--pad) * -1); min-height: 100vh; display: grid; place-items: center; color: var(--paper); text-align: center; }
.finale.stage { background: transparent; }
html.nogl .finale.stage { background: var(--stage); }
.yours { background: linear-gradient(var(--paper) 0 calc(100% - 100vh), var(--stage) 0); }
.finale-copy { position: relative; z-index: 2; display: grid; justify-items: center; gap: 36px; padding: 0 var(--pad); align-self: end; margin-bottom: 14vh; }
.finale h2 { font-size: clamp(46px, 7.4vw, 130px); }

/* ============================================================ footer & tray */
#foot { position: relative; z-index: 2; background: var(--stage); color: var(--paper); padding: 40px var(--pad) 46px; display: grid; gap: 22px; border-top: 1px solid rgba(243, 240, 233, .12); }
.foot-row { display: flex; gap: 28px; align-items: center; flex-wrap: wrap; justify-content: space-between; }
.foot-row p { margin: 0; }
#tray { position: fixed; inset: 0; z-index: 40; display: grid; justify-items: end; background: rgba(6, 6, 7, .55); backdrop-filter: blur(3px); }
#tray[hidden] { display: none; }
.tray-in { width: min(440px, 100vw); height: 100%; background: var(--paper); color: var(--ink); padding: 26px 28px; display: flex; flex-direction: column; gap: 18px; overflow: auto; animation: trayIn .6s var(--ease); }
@keyframes trayIn { from { transform: translateX(100%); } }
.tray-in header { display: flex; justify-content: space-between; align-items: center; }
.tray-in .tool { border-color: var(--rule); }
#tray-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0; }
#tray-list li { display: flex; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--rule); }
.tray-total { font-size: 16px; }
#card-flash { position: fixed; inset: 0; z-index: 30; pointer-events: none; }
.nojs { position: fixed; inset: auto 0 0; z-index: 99; background: var(--ink); color: var(--paper); padding: 16px; margin: 0; text-align: center; max-width: none; }

/* ============================================================ responsive */
@media (max-width: 1100px) {
  .letters { grid-template-columns: repeat(2, 1fr); }
  .court-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 860px) {
  body { font-size: 16px; }
  #bar { height: 56px; grid-template-columns: auto 1fr; }
  #rail { display: none; }
  .tool .tool-l { display: none; }
  .sec { padding: 110px var(--pad) 90px; }
  .count-ui { grid-template-columns: 1fr; grid-template-rows: auto auto auto 1fr; min-height: calc(100svh - 150px); }
  .count-steps, .count-ctl { grid-column: 1; grid-row: auto; }
  .secret-grid, .sight-grid, .ace-grid, .ed-grid, .ames, .sigil-wrap, .illusion, .illusion:nth-of-type(even) { grid-template-columns: 1fr; }
  .illusion:nth-of-type(even) .ill-view { order: 0; }
  .illusion { min-height: auto; padding: 60px 0; }
  .secret-fig { position: relative; top: 0; }
  .secret-facts { grid-template-columns: 1fr; margin-top: 60px; }
  .stock .stick { grid-template-columns: 1fr; }
  .stock-specs { grid-column: 1; }
  .orph-pair { grid-template-columns: 1fr; }
  .orph-hero { height: 70vh; }
  .order { columns: 3; }
  .court-grid { grid-template-columns: repeat(2, 1fr); }
  .letters { grid-template-columns: 1fr; }
  .letter:nth-child(n) { margin-top: 0; }
  .hero-hint { display: none; }
  .sec-index:not(.br) { display: none; }
  .hero { min-height: 112svh; }
  .hero .hero-kicker { display: none; }
  .hero h1 { font-size: clamp(64px, 19vw, 120px); }
  .hero-ctas .btn { min-height: 44px; padding: 0 16px; font-size: 13px; }
  .count.dealing .count-steps, .count.dealing .count-head .kicker { display: none; }
  .count.dealing .count-head h2 { font-size: 30px; }
  .faro-n { top: auto; bottom: 4vh; right: var(--pad); font-size: 84px; }
  .faro-copy h2 { font-size: 40px; }
  .court-card .cc-cap { flex-direction: column; gap: 4px; }
  .stock { height: auto; }
  .stock .stick { position: relative; height: auto; display: flex; flex-direction: column; overflow: visible; }
  .stock-copy { order: 1; } .stock-stage { order: 2; } .stock-specs { order: 3; }
  .stock-stage { position: relative; inset: auto; height: 62vh; margin: 10px calc(var(--pad) * -1) 0; }
  .layer-label b { font-size: 14px; } .layer-label span { display: none; }
  .your-card { white-space: normal; }
  .finale h2 { font-size: clamp(38px, 11vw, 60px); }
  .faro-copy { top: 90px; right: var(--pad); }
  .shuffle-stage { position: relative !important; width: auto; height: 62vh; margin: 0 calc(var(--pad) * -1); }
  .shuffle-copy { min-height: 0; }
  .faro-copy p:not(.kicker) { display: none; }
}

/* ============================================================ motion & calm */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
  .rv { opacity: 1; transform: none; }
}
html.nogl .view-fill, html.nogl [data-view] { background-size: cover; background-position: center; }

/* ============================================================ three, seven, ace */
#pushkin { position: fixed; inset: 0; z-index: 60; background: rgba(6, 6, 7, .94); color: var(--paper); display: grid; place-items: center; align-content: center; gap: 34px; padding: 24px; animation: pkIn .5s var(--ease); }
#pushkin.out { opacity: 0; transition: opacity .5s; }
@keyframes pkIn { from { opacity: 0; } }
.pk-row { display: flex; gap: clamp(12px, 3vw, 40px); perspective: 1600px; }
.pk-card { width: clamp(110px, 16vw, 230px); aspect-ratio: 63 / 88; transform: translateY(-60px) rotate(-8deg); opacity: 0; transition: transform 1s var(--ease), opacity .6s; }
.pk-card.up { transform: none; opacity: 1; }
.pk-in { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; animation: pkFlip 1s .2s var(--ease) both; }
@keyframes pkFlip { from { transform: rotateY(180deg); } }
.pk-f, .pk-b { position: absolute; inset: 0; border-radius: 5% / 3.6%; overflow: hidden; backface-visibility: hidden; box-shadow: 0 40px 70px -30px #000; }
.pk-f canvas { width: 100%; height: 100%; }
.pk-b { transform: rotateY(180deg); background: repeating-radial-gradient(circle at 50% 50%, #0c0c0d 0 3px, #fbf9f4 3px 6px); border: 8px solid #fbf9f4; }
.pk-cap { font: 500 clamp(22px, 2.4vw, 34px)/1.25 var(--f-display); text-align: center; max-width: 30em; min-height: 3em; margin: 0; }
.pk-cap .mono { display: block; margin-top: 12px; font-size: 12px; opacity: .6; font-family: var(--f-mono); }
.ps { font: italic 400 17px/1.35 var(--f-display); margin: 14px 0 0; }

#pushkin .btn { color: var(--paper); }
#pushkin .btn:hover, #pushkin .btn:focus-visible { color: var(--ink); }

/* ============================================================ no WebGL: the Count as drawn cards */
.count-dom { grid-column: 2; grid-row: 1 / span 3; align-self: center; display: grid; grid-template-columns: repeat(13, 1fr); gap: 8px; }
.count-dom .cd { position: relative; aspect-ratio: 63 / 88; border-radius: 6%; border: 1px solid rgba(243, 240, 233, .16); display: grid; place-items: end center; transition: transform .5s var(--ease), opacity .5s; }
.count-dom .cd span { position: absolute; bottom: -18px; left: 0; right: 0; text-align: center; font: 500 9px var(--f-mono); opacity: .4; }
.count-dom .cd canvas { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 6%; }
.count-dom .cd.up { border-color: transparent; animation: cdIn .5s var(--ease); }
@keyframes cdIn { from { transform: translateY(-30px) rotate(-6deg); opacity: 0; } }
.count-dom .cd.down canvas { opacity: 0; }
.count-dom .cd.down { background: repeating-radial-gradient(circle at 50% 50%, #0c0c0d 0 1.5px, #e9e5dc 1.5px 3px); border: 3px solid #fbf9f4; opacity: .6; }
.count-dom .cd.final { transform: scale(1.5); z-index: 2; box-shadow: 0 0 0 2px var(--red), 0 20px 40px -10px #000; }
.count.revealed .count-dom { opacity: .9; }
@media (max-width: 860px) { .count-dom { grid-column: 1; grid-row: auto; grid-template-columns: repeat(7, 1fr); gap: 6px 5px; margin-bottom: 220px; } }

/* ============================================================ no WebGL: posters rendered from the site itself */
html.nogl .hero { background: var(--paper) url(../img/poster/hero.webp) center / cover no-repeat; }
html.nogl [data-view="troxler"] { background-image: url(../img/poster/troxler.webp); }
html.nogl [data-view="fraser"] { background-image: url(../img/poster/fraser.webp); }
html.nogl [data-view="cafe"] { background-image: url(../img/poster/cafe.webp); }
html.nogl [data-view="ouchi"] { background-image: url(../img/poster/ouchi.webp); }
html.nogl #sight-back { background-image: url(../img/poster/sight.webp); }
html.nogl .shuffle-stage { background: url(../img/poster/shuffle.webp) center / cover no-repeat; }
html.nogl [data-view="faro"] { background-image: url(../img/poster/faro.webp); }
html.nogl .stock-stage { background: url(../img/poster/stock.webp) center / cover no-repeat; }
html.nogl #ed-stage { background: url(../img/poster/tuck.webp) center / contain no-repeat; }
html.nogl #ames { background-image: url(../img/poster/ames.webp); }
html.nogl .finale { background: var(--stage) url(../img/poster/finale.webp) center / cover no-repeat; }
html.nogl [data-view="ht-exterior"] { background-image: url(../img/photo/orpheus-exterior.webp); }
html.nogl [data-view="ht-stalls"] { background-image: url(../img/photo/orpheus-stalls.webp); }
html.nogl [data-view="ht-booth"] { background-image: url(../img/photo/orpheus-booth.webp); }
html.nogl .loupe, html.nogl .hero-hint { display: none; }
.count.revealed .count-dom { align-self: start; transform: scale(.82); transform-origin: 50% 0; }

/* ============================================================ the cut: every heading is a card sliced in two */
.cut { position: relative; }
.cut > .cut-src { color: transparent; }
.cut > .cut-src * { color: transparent !important; }
.cut > .cut-a, .cut > .cut-b { position: absolute; inset: 0; pointer-events: none; color: inherit; }
.cut > .cut-a { clip-path: inset(-10% 0 calc(50% + .5px) 0); }
.cut > .cut-b { clip-path: inset(calc(50% + .5px) 0 -20% 0); transform: translateX(calc(var(--cut, 0) * 1px + var(--shear, 0) * 1px)); transition: transform 1.3s var(--ease); }
.cut > .cut-a { transform: translateX(calc(var(--cut, 0) * -0.35px)); transition: transform 1.3s var(--ease); }
.cut:not(.cut-in) { --cut: 46; }
.cut-in { --cut: 0; }
.cut .red { color: var(--red); }
@media (prefers-reduced-motion: reduce) { .cut { --cut: 0 !important; --shear: 0 !important; } }
