/* ==========================================================================
   Infinite website v2: the launch-film language on the web
   Paper, rounded cards, springs, the exact logo, node grammar, the digit bird.
   Plan: docs/plans/website/README.md
   ========================================================================== */

:root {
  /* Type */
  --font-sans: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-hand: 'Caveat', cursive;
  --font-mono: 'Geist Mono', ui-monospace, Menlo, Monaco, monospace;

  --fs-display: clamp(2.6rem, 7.2vw, 5.4rem);
  --fs-h2: clamp(1.35rem, 2.6vw, 1.9rem);
  --fs-h3: clamp(1.05rem, 1.4vw, 1.2rem);
  --fs-body: clamp(0.98rem, 1.1vw, 1.05rem);
  --fs-small: 0.85rem;
  --fs-micro: 0.72rem;

  /* Palette: aliases onto brand.css (docs/brand, Paper mode). Never put a hex here; run tools/brand/brand_lint.py. */
  --paper: var(--ground);
  --card: var(--surface-1);
  --inner: var(--deep);
  --ink2: var(--ink-2);
  --muted: var(--ink-3);
  --line: rgba(26, 31, 54, 0.10);       /* the brand shadow #1A1F36 at 10%: hairlines on glass */
  --line-soft: rgba(26, 31, 54, 0.06);
  --accent: var(--accent-ink);           /* Ember 600: passes 4.5:1 for the small mono labels that use it */

  /* App chrome (node cards are the app's own dark UI) */
  --app-window: #151930;
  --app-panel: #20263F;  /* brand surface Midnight 1, not the app's grey */
  --app-raised: #2A3052;
  --app-text: #EEF1FA;
  --app-dim: #A3AACB;
  --app-border: #343B5E;

  --brand-grad: linear-gradient(90deg, #F57F66, #D99A9C 35%, #C7AFC0 65%, #A9CDF1);

  /* Everything rounded */
  --r-sm: 10px;
  --r-md: 16px;   /* media inside a card */
  --r-lg: 24px;   /* every card */
  --r-pill: 999px;

  /* Premium shadow: three stacked soft layers + contact */
  --shadow-1: 0 1px 1px rgba(26, 31, 54, 0.04), 0 4px 10px rgba(26, 31, 54, 0.05), 0 14px 32px rgba(26, 31, 54, 0.06);
  --shadow-2: 0 1px 2px rgba(26, 31, 54, 0.06), 0 8px 20px rgba(26, 31, 54, 0.08), 0 28px 60px rgba(26, 31, 54, 0.10);

  /* Motion: springs come from brand.css (--spring-slab, --spring-letter, --spring-soft, --spring-press) */
  --ease-io: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  --gutter: 16px;
  --header-h: 60px;
}

@supports not (transition-timing-function: linear(0, 1)) {
  :root { --spring-slab: cubic-bezier(0.34, 1.56, 0.64, 1); --spring-letter: cubic-bezier(0.34, 1.3, 0.64, 1); }
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 12px);
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
}

body {
  background-color: var(--paper);
  background-image: radial-gradient(rgba(26, 31, 54, 0.06) 1px, transparent 1.2px);
  background-size: 24px 24px;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, video, canvas, svg { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
code, .mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
strong { font-weight: 600; color: var(--ink); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

#cosmic-canvas {
  position: fixed; inset: 0; width: 100vw; height: 100vh;
  pointer-events: none; z-index: 0; opacity: 0.55;
}

.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 max(var(--gutter), env(safe-area-inset-left));
  position: relative;
  z-index: 1;
}

.section { padding: clamp(36px, 5vw, 64px) 0 0; position: relative; }

/* --------------------------------------------------------------------------
   Buttons (rounded, anticipation on press, spring on release)
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 44px; padding: 0 20px;
  border-radius: var(--r-pill);
  font-weight: 600; font-size: 0.95rem; letter-spacing: -0.01em;
  text-decoration: none; white-space: nowrap;
  transition: transform var(--spring-slab-ms) var(--spring-slab), background-color var(--dur-small), box-shadow var(--dur-medium), color var(--dur-small);
  -webkit-tap-highlight-color: transparent;
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: scale(0.96); transition-duration: 0.08s; transition-timing-function: ease-out; }

.btn-primary {
  background: var(--ink); color: var(--paper);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.12) inset, var(--shadow-1);
}
.btn-primary:hover { background: #000; }
.btn-ghost { background: var(--card); color: var(--ink); box-shadow: var(--shadow-1); }
.btn-ghost:hover { box-shadow: 0 0 0 1px rgba(26, 31, 54, 0.18), var(--shadow-2); }
.btn-lg { min-height: 54px; padding: 0 26px; font-size: 1.02rem; }
.btn-sm { min-height: 40px; padding: 0 16px; font-size: 0.88rem; }

.icon-btn {
  width: 40px; height: 40px; border-radius: var(--r-pill);
  display: inline-grid; place-items: center; color: var(--ink2);
  transition: background-color var(--dur-small), color var(--dur-small), transform var(--spring-slab-ms) var(--spring-slab);
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { background: rgba(26, 31, 54, 0.06); color: var(--ink); }
.icon-btn:active { transform: scale(0.92); }

/* --------------------------------------------------------------------------
   Header + mobile sheet
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  height: var(--header-h);
  background: rgba(251, 250, 246, 0.82);
  backdrop-filter: saturate(1.4) blur(18px);
  -webkit-backdrop-filter: saturate(1.4) blur(18px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur-medium);
}
.site-header.scrolled { border-bottom-color: var(--line-soft); }

/* the header runs edge to edge: mark on the left, links and download on the right */
.nav-container {
  height: 100%; display: flex; align-items: center; gap: 16px;
  max-width: none; padding: 0 max(clamp(20px, 2.4vw, 36px), env(safe-area-inset-left));
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-icon { width: 30px; height: 30px; border-radius: 8px; box-shadow: var(--shadow-1); }
.brand-name { font-weight: 700; letter-spacing: -0.03em; font-size: 1.08rem; }

.nav-links { display: flex; gap: 2px; margin-left: auto; }
.nav-links > a {
  padding: 8px 12px; border-radius: var(--r-pill);
  text-decoration: none; font-size: 0.9rem; font-weight: 500; color: var(--ink2);
  transition: background-color var(--dur-small), color var(--dur-small);
}
.nav-links > a:hover { color: var(--ink); background: rgba(26, 31, 54, 0.05); }
.nav-sheet-social { display: none; }

.nav-actions { display: flex; align-items: center; gap: 4px; }
.nav-download { margin-left: 8px; }
.nav-actions .sm-only { display: none; }

.menu-btn { display: none; width: 44px; height: 44px; border-radius: var(--r-pill); position: relative; }
.menu-btn span {
  position: absolute; left: 13px; right: 13px; height: 2px; border-radius: 2px; background: var(--ink);
  transition: transform var(--spring-slab-ms) var(--spring-slab), top var(--dur-medium);
}
.menu-btn span:first-child { top: 17px; }
.menu-btn span:last-child { top: 25px; }
.nav-open .menu-btn span:first-child { top: 21px; transform: rotate(45deg); }
.nav-open .menu-btn span:last-child { top: 21px; transform: rotate(-45deg); }

/* --------------------------------------------------------------------------
   HUD language: brackets + mono coordinates, always quiet
   -------------------------------------------------------------------------- */
.hud-brackets { position: absolute; inset: 14px; pointer-events: none; z-index: 2; }
.hud-brackets i { position: absolute; width: 18px; height: 18px; border: 1.5px solid rgba(26, 31, 54, 0.28); }
.hud-brackets i:nth-child(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; border-top-left-radius: 6px; }
.hud-brackets i:nth-child(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; border-top-right-radius: 6px; }
.hud-brackets i:nth-child(3) { bottom: 0; left: 0; border-right: 0; border-top: 0; border-bottom-left-radius: 6px; }
.hud-brackets i:nth-child(4) { bottom: 0; right: 0; border-left: 0; border-top: 0; border-bottom-right-radius: 6px; }

.hud-coord {
  position: absolute; top: 26px; z-index: 2;
  font-family: var(--font-mono); font-size: var(--fs-micro); letter-spacing: 0.04em;
  color: rgba(26, 31, 54, 0.42); font-variant-numeric: tabular-nums;
}
.hud-tl { left: 40px; }
.hud-tr { right: 40px; }

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */
.hero { position: relative; padding: clamp(36px, 6vw, 80px) 0 clamp(28px, 3.5vw, 44px); overflow: hidden; }
.hero-inner { display: flex; flex-direction: column; align-items: center; text-align: center; }

.logo-mark { width: clamp(150px, 20vw, 220px); margin-bottom: clamp(18px, 3vw, 30px); }
.logo-mark svg { width: 100%; height: auto; overflow: visible; }
.lemni-path {
  fill: none; stroke: url(#brand-grad); stroke-linecap: round; stroke-linejoin: round;
}
#lemni-ball { filter: drop-shadow(0 3px 4px rgba(181, 55, 0, 0.35)); opacity: 0; }

.hero-title {
  font-size: var(--fs-display);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 0.98;
  display: flex; flex-direction: column; align-items: center;
}
.hero-line { display: block; }
.hero-word-slot {
  position: relative; display: block;
  height: 1.15em; margin-top: 0.02em;
  min-width: 4ch;
}
.hero-word {
  display: inline-block;
  font-family: var(--font-hand); font-weight: 700;
  font-size: 1.45em; line-height: 0.8; letter-spacing: -0.01em;
  color: var(--hand, var(--accent));
  clip-path: inset(-20% -10% -20% -10%);
  transition: color var(--dur-small);
}
.hero-word.writing { animation: write-on 0.42s var(--ease-out) both; }
@keyframes write-on {
  from { clip-path: inset(-20% 100% -20% -10%); transform: translateY(0.04em); }
  to   { clip-path: inset(-20% -10% -20% -10%); transform: none; }
}
.hand-underline {
  position: absolute; left: 50%; bottom: -0.02em;
  width: var(--u-w, 3.2em); height: 0.2em; transform: translateX(-50%);
  overflow: visible;
}
.hand-underline path {
  fill: none; stroke: var(--hand, var(--accent)); stroke-width: 5; stroke-linecap: round;
  stroke-dasharray: 320; stroke-dashoffset: 320;
  vector-effect: non-scaling-stroke;
}
.hand-underline.draw path { animation: underline 0.34s var(--ease-out) 0.3s forwards; }
@keyframes underline { to { stroke-dashoffset: 0; } }

.hero-sub {
  max-width: 34em; margin: clamp(22px, 3vw, 32px) auto 0;
  color: var(--ink2); font-size: clamp(1.02rem, 1.4vw, 1.18rem); line-height: 1.55;
}

.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 30px; }
.platform-chip {
  margin-top: 18px; display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px; border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.7); box-shadow: 0 0 0 0 transparent;
  font-family: var(--font-mono); font-size: var(--fs-micro); color: var(--ink2); letter-spacing: 0.02em;
}
.dot-live { width: 7px; height: 7px; border-radius: 50%; background: #22D388; box-shadow: 0 0 0 3px rgba(34, 211, 136, 0.18); flex: none; }

/* --------------------------------------------------------------------------
   Product: one screenshot in an app window
   -------------------------------------------------------------------------- */
.product { position: relative; z-index: 1; }
.app-window {
  border-radius: var(--r-lg); overflow: hidden;
  background: var(--app-window);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35), var(--shadow-2), 0 50px 90px -30px rgba(26, 31, 54, 0.35);
}
.app-bar {
  height: 36px; display: flex; align-items: center; gap: 12px; padding: 0 14px;
  background: #20263F; border-bottom: 1px solid #343B5E; color: var(--app-dim);
  font-size: var(--fs-micro);
}
.app-bar .dots { display: flex; gap: 7px; }
.app-bar .dots i { width: 11px; height: 11px; border-radius: 50%; background: #343B5E; }
.app-bar .dots i:nth-child(1) { background: #F57F66; }
.app-bar .dots i:nth-child(2) { background: #343B5E; }
.app-bar .dots i:nth-child(3) { background: #343B5E; }
.app-title { font-family: var(--font-mono); color: var(--app-text); opacity: 0.8; }
.product-shot { width: 100%; height: auto; aspect-ratio: 2628 / 1464; }

/* --------------------------------------------------------------------------
   Section heads: Patch Type slabs (word on a node-card slab with a port dot)
   -------------------------------------------------------------------------- */
.section-head { display: flex; flex-direction: column; align-items: center; text-align: center; margin-bottom: clamp(16px, 2.2vw, 24px); }
.slab {
  position: relative; display: inline-flex; align-items: baseline; flex-wrap: wrap; justify-content: center; gap: 0 0.3em;
  padding: 0.34em 0.8em 0.4em;
  background: var(--card); border-radius: var(--r-md);
  box-shadow: var(--shadow-1);
  font-size: var(--fs-h2); font-weight: 800; letter-spacing: -0.03em; line-height: 1.1;
}
.slab::before, .slab::after {
  content: ''; position: absolute; top: 50%; width: 10px; height: 10px; margin-top: -5px;
  border-radius: 50%; background: var(--card); box-shadow: 0 0 0 2px var(--ink);
}
.slab::before { left: -5px; }
.slab::after { right: -5px; background: var(--accent); box-shadow: 0 0 0 2px var(--card), 0 0 0 3px var(--accent); }
.slab b { font-weight: 800; font-variant-numeric: tabular-nums; }

.hand { font-family: var(--font-hand); font-weight: 700; font-style: normal; color: var(--hand, var(--accent)); font-size: 1.4em; line-height: 0.7; letter-spacing: 0; }

.section-sub { max-width: 36em; margin-top: 16px; color: var(--ink2); }

/* reveal: stagger + spring */
.reveal { opacity: 0; transform: translateY(18px) scale(0.985); }
.reveal.in {
  opacity: 1; transform: none;
  transition: opacity var(--dur-large) var(--ease-out) calc(var(--i, 0) * 62ms), transform var(--dur-page) var(--spring-letter) calc(var(--i, 0) * 62ms);
}

/* --------------------------------------------------------------------------
   Film
   -------------------------------------------------------------------------- */
.film-frame {
  position: relative; border-radius: var(--r-lg); overflow: hidden;
  background: var(--card); padding: 10px;
  box-shadow: var(--shadow-2);
}
.film-video { width: 100%; aspect-ratio: 16 / 9; border-radius: var(--r-md); background: var(--inner); object-fit: cover; }
.film-sound {
  position: absolute; right: 26px; bottom: 26px; z-index: 4;
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px;
  border-radius: var(--r-pill); background: rgba(18, 21, 42, 0.86); color: var(--paper);
  font-size: 0.82rem; font-weight: 600;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: transform var(--spring-slab-ms) var(--spring-slab), background-color var(--dur-small);
}
.film-sound:active { transform: scale(0.94); }
.film-sound svg { width: 18px; height: 18px; }
.film-sound .i-on { display: none; }
.film-sound[aria-pressed="true"] .i-on { display: block; }
.film-sound[aria-pressed="true"] .i-off { display: none; }

/* --------------------------------------------------------------------------
   Instruments: the 3D kit (cutouts with contact shadow, tilt on pointer)
   -------------------------------------------------------------------------- */
.stage { width: 100vw; margin-left: calc(50% - 50vw); overflow: hidden; }
.stage-model { display: block; width: 100%; height: clamp(420px, 52vw, 760px); background: transparent; --poster-color: transparent; cursor: grab; }
@keyframes breathe { 50% { transform: translateY(-6px); } }

/* --------------------------------------------------------------------------
   What if: node chain
   -------------------------------------------------------------------------- */
.chain {
  position: relative;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(20px, 3vw, 40px);
}
.chain-cables { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; z-index: 0; }
.chain-cables path.cable {
  fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; opacity: 0.55;
  stroke-dasharray: var(--len); stroke-dashoffset: var(--len);
}
.chain.in .chain-cables path.cable { transition: stroke-dashoffset 0.9s var(--ease-io) calc(0.35s + var(--i) * 0.18s); stroke-dashoffset: 0; }
.chain-cables circle.pulse { fill: var(--accent); }

.node-card { position: relative; z-index: 1; display: flex; flex-direction: column; min-width: 0; }
.hand-cap {
  font-family: var(--font-mono); font-weight: 500; font-size: 0.74rem; letter-spacing: 0.06em; line-height: 1;
  color: var(--ink2); margin: 0 0 10px 6px;
}
.node {
  position: relative; background: var(--app-panel); border-radius: var(--r-lg);
  box-shadow: var(--shadow-2);
  padding: 0 0 2px;
  transition: transform var(--spring-slab-ms) var(--spring-slab), box-shadow var(--dur-medium);
}
.node:hover { transform: translateY(-3px); }
.node-head {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  color: var(--app-text); font-size: 0.85rem; font-weight: 600;
}
.cat-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--cat); flex: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--cat) 22%, transparent); }
.node-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.node-cat { margin-left: auto; font-family: var(--font-mono); font-size: 0.66rem; color: var(--app-dim); font-weight: 500; letter-spacing: 0.03em; }
.node-view {
  margin: 8px; border-radius: var(--r-md); overflow: hidden;
  aspect-ratio: 1 / 1; background: #0D1020; position: relative;
  touch-action: pan-y; user-select: none; -webkit-user-select: none;
}
.node-view canvas { width: 100%; height: 100%; display: block; }
.node-foot { padding: 2px 12px 10px; font-size: 0.68rem; color: var(--app-dim); letter-spacing: 0.02em; }

.port {
  position: absolute; top: 50%; width: 14px; height: 14px; margin-top: -7px; border-radius: 50%;
  background: var(--app-panel); box-shadow: 0 0 0 2px var(--cat); z-index: 2;
}
.port::after { content: ''; position: absolute; inset: 4px; border-radius: 50%; background: var(--cat); }
.port-in { left: -7px; }
.port-out { right: -7px; }

.all-at-once {
  text-align: center; margin-top: clamp(36px, 6vw, 64px);
  font-size: clamp(2.4rem, 7vw, 5rem); font-weight: 800; letter-spacing: -0.04em; line-height: 1;
}
.dot-accent { color: var(--accent); }

/* --------------------------------------------------------------------------
   Aside: prediction ("oh, and also")
   -------------------------------------------------------------------------- */
.aside { text-align: center; }
.typewriter { color: var(--muted); font-size: 0.95rem; letter-spacing: 0.04em; min-height: 1.6em; }
.typewriter.typing::after { content: '_'; animation: blink 0.8s steps(1) infinite; color: var(--accent); }
@keyframes blink { 50% { opacity: 0; } }
.pixel-title { width: min(100%, 880px); margin: 14px auto 0; height: auto; image-rendering: pixelated; }

.predict-card {
  margin: clamp(28px, 4vw, 44px) auto 0; max-width: 920px;
  display: grid; grid-template-columns: 1.25fr 1fr; gap: 24px; align-items: center;
  background: var(--card); border-radius: var(--r-lg); padding: clamp(16px, 3vw, 28px);
  box-shadow: var(--shadow-2);
  text-align: left;
}
.predict-knobs { width: 100%; aspect-ratio: 2.2 / 1; touch-action: none; cursor: grab; }
.predict-knobs:active { cursor: grabbing; }
.predict-copy p { color: var(--ink2); }
.eq {
  display: inline-block; margin-top: 14px; padding: 8px 12px; border-radius: var(--r-sm);
  background: var(--inner); color: var(--accent-ink); font-size: 0.82rem;
}

/* --------------------------------------------------------------------------
   Nature
   -------------------------------------------------------------------------- */
.nature-canvas-wrapper { width: 100%; height: 460px; position: relative; }
#nature-branch-canvas { width: 100%; height: 100%; display: block; touch-action: none; user-select: none; -webkit-user-select: none; }

/* --------------------------------------------------------------------------
   Listen: white waveform card (film act IV)
   -------------------------------------------------------------------------- */
.wave-card {
  max-width: 820px; margin: 0 auto;
  display: flex; align-items: center; gap: 18px;
  background: var(--card); border-radius: var(--r-lg); padding: 18px 22px 18px 18px;
  box-shadow: var(--shadow-2);
}
.play-btn {
  width: 64px; height: 64px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: var(--accent); color: #fff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.25) inset, 0 8px 20px rgba(181, 55, 0, 0.35);
  transition: transform var(--spring-slab-ms) var(--spring-slab);
}
.play-btn:hover { transform: scale(1.04); }
.play-btn:active { transform: scale(0.92); transition-duration: 0.08s; }
.play-btn svg { margin-left: 2px; }
.wave-main { flex: 1; min-width: 0; }
.wave-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.wave-title { font-weight: 600; font-size: 0.92rem; }
.wave-time { font-size: 0.78rem; color: var(--muted); }
.waveform-box { height: 56px; cursor: pointer; }
.waveform-box canvas { width: 100%; height: 100%; }

/* --------------------------------------------------------------------------
   Recipes: node chains
   -------------------------------------------------------------------------- */
.tutorial-frame { max-width: 920px; margin: 0 auto clamp(28px, 4vw, 44px); }
.yt-embed { position: relative; aspect-ratio: 16 / 9; border-radius: var(--r-md); overflow: hidden; background: #111; }
.yt-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.yt-poster { position: absolute; inset: 0; width: 100%; height: 100%; }
.yt-poster img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.8s var(--ease-out); }
.yt-poster:hover img { transform: scale(1.03); }
.yt-play {
  position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; margin: -29px 0 0 -29px;
  border-radius: 50%; background: var(--paper); color: var(--ink); display: grid; place-items: center;
  box-shadow: var(--shadow-2); transition: transform var(--spring-slab-ms) var(--spring-slab);
}
.yt-play svg { width: 22px; height: 22px; margin-left: 2px; }
.yt-poster:hover .yt-play { transform: scale(1.08); }
.yt-poster:active .yt-play { transform: scale(0.94); }
.yt-label {
  position: absolute; left: 14px; bottom: 14px; padding: 5px 10px; border-radius: var(--r-pill);
  background: rgba(251, 250, 246, 0.94); font-family: var(--font-mono); font-size: 0.7rem;
}

.recipe-num { font-size: 0.72rem; color: var(--accent); letter-spacing: 0.06em; }

/* a patch: dark node chips joined by cables with port dots */
/* always one horizontal chain; a chain longer than its card scrolls inside it */
.patch {
  display: flex; flex-wrap: nowrap; align-items: center; margin: 16px -2px 0; padding: 2px;
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.patch::-webkit-scrollbar { display: none; }
.pnode {
  position: relative; flex: none; display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 10px; border-radius: 10px;
  background: var(--app-panel); color: var(--app-text);
  font-size: 0.74rem; font-weight: 600; white-space: nowrap;
  box-shadow: 0 0 0 1px var(--app-border), inset 3px 0 0 var(--cat);
}
.pnode::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--cat); }
.pnode + .pnode { margin-left: 22px; }
.pnode + .pnode::after {
  content: ''; position: absolute; right: 100%; top: 50%; width: 22px; height: 2px; margin-top: -1px;
  background: radial-gradient(circle at 3px 50%, var(--ink) 3px, transparent 3.5px) left / 8px 8px no-repeat,
              radial-gradient(circle at calc(100% - 3px) 50%, var(--ink) 3px, transparent 3.5px) right / 8px 8px no-repeat,
              linear-gradient(var(--ink), var(--ink)) center / calc(100% - 8px) 2px no-repeat;
  height: 8px; margin-top: -4px; opacity: 0.6;
}

.center-row { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 20px; }

/* --------------------------------------------------------------------------
   Node ticker tapes (three marquees, category dots, tap for details)
   -------------------------------------------------------------------------- */
.ticker-wrapper {
  display: flex; flex-direction: column; gap: 12px;
  overflow: hidden; padding: 10px 0; user-select: none; -webkit-user-select: none;
  position: relative; z-index: 1;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.ticker-track { display: flex; gap: 10px; width: max-content; will-change: transform; }
.ticker-pill {
  flex: none; display: inline-flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 0 16px 0 14px; border-radius: var(--r-pill);
  background: var(--card); color: var(--ink2);
  box-shadow: 0 1px 2px rgba(26, 31, 54, 0.05), 0 4px 12px rgba(26, 31, 54, 0.05);
  font-size: 0.88rem; font-weight: 500; white-space: nowrap;
  transition: transform var(--spring-slab-ms) var(--spring-slab), color var(--dur-small), box-shadow 0.25s;
}
.ticker-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--cat); box-shadow: 0 0 0 3px color-mix(in srgb, var(--cat) 20%, transparent); }
.ticker-pill small { font-family: var(--font-mono); font-size: 0.68rem; color: var(--muted); }
.ticker-pill:hover { color: var(--ink); transform: translateY(-2px); box-shadow: 0 0 0 1px color-mix(in srgb, var(--cat) 60%, transparent), var(--shadow-1); }
.ticker-pill:active { transform: scale(0.95); transition-duration: 0.08s; }
.ticker-forward { animation: tick-fwd var(--dur, 60s) linear infinite; }
.ticker-reverse { animation: tick-rev var(--dur, 60s) linear infinite; }
@keyframes tick-fwd { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(-50%, 0, 0); } }
@keyframes tick-rev { from { transform: translate3d(-50%, 0, 0); } to { transform: translate3d(0, 0, 0); } }
@media (hover: hover) and (pointer: fine) { .ticker-track:hover { animation-play-state: paused; } }
.docs-row { margin-top: 22px; }

/* --------------------------------------------------------------------------
   Setup card with OS tabs
   -------------------------------------------------------------------------- */
.setup-card {
  background: var(--card); border-radius: var(--r-lg); padding: clamp(16px, 3vw, 30px);
  box-shadow: var(--shadow-1);
}
.tabs {
  position: relative; display: inline-flex; padding: 4px; border-radius: var(--r-pill);
  background: var(--inner); margin-bottom: 20px; max-width: 100%;
}
.tabs button {
  position: relative; z-index: 1; min-height: 40px; padding: 0 18px; border-radius: var(--r-pill);
  font-size: 0.9rem; font-weight: 600; color: var(--ink2); transition: color var(--dur-small);
}
.tabs button[aria-selected="true"] { color: var(--ink); }
.tab-pill {
  position: absolute; top: 4px; bottom: 4px; left: 0; width: 0; border-radius: var(--r-pill);
  background: var(--card); box-shadow: var(--shadow-1);
  transition: transform var(--spring-slab-ms) var(--spring-slab), width 0.6s var(--spring-slab);
}
.tab-panel { animation: panel-in 0.5s var(--spring-letter); }
@keyframes panel-in { from { opacity: 0; transform: translateY(8px); } }
.setup-intro { color: var(--ink2); max-width: 60em; margin-bottom: 18px; }
.setup-intro a { color: var(--accent-ink); }
.steps { list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.step { background: var(--paper); border-radius: var(--r-lg); padding: 16px; min-width: 0; }
.step-num {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--ink); color: var(--paper); font-size: 0.8rem; margin-bottom: 10px;
}
.step h4 { font-size: 1rem; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 4px; }
.step p { color: var(--ink2); font-size: 0.92rem; }
.step code, .setup-intro code { font-size: 0.84em; background: var(--inner); padding: 1px 6px; border-radius: 6px; overflow-wrap: anywhere; }
.code-pill {
  display: flex; align-items: center; gap: 8px; margin-top: 10px; padding: 6px 6px 6px 12px;
  background: var(--ink); border-radius: var(--r-sm); min-width: 0;
}
.code-pill code { flex: 1; min-width: 0; background: none; color: #EEF1FA; font-size: 0.76rem; overflow-x: auto; white-space: nowrap; scrollbar-width: none; padding: 0; }
.code-pill code::-webkit-scrollbar { display: none; }
.copy-inline-btn {
  flex: none; min-height: 32px; padding: 0 12px; border-radius: 8px;
  background: rgba(255, 255, 255, 0.12); color: #fff; font-size: 0.76rem; font-weight: 600;
  transition: transform var(--spring-slab-ms) var(--spring-slab), background-color var(--dur-small);
}
.copy-inline-btn:hover { background: rgba(255, 255, 255, 0.2); }
.copy-inline-btn:active { transform: scale(0.92); }

/* --------------------------------------------------------------------------
   Download
   -------------------------------------------------------------------------- */
.download-card {
  position: relative; text-align: center;
  background: var(--card); border-radius: var(--r-lg); padding: clamp(36px, 6vw, 64px) clamp(16px, 4vw, 48px);
  box-shadow: var(--shadow-2); overflow: hidden;
}
.download-tile { display: block; position: relative; width: clamp(140px, 18vw, 190px); height: clamp(140px, 18vw, 190px); margin: -8px auto 4px; background: transparent; --poster-color: transparent; cursor: grab; }
.download-title { position: relative; font-size: clamp(2rem, 5vw, 3.4rem); font-weight: 800; letter-spacing: -0.035em; line-height: 1.05; }
.download-actions { position: relative; display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.btn-dl {
  min-height: 64px; padding: 0 22px 0 18px; justify-content: flex-start; gap: 12px; text-align: left;
  background: var(--card); color: var(--ink); border-radius: var(--r-md);
  box-shadow: var(--shadow-1);
}
.btn-dl svg { width: 24px; height: 24px; }
.btn-dl span { display: flex; flex-direction: column; line-height: 1.2; }
.btn-dl b { font-size: 1rem; }
.btn-dl small { font-size: 0.74rem; color: var(--muted); font-weight: 500; }
.btn-dl.primary { background: var(--ink); color: var(--paper); box-shadow: var(--shadow-2); }
.btn-dl.primary small { color: rgba(251, 250, 246, 0.65); }
.btn-dl.primary::after {
  content: 'your system'; margin-left: 10px; padding: 3px 8px; border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.14); font-family: var(--font-mono); font-size: 0.65rem; font-weight: 500;
}
.specs { position: relative; display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 22px; margin-top: 26px; font-size: 0.76rem; color: var(--ink2); }
.specs div { display: flex; gap: 8px; }
.specs dt { color: var(--muted); }
.donate { position: relative; margin-top: 28px; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px 14px; color: var(--ink2); font-size: 0.9rem; }
.donate svg { color: var(--accent); }

/* --------------------------------------------------------------------------
   Modal
   -------------------------------------------------------------------------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 200; padding: 16px;
  background: rgba(18, 21, 42, 0.35); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: none; align-items: center; justify-content: center;
}
.modal-backdrop.active { display: flex; animation: fade 0.2s ease; }
@keyframes fade { from { opacity: 0; } }
.modal-card {
  position: relative; width: 100%; max-width: 400px;
  background: var(--card); border-radius: var(--r-lg); padding: 22px;
  box-shadow: var(--shadow-2), 0 30px 80px rgba(18, 21, 42, 0.25);
  animation: modal-in 0.6s var(--spring-slab);
}
@keyframes modal-in { from { transform: translateY(16px) scale(0.94); opacity: 0; } }
.modal-close { position: absolute; top: 12px; right: 12px; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--ink2); }
.modal-close:hover { background: var(--inner); }
.modal-close svg { width: 18px; height: 18px; }
.modal-badge {
  display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px; border-radius: var(--r-pill);
  background: var(--inner); font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink2);
}
.modal-badge::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--cat, var(--muted)); }
.modal-title { font-size: 1.4rem; font-weight: 800; letter-spacing: -0.03em; margin: 10px 0 6px; }
.modal-desc { color: var(--ink2); }
.modal-doc-link { display: inline-block; margin-top: 14px; font-size: 0.85rem; font-weight: 600; color: var(--accent-ink); }

/* --------------------------------------------------------------------------
   Footer: the loop frame
   -------------------------------------------------------------------------- */
.site-footer { position: relative; z-index: 1; margin-top: clamp(56px, 7vw, 96px); padding: clamp(40px, 6vw, 72px) 0 calc(28px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line-soft); }
.footer-top { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.footer-line {
  display: inline-block; font-size: clamp(2.4rem, 7vw, 4.8rem); font-weight: 800; letter-spacing: -0.04em; line-height: 1;
  margin-bottom: clamp(36px, 6vw, 64px);
}
.footer-grid { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 28px; }
.footer-brand p { color: var(--ink2); margin-top: 10px; font-size: 0.92rem; max-width: 22em; }
.footer-col { display: flex; flex-direction: column; gap: 4px; }
.footer-col h5 { font-family: var(--font-mono); font-size: 0.72rem; font-weight: 500; color: var(--muted); letter-spacing: 0.06em; text-transform: lowercase; margin-bottom: 6px; }
.footer-col a { color: var(--ink2); text-decoration: none; font-size: 0.9rem; padding: 3px 0; }
.footer-col a:hover { color: var(--ink); }
.footer-bottom { margin-top: 40px; font-size: 0.72rem; color: var(--muted); }

/* --------------------------------------------------------------------------
   The digit bird
   -------------------------------------------------------------------------- */
#bird {
  position: absolute; left: 0; top: 0; z-index: 60;
  width: 68px; height: 52px; pointer-events: none;
  opacity: 0; transition: opacity 0.4s;
  -webkit-tap-highlight-color: transparent;
}
#bird.ready { opacity: 1; }
html.over-bird body { cursor: pointer; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1080px) {
  .chain { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 36px; }
}

@media (max-width: 900px) {
        .nav-links {
    position: fixed; left: 0; right: 0; top: var(--header-h);
    flex-direction: column; gap: 0; margin: 0; padding: 8px max(var(--gutter), env(safe-area-inset-left)) 20px;
    background: rgba(251, 250, 246, 0.98);
    backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 30px 50px rgba(26, 31, 54, 0.10);
    transform: translateY(-12px); opacity: 0; visibility: hidden;
    transition: transform var(--spring-slab-ms) var(--spring-slab), opacity var(--dur-small), visibility 0s 0.5s;
  }
  .nav-open .nav-links { transform: none; opacity: 1; visibility: visible; transition: transform var(--spring-slab-ms) var(--spring-slab), opacity var(--dur-small), visibility 0s; }
  .nav-links > a { padding: 14px 6px; font-size: 1.1rem; color: var(--ink); border-radius: 0; border-bottom: 1px solid var(--line-soft); font-weight: 600; }
  .nav-links > a:hover { background: none; }
  .nav-sheet-social { display: flex; gap: 18px; padding-top: 14px; }
  .nav-sheet-social a { font-family: var(--font-mono); font-size: 0.85rem; color: var(--ink2); text-decoration: none; padding: 8px 6px; }
  /* hamburger, then the mark beside it, download on the right */
  .nav-container { gap: 6px; padding: 0 max(var(--gutter), env(safe-area-inset-left)); }
  .menu-btn { display: block; margin-left: -10px; }
  .brand-name { display: none; }
  .brand-icon { width: 32px; height: 32px; }
  .nav-actions { margin-left: auto; }
  .nav-download { display: none; }   /* phones: YouTube and Discord sit top right instead */
  .nav-actions .sm-only { display: inline-flex; }
  .hide-sm { display: none; }

  .predict-card { grid-template-columns: 1fr; }
  .footer-brand { grid-column: 1 / -1; }
  .hud-coord { display: none; }
}

@media (max-width: 640px) {
  :root { --r-lg: 20px; --r-md: 12px; }
  :root { --header-h: 56px; }
  /* 2 x 2 on phones: compact node cards */
  .chain { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 26px 14px; }
  .hand-cap { margin: 0 0 6px 2px; white-space: nowrap; }
  .node-head { padding: 7px 9px; font-size: 0.74rem; gap: 6px; }
  .node-cat { display: none; }
  .node { flex: 1; display: flex; flex-direction: column; }
  .node-foot { margin-top: auto; }
  .node-view { margin: 6px; }
  .node-foot { padding: 0 9px 7px; font-size: 0.58rem; line-height: 1.3; }
  .app-bar { height: 30px; }
  .nature-canvas-wrapper { height: 380px; }
  .wave-card { padding: 14px; gap: 14px; }
  .play-btn { width: 54px; height: 54px; }
  .yt-play { width: 44px; height: 44px; margin: -22px 0 0 -22px; }
  .yt-play svg { width: 17px; height: 17px; }
  .yt-label { left: 10px; bottom: 10px; padding: 4px 8px; font-size: 0.6rem; }
  .film-frame { padding: 6px; border-radius: var(--r-md); }
  .film-sound { right: 14px; bottom: 14px; min-height: 36px; padding: 0 12px; }
  .hero-cta .btn { flex: 1 1 100%; }
  .btn-dl { flex: 1 1 100%; }
  .tabs { display: flex; width: 100%; }
  .tabs button { flex: 1; padding: 0 8px; }
  /* the patch stays a horizontal chain, just smaller */
  .patch { margin-top: 12px; }
  .pnode { padding: 4px 6px; gap: 4px; font-size: 0.6rem; border-radius: 7px; letter-spacing: -0.01em; }
  .pnode::before { width: 5px; height: 5px; }
  .pnode + .pnode { margin-left: 12px; }
  .pnode + .pnode::after {
    width: 12px; height: 6px; margin-top: -3px;
    background: radial-gradient(circle at 2px 50%, var(--ink) 2px, transparent 2.5px) left / 6px 6px no-repeat,
                radial-gradient(circle at calc(100% - 2px) 50%, var(--ink) 2px, transparent 2.5px) right / 6px 6px no-repeat,
                linear-gradient(var(--ink), var(--ink)) center / calc(100% - 6px) 1.5px no-repeat;
  }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 24px 16px; }
  .slab { padding: 0.3em 0.7em 0.36em; }
}

@media (hover: none) {
  .node:hover, .btn:hover { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-delay: 0s !important; transition-duration: 0.001ms !important; transition-delay: 0s !important; }
  .reveal { opacity: 1; transform: none; }
  .ticker-track { animation: none !important; }
    .ticker-wrapper { overflow-x: auto; }
}
