/* =========================================================================
   Nodebreak — Cinematic landing page
   Stack: vanilla HTML + SVG + JS. Uses tokens from colors_and_type.css.
   ========================================================================= */

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: auto; }
body {
  background: var(--nb-bg-void);
  color: var(--fg);
  font-family: var(--font-ui);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  /* page is N sections tall — height drives scrolling */
}

img, svg { display: block; }
button { font: inherit; cursor: pointer; background: none; border: 0; color: inherit; }
a { color: inherit; text-decoration: none; }

/* =========================================================================
   ACCESSIBILITY — focus, skip-link, reduced motion
   ========================================================================= */

/* Visible focus ring for keyboard users (design-system: 2px teal + glow).
   :focus-visible keeps it off mouse clicks but on for keyboard/AT. */
:focus { outline: none; }
a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible,
.btn:focus-visible,
.signal:focus-visible,
.scroll-rail__item:focus-visible,
.topbar__nav button:focus-visible {
  outline: 2px solid var(--nb-teal-400);
  outline-offset: 2px;
  box-shadow: var(--glow-teal-md);
  border-radius: var(--radius-1);
}

/* Skip link — hidden until focused, then pinned top-left above all chrome */
.skip-link {
  position: fixed;
  top: 8px; left: 8px;
  z-index: 1000;
  padding: 10px 16px;
  min-height: 44px;
  display: inline-flex; align-items: center;
  font-family: var(--font-mono); font-size: 12px;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--nb-bg-void); background: var(--nb-teal-400);
  box-shadow: var(--glow-teal-md);
  transform: translateY(-150%);
  transition: transform var(--dur-fast) var(--ease-snap);
}
.skip-link:focus-visible { transform: translateY(0); outline: none; }

/* Reduced motion — kill perpetual/decorative animation, keep content usable.
   The JS engine also reads prefers-reduced-motion and switches scroll to 1:1,
   disables the comet trail, and freezes the orb stretch. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  /* Panels appear immediately rather than sliding/fading in */
  .panel { opacity: 1 !important; transform: none !important; }
  .circuit-preview, .gameplay-media { opacity: 1 !important; }
  .section--hero .panel,
  .section--nexus .panel { transform: translate(-50%, -50%) !important; }
  .star-twinkle { animation: none !important; }
  .scroll-cue { display: none; }
  /* Freeze the gameplay GIF → show its static first frame instead */
  .circuit-preview .preview-gif { display: none; }
  .circuit-preview .preview-poster { display: block; }
}

/* =========================================================================
   FIXED CANVAS — the world the orb lives in
   ========================================================================= */

.world-canvas {
  position: fixed; inset: 0;
  width: 100%; height: 100vh; height: 100dvh; /* dvh: stable under mobile URL bar; % avoids scrollbar-induced overflow */
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 50%, rgba(46, 230, 210, 0.04), transparent 55%),
    radial-gradient(ellipse at 80% 10%, rgba(46, 230, 210, 0.03), transparent 40%),
    radial-gradient(ellipse at 10% 90%, rgba(46, 230, 210, 0.025), transparent 45%),
    var(--nb-bg-void);
}

/* starfield grid layer */
.world-canvas::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(to right, rgba(46, 230, 210, 0.035) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(46, 230, 210, 0.035) 1px, transparent 1px);
  background-size: 64px 64px;
  background-position: center center;
  transform: translateY(var(--grid-offset, 0px));
  will-change: transform;
}

/* faint vignette */
.world-canvas::after {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(4,7,10,0.65) 100%);
  pointer-events: none;
}

/* the SVG graph fills the canvas */
.world-svg { position: absolute; inset: 0; width: 100%; height: 100%; }

/* Promote SVG transform mutations to compositor layer */
#world, #orb-layer { will-change: transform; }

/* =========================================================================
   HUD — fixed chrome
   ========================================================================= */

.hud {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 50;
}

.hud > * { pointer-events: auto; }

/* Top bar */
.topbar {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 24px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--nb-teal-400);
  background: linear-gradient(to bottom, rgba(4, 7, 10, 0.6), transparent);
  pointer-events: none;
  z-index: 50;
}
.topbar > * { pointer-events: auto; }
.topbar__brand { display: flex; align-items: center; gap: 12px; }
.topbar__icon  { width: 22px; height: 22px; image-rendering: pixelated; filter: drop-shadow(0 0 4px var(--nb-teal-glow-soft)); }
.topbar__wordmark { font-family: var(--font-display); font-size: 14px; font-weight: 700; letter-spacing: 0.18em; color: var(--fg); }
.topbar__nav { display: flex; gap: 24px; font-size: 10px; }
.topbar__nav button {
  /* ≥44px tap target via padding; visual underline stays compact */
  padding: 14px 4px;
  min-height: 44px;
  display: inline-flex; align-items: center;
  border-bottom: 1px solid transparent;
  color: var(--fg-subtle);
  letter-spacing: 0.24em;
  transition: color var(--dur-fast), border-color var(--dur-fast);
}
.topbar__nav button:hover { color: var(--nb-teal-400); border-bottom-color: var(--nb-teal-400); }
.topbar__nav button.is-active { color: var(--nb-teal-400); border-bottom-color: var(--nb-teal-400); }
.topbar__status { display: flex; gap: 18px; align-items: center; }
.topbar__status .dot {
  width: 6px; height: 6px; background: var(--nb-teal-400);
  box-shadow: 0 0 6px var(--nb-teal-glow);
  animation: pulse-dot 1.6s var(--ease-snap) infinite;
}
@keyframes pulse-dot { 0%,100% { opacity:1; } 50% { opacity: 0.35; } }

/* Scroll progress rail — left side */
.scroll-rail {
  position: absolute; top: 50%; left: 28px;
  transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 22px;
  z-index: 51;
}
.scroll-rail__item {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-subtle); /* a11y: fg-faint failed 4.5:1 at this size */
  transition: color var(--dur-base) var(--ease-snap);
}
/* Circular pip — reads like a mini version of the world nodes. */
.scroll-rail__pip {
  width: 9px; height: 9px;
  border: 1px solid var(--fg-faint);
  border-radius: 50%;
  background: transparent;
  flex: none;
  transition: transform var(--dur-base) var(--ease-snap),
              background var(--dur-base) var(--ease-snap),
              border-color var(--dur-base) var(--ease-snap),
              box-shadow var(--dur-base) var(--ease-snap);
}
/* Collapse the label so the rail is just a column of dots and never sits over
   the page copy; reveal the compact "N#" only for the active / hovered item. */
.scroll-rail__item .label {
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
  opacity: 0;
  transition: max-width var(--dur-base) var(--ease-snap),
              opacity var(--dur-fast) var(--ease-snap);
}
.scroll-rail__item.is-active .label,
.scroll-rail__item:hover .label,
.scroll-rail__item:focus-visible .label { max-width: 40px; opacity: 1; }
.scroll-rail__line {
  position: absolute;
  left: 4px; top: 0; bottom: 0; /* runs through the dot centres (node-chain feel) */
  width: 1px;
  background: linear-gradient(to bottom, transparent, var(--border-hairline) 8%, var(--border-hairline) 92%, transparent);
  z-index: -1;
}
.scroll-rail__item.is-active .scroll-rail__pip {
  background: var(--nb-teal-400);
  border-color: var(--nb-teal-400);
  box-shadow: var(--glow-teal-md);
  transform: scale(1.25); /* glowing node feel, no layout shift */
}
.scroll-rail__item.is-active { color: var(--nb-teal-400); }
.scroll-rail__item.is-past .scroll-rail__pip {
  background: var(--nb-teal-700);
  border-color: var(--nb-teal-600);
}
.scroll-rail__item.is-past { color: var(--fg-subtle); }

/* Bottom-right HUD readout */
.hud-readout {
  position: absolute; bottom: 16px; right: 24px;
  display: grid; grid-template-columns: auto auto; gap: 3px 14px;
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--fg-subtle); /* a11y: fg-faint failed 4.5:1 at this size */
  text-align: right;
}
@media (max-height: 620px) { .hud-readout { display: none; } }
.hud-readout b { color: var(--nb-teal-400); font-weight: 500; text-shadow: 0 0 6px var(--nb-teal-glow-soft); }

/* Bottom-left build tag */
.build-tag {
  position: absolute; bottom: 16px; left: 24px;
  font-family: var(--font-mono); font-size: 9px;
  letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--fg-subtle); /* a11y: fg-faint failed 4.5:1 at this size */
  display: flex; align-items: center; gap: 8px;
}
@media (max-height: 620px) { .build-tag { display: none; } }
.build-tag::before {
  content: '';
  width: 6px; height: 6px; background: var(--nb-red-500);
  box-shadow: 0 0 6px var(--nb-red-glow);
  animation: pulse-dot 1.2s var(--ease-snap) infinite;
}

/* Scroll-cue (hero only) */
.scroll-cue {
  position: absolute; bottom: 56px; left: 50%;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 9px;
  letter-spacing: 0.32em; text-transform: uppercase;
  color: var(--fg-subtle);
  transition: opacity var(--dur-base) var(--ease-snap);
}
/* On short viewports the cue would overlap the hero CTAs — hide it */
@media (max-height: 720px) { .scroll-cue { display: none; } }
.scroll-cue.is-hidden { opacity: 0; pointer-events: none; }
.scroll-cue__bar {
  width: 1px; height: 28px;
  background: linear-gradient(to bottom, var(--nb-teal-400), transparent);
  animation: cue-bar 1.4s var(--ease-snap) infinite;
}
@keyframes cue-bar {
  0%   { transform: translateY(-12px) scaleY(0.4); opacity: 0; }
  40%  { opacity: 1; }
  100% { transform: translateY(12px) scaleY(1); opacity: 0; }
}

/* =========================================================================
   SECTIONS — content panels, transparent over the canvas
   ========================================================================= */

.page {
  position: relative;
  z-index: 10;
}

.section {
  position: relative;
  height: 100vh;
  height: 100dvh; /* dvh: avoids the mobile address-bar jump/clip */
  width: 100%;    /* % not 100vw → no horizontal overflow / phantom scrollbar */
  display: flex;
  pointer-events: none; /* children re-enable */
}
.section > * { pointer-events: auto; }

/* Panel = content card anchored opposite the node */
.panel {
  position: absolute;
  max-width: 480px;
  padding: 16px 0;
  display: flex; flex-direction: column; gap: 12px;
  max-height: calc(100dvh - 130px);
  overflow-y: auto; /* dense panels scroll on short viewports instead of clipping */
  scrollbar-width: none;        /* hide the inner bar (Firefox) */
  -ms-overflow-style: none;     /* hide the inner bar (legacy Edge) */
  opacity: 0;
  transform: translateY(40px);
  /* Entrance ≤ --dur-slow (420ms): the brand spec says nothing lingers */
  transition: opacity 300ms var(--ease-out), transform 300ms var(--ease-snap);
}
.section.is-active .panel { opacity: 1; transform: translateY(0); }
/* hide the inner panel scrollbar (WebKit) so it never shows as a 2nd bar */
.panel::-webkit-scrollbar { width: 0; height: 0; }

/* per-section panel placement */
.section--hero      .panel { top: 50%; left: 50%; transform: translate(-50%, calc(-50% + 24px)); text-align: center; align-items: center; max-width: 760px; gap: 18px; }
.section--hero.is-active .panel { transform: translate(-50%, -50%); }

.section--gameplay  .panel { top: 50%; right: 7vw; transform: translateY(calc(-50% + 24px)); max-width: 460px; }
.section--gameplay.is-active .panel { transform: translateY(-50%); }

.section--level     .panel { top: 50%; left: 7vw; transform: translateY(calc(-50% + 24px)); max-width: 460px; }
.section--level.is-active .panel { transform: translateY(-50%); }

.section--community .panel { top: 50%; right: 7vw; transform: translateY(calc(-50% + 24px)); max-width: 520px; }
.section--community.is-active .panel { transform: translateY(-50%); }

.section--nexus     .panel { top: 50%; left: 50%; transform: translate(-50%, calc(-50% + 24px)); text-align: center; align-items: center; max-width: 680px; }
.section--nexus.is-active .panel { transform: translate(-50%, -50%); }

/* Panel content atoms */
.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--nb-teal-400);
}
.eyebrow::before {
  content: '';
  width: 22px; height: 1px; background: var(--nb-teal-400); box-shadow: var(--glow-teal-sm);
}
.eyebrow .num { color: var(--fg-subtle); }

h1.display {
  font-family: var(--font-display);
  font-size: clamp(44px, 7.2vw, 108px);
  font-weight: 900;
  letter-spacing: 0.02em;
  line-height: 0.94;
  text-transform: uppercase;
  color: var(--fg);
  text-shadow:
    0 0 14px rgba(46, 230, 210, 0.18),
    0 0 2px rgba(46, 230, 210, 0.35);
}
h1.display .slash {
  color: var(--nb-red-500);
  text-shadow: 0 0 8px var(--nb-red-glow), 0 0 22px var(--nb-red-glow-soft);
  display: inline-block;
  transform: skewX(-8deg);
  margin: 0 -0.04em;
}

h2.title {
  font-family: var(--font-display);
  font-size: clamp(28px, 3.6vw, 48px);
  font-weight: 800;
  letter-spacing: 0.005em;
  line-height: 1;
  text-transform: uppercase;
  color: var(--fg);
  /* dark halo keeps headings readable when a bright path/hazard passes behind */
  text-shadow: 0 0 10px var(--nb-bg-void), 0 0 20px var(--nb-bg-void);
}
h2.title em {
  font-style: normal;
  color: var(--nb-teal-400);
  text-shadow: var(--text-glow-teal);
}

.tagline {
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: 0.5em;
  text-transform: uppercase;
  color: var(--fg-muted);
  padding-right: 0;
  margin-right: -0.5em; /* compensate trailing tracking */
}

/* Hero hazard sub-line — small red HUD-style tag under the wordmark */
.hazard-tag {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.36em;
  text-transform: uppercase;
  color: var(--nb-red-400);
  text-shadow: 0 0 6px var(--nb-red-glow-soft);
  padding: 6px 12px;
  border: 1px solid rgba(255, 42, 60, 0.35);
  background: rgba(255, 42, 60, 0.06);
  align-self: center;
  margin-top: 2px;
}
.hazard-tag__dot {
  width: 6px; height: 6px; background: var(--nb-red-500);
  box-shadow: 0 0 6px var(--nb-red-glow);
  animation: pulse-dot 1.2s var(--ease-snap) infinite;
}

.lede {
  font-family: var(--font-ui);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.5;
  color: var(--fg-muted);
  max-width: 44ch;
  /* dark halo for legibility over the moving canvas */
  text-shadow: 0 0 8px var(--nb-bg-void), 0 0 16px var(--nb-bg-void);
}

/* CTA row */
.cta-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; align-items: center; }
.section--hero .cta-row { justify-content: center; }

/* Button — magnetic, hairline, fast */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 11px 18px;
  min-height: 44px; /* meet 44px touch-target minimum */
  border: 1px solid var(--border-soft);
  background: rgba(4, 7, 10, 0.55);
  color: var(--fg);
  position: relative;
  transition: color var(--dur-fast) var(--ease-snap),
              border-color var(--dur-fast) var(--ease-snap),
              box-shadow var(--dur-fast) var(--ease-snap),
              background var(--dur-fast) var(--ease-snap);
  backdrop-filter: blur(4px);
}
.btn:hover { border-color: var(--nb-teal-400); color: var(--nb-teal-400); box-shadow: var(--glow-teal-sm); }
.btn:active { transform: translateY(1px); box-shadow: var(--glow-teal-md); }
.btn .arrow { transition: transform var(--dur-fast) var(--ease-snap); }
.btn:hover .arrow { transform: translateX(3px); }

.btn--primary {
  background: var(--nb-teal-400);
  color: var(--nb-bg-void);
  border-color: var(--nb-teal-400);
}
.btn--primary:hover { color: var(--nb-bg-void); box-shadow: var(--glow-teal-md); }
.btn--primary .arrow { color: var(--nb-bg-void); }

.btn--lg { font-size: 12px; padding: 13px 22px; letter-spacing: 0.24em; }

/* corner ticks on buttons */
.btn::before, .btn::after {
  content: ''; position: absolute;
  width: 6px; height: 6px;
  border: 1px solid var(--nb-teal-400);
  opacity: 0; transition: opacity var(--dur-fast) var(--ease-snap);
  pointer-events: none;
}
.btn::before { top: -3px; left: -3px; border-right: 0; border-bottom: 0; }
.btn::after  { bottom: -3px; right: -3px; border-left: 0; border-top: 0; }
.btn:hover::before, .btn:hover::after { opacity: 1; }

/* Hero meta strip below CTA */
.hero-meta {
  display: flex; gap: 22px; margin-top: 6px;
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--fg-subtle);
}
/* Hide hero-meta on short viewports to keep panel inside the chrome */
@media (max-height: 700px) { .hero-meta { display: none; } }
.hero-meta span { display: flex; align-items: center; gap: 8px; }
.hero-meta b { color: var(--nb-teal-400); font-weight: 500; letter-spacing: 0.16em; }
.hero-meta .pip {
  width: 4px; height: 4px; background: var(--nb-teal-400); box-shadow: var(--glow-teal-sm);
}

/* Hero logo above title (subtle, small) */
.hero-logo {
  width: 38px; height: auto; opacity: 0.85;
  filter: drop-shadow(0 0 14px rgba(46,230,210,0.35));
}

/* Hero wordmark — the brand lockup, replaces the typeset title */
.hero-wordmark {
  width: min(720px, 82vw);
  height: auto;
  filter:
    drop-shadow(0 0 10px rgba(46, 230, 210, 0.55))
    drop-shadow(0 0 28px rgba(46, 230, 210, 0.25));
  user-select: none;
  margin-bottom: -6px;
  /* Lift the wordmark into the empty space above center so it no longer
     collides with the orb resting at screen-center (feedback: logo/orb conflict). */
  transform: translateY(-7vh);
}
@media (max-height: 620px) {
  .hero-wordmark { transform: translateY(-4vh); }
}
@media (max-height: 620px) {
  .hero-wordmark { width: min(560px, 72vw); }
}

/* Screen-reader-only utility — keep semantic <h1> for accessibility */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* =========================================================================
   GAMEPLAY — feature cards branching from the node
   ========================================================================= */

.feature-stack { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.feature-stack .feature {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 300ms var(--ease-out), transform 300ms var(--ease-out);
  transition-delay: 0ms;
}
.section.is-active .feature-stack .feature {
  opacity: 1;
  transform: translateY(0);
}
.section.is-active .feature-stack .feature:nth-child(2) { transition-delay: 30ms; }
.section.is-active .feature-stack .feature:nth-child(3) { transition-delay: 60ms; }
.section.is-active .feature-stack .feature:nth-child(4) { transition-delay: 90ms; }
.feature {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 12px; align-items: center;
  padding: 9px 14px;
  border: 1px solid var(--border-hairline);
  background: rgba(7, 12, 16, 0.55);
  backdrop-filter: blur(6px);
  transition: all var(--dur-fast) var(--ease-snap);
}
.feature:hover {
  border-color: var(--border-soft);
  background: rgba(12, 20, 26, 0.7);
  box-shadow: var(--glow-teal-sm);
}
.feature:active {
  background: rgba(12, 20, 26, 0.8);
  transform: translateY(1px);
}
.feature__id {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--nb-teal-400);
  letter-spacing: 0.12em;
}
.feature__title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg);
}
.feature__sub {
  font-family: var(--font-ui);
  font-size: 12px;
  line-height: 1.35;
  color: var(--fg-subtle);
  margin-top: 2px;
}
.feature__tag {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-subtle); /* a11y: fg-faint failed 4.5:1 at this size */
  padding: 3px 8px;
  border: 1px solid var(--border-hairline);
}
.feature__tag.warn { color: var(--nb-red-400); border-color: rgba(255,42,60,0.3); }

/* Gameplay footage — CRT-framed video opposite the panel (left side) */
.gameplay-media {
  position: absolute;
  top: 50%;
  /* max(7vw,130px) keeps the frame clear of the left scroll-rail in the
     ~900–1100px band where 7vw alone collided with it. */
  left: max(7vw, 130px);
  transform: translateY(calc(-50% + 24px));
  width: clamp(300px, 28vw, 460px);
  aspect-ratio: 25 / 14; /* native 500×280 — never squashed */
  border: 1px solid var(--border-soft);
  background: rgba(4, 7, 10, 0.65);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 400ms var(--ease-out), transform 400ms var(--ease-out);
  overflow: hidden;
}
.section--gameplay.is-active .gameplay-media { opacity: 1; transform: translateY(-50%); }
.gameplay-media::before, .gameplay-media::after {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  border: 1px solid var(--nb-teal-400);
  pointer-events: none;
  z-index: 2;
}
.gameplay-media::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.gameplay-media::after  { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }
.gameplay-media__head,
.gameplay-media__foot {
  position: absolute; left: 12px; right: 12px; z-index: 2;
  display: flex; justify-content: space-between;
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--nb-teal-400);
  text-shadow: 0 0 6px var(--nb-bg-void), 0 0 10px var(--nb-bg-void);
}
.gameplay-media__head { top: 10px; }
.gameplay-media__foot { bottom: 10px; color: var(--fg-subtle); font-size: 9px; }
/* Red REC dot distinguishes this "live feed" frame from the level CIRC. preview */
.gameplay-media__head .rec-dot {
  display: inline-block;
  width: 6px; height: 6px; margin-right: 7px; vertical-align: middle;
  background: var(--nb-red-500);
  box-shadow: 0 0 6px var(--nb-red-glow);
  animation: pulse-dot 1.2s var(--ease-snap) infinite;
}
.gameplay-media .preview-gif,
.gameplay-media .preview-poster {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.gameplay-media .preview-poster { display: none; } /* shown only for reduced motion */
@media (prefers-reduced-motion: reduce) {
  .gameplay-media .preview-gif { display: none; }
  .gameplay-media .preview-poster { display: block; }
}

/* =========================================================================
   LEVEL DESIGN — circuit preview panel + spec list
   ========================================================================= */

.circuit-preview {
  position: absolute;
  top: 50%; right: 8vw;
  transform: translateY(calc(-50% + 24px));
  width: clamp(320px, 32vw, 480px);
  /* match the footage's native 500×280 (25:14) so it is never squashed */
  aspect-ratio: 25 / 14;
  border: 1px solid var(--border-soft);
  background: rgba(4, 7, 10, 0.65);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 400ms var(--ease-out), transform 400ms var(--ease-out);
  overflow: hidden;
}
.section--level.is-active .circuit-preview { opacity: 1; transform: translateY(-50%); }
.circuit-preview::before, .circuit-preview::after {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  border: 1px solid var(--nb-teal-400);
  pointer-events: none;
}
.circuit-preview::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.circuit-preview::after  { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }
.circuit-preview__head {
  position: absolute; top: 10px; left: 12px; right: 12px;
  display: flex; justify-content: space-between;
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--nb-teal-400);
}
.circuit-preview__foot {
  position: absolute; bottom: 10px; left: 12px; right: 12px;
  display: flex; justify-content: space-between;
  font-family: var(--font-mono); font-size: 9px;
  letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--fg-subtle); /* a11y: fg-faint failed 4.5:1 at this size */
}
.circuit-preview svg.preview-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
/* Real gameplay footage filling the CRT frame (under the head/foot chrome) */
.circuit-preview .preview-gif,
.circuit-preview .preview-poster {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  /* cover (not fill) → preserve aspect ratio, no horizontal squash */
  object-fit: cover;
}
.circuit-preview .preview-poster { display: none; } /* shown only for reduced motion */

/* spec grid (level section) */
.spec-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0;
  margin-top: 4px;
  border-top: 1px solid var(--border-hairline);
  border-bottom: 1px solid var(--border-hairline);
}
.spec-grid > div {
  padding: 9px 14px;
  border-right: 1px dashed var(--border-hairline);
  border-bottom: 1px dashed var(--border-hairline);
}
.spec-grid > div:nth-child(2n) { border-right: 0; }
.spec-grid > div:nth-last-child(-n+2) { border-bottom: 0; }
.spec-grid .k {
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--fg-subtle);
  margin-bottom: 4px;
}
.spec-grid .v {
  font-family: var(--font-mono); font-weight: 700;
  font-size: 20px; color: var(--nb-teal-400);
  text-shadow: var(--text-glow-teal);
  letter-spacing: 0.02em;
  line-height: 1;
}

/* =========================================================================
   COMMUNITY — signal grid + chips
   ========================================================================= */

.signal-list { display: flex; flex-direction: column; gap: 6px; margin-top: 2px; }
.signal {
  display: grid; grid-template-columns: 18px 1fr auto;
  gap: 12px; align-items: center;
  padding: 9px 14px;
  border: 1px solid var(--border-hairline);
  background: rgba(7,12,16,0.55);
  backdrop-filter: blur(6px);
}
.signal { transition: border-color var(--dur-fast) var(--ease-snap), box-shadow var(--dur-fast) var(--ease-snap), background var(--dur-fast) var(--ease-snap); }
.signal:hover { border-color: var(--border-soft); box-shadow: var(--glow-teal-sm); background: rgba(12,20,26,0.7); }
.signal:active { background: rgba(12,20,26,0.8); transform: translateY(1px); }
.signal__bullet { width: 6px; height: 6px; background: var(--nb-teal-400); box-shadow: var(--glow-teal-sm); margin-left: 6px; }
.signal__bullet.ghost { background: transparent; border: 1px solid var(--nb-teal-400); box-shadow: none; }
.signal__title { font-family: var(--font-heading); font-size: 12px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--fg); }
.signal__sub { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--fg-subtle); margin-top: 2px; }
.signal__time { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--nb-teal-400); }
.signal__cta { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--nb-teal-400); }
.signal__cta:hover { text-shadow: var(--text-glow-teal); }

.countdown {
  display: flex; gap: 8px; margin-top: 2px;
}
.countdown__cell {
  flex: 1;
  padding: 8px 6px;
  border: 1px solid var(--border-hairline);
  background: rgba(4,7,10,0.5);
  text-align: center;
}
.countdown__n {
  font-family: var(--font-mono); font-weight: 700;
  font-size: 24px; color: var(--nb-teal-400);
  text-shadow: var(--text-glow-teal);
  letter-spacing: 0.04em;
  line-height: 1;
}
.countdown__l {
  font-family: var(--font-mono); font-size: 9px;
  letter-spacing: 0.24em; text-transform: uppercase;
  color: var(--fg-subtle); margin-top: 5px;
}

/* =========================================================================
   NEXUS — final
   ========================================================================= */
/* Darken the canvas directly behind the final copy so the bright nexus core
   never washes out the text (feedback: darken behind text to make it readable). */
.nexus-darken {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: min(900px, 94vw);
  height: min(620px, 78vh);
  background: radial-gradient(
    ellipse at center,
    rgba(4, 7, 10, 0.92) 0%,
    rgba(4, 7, 10, 0.72) 48%,
    rgba(4, 7, 10, 0.30) 70%,
    transparent 82%
  );
  pointer-events: none;
  z-index: 0;
}
.section--nexus .panel { z-index: 1; }
.section--nexus .lede { max-width: 60ch; margin: 0 auto; }
.nexus-meta {
  display: flex; gap: 28px; justify-content: center; margin-top: 22px;
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.24em; text-transform: uppercase; color: var(--fg-subtle);
}
.nexus-meta b { color: var(--nb-teal-400); font-weight: 500; }

/* Final fade */
.final-fade {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 30vh;
  background: linear-gradient(to bottom, transparent, var(--nb-bg-void));
  pointer-events: none;
}

/* =========================================================================
   Responsive
   ========================================================================= */
@media (max-width: 900px) {
  .topbar { padding: 14px 18px; }
  .topbar__nav { display: none; }
  /* Mobile: collapse the rail to a column of node-like dots so it never sits
     over the centered copy. ≥44px tap targets kept via padding; the per-item
     aria-label still names each section for screen readers. */
  .scroll-rail { left: 12px; gap: 12px; }
  .scroll-rail__item { min-height: 44px; padding: 4px; }
  .scroll-rail__line { left: 8px; } /* re-align through the padded dots */
  .scroll-rail__item .label,
  .scroll-rail__item.is-active .label { max-width: 0; opacity: 0; }
  .hud-readout { display: none; }
  .build-tag { left: 18px; bottom: 14px; }

  /* Panels must NOT scroll internally on mobile. An overflow:auto panel becomes
     a scroll container that swallows the touch gesture, locking the page scroll
     (worst on the dense "Plot your course" panel). Let the copy flow instead. */
  .panel { overflow: visible; max-height: none; }

  .section--gameplay .panel,
  .section--level .panel,
  .section--community .panel {
    left: 6vw; right: 6vw; max-width: none;
    top: auto; bottom: 8vh;
    transform: translateY(24px);
  }
  .section--gameplay.is-active .panel,
  .section--level.is-active .panel,
  .section--community.is-active .panel { transform: translateY(0); }

  /* Hero — top-anchor the lockup so the viewport-centered orb sits in clear
     space BELOW the CTAs instead of colliding with the tagline. (!important
     beats the global reduced-motion transform override.) */
  .section--hero .panel { top: 11vh; transform: translate(-50%, 20px) !important; }
  .section--hero.is-active .panel { transform: translate(-50%, 0) !important; }
  .hero-wordmark { transform: none; }

  /* Both videos show on mobile too: the gameplay footage (NODE 02) and the
     level/circuit preview (NODE 03) each render as a centered strip above
     their copy. */
  .gameplay-media,
  .circuit-preview {
    display: block;
    top: 7vh; left: 50%; right: auto; bottom: auto;
    transform: translate(-50%, 20px);
    height: 15vh; width: auto; max-width: 88vw;
    aspect-ratio: 25 / 14;
  }
  .section--gameplay.is-active .gameplay-media,
  .section--level.is-active .circuit-preview { transform: translate(-50%, 0); }
  /* Anchor the copy BELOW the video strip (which ends ~22vh) and let it flow
     downward. No internal scroll (see .panel override below) so it never traps
     the touch gesture. */
  .section--gameplay .panel,
  .section--level .panel {
    top: 23vh; bottom: auto;
  }

  /* ---- Center-align everything on mobile ---------------------------------
     On phones the panels span the full width, so left-aligned copy reads as
     lopsided against the centered media. Center the whole stack. */
  .section--gameplay .panel,
  .section--level .panel,
  .section--community .panel {
    align-items: center;
    text-align: center;
  }
  .section--gameplay .eyebrow,
  .section--level .eyebrow,
  .section--community .eyebrow { justify-content: center; }
  .section--gameplay .lede,
  .section--level .lede,
  .section--community .lede { margin-left: auto; margin-right: auto; }
  .cta-row { justify-content: center; }

  /* Feature / signal cards → compact centered single-column blocks. The
     decorative ▸0N id is dropped on mobile to save vertical space. */
  .feature-stack { gap: 5px; }
  .feature-stack, .signal-list, .spec-grid, .countdown { width: 100%; }
  .feature, .signal {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    gap: 3px;
    padding: 8px 12px;
  }
  .feature__id { display: none; }
  .feature > div, .signal > div { width: 100%; }
  .feature__sub, .signal__sub { margin-left: auto; margin-right: auto; max-width: 38ch; }
  .spec-grid > div { text-align: center; }

  /* Nexus — give the panel full-width insets instead of left:50%. At phone
     widths left:50% left only the right half as available width, squeezing the
     panel to ~190px so the wide "WISHLIST ON STEAM" button overflowed and read
     as off-centre. Full-width insets + translateY-only centering fixes it.
     (!important beats the reduced-motion translate(-50%,-50%) override.) */
  .section--nexus .panel {
    left: 6vw; right: 6vw; max-width: none;
    transform: translateY(calc(-50% + 20px)) !important;
  }
  .section--nexus.is-active .panel { transform: translateY(-50%) !important; }
}
