/* ============================================================
   TurboScanner — production project page (Tvoidom Studio)
   Dark product-lab / shopping-OS / cinematic WebGL case study.
   Stage 1: shell + Hero/Chaos Cloud. Later stages add WebGL scenes.
   ============================================================ */

:root {
  --ink-0: #030506;   /* near-black bg */
  --ink-1: #070b0f;   /* deep graphite */
  --ink-2: #101820;   /* panels / cards */
  --ink-3: #151d26;   /* secondary surfaces */
  --line: rgba(244, 247, 250, 0.10);
  --line-2: rgba(244, 247, 250, 0.06);

  --w-0: #f4f7fa;     /* primary white */
  --w-1: #9aa4b2;     /* secondary text */
  --w-2: #5f6875;     /* technical labels */

  --scan: #00f0d0;    /* scan turquoise */
  --ok: #a3ff12;      /* confirmed / match */
  --warn: #ffb84d;    /* needs confirmation */
  --laser: #ff3b30;   /* checkout laser only */

  --font-display: 'Clash Display', 'Manrope', system-ui, sans-serif;
  --font-body: 'Manrope', system-ui, sans-serif;
  --font-mono: 'Space Mono', ui-monospace, monospace;

  --maxw: 1320px;
  --gutter: clamp(20px, 5vw, 64px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }

body {
  margin: 0;
  /* CSS fallback gravity-glow shown only when the WebGL artbg can't run (no-WebGL); the canvas covers it otherwise */
  background:
    radial-gradient(58% 46% at 50% 40%, rgba(0, 240, 208, 0.05), transparent 70%),
    var(--ink-0);
  color: var(--w-0);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.5;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* arrived via the art-portal transition: cover the page BLACK instantly (portal.js then fades it out into the hero) */
html.from-portal::before { content: ''; position: fixed; inset: 0; background: #02040a; z-index: 2147483646; pointer-events: none; }

/* Geodesic Well — living WebGL background (artbg.js), behind all content */
.artbg {
  position: fixed; inset: 0; width: 100vw; height: 100vh;
  z-index: -1; pointer-events: none; display: block;
}

/* full-screen light flash over the hero as the well consumes the products (driven by initHero) */
.hero-flash {
  position: fixed; inset: 0; z-index: 4; pointer-events: none; opacity: 0;
  mix-blend-mode: screen; will-change: opacity;
  background: radial-gradient(circle at 62% 47%,
    rgba(212, 255, 250, 0.95) 0%, rgba(120, 255, 244, 0.7) 22%,
    rgba(0, 240, 208, 0.42) 50%, rgba(0, 240, 208, 0.16) 74%, transparent 100%);
}
@media (prefers-reduced-motion: reduce) { .hero-flash { display: none; } }

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
::selection { background: var(--scan); color: var(--ink-0); }

/* film grain */
.grain {
  position: fixed; inset: 0; z-index: 9999; pointer-events: none; opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

/* ---------- layout helpers ---------- */
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }
.section { position: relative; padding: clamp(90px, 14vh, 180px) 0; }
.section-num { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.18em;
  color: var(--scan); text-transform: uppercase; }
.eyebrow { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--w-2); display: inline-flex; align-items: center; gap: 10px; }
.eyebrow::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--scan);
  box-shadow: 0 0 12px var(--scan); }

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 0.98;
  letter-spacing: -0.02em; margin: 0; }
.h-xl { font-size: clamp(44px, 8.5vw, 132px); }
.h-lg { font-size: clamp(34px, 5.5vw, 84px); }
.h-md { font-size: clamp(26px, 3.4vw, 48px); }
.lead { color: var(--w-1); font-size: clamp(16px, 1.5vw, 21px); max-width: 56ch; }
.muted { color: var(--w-1); }
.mono { font-family: var(--font-mono); }
.outline-text { -webkit-text-stroke: 1px rgba(244,247,250,0.55); color: transparent; }

/* ---------- nav ---------- */
.ts-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px var(--gutter);
  background: linear-gradient(to bottom, rgba(3,5,6,0.7), rgba(3,5,6,0));
  backdrop-filter: blur(4px);
}
.ts-nav .brand { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.01em; font-size: 18px; }
.ts-nav .brand sup { color: var(--scan); }
.ts-nav .nav-right { display: flex; gap: 22px; align-items: center; font-size: 13px; }
.ts-nav .nav-right a { color: var(--w-1); transition: color .25s; }
.ts-nav .ts-nav .nav-right a:hover { color: var(--w-0); }
.ts-back { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.12em; color: var(--w-1); }
.ts-back:hover { color: var(--scan); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600;
  padding: 14px 22px; border-radius: 100px; border: 1px solid var(--line);
  transition: transform .3s cubic-bezier(.2,.8,.2,1), background .3s, color .3s, border-color .3s; }
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--scan); color: var(--ink-0); border-color: var(--scan); }
.btn-primary:hover { box-shadow: 0 10px 40px -10px var(--scan); }
.btn-ghost { color: var(--w-0); }
.btn-ghost:hover { border-color: var(--scan); color: var(--scan); }
.btn-arrow { transition: transform .3s; }
.btn:hover .btn-arrow { transform: translateX(4px); }

/* ============================================================
   HERO / CHAOS CLOUD
   ============================================================ */
.hero { position: relative; min-height: 100svh; display: flex; align-items: center;
  overflow: hidden; }
#hero-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0;
  opacity: 0; transition: opacity 1.2s ease; }
body.webgl-on #hero-canvas { opacity: 1; }
/* static fallback gradient when WebGL is off */
.hero::before {
  content: ''; position: absolute; inset: 0; z-index: 0;
  background:
    radial-gradient(60% 50% at 70% 40%, rgba(0,240,208,0.10), transparent 70%),
    radial-gradient(50% 60% at 20% 70%, rgba(0,240,208,0.05), transparent 70%),
    var(--ink-0);
}
body.webgl-on .hero::before { opacity: 0; transition: opacity 1s; }
.hero-grad { position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(to right, rgba(3,5,6,0.92) 0%, rgba(3,5,6,0.6) 42%, rgba(3,5,6,0.12) 66%, transparent 80%); }
.hero-inner { position: relative; z-index: 2; width: 100%; }
.hero h1 { margin: 18px 0 0; text-shadow: 0 2px 34px rgba(3,5,6,0.7), 0 1px 4px rgba(3,5,6,0.5); }
.hero .hero-sub { text-shadow: 0 2px 18px rgba(3,5,6,0.7); }
.hero .eyebrow { text-shadow: 0 1px 10px rgba(3,5,6,0.8); }
.hero .accent { color: var(--scan); }
.hero-sub { margin-top: 26px; }
.hero-actions { margin-top: 40px; display: flex; flex-wrap: wrap; gap: 14px; }
.scroll-cue { position: absolute; bottom: 26px; left: var(--gutter); z-index: 2;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.2em; color: var(--w-2);
  display: flex; align-items: center; gap: 10px; }
.scroll-cue .bar { width: 1px; height: 38px; background: linear-gradient(var(--scan), transparent);
  animation: cue 2.2s ease-in-out infinite; transform-origin: top; }
@keyframes cue { 0%,100%{ transform: scaleY(.4); opacity:.4 } 50%{ transform: scaleY(1); opacity:1 } }

/* ---------- flow strip ---------- */
.flow { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  background: var(--ink-1); }
.flow-track { display: flex; gap: 26px; align-items: center; padding: 22px var(--gutter);
  font-family: var(--font-mono); font-size: clamp(13px, 1.4vw, 16px); color: var(--w-1);
  flex-wrap: wrap; }
.flow-track b { color: var(--w-0); font-weight: 700; }
.flow-track .arrow { color: var(--scan); }

/* ---------- generic story section ---------- */
.story-head { max-width: 60ch; }
.story-head h2 { margin: 14px 0 18px; }
.two-col { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: clamp(30px, 5vw, 80px);
  align-items: center; margin-top: 56px; }
@media (max-width: 880px) { .two-col { grid-template-columns: 1fr; } }

/* chips / tokens */
.tokens { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.token { font-family: var(--font-mono); font-size: 13px; padding: 8px 14px; border-radius: 100px;
  border: 1px solid var(--line); color: var(--w-0); background: var(--ink-2); }
.token .src { color: var(--w-2); margin-left: 8px; font-size: 11px; }

/* source list */
.sources { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 12px; margin-top: 8px; }
.source { border: 1px solid var(--line); border-radius: 14px; padding: 16px; background: var(--ink-2); }
.source .k { font-family: var(--font-mono); font-size: 11px; letter-spacing: .14em; color: var(--scan); text-transform: uppercase; }
.source .v { margin-top: 8px; color: var(--w-1); font-size: 14px; }

/* match cards */
.matches { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px,1fr)); gap: 14px; margin-top: 40px; }
.match { border: 1px solid var(--line); border-radius: 16px; padding: 18px; background:
  linear-gradient(180deg, var(--ink-2), var(--ink-1)); display: flex; flex-direction: column; gap: 10px; }
.match .name { font-weight: 600; font-size: 17px; }
.match .row { display: flex; justify-content: space-between; align-items: center; font-family: var(--font-mono); font-size: 12px; }
.match .score { color: var(--w-2); }
.match .bar { height: 4px; border-radius: 4px; background: var(--ink-3); overflow: hidden; }
.match .bar > i { display: block; height: 100%; background: var(--scan); border-radius: 4px; }
.badge { font-family: var(--font-mono); font-size: 11px; padding: 4px 9px; border-radius: 100px; border: 1px solid var(--line); }
.badge.ok { color: var(--ok); border-color: rgba(163,255,18,.4); }
.badge.warn { color: var(--warn); border-color: rgba(255,184,77,.4); }
.badge.scan { color: var(--scan); border-color: rgba(0,240,208,.4); }

/* barcode session */
.session { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: 14px; margin-top: 40px; }
.bcard { border: 1px solid var(--line); border-radius: 16px; padding: 16px; background: var(--ink-2); }
.bcard .barcode { height: 56px; margin-top: 12px; border-radius: 6px;
  background-image: repeating-linear-gradient(90deg, var(--w-0) 0 2px, transparent 2px 4px, var(--w-0) 4px 5px, transparent 5px 9px, var(--w-0) 9px 12px, transparent 12px 14px);
  background-color: #fff; }
.bcard .saved { color: var(--ok); font-family: var(--font-mono); font-size: 11px; margin-top: 10px; }

/* fact cards */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap: 14px; margin-top: 48px; }
.fact { border: 1px solid var(--line); border-radius: 18px; padding: 22px; background: var(--ink-1); }
.fact h3 { font-family: var(--font-mono); font-size: 12px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--scan); font-weight: 400; }
.fact ul { list-style: none; padding: 0; margin: 16px 0 0; }
.fact li { color: var(--w-1); font-size: 14px; padding: 7px 0; border-top: 1px solid var(--line-2); }
.fact li:first-child { border-top: 0; }

/* CTA */
.cta { text-align: center; padding: 0; position: relative; background: transparent; }
.cta h2 { margin: 0 auto 22px; max-width: 22ch; }
.cta .hero-actions { justify-content: center; }

/* (08) — SINGULARITY finale: fall into the well, a singularity awaits */
.cta-pin { position: relative; z-index: 2; min-height: 100vh; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.finale-bg { position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: 0; transition: opacity .5s ease; display: block; }
/* static singularity (no-WebGL / reduced-motion / mobile fallback) */
.cta-singularity { position: absolute; left: 50%; top: 46%; width: 78vmax; height: 78vmax; transform: translate(-50%, -50%);
  z-index: 1; pointer-events: none; border-radius: 50%;
  background: radial-gradient(circle, #ffffff 0%, rgba(205, 255, 249, .92) 1.3%, rgba(0, 240, 208, .5) 6.2%, rgba(0, 240, 208, .13) 16%, rgba(3, 5, 6, 0) 44%); }
#cta.is-animated .cta-singularity { display: none; }
.cta-inner { position: relative; z-index: 3; transform-origin: center center; will-change: transform, opacity; }
/* the final copy is a SHEET exhaled from the singularity */
#cta.is-animated .cta-inner { padding: clamp(30px, 5vw, 56px) clamp(26px, 5vw, 60px); border-radius: 22px;
  background: linear-gradient(180deg, rgba(13, 19, 26, .8), rgba(6, 10, 14, .92));
  border: 1px solid rgba(255, 255, 255, .09); -webkit-backdrop-filter: blur(7px); backdrop-filter: blur(7px);
  box-shadow: 0 50px 130px -30px rgba(0, 0, 0, .85), 0 0 72px rgba(0, 240, 208, .14); }
.cta-descent { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); z-index: 3; text-align: center; pointer-events: none; }
.cta-descent p { font-family: var(--font-mono); font-size: 13px; letter-spacing: .18em; text-transform: uppercase; color: var(--scan); opacity: 0; margin: 0; }
.cta-barcode { width: min(300px, 60vw); height: 50px; margin: 24px auto 6px; border-radius: 3px;
  background-image: repeating-linear-gradient(90deg, var(--w-0) 0 2px, transparent 2px 4px, var(--w-0) 4px 5px, transparent 5px 9px, var(--w-0) 9px 12px, transparent 12px 14px, var(--w-0) 14px 17px, transparent 17px 19px);
  filter: drop-shadow(0 0 11px rgba(0, 240, 208, .45)); }

/* footer */
.ts-foot { border-top: 1px solid var(--line); padding: 40px var(--gutter); color: var(--w-2);
  font-family: var(--font-mono); font-size: 12px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 14px; }

/* ============================================================
   SECTION 2 — EXTRACT (pinned scroll scene: messy text -> tokens -> phone)
   ============================================================ */
.extract { padding: 0; }
.extract-pin { min-height: 100svh; display: flex; align-items: center; padding: 80px 0; }
.ex-stage { display: grid; grid-template-columns: 1.05fr 0.75fr; gap: clamp(28px, 5vw, 70px);
  align-items: center; margin-top: 48px; }
@media (max-width: 900px) { .ex-stage { grid-template-columns: 1fr; } }

.ex-sources { display: flex; flex-direction: column; gap: 16px; }
.ex-msg { position: relative; border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px 18px;
  background: linear-gradient(180deg, var(--ink-2), var(--ink-1)); }
.ex-msg .ex-tag { font-family: var(--font-mono); font-size: 10px; letter-spacing: .16em; color: var(--w-2);
  text-transform: uppercase; display: block; margin-bottom: 8px; }
.ex-msg p { margin: 0; font-size: clamp(17px, 1.8vw, 22px); line-height: 1.5; color: var(--w-0);
  transition: color .5s ease; }
mark.kw { background: none; color: inherit; border-radius: 6px; padding: 1px 3px; transition: color .45s ease, background .45s ease, box-shadow .45s ease; }
/* parsing state: dim prose, light up the product words */
.extract.is-parsing .ex-msg p { color: var(--w-2); }
.extract.is-parsing mark.kw { color: var(--ink-0); background: var(--scan); box-shadow: 0 0 18px rgba(0,240,208,.5); }
.extract.is-parsing mark.kw.spent { color: var(--w-2); background: rgba(0,240,208,.10); box-shadow: none; }

.ex-phone { display: flex; justify-content: center; }
.ex-screen { width: min(340px, 90%); border: 1px solid var(--line); border-radius: 26px; padding: 18px;
  background: #05090d; box-shadow: 0 30px 80px -30px rgba(0,0,0,.8), inset 0 0 0 6px rgba(255,255,255,.02); }
.ex-screen-head { font-family: var(--font-mono); font-size: 12px; letter-spacing: .12em; color: var(--w-1);
  text-transform: uppercase; padding: 6px 4px 14px; border-bottom: 1px solid var(--line); }
.ex-screen-head .ex-count { color: var(--scan); }
.ex-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ex-list li { display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px; border-radius: 12px; background: rgba(255,255,255,.03); }
.ex-list li b { font-weight: 600; font-size: 15px; }
.ex-list li em { font-style: normal; font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em; color: var(--w-2); }
.ex-list li::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--scan);
  box-shadow: 0 0 10px var(--scan); margin-right: 10px; opacity: .9; }
.ex-list li b { margin-right: auto; }
/* hidden until the token lands (only when JS drives the scene) */
.extract.js-on .ex-list li { opacity: 0; transform: translateX(-14px); }

/* flying tokens layer (fixed, above the pinned scene) */
.ex-fly { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
.ex-chip { position: fixed; top: 0; left: 0; display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 13px; font-weight: 700; color: var(--ink-0);
  background: var(--scan); padding: 7px 12px; border-radius: 100px; white-space: nowrap;
  box-shadow: 0 6px 24px -6px rgba(0,240,208,.7); will-change: transform, opacity; opacity: 0; }
.ex-chip .src { color: rgba(3,5,6,.6); font-size: 10px; }
@media (prefers-reduced-motion: reduce) { .ex-fly { display: none; } }

/* ============================================================
   SECTION 3 — MATCH ENGINE (pinned: tokens <-> catalog, matching beams)
   ============================================================ */
.match-scene { padding: 0; }
.match-pin { min-height: 100svh; display: flex; align-items: center; padding: 70px 0; }
.match-pin .story-head h2 { font-size: clamp(28px, 4vw, 56px); }
.mt-stage { position: relative; display: grid; grid-template-columns: 210px 1fr; gap: clamp(40px, 9vw, 130px);
  align-items: center; margin-top: 36px; }
@media (max-width: 820px) { .mt-stage { grid-template-columns: 120px 1fr; gap: 30px; } }

.mt-links { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; overflow: visible; }
.mt-links path { fill: none; stroke-width: 2; opacity: 0; filter: drop-shadow(0 0 5px currentColor); }

.mt-tokens { display: flex; flex-direction: column; gap: 12px; position: relative; z-index: 2; }
.mt-token { font-family: var(--font-mono); font-size: 13px; color: var(--w-0); padding: 11px 14px;
  border: 1px solid var(--line); border-radius: 100px; background: var(--ink-2); text-align: center; }
.mt-token.lit { border-color: rgba(0,240,208,.5); box-shadow: 0 0 16px rgba(0,240,208,.18); }

.mt-cards { display: flex; flex-direction: column; gap: 12px; position: relative; z-index: 2; }
.mt-card { display: grid; grid-template-columns: 46px 1fr auto; gap: 14px; align-items: center;
  border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; background: linear-gradient(180deg, var(--ink-2), var(--ink-1));
  transition: border-color .4s, box-shadow .4s; }
.mt-card.matched.ok { border-color: rgba(163,255,18,.4); box-shadow: 0 0 22px -6px rgba(163,255,18,.3); }
.mt-card.matched.warn { border-color: rgba(255,184,77,.4); box-shadow: 0 0 22px -6px rgba(255,184,77,.3); }
.mt-thumb { width: 46px; height: 46px; border-radius: 10px; background: var(--ink-3); display: grid; place-items: center; font-size: 24px; }
.mt-body .mt-name { font-weight: 600; font-size: 15px; }
.mt-body .mt-meta { font-family: var(--font-mono); font-size: 11px; color: var(--w-2); margin-top: 2px; }
.mt-body .bar { height: 4px; border-radius: 4px; background: var(--ink-3); overflow: hidden; margin-top: 9px; }
.mt-body .bar > i { display: block; height: 100%; width: 90%; border-radius: 4px; background: var(--scan); }
.mt-card.matched.ok .bar > i { background: var(--ok); }
.mt-card.matched.warn .bar > i { background: var(--warn); }
.mt-right { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.mt-status { font-family: var(--font-mono); font-size: 11px; padding: 4px 9px; border-radius: 100px; border: 1px solid var(--line);
  color: var(--w-2); white-space: nowrap; }
.mt-card.matched.ok .mt-status { color: var(--ok); border-color: rgba(163,255,18,.4); }
.mt-card.matched.warn .mt-status { color: var(--warn); border-color: rgba(255,184,77,.4); }
.mt-barcode { font-family: var(--font-mono); font-size: 10px; letter-spacing: .1em; color: var(--scan); }
.mt-foot { margin-top: 26px; font-family: var(--font-mono); font-size: 13px; color: var(--w-1); }
.mt-foot b { color: var(--scan); }
/* hidden until the matching beam connects (only when JS drives the scene) */
.match-scene.js-on .mt-token { opacity: 0; transform: translateX(-12px); }
.match-scene.js-on .mt-card { opacity: 0; transform: translateX(14px); }
.match-scene.js-on .mt-status { opacity: 0; transform: translateY(4px); }
.match-scene.js-on .mt-barcode { opacity: 0; }
.match-scene.js-on .mt-body .bar > i { width: 0; }

/* ============================================================
   SECTION 4 — BARCODE SESSION (pinned: product cards flip into barcode
   cards along a horizontal ribbon; session counter fills)
   ============================================================ */
.barcode-scene { padding: 0; }
.bs-pin { min-height: 100svh; display: flex; flex-direction: column; justify-content: center; padding: 70px 0; overflow: hidden; }
.bs-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; }
.bs-head .story-head h2 { font-size: clamp(28px, 4vw, 56px); }
.bs-session { font-family: var(--font-mono); font-size: 12px; color: var(--w-1); text-align: right; line-height: 1.7; }
.bs-session .big { font-size: 15px; color: var(--w-0); }
.bs-session b { color: var(--scan); }
.bs-stage { margin-top: 40px; overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); }
.bs-track { display: flex; gap: 22px; padding: 24px max(0px, calc((100% - 1320px)/2 + 0px)); will-change: transform; }
.bs-card { flex: 0 0 290px; height: 330px; perspective: 1300px; }
.bs-card-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; will-change: transform; }
.bs-face { position: absolute; inset: 0; border: 1px solid var(--line); border-radius: 22px; padding: 24px;
  backface-visibility: hidden; -webkit-backface-visibility: hidden; display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--ink-2), var(--ink-1)); transition: border-color .4s, box-shadow .4s; }
.bs-face.back { transform: rotateY(180deg); }
.bs-thumb { width: 64px; height: 64px; border-radius: 16px; background: var(--ink-3); display: grid; place-items: center; font-size: 34px; }
.bs-name { font-weight: 600; font-size: 21px; margin-top: auto; }
.bs-meta { font-family: var(--font-mono); font-size: 12px; color: var(--w-2); margin-top: 4px; }
.bs-tagrow { font-family: var(--font-mono); font-size: 10px; letter-spacing: .14em; color: var(--scan); text-transform: uppercase; }
.bs-barcode { height: 96px; margin: 8px 0 14px; border-radius: 6px; background: #f4f7fa;
  background-image: repeating-linear-gradient(90deg, #05090d 0 2px, transparent 2px 4px, #05090d 4px 7px, transparent 7px 9px, #05090d 9px 11px, transparent 11px 16px, #05090d 16px 19px, transparent 19px 21px, #05090d 21px 24px, transparent 24px 27px); }
.bs-num { font-family: var(--font-mono); font-size: 12px; letter-spacing: .22em; color: var(--w-1); }
.bs-saved { font-family: var(--font-mono); font-size: 12px; color: var(--ok); margin-top: auto; opacity: .35; }
.bs-card.active .bs-face { border-color: rgba(0,240,208,.5); box-shadow: 0 0 44px -12px rgba(0,240,208,.45); }
.bs-card.active .bs-saved { opacity: 1; }
.bs-card.active .bs-barcode { box-shadow: 0 0 26px -4px rgba(0,240,208,.5); }
.bs-hint { margin-top: 22px; font-family: var(--font-mono); font-size: 11px; letter-spacing: .14em; color: var(--w-2); }

/* ============================================================
   SECTION 5 — SELF-CHECKOUT (pinned: laser scans the phone barcode,
   items drop into the receipt, progress fills)
   ============================================================ */
.checkout-scene { padding: 0; }
.co-pin { min-height: 100svh; display: flex; flex-direction: column; justify-content: center; padding: 70px 0; }
.co-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; }
.co-head .story-head h2 { font-size: clamp(28px, 4vw, 56px); }
.co-progress { font-family: var(--font-mono); font-size: 12px; color: var(--w-1); min-width: 210px; }
.co-pct { height: 5px; border-radius: 5px; background: var(--ink-3); overflow: hidden; margin-bottom: 8px; }
.co-pct > i { display: block; height: 100%; width: 0; background: var(--scan); border-radius: 5px; }
.co-progress .co-count { color: var(--scan); }
.co-stage { margin-top: 42px; display: grid; grid-template-columns: 360px 1fr; gap: clamp(30px, 6vw, 90px); align-items: center; }
@media (max-width: 820px) { .co-stage { grid-template-columns: 1fr; gap: 30px; } }

.co-phone { position: relative; }
.co-screen { border: 1px solid var(--line); border-radius: 26px; padding: 22px; background: #05090d; box-shadow: 0 30px 80px -30px rgba(0,0,0,.8); }
.co-screen-head { font-family: var(--font-mono); font-size: 11px; letter-spacing: .14em; color: var(--w-2); text-transform: uppercase; }
.co-bcwrap { position: relative; height: 210px; margin: 16px 0; border-radius: 14px; overflow: hidden; background: #f4f7fa;
  background-image: repeating-linear-gradient(90deg, #05090d 0 3px, transparent 3px 6px, #05090d 6px 10px, transparent 10px 13px, #05090d 13px 15px, transparent 15px 20px, #05090d 20px 24px, transparent 24px 28px, #05090d 28px 30px); }
.co-laser { position: absolute; left: -2%; width: 104%; height: 3px; top: 0; opacity: 0; background: #ff3b30;
  box-shadow: 0 0 18px 4px rgba(255,59,48,.85); }
.co-flash { position: absolute; inset: 0; background: var(--scan); opacity: 0; mix-blend-mode: screen; }
.co-item { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.co-item-name { font-size: 18px; font-weight: 600; }
.co-item-num { font-family: var(--font-mono); font-size: 11px; color: var(--w-2); letter-spacing: .14em; }
.co-done { position: absolute; inset: 0; display: grid; place-items: center; border-radius: 26px; background: rgba(5,9,13,.92);
  color: var(--ok); font-family: var(--font-mono); font-size: 17px; letter-spacing: .04em; opacity: 0; pointer-events: none; transition: opacity .4s; }

.co-receipt { border: 1px solid var(--line); border-radius: 18px; padding: 22px 24px; background: var(--ink-1); max-width: 460px; }
.co-receipt-head { font-family: var(--font-mono); font-size: 11px; letter-spacing: .14em; color: var(--w-2); text-transform: uppercase; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.co-rows { list-style: none; margin: 14px 0; padding: 0; display: flex; flex-direction: column; gap: 11px; }
.co-rows li { display: flex; align-items: center; justify-content: space-between; font-size: 15px; }
.co-rows li::before { content: '✓'; color: var(--ok); margin-right: 11px; font-size: 13px; }
.co-rows li span { margin-right: auto; }
.co-rows li em { font-style: normal; font-family: var(--font-mono); color: var(--w-1); }
.co-total { display: flex; justify-content: space-between; padding-top: 14px; border-top: 1px solid var(--line); font-family: var(--font-mono); font-size: 14px; }
.co-total b { color: var(--scan); }
.checkout-scene.js-on .co-rows li { opacity: 0; transform: translateX(12px); }

/* ============================================================
   SECTION 6 — REAL PRODUCT INTERFACE (sticky phone, screens switch on scroll)
   ============================================================ */
.ri-scene { padding: clamp(80px, 12vh, 150px) 0; }
.ri-grid { display: grid; grid-template-columns: 340px 1fr; gap: clamp(40px, 8vw, 120px); align-items: stretch; }
@media (max-width: 900px) { .ri-grid { grid-template-columns: 1fr; } }
.ri-phone-col { position: relative; }
.ri-phone { position: sticky; top: 16vh; width: 320px; height: 640px; margin: 0 auto; }
@media (max-width: 900px) { .ri-phone { position: relative; top: 0; margin-bottom: 40px; } }
.ri-device { position: absolute; inset: 0; border: 1px solid var(--line); border-radius: 40px; background: #05090d;
  box-shadow: 0 50px 120px -50px #000, inset 0 0 0 6px rgba(255,255,255,.02); overflow: hidden; }
.ri-screen { position: absolute; inset: 20px; opacity: 0; transform: translateY(14px) scale(.99);
  transition: opacity .5s ease, transform .5s ease; pointer-events: none; display: flex; flex-direction: column; gap: 10px; }
.ri-screen.active { opacity: 1; transform: none; }
.ri-head { font-family: var(--font-display); font-weight: 600; font-size: 22px; margin-top: 6px; }
.ri-sub { font-family: var(--font-mono); font-size: 11px; color: var(--w-2); margin-top: -4px; }
.ri-opts, .ri-list, .ri-alts { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.ri-opt, .ri-li, .ri-alt { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-radius: 12px;
  background: rgba(255,255,255,.03); font-size: 15px; }
.ri-li { justify-content: space-between; }
.ri-li b, .ri-opt span { font-weight: 600; font-size: 15px; }
.ri-li em, .ri-opt em { font-style: normal; font-family: var(--font-mono); font-size: 10px; color: var(--w-2); letter-spacing: .1em; }
.ri-li.done em { color: var(--ok); }
.ri-prod { border: 1px solid var(--line); border-radius: 14px; padding: 16px; background: rgba(255,255,255,.03); }
.ri-prod-top { display: flex; align-items: center; gap: 12px; font-size: 26px; }
.ri-prod-top div { display: flex; flex-direction: column; }
.ri-prod-top b { font-size: 16px; } .ri-prod-top span { font-family: var(--font-mono); font-size: 11px; color: var(--w-2); }
.ri-bar { height: 5px; border-radius: 5px; background: var(--ink-3); overflow: hidden; margin: 12px 0; }
.ri-bar > i { display: block; height: 100%; background: var(--ok); border-radius: 5px; }
.ri-badges { display: flex; gap: 8px; }
.ri-alt { justify-content: space-between; font-family: var(--font-mono); font-size: 13px; color: var(--w-1); }
.ri-btn { margin-top: auto; padding: 14px; border-radius: 14px; border: 0; background: var(--scan); color: var(--ink-0);
  font-weight: 700; font-size: 14px; font-family: var(--font-body); cursor: default; }
.ri-screen[data-s="confirm"] .ri-alt:first-of-type { color: var(--w-0); border: 1px solid rgba(0,240,208,.4); }

.ri-captions { display: flex; flex-direction: column; }
.ri-cap { min-height: 62vh; display: flex; flex-direction: column; justify-content: center; max-width: 48ch; }
.ri-scene.js-on .ri-cap { opacity: .35; transition: opacity .45s ease; }
.ri-scene.js-on .ri-cap.active { opacity: 1; }
.ri-cap .n { font-family: var(--font-mono); font-size: 12px; letter-spacing: .14em; color: var(--scan); }
.ri-cap h3 { font-size: clamp(26px, 3.2vw, 44px); margin: 14px 0 12px; }
.ri-cap p { color: var(--w-1); margin: 0; }

/* ============================================================
   MOBILE — pinned/scrub scenes are un-pinned in JS and shown static;
   here we relayout them to flow naturally on small screens.
   ============================================================ */
@media (max-width: 820px) {
  .extract-pin, .match-pin, .co-pin { min-height: auto; padding: 70px 0; }
  .extract-pin .container, .match-pin .container { }
  /* MATCH: drop the beams + tokens, show the matched catalog cards full-width */
  .mt-links, .mt-tokens { display: none; }
  .mt-stage { grid-template-columns: 1fr; margin-top: 28px; }
  /* BARCODE: ribbon becomes a centered vertical stack */
  .bs-pin { min-height: auto; overflow: visible; padding: 60px 0; }
  .bs-stage { overflow: visible; -webkit-mask-image: none; mask-image: none; margin-top: 28px; }
  .bs-track { flex-wrap: wrap; justify-content: center; transform: none !important; gap: 16px; padding: 0; }
  .bs-card { flex: 0 0 100%; max-width: 320px; height: 300px; }
  .bs-head { flex-direction: column; align-items: flex-start; }
  .bs-session { text-align: left; }
  /* CHECKOUT: phone over receipt, full width */
  .co-receipt { max-width: 100%; }
  .co-head { flex-direction: column; align-items: flex-start; }
  .co-progress { text-align: left; }
  /* INTERFACE: compact captions, all readable, phone in flow */
  .ri-cap { min-height: auto; padding: 24px 0; opacity: 1 !important; }
  .ri-scene .ri-grid { gap: 30px; }
}

/* scan-suction transition overlay (between acts) */
#tsx { position: fixed; inset: 0; z-index: 60; pointer-events: none; overflow: hidden; }
#tsx .tsx-veil { position: absolute; inset: 0; background: #020405; opacity: 0; will-change: opacity; }
#tsx .tsx-scan { position: absolute; left: -8%; right: -8%; top: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--scan), transparent);
  box-shadow: 0 0 26px 7px rgba(0, 240, 208, .6); opacity: 0; will-change: transform, opacity; }
#tsx .tsx-core { position: absolute; left: 50%; top: 50%; width: 46vmax; height: 46vmax; border-radius: 50%;
  transform: translate(-50%, -50%) scale(.18); opacity: 0; will-change: transform, opacity;
  background: radial-gradient(circle, #010304 0%, #010304 15%, rgba(0, 240, 208, .32) 23%, rgba(0, 240, 208, .07) 42%, transparent 66%); }
#tsx .tsx-flare { position: absolute; left: 50%; top: 50%; width: 52vmax; height: 52vmax; border-radius: 50%;
  transform: translate(-50%, -50%) scale(.45); opacity: 0; will-change: transform, opacity; mix-blend-mode: screen;
  background: radial-gradient(circle, rgba(235, 255, 252, 1) 0%, rgba(150, 255, 245, .9) 16%, rgba(0, 240, 208, .6) 36%, rgba(0, 240, 208, .18) 55%, transparent 72%); }
#tsx .tsx-streak { position: absolute; left: 50%; top: 50%; width: 2px; height: 56px; border-radius: 2px;
  transform-origin: center; opacity: 0; will-change: transform, opacity;
  background: linear-gradient(180deg, transparent, var(--scan), transparent); }
@media (prefers-reduced-motion: reduce) { #tsx { display: none; } }

/* rendered product thumbnails (replace emoji) */
.mt-thumb img, .bs-thumb img, .ri-thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }
.ri-prod-top img { width: 40px; height: 40px; object-fit: cover; border-radius: 10px; }

/* reveal */
[data-reveal] { opacity: 0; transform: translateY(26px); }
body.reveal-ready [data-reveal] { transition: opacity .8s cubic-bezier(.2,.8,.2,1), transform .8s cubic-bezier(.2,.8,.2,1); }
[data-reveal].is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  #hero-canvas { display: none; }
  [data-reveal] { opacity: 1 !important; transform: none !important; }
  .scroll-cue .bar { animation: none; }
}

@media (max-width: 700px) {
  body { font-size: 16px; }
  .hero-grad { background: linear-gradient(to top, rgba(3,5,6,0.9), rgba(3,5,6,0.2)); }
}
