/* ==========================================================
   nawa home — background depth layer
   Soft indigo glows placed down the page, four lime spotlights, and the
   BackgroundField (film grain + dot grid + pulse, see js/background-field.js).
   Everything sits behind the content and is purely decorative.
   ========================================================== */

body { position: relative; }
main,
.site-footer { position: relative; z-index: 1; }

.page-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

/* A glow is a large radial fade; no filter, so it costs nothing to scroll */
.glow {
  position: absolute;
  width: min(1000px, 120vw);
  aspect-ratio: 1;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(closest-side, rgba(43, 29, 143, 0.5), rgba(43, 29, 143, 0.18) 55%, rgba(43, 29, 143, 0));
}
.glow--sm { width: min(680px, 95vw); }

/* Positions down the page, so the light shifts as you scroll */
.glow--1 { top: 3%;  left: 12%; }
.glow--2 { top: 10%; left: 88%; }
.glow--3 { top: 21%; left: 96%; }
.glow--4 { top: 33%; left: 4%; }
.glow--5 { top: 50%; left: 92%; }
.glow--6 { top: 63%; left: 14%; }
.glow--7 { top: 79%; left: 74%; }
.glow--8 { top: 95%; left: 26%; }

/* Section isolation kept from before (the lime spotlights rely on it) */
.hero,
.how,
.path { isolation: isolate; }
.how,
.path { position: relative; }

/* ---------- Background field: grain + dot grid + pulse ----------
   Fixed to the viewport, behind every section (main/footer are z-index 1).
   It comes after .page-bg in the DOM, so the grain also textures the glows. */
.background-field {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.background-field__layer {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
}

@media (max-width: 767px) {
  .glow { width: 140vw; }
  .glow--sm { width: 110vw; }
}

/* ---------- Lime spotlights (the only lime glows on the page) ----------
   Pre-blurred radial gradients (no filter), 12–20% lime at the centre (set per
   spot via --spot) fading to nothing. Each sits behind content, in front of the (transparent) section.
   1. Hero, behind the workspace animation  → layered into .hero__glow (sections.css)
   2. Behind the "Choose your path" cards    → .flips::before
   3. How nawa works, behind the pinned card → .how__sticky::before (pinned with it)
   4. Footer, lower left, partly off-screen   → .site-footer::before */
.flips::before,
.how__sticky::before,
.site-footer::before {
  content: "";
  position: absolute;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(closest-side, rgb(209 238 43 / var(--spot)), rgb(209 238 43 / calc(var(--spot) * 0.35)) 45%, rgb(209 238 43 / 0));
}
/* 2. Flip cards: slightly below centre */
.flips { position: relative; }
.path { overflow-x: clip; } /* keep the glow inside the section on narrow screens */
.flips::before {
  left: 50%;
  top: 60%;
  width: min(820px, 115%);
  aspect-ratio: 1.3;
  transform: translate(-50%, -50%);
}
/* 3. Pinned card in How nawa works (desktop only; the stage is hidden on phones).
   clip (not hidden) keeps the glow inside the section without breaking the sticky card;
   at ~960–1100px wide it otherwise stuck out past the right edge and the page scrolled sideways. */
.how { overflow-x: clip; }
.how__sticky::before {
  left: 50%;
  top: 45%;
  width: min(760px, 125%);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
}
/* 4. Footer: lower left, partly off-screen */
.site-footer { overflow-x: clip; }
.site-footer::before {
  left: -180px;
  top: 55%; /* low enough that it doesn't spill up into the section above */
  width: 640px;
  aspect-ratio: 1;
  transform: translateY(-50%);
}
@media (max-width: 767px) {
  .site-footer::before { left: -260px; width: 520px; }
}
/* Per-spot strength, tuned by eye: lime and navy are near-complements, so at
   high opacity over plain navy the mix turns grey-olive. Spots over plain navy
   are therefore a little lower. */
.flips::before { --spot: 0.18; }
.how__sticky::before { --spot: 0.12; }
.site-footer::before { --spot: 0.14; }

/* ---------- HexCards (js/hex-cards.js): things built from the background's hex cells ----------
   The tiles' canvas sits over the thing being built and never catches the pointer.
   A thing waiting to build itself is hidden until its turn starts (the script then clips
   it cell by cell, and clears the clip once it is whole). Opacity, not a clip: a fully
   clipped element never counts as "in view", so it would never start. */
.hex-cards__canvas {
  position: absolute;
  inset: 0;
  z-index: 3;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  pointer-events: none;
}
html.js .hex-waiting { opacity: 0; }
