/* ── null.point audio · CIRCUIT BACKDROP ──────────────────────────────
   Home-only fixed circuit + logo watermark, baked static from the
   Claude Design "Circuit backdrop" (intensity 25, logo on, stars off).

   Sits behind everything at z-index:-1. Opaque drop cards and the
   colour tickers stay solid; the open sections are made transparent so
   the field reads as one continuous backdrop. Static — no motion, so
   nothing to gate behind prefers-reduced-motion.

   Tune overall strength with --np-backdrop-opacity (1 = exactly as
   designed; lower it to fade the field toward the base colour). */

:root { --np-backdrop-opacity: 1; }

/* Deep base under the backdrop (matches the nav scrim colour). */
html { background-color: #05040b; }

/* Plain backgrounds keep the reading pages quiet. Home keeps the circuit field. */
body { background: var(--near); }
body.home-page { background: transparent; }

body.home-page::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: url("../assets/circuit-backdrop.svg") center center / cover no-repeat;
  opacity: var(--np-backdrop-opacity, 1);
  /* Promoted to its own layer, and told it will never be drawn on.
     This is a full-viewport SVG rasterised at `cover` — on a portrait phone
     that means a 1920x1080 artwork blown up to cover a very tall box, which is
     not something to re-raster casually. Left unpromoted it is a fixed
     background, and a fixed background is repainted as the content over it
     scrolls; translateZ(0) hands it to the compositor instead, where scrolling
     it costs nothing because it does not move. `contain` stops it from being
     considered for layout or paint invalidation at all. */
  transform: translateZ(0);
  contain: layout paint style;
}

/* Home's open sections reveal the field; cards and tickers keep their ground. */
.home-page :is(.home-hero, .cs-drops, .quote-section) { background: transparent; }

body:not(.home-page) .cs-hero::before,
body:not(.home-page) .cs-hero::after { content: none; animation: none; }
body:not(.home-page) :is(.scope-band, .circuit-pulse) { display: none; }

/* ── CIRCUIT PULSE ────────────────────────────────────────────────────
   Animated current travelling outward along the SAME traces the static
   backdrop above draws. The signal broadcasts from the null point at the
   centre — the same idea as the logo mark's ping in components.css.

   Lives here rather than in its own stylesheet so there is nothing extra
   to link: this file is already on every page. The SVG is built by
   js/main.js only for .home-page, so reading pages never build the layer.

   Cost model — deliberately a CSS-only effect:
   · No canvas, no rAF loop, no library. (edgeaudiolabs.com does its
     background with Three.js + five autoplaying 720p videos; we get the
     same read for ~2KB and no main-thread work of our own.)
   · 14 traces, each TWO <path>s — a wide soft stroke under a narrow
     bright one. That fakes the glow geometrically, which is why there is
     no `filter: drop-shadow()` anywhere: a filter would be re-evaluated
     every frame as the dash moves, and that is what actually gets costly.
   · Only `stroke-dashoffset` animates. No layout, no geometry rebuild.
   · pathLength="100" normalises every trace to 100 units, so one shared
     keyframe drives paths of wildly different real lengths.
   · Damped by scroll depth rather than stopped. This layer is position:fixed
     and every section below the hero is transparent, so it is on screen the
     whole way down — it used to be paused outright the moment the hero left,
     which was plainly visible and read as the background dying rather than
     resting. js/main.js eases it down to a slow drift instead. Browsers
     already halt CSS animation in hidden tabs, so that case needs nothing. */

.circuit-pulse {
  position: fixed;
  inset: 0;
  z-index: -1;              /* above body::before backdrop, below content */
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: block;
  /* viewBox + `slice` must match the backdrop's `cover` exactly or the
     pulses drift off their own traces. `slice` IS background-size:cover. */
}

/* The fade that keeps current away from the headline is an SVG <mask>
   built in js/main.js, NOT a CSS mask-image: CSS masking applied to inner
   SVG elements is unreliable across engines, and when it resolves wrong the
   whole layer silently disappears. An SVG-native luminance mask always
   works — white shows, black hides. */

/* Pointer parallax. js/main.js writes a transform here on pointer move; the
   easing is this transition, so there is no rAF loop driving it. Long and
   heavily eased so the field drifts rather than tracks the cursor. */
.circuit-pulse-inner {
  transition: transform 1.1s cubic-bezier(0.22, 1, 0.36, 1);
}
@media (prefers-reduced-motion: reduce) {
  .circuit-pulse-inner { transition: none; transform: none !important; }
}

.cp-trace {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  /* 20 units lit, 80 dark. Tuned by rasterising the layer and counting lit
     pixels: at the original 9/91 with 1.4px cores the whole effect covered
     0.07% of the frame — technically animating, visually not there. */
  stroke-dasharray: 20 80;
  animation: cp-travel var(--cp-dur, 4s) linear var(--cp-delay, 0s) infinite;
}

/* Widths are in viewBox units and get scaled DOWN by `slice` (~0.83 at
   1440x900), so they need to be set larger than they look here. */
/* Soft under-stroke: the glow. */
.cp-glow  { stroke-width: 10; opacity: 0.30; }
/* Bright core. */
.cp-core  { stroke-width: 2.4; opacity: 1; }

.cp-neon   { stroke: var(--neon); }
.cp-purple { stroke: var(--purple); }

/* Purple runs are secondary — hold them back so neon reads as "live". */
.cp-purple.cp-glow { opacity: 0.22; }
.cp-purple.cp-core { opacity: 0.8; }

/* Offset 100 → 0 walks the lit dash from the path start (centre) outward. */
@keyframes cp-travel {
  from { stroke-dashoffset: 100; }
  to   { stroke-dashoffset: 0; }
}

/* Motion off: keep the traces, drop the travel. The static backdrop above
   already carries the circuit motif, so nothing is lost. */
@media (prefers-reduced-motion: reduce) {
  .cp-trace { animation: none; stroke-dasharray: none; opacity: 0.05; }
  .cp-glow  { display: none; }
}

/* Small screens: the hero copy occupies most of the viewport and the
   traces would sit directly under it. Not worth the paint cost. */
@media (max-width: 620px) {
  .circuit-pulse { display: none; }
}
