/* Home page: one fixed WebGL stage behind full-screen, scroll-snapped sections.
   Every section names a scene; landing.js plays that scene on the stage when the section comes into view. */

html:has(.page-landing) { scroll-snap-type: y mandatory; scroll-padding-top: 0; scrollbar-width: none; }
html:has(.page-landing)::-webkit-scrollbar { display: none; }
.page-landing { background: var(--ink); overflow-x: hidden; }
.page-landing .nav-overlay { z-index: 40; }

#stage, #snapshot { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
#stage { touch-action: pan-y; opacity: 0; transition: opacity .6s var(--ease); }
#stage.on { opacity: 1; }
#snapshot { pointer-events: none; opacity: 0; }
#snapshot.dissolve { animation: dissolve .8s var(--ease) forwards; }
@keyframes dissolve {
  from { opacity: 1; filter: blur(0); transform: scale(1); }
  to { opacity: 0; filter: blur(14px); transform: scale(1.06); }
}

/* No z-index here: main must not become a stacking context, or the knockout headline couldn't blend with the stage. */
main#content { position: relative; }
.scene { position: relative; height: 100vh; height: 100svh; overflow: hidden; scroll-snap-align: start; pointer-events: none; }
.scene a, .scene button, .scene input, .scene pre, .scene .panel, .scene .gui-wrap, .scene .install { pointer-events: auto; }
.footer-snap { position: relative; scroll-snap-align: end; }

.scrim {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(140% 95% at 0% 100%, rgba(5, 5, 10, .94), rgba(5, 5, 10, .5) 45%, transparent 70%);
  -webkit-mask-image: linear-gradient(transparent, #000 35%, #000 85%, transparent);
  mask-image: linear-gradient(transparent, #000 35%, #000 85%, transparent);
}

/* ── side dots, hud, cursor ── */
.dots { position: fixed; z-index: 30; right: clamp(12px, 2vw, 28px); top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 10px; }
.dots button { width: 6px; height: 6px; padding: 0; border-radius: 99px; border: 0; background: rgba(255, 255, 255, .3); cursor: pointer; transition: height .4s var(--ease), background .4s; }
.dots button:hover { background: rgba(255, 255, 255, .6); }
.dots button.on { height: 26px; background: var(--lime); }
.hud { position: fixed; z-index: 30; right: clamp(20px, 4vw, 48px); bottom: 22px; display: flex; gap: 8px; align-items: center; font: 500 12px/1 var(--font-mono); transition: opacity .4s; }
.hud, .dots { transition: opacity .4s; }
.hud.away, .dots.away { opacity: 0; pointer-events: none; }
.hud-pill { padding: 9px 12px; border-radius: 99px; border: 1px solid var(--line-2); background: var(--glass); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); color: var(--text); font: inherit; }
button.hud-pill { cursor: pointer; }
button.hud-pill:hover { color: var(--strong); border-color: rgba(255, 255, 255, .3); }
#hint { color: var(--lime); transition: opacity .3s; }
#hint:empty { opacity: 0; }
.cursor { position: fixed; z-index: 50; left: 0; top: 0; width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%; border: 1.5px solid #fff; mix-blend-mode: difference; pointer-events: none; opacity: 0; transition: opacity .3s, width .25s var(--ease), height .25s var(--ease), margin .25s var(--ease); }
.cursor.on { opacity: 1; }
.cursor.down { width: 64px; height: 64px; margin: -32px 0 0 -32px; }
@media (hover: none) { .cursor { display: none; } }

/* ── section copy ── */
.copy { position: absolute; left: clamp(20px, 5vw, 72px); bottom: clamp(28px, 9vh, 96px); max-width: min(640px, 86vw); }
.copy h2, .copy p { text-shadow: 0 2px 24px rgba(5, 5, 10, .85); }
.scene h2 { margin: 18px 0 16px; color: var(--strong); font: 700 clamp(42px, 7.4vw, 108px)/.9 var(--font-display); letter-spacing: -.05em; }
.copy p { max-width: 44ch; color: var(--text); font-size: clamp(15px, 1.45vw, 19px); line-height: 1.45; }
.copy .chip-code { margin-top: 22px; }
.more { display: inline-flex; margin-top: 16px; margin-left: 2px; color: var(--strong); font: 500 13px/1 var(--font-mono); text-decoration: none; opacity: .75; transition: opacity .2s, color .2s; }
.more:hover { opacity: 1; color: var(--lime); }
.copy .more { display: flex; width: max-content; }

/* staggered entrance */
.copy > *, .hero-copy > *, .info-inner > * > *, .info-inner > .features, .info-inner > .info-more { opacity: 0; transform: translateY(28px); filter: blur(10px); transition: opacity .9s var(--ease), transform .9s var(--ease), filter .9s var(--ease); }
.in .copy > *, .in .hero-copy > *, .in .info-inner > * > *, .in .info-inner > .features, .in .info-inner > .info-more { opacity: 1; transform: none; filter: none; }
.in .copy > :nth-child(2), .in .hero-copy > :nth-child(2), .in .info-inner > * > :nth-child(2) { transition-delay: .08s; }
.in .copy > :nth-child(3), .in .hero-copy > :nth-child(3), .in .info-inner > * > :nth-child(3), .in .info-inner > .features { transition-delay: .16s; }
.in .copy > :nth-child(4), .in .hero-copy > :nth-child(4), .in .info-inner > * > :nth-child(4) { transition-delay: .24s; }
.in .copy > :nth-child(5), .in .hero-copy > :nth-child(5), .in .info-inner > .info-more { transition-delay: .32s; }
@media (prefers-reduced-motion: reduce) { .copy > *, .hero-copy > *, .info-inner > * > *, .info-inner > .features, .info-inner > .info-more { transition: none; transform: none; filter: none; } }

/* ── hero ── */
.hero-copy { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: var(--nav-h) 20px 40px; text-align: center; }
.badge { display: inline-flex; align-items: center; gap: 10px; padding: 9px 14px; border-radius: 99px; border: 1px solid var(--line-2); background: var(--glass); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); color: var(--strong); font: 500 12px/1 var(--font-mono); text-decoration: none; transition: border-color .2s; }
.badge:hover { border-color: rgba(198, 255, 61, .5); }
.badge i { width: 7px; height: 7px; border-radius: 99px; background: var(--lime); box-shadow: 0 0 12px var(--lime); animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.hero h1 { margin: 26px 0 22px; color: var(--strong); font: 700 clamp(64px, 14.5vw, 230px)/.85 var(--font-display); letter-spacing: -.065em; text-shadow: 0 10px 60px rgba(5, 5, 10, .45); }
.hero h1 .grad { background: linear-gradient(100deg, var(--lime), var(--cyan) 60%, var(--pink)); -webkit-background-clip: text; background-clip: text; }
.hero-copy > p { max-width: 52ch; color: var(--text); font-size: clamp(15px, 1.5vw, 20px); line-height: 1.45; text-shadow: 0 2px 24px rgba(5, 5, 10, .85); }
.hero-cta { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; margin-top: 28px; }
.install { display: inline-flex; align-items: center; gap: 10px; height: 50px; padding: 0 8px 0 18px; border: 1px solid var(--line-2); border-radius: 99px; background: var(--glass); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); color: var(--strong); font: 400 14px/1 var(--font-mono); }
.install i { color: var(--lime); font-style: normal; }
.install button { height: 34px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 99px; background: rgba(255, 255, 255, .06); color: var(--text); font: 500 12px/1 var(--font-mono); cursor: pointer; }
.install button:hover { color: var(--strong); background: rgba(255, 255, 255, .12); }
.hero-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 22px; margin-top: 26px; color: var(--dim); font: 500 12px/1 var(--font-mono); letter-spacing: .04em; }
.hero-meta span::before { content: "◆"; margin-right: 8px; color: var(--lime); font-size: 8px; vertical-align: 2px; }
.scroll-cue { position: absolute; left: 50%; bottom: 26px; width: 26px; height: 40px; margin-left: -13px; border: 1.5px solid rgba(255, 255, 255, .35); border-radius: 99px; }
.scroll-cue span { position: absolute; left: 50%; top: 8px; width: 3px; height: 8px; margin-left: -1.5px; border-radius: 3px; background: var(--lime); animation: cue 1.8s var(--ease) infinite; }
@keyframes cue { 0% { opacity: 0; transform: translateY(-4px); } 40% { opacity: 1; } 100% { opacity: 0; transform: translateY(14px); } }

/* ── slider panel + GUI ── */
.panel, .gui-wrap { position: absolute; right: clamp(48px, 7vw, 110px); bottom: clamp(28px, 9vh, 96px); }
.panel { display: grid; gap: 16px; width: min(320px, 86vw); padding: 18px; border: 1px solid var(--line-2); border-radius: 18px; background: var(--glass); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); color: var(--text); font: 12px/1 var(--font-mono); }
.panel label { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.panel output { color: var(--lime); }
.panel input { grid-column: 1 / -1; width: 100%; accent-color: var(--lime); }
.gui-wrap .lil-gui.root { -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }

/* ── shader buttons ── */
.fx-buttons { position: absolute; right: clamp(48px, 8vw, 130px); top: 50%; transform: translateY(-50%); display: grid; grid-template-columns: repeat(2, 210px); gap: 22px 26px; }
.shader-btn {
  position: relative; overflow: hidden; isolation: isolate;
  height: 62px; border: 1px solid var(--line-2); border-radius: 99px;
  background: var(--panel); color: #fff; font: 600 16px var(--font-ui); letter-spacing: -.01em; cursor: pointer;
  box-shadow: 0 14px 36px -18px #000;
  transition: transform .25s var(--ease), box-shadow .25s, border-color .25s;
}
.shader-btn:hover, .shader-btn.demo { transform: translateY(-3px); box-shadow: 0 22px 44px -18px rgba(124, 92, 255, .7); border-color: rgba(255, 255, 255, .3); }
.shader-btn:active { transform: translateY(0) scale(.97); }
.shader-btn canvas { position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; border-radius: inherit; clip-path: inset(0 round 999px); }   /* clip-path: GPU canvases can leak past overflow + border-radius */
.shader-btn.bleed { overflow: visible; background: transparent; border-color: transparent; box-shadow: none; }
.shader-btn.bleed:hover, .shader-btn.bleed.demo { box-shadow: none; }
.shader-btn.bleed canvas { inset: -24px; width: calc(100% + 48px); max-width: none; height: calc(100% + 48px); border-radius: 0; clip-path: none; }   /* BLEED_PX in effects.js */
.shader-btn span { text-shadow: 0 1px 10px rgba(0, 0, 0, .6); }
.buttons-scene .copy { max-width: min(44vw, 560px); }

/* ── knockout type: white text multiplied over the shader, inside a dark band ──
   The band is opaque from 12% to 92% of the screen; the text block sits between ~24% and ~66%, so the
   letters never reach the faded edges, at any aspect ratio. */
.knockout {
  position: absolute; inset: 0; z-index: 0; margin: 0 !important;
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding-bottom: 10vh;
  background: var(--ink); color: #fff !important; mix-blend-mode: multiply; pointer-events: none;
  font: 700 min(19vw, 26vh)/.82 var(--font-display) !important; letter-spacing: -.07em !important;
  -webkit-mask-image: linear-gradient(transparent, #000 12%, #000 92%, transparent);
  mask-image: linear-gradient(transparent, #000 12%, #000 92%, transparent);
}
.type-scene .copy { z-index: 2; left: 50%; bottom: clamp(24px, 8vh, 84px); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; text-align: center; width: max-content; max-width: 92vw; }
.type-scene .copy .kicker::after { content: ""; width: 30px; height: 1px; background: currentColor; }
.type-scene .copy p { margin-top: 12px; }
.type-scene .copy .chip-code { margin-top: 14px; }

/* ── info sections (features, install) ── */
.info { display: flex; align-items: center; }
.info::before { content: ""; position: absolute; inset: 0; background: linear-gradient(rgba(5, 5, 10, .55), rgba(5, 5, 10, .78)); pointer-events: none; }
.info-inner { position: relative; width: min(1240px, 100% - 48px); margin: 0 auto; padding: calc(var(--nav-h) + 12px) 0 40px; }
.info-head h2 { margin-bottom: 30px; font-size: clamp(40px, 5.4vw, 80px); }
.features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.feature { padding: 20px 20px 16px; border: 1px solid var(--line); border-radius: 20px; background: var(--glass); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); transition: border-color .25s, transform .25s var(--ease); pointer-events: auto; }
.feature:hover { border-color: rgba(198, 255, 61, .45); transform: translateY(-3px); }
.feature h3 { color: var(--strong); font: 600 17px/1.2 var(--font-display); letter-spacing: -.02em; }
.feature p { margin-top: 6px; color: var(--dim); font-size: 14px; line-height: 1.4; }
.feature p code { color: var(--text); font: 12.5px var(--font-mono); }
.feature pre { margin-top: 12px; padding: 10px 12px; overflow-x: auto; border-radius: 12px; background: rgba(0, 0, 0, .35); font: 12px/1.5 var(--font-mono); white-space: pre; scrollbar-width: none; }
.info-more { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }

.start-inner { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: clamp(28px, 5vw, 72px); align-items: center; }
.spec { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; overflow: hidden; margin: 6px 0 4px; border: 1px solid var(--line); border-radius: 18px; background: var(--line); }
.spec div { padding: 14px 16px; background: rgba(10, 9, 22, .82); }
.spec dt { color: var(--lime); font: 500 11px/1 var(--font-mono); letter-spacing: .14em; text-transform: uppercase; }
.spec dd { margin: 8px 0 0; color: var(--strong); font-size: 15px; }
.spec code { font: 12.5px var(--font-mono); color: var(--text); }
.start-left .hero-cta { justify-content: flex-start; }
.start-code { overflow: hidden; border: 1px solid var(--line-2); border-radius: 22px; background: rgba(10, 9, 22, .78); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); box-shadow: 0 40px 100px -40px #000; pointer-events: auto; }
.tabs { display: flex; gap: 6px; padding: 10px; border-bottom: 1px solid var(--line); }
.tabs button { height: 34px; padding: 0 14px; border: 1px solid transparent; border-radius: 99px; background: none; color: var(--dim); font: 500 13px/1 var(--font-ui); cursor: pointer; }
.tabs button:hover { color: var(--strong); }
.tabs button[aria-selected="true"] { background: var(--strong); color: var(--ink); }
.code-panel { position: relative; }
.code-panel pre { margin: 0; padding: 20px 22px; overflow-x: auto; font: 13px/1.65 var(--font-mono); color: #ebe8ff; }
.code-panel .copy-btn { position: absolute; top: 12px; right: 12px; height: 30px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 99px; background: rgba(255, 255, 255, .06); color: var(--text); font: 500 12px/1 var(--font-mono); cursor: pointer; }
.code-panel .copy-btn:hover { color: var(--strong); }
.start-note { padding: 14px 22px 18px; border-top: 1px solid var(--line); color: var(--dim); font-size: 14px; }
.start-note a { color: var(--strong); }

/* ── smaller screens: no snapping, content-height info sections ── */
@media (max-width: 960px) {
  .features { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .start-inner { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px), (max-height: 620px) {
  html:has(.page-landing) { scroll-snap-type: y proximity; }
  .info { height: auto; min-height: 100vh; }
  .info-inner { padding-bottom: 72px; }
  .fx-buttons { right: 50%; top: calc(var(--nav-h) + 16px); transform: translateX(50%); grid-template-columns: repeat(2, minmax(140px, 1fr)); gap: 12px; width: min(440px, 100% - 40px); }
  .shader-btn { height: 52px; font-size: 15px; }
  .buttons-scene .copy { max-width: 86vw; }
  .panel, .gui-wrap { top: calc(var(--nav-h) + 12px); bottom: auto; right: 20px; }
  .dots { display: none; }
  .hud #counter, .hud #tour { display: none; }
}
@media (max-width: 560px) {
  .features { grid-template-columns: minmax(0, 1fr); }
  .spec { grid-template-columns: 1fr; }
  .hero-meta { display: none; }
  .install { display: none; }
  .copy .chip-code { font-size: 11.5px; }
  .copy .chip-code, .knockout ~ .copy .chip-code { white-space: pre-wrap; }
}
