/* ─────────────────────────────────────────────────────────────
   Waves design layer (December 2026)

   One stylesheet shared by every page, loaded after each page's own
   <style>, so everything here is additive: take the <link> out and a page
   is exactly what it was. It adds depth and motion, never new colors: every
   value is the house phosphor, teal or ink at a lower alpha.

   What lives here:
     1. Film grain over the whole page, so large dark fields stop reading as
        flat #050807.
     2. A phosphor scroll meter along the foot of the nav.
     3. Light that follows the pointer across card grids, lighting the
        hairlines nearest it ("spotlight").
     4. Headings that come into focus as they reveal.
     5. The hero screen tilting up into place as the page scrolls.
     6. The curved screen gallery on the home page.
     7. The collapsed What's new grid on the home page.
     8. The reading pages: a glass header, a lit title, entries that rise in.

   Under prefers-reduced-motion, every animated part is either held still or
   removed; the pointer light stays, because it moves only when you do.
   ───────────────────────────────────────────────────────────── */

/* ── 1. Grain ─────────────────────────────────────────────────
   A fixed, non-interactive layer above the page and under the nav. The
   noise is an inline SVG (img-src allows data:), so it costs no request. */
body::after {
  content: "";
  position: fixed; inset: 0; z-index: 90;
  pointer-events: none;
  opacity: .055;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 1.1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
}

/* ── 2. Scroll meter ──────────────────────────────────────────
   Drawn by script as a scaleX on one element, so it never triggers layout.
   Sits on the nav's bottom edge, where the hairline already is. */
.wm-meter {
  position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  transform-origin: 0 50%;
  transform: scaleX(var(--p, 0));
  background: linear-gradient(90deg, rgba(51,255,102,0), var(--phos, #33ff66) 30%, #a8ffc4);
  box-shadow: 0 0 12px rgba(51,255,102,.55);
  pointer-events: none;
  opacity: .9;
}

/* ── 3. Spotlight ─────────────────────────────────────────────
   Hairline grids (.grid, .index-grid, .hood, .qspecs) are a container whose
   background IS the hairline, showing through 1px gaps between cells. Paint
   a phosphor bloom into that background at the pointer and the lines nearest
   it light up, while the cells stay dark. Each cell then gets a faint wash
   of its own from the same point. --mx/--my are set by script, in px,
   relative to the element being lit. */
.sl {
  --mx: -999px; --my: -999px; --sl-a: 0;
}
.sl.grid, .sl.index-grid, .sl.hood, .sl.qspecs {
  background:
    radial-gradient(420px circle at var(--mx) var(--my),
      rgba(51,255,102, calc(.55 * var(--sl-a))), rgba(51,255,102,0) 62%),
    var(--hairline);
}
.sl-cell { position: relative; isolation: isolate; }
.sl-cell::before {
  content: "";
  position: absolute; inset: 0; z-index: -1;
  pointer-events: none;
  opacity: var(--sl-a, 0);
  transition: opacity .35s var(--ease);
  background: radial-gradient(520px circle at var(--cx, -999px) var(--cy, -999px),
    rgba(51,255,102,.075), rgba(51,255,102,0) 55%);
}
/* Bordered cards (.stat, .qdetail, .cta, the FAQ and changelog cards) light
   their own border instead: a masked ring the width of the border. */
.sl-ring { position: relative; }
.sl-ring::after {
  content: "";
  position: absolute; inset: -1px; border-radius: inherit;
  padding: 1px;
  pointer-events: none;
  opacity: var(--sl-a, 0);
  transition: opacity .35s var(--ease);
  background: radial-gradient(360px circle at var(--cx, -999px) var(--cy, -999px),
    rgba(85,252,135,.75), rgba(51,255,102,0) 60%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          mask-composite: exclude;
}
/* The cell background used to step to --panel on hover; the wash replaces
   that, so the step would double it. */
@media (hover: hover) {
  .sl-cell:hover { background: var(--bg); }
}

/* ── 4. Headings settle into focus ────────────────────────────
   Rides the page's existing .rv/.in reveal: a section head that is still
   waiting holds its h2 a touch blurred, and the same .in that
   fades the block brings the heading into focus a beat behind it. */
html.js .rv .wm-focus, html.js .rv.wm-focus {
  filter: blur(10px);
  opacity: .2;
  transition: filter .9s var(--ease) .08s, opacity .9s var(--ease) .08s;
}
html.js .rv.in .wm-focus, html.js .rv.in.wm-focus { filter: none; opacity: 1; }
/* The eyebrow gets a short drawn rule that grows in ahead of it. */
.wm-eyebrow { display: inline-flex; align-items: center; gap: 12px; }
.wm-eyebrow::before, .sec-head.center .wm-eyebrow::after {
  content: ""; width: 26px; height: 1px;
  background: linear-gradient(90deg, rgba(51,255,102,0), currentColor);
  transform-origin: 100% 50%;
  transform: scaleX(1);
  transition: transform .8s var(--ease) .15s;
}
.sec-head.center .wm-eyebrow::after { transform-origin: 0 50%; background: linear-gradient(90deg, currentColor, rgba(51,255,102,0)); }
html.js .rv:not(.in) .wm-eyebrow::before, html.js .rv:not(.in) .wm-eyebrow::after { transform: scaleX(0); }

/* ── 5. Hero screen tilt ──────────────────────────────────────
   The recorded screen starts leaned back and rises flat as the page scrolls,
   driven by --tilt (0 → 1) from script. Individual transform properties
   compose with the reveal's own transform rather than replacing it. */
.wm-stage { perspective: 1800px; perspective-origin: 50% 0%; }
.wm-tilt {
  rotate: x calc(var(--tilt, 0) * 16deg);
  scale: calc(1 - var(--tilt, 0) * .06);
  transform-origin: 50% 0%;
  will-change: rotate, scale;
}
/* A phosphor floor-glow under the tilted screen, fading as it flattens. */
.wm-tilt::before {
  content: ""; position: absolute; z-index: 3; inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(168,255,196,calc(.10 * var(--tilt, 0))), rgba(168,255,196,0) 40%);
  mix-blend-mode: screen;
}

/* ── 6. Curved gallery ────────────────────────────────────────
   Full bleed, deliberately: it is the one band on the page that runs past
   the column, which breaks the run of centered heading, centered lede,
   bordered grid. Without script it is a plain scrolling row of screens. */
.gal {
  position: relative;
  padding-block: clamp(36px, 5vw, 64px) clamp(28px, 4vw, 48px);
  overflow: hidden;
}
.gal::before {
  /* A floor of light under the arc. */
  content: ""; position: absolute; left: 50%; top: 18%; bottom: 0; translate: -50% 0;
  width: min(1500px, 130vw);
  background: radial-gradient(ellipse 50% 45% at 50% 55%, rgba(51,255,102,.09), rgba(51,255,102,0) 100%);
  pointer-events: none;
}
.gal-head {
  display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between;
  gap: 10px 24px; margin-bottom: clamp(18px, 2.4vw, 30px);
}
.gal-head h2 { font-size: clamp(1.5rem, 3vw, 2.2rem); max-width: 22em; }
.gal-hint {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted-2);
}
.gal-hint svg { width: 16px; height: 16px; color: var(--phos-dim); }

.gal-view { position: relative; }
.gal-track {
  display: flex; gap: clamp(14px, 1.6vw, 22px);
  overflow-x: auto; overscroll-behavior-x: contain;
  scrollbar-width: none;
  padding: 28px max(var(--gutter), calc((100vw - var(--maxw)) / 2 + var(--gutter)));
  /* The perspective sits on the scroller itself: a scroll container flattens
     3D, so a perspective on anything above it never reaches the cards. */
  perspective: 1400px;
  perspective-origin: 50% 50%;
  cursor: grab;
  -webkit-user-select: none; user-select: none;
}
.gal-track::-webkit-scrollbar { display: none; }
.gal-track.drag { cursor: grabbing; }
.gal-card {
  flex: none;
  width: clamp(240px, 27vw, 430px);
  margin: 0;
  transform-origin: 50% 50%;
  transform-style: preserve-3d;
  will-change: transform;
}
.gal-card .frame {
  border-radius: 14px;
  box-shadow: 0 18px 50px -18px rgba(0,0,0,.9), 0 0 60px -30px rgba(51,255,102,.35);
  transition: box-shadow .3s var(--ease), border-color .3s var(--ease);
}
.gal-card .frame img { pointer-events: none; -webkit-user-drag: none; }
.gal-card:hover .frame { border-color: rgba(51,255,102,.35); box-shadow: 0 18px 50px -18px rgba(0,0,0,.9), 0 0 70px -24px rgba(51,255,102,.55); }
/* A sheen that rides across a card as it passes the middle of the arc. */
.gal-card .frame::after {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(105deg, rgba(255,255,255,0) 35%, rgba(255,255,255,.07) 50%, rgba(255,255,255,0) 65%);
  background-size: 300% 100%;
  background-position: calc(50% + var(--k, 0) * 120%) 0;
}
.gal-card figcaption {
  margin-top: 12px; display: flex; align-items: baseline; gap: 10px;
  font-size: .88rem; color: var(--muted);
}
.gal-card figcaption .n { font-family: var(--mono); font-size: .7rem; letter-spacing: .12em; color: var(--phos-dim); }
.gal-card figcaption b { color: var(--text); font-weight: 600; }
@media (max-width: 640px) { .gal-card figcaption .d { display: none; } }
/* Edge fades, so the arc dissolves into the page instead of being cut. */
.gal-view::before, .gal-view::after {
  content: ""; position: absolute; top: 0; bottom: 0; z-index: 2; width: clamp(40px, 9vw, 180px);
  pointer-events: none;
}
.gal-view::before { left: 0;  background: linear-gradient(90deg, var(--bg), rgba(5,8,7,0)); }
.gal-view::after  { right: 0; background: linear-gradient(-90deg, var(--bg), rgba(5,8,7,0)); }

.gal-ctrl { display: flex; justify-content: center; gap: 10px; margin-top: 8px; }
.gal-btn {
  width: 40px; height: 40px; border-radius: 999px;
  border: 1px solid var(--hairline-strong); background: rgba(255,255,255,.03);
  color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center;
  transition: color .18s var(--ease), border-color .18s var(--ease), background .18s var(--ease);
}
.gal-btn:hover { color: var(--phos-ink); border-color: var(--phos-edge); background: var(--phos-well); }
.gal-btn svg { width: 17px; height: 17px; }
.gal-btn[aria-pressed="true"] { color: var(--phos-ink); border-color: var(--phos-edge); }

/* ── 7. What's new, folded ────────────────────────────────────
   Script adds .wn-fold to the grid and a button under it. Only the first six
   cells show, the sixth fading out under a gradient, until it is opened. */
.wn-fold > .cell:nth-child(n+7) { display: none; }
.wn-wrap { position: relative; }
.wn-wrap.folded::after {
  content: ""; position: absolute; left: 1px; right: 1px; bottom: 1px; height: 180px;
  border-radius: 0 0 var(--radius) var(--radius);
  background: linear-gradient(180deg, rgba(5,8,7,0), var(--bg) 85%);
  pointer-events: none;
}
.wn-more { display: flex; justify-content: center; margin-top: -22px; position: relative; z-index: 2; }
.wn-wrap:not(.folded) + .wn-more { margin-top: 18px; }

/* ── Magnetic primary buttons ─────────────────────────────────
   The two big CTAs lean a few px toward the pointer. Script sets --bx/--by. */
.wm-mag { translate: var(--bx, 0) var(--by, 0); transition: translate .25s var(--ease), background .2s var(--ease), border-color .2s var(--ease), box-shadow .2s var(--ease); }


/* ── 8. Reading pages ─────────────────────────────────────────
   FAQ, changelog, terms and hire: script marks <html> with .wm-reading
   when the page has the reading layout (a sticky .aside beside a .col).
   The header becomes a glass bar that stays, carrying the scroll meter;
   the title gets a lit ink and a bloom behind it; entries rise in as they
   arrive; FAQ answers open with a slide instead of a jump. */
.wm-reading body > header {
  position: sticky; top: 0; z-index: 95;
  background: rgba(5,8,7,.72);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
          backdrop-filter: blur(18px) saturate(150%);
}
.wm-reading body > header .wm-meter { bottom: -1px; }
@media (min-width: 1200px) {
  .wm-reading .aside { top: 112px; max-height: calc(100vh - 144px); }
}
.wm-reading main { position: relative; overflow-x: clip; }   /* the bloom below is wider than a phone or a 1024 window: keep it from widening the page */
/* The header is now sticky, so in-page jumps (the terms and hire tables of
   contents) need to clear it. */
html.wm-reading { scroll-padding-top: 96px; }
.wm-reading main::before {
  content: ""; position: absolute; z-index: -1; pointer-events: none;
  top: -80px; left: 50%; translate: -50% 0;
  width: min(1300px, 140vw); height: 620px;
  background:
    radial-gradient(ellipse 38% 46% at 26% 30%, rgba(51,255,102,.10), rgba(51,255,102,0) 70%),
    radial-gradient(ellipse 30% 40% at 72% 10%, rgba(45,212,191,.06), rgba(45,212,191,0) 70%);
}
.wm-reading body { isolation: isolate; }
.wm-reading main h1 {
  background: linear-gradient(180deg, #f2fff5 30%, #9fe9b6 130%);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
/* Entries rise in. The hidden state is set by the class script adds, so a
   page without script never hides anything. */
.wm-rise { opacity: 0; translate: 0 14px; transition: opacity .55s var(--ease), translate .55s var(--ease); }
.wm-rise.in { opacity: 1; translate: none; }
/* FAQ: animate the disclosure where the browser can (Chrome 131+, Safari 26);
   elsewhere it opens as before. */
@supports (interpolate-size: allow-keywords) {
  .wm-reading { interpolate-size: allow-keywords; }
  .wm-reading details::details-content {
    height: 0; overflow: clip;
    transition: height .38s var(--ease), content-visibility .38s allow-discrete;
  }
  .wm-reading details[open]::details-content { height: auto; }
}
.wm-reading .faq summary { transition: color .2s var(--ease), padding-left .25s var(--ease); }
@media (hover: hover) { .wm-reading .faq summary:hover { padding-left: 6px; } }

@media (prefers-reduced-motion: reduce) {
  .wm-rise { opacity: 1; translate: none; transition: none; }
  .wm-reading details::details-content { transition: none; }
}

/* ── Reduced motion ───────────────────────────────────────────*/
@media (prefers-reduced-motion: reduce) {
  html.js .rv .wm-focus, html.js .rv.wm-focus { filter: none; opacity: 1; transition: none; }
  .wm-eyebrow::before, .wm-eyebrow::after { transition: none; transform: none !important; }
  .wm-tilt { rotate: none; scale: none; }
  .wm-tilt::before { display: none; }
  .gal-card { transform: none !important; }
  .gal-card .frame::after { display: none; }
  .wm-mag { translate: none; }
  .gal-track { scroll-snap-type: x mandatory; }
  .gal-card { scroll-snap-align: center; }
}
