/* ==========================================================================
   GLOW WORDS: the neon section names (assets/stage/glow.js).
   One component on every page: the flagship pages (OptiTools Display), Eclipse
   (Instrument Heading) and Horizon (Funnel Heading), lit in each product's
   own colours. On Horizon's day paper the word is ink and its light is the
   product's hue, laid on rather than added.
   Every hidden starting state is behind html.glow-motion, so a word reads
   complete without JavaScript and under Reduce Motion.
   ========================================================================== */
.v2-glow {
  --m: 0;
  --q: 0;
  --glow-core: rgba(238, 241, 255, .95);
  --glow-a: rgba(158, 178, 255, .8);
  --glow-b: rgba(124, 92, 255, .7);
  --lit: #f5f6fb;
  --unlit: #262a36;
  --glow-font: var(--font-display, "Instrument Sans", -apple-system, BlinkMacSystemFont, sans-serif);
  --glow-stretch: 100%;
  --glow-sub: #7b8396;
  position: relative;
  /* the word holds for half a screen; the next section's story slides
     up over it while it steps back (Apple's Display overlap) */
  height: 150vh;
  height: 150svh;
  margin-bottom: -55vh;
  margin-bottom: -55svh;
}
.v2-glow + * { position: relative; z-index: 1; }
/* A sticky box is its own layer group, so the light is added to the page
   from there: the whole word screens onto the sky and can only brighten
   what is behind it, never dim a box around itself. */
.v2-glow__sticky { position: sticky; top: 0; height: 100vh; height: 100svh; display: grid; place-items: center; overflow: clip; mix-blend-mode: screen; }
.v2-glow__stage { position: relative; transform: scale(calc(1 - var(--q) * .2)); opacity: calc(1 - var(--q)); will-change: transform, opacity; }
.v2-glow__text {
  position: relative;
  z-index: 1;
  margin: 0;
  padding: .06em .04em .12em;
  font: 700 min(220px, 13.5vw, calc(150vw / var(--chars, 6)))/1 var(--glow-font);
  font-stretch: var(--glow-stretch);
  letter-spacing: -.055em;
  white-space: nowrap;
  background: linear-gradient(90deg, var(--lit) calc(var(--m) * 150% - 50%), var(--unlit) calc(var(--m) * 150%));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.v2-glow__canvas { position: absolute; z-index: 2; pointer-events: none; }
.v2-glow__sub { position: absolute; left: 0; right: 0; bottom: 12vh; margin: 0; color: var(--glow-sub); font: 500 12px/1 var(--font-mono, ui-monospace, monospace); letter-spacing: .16em; text-align: center; text-transform: uppercase; opacity: calc(var(--m) - var(--q) * 2); }
@media (max-width: 734px) { .v2-glow { height: 125svh; margin-bottom: -45svh; } }
html:not(.glow-motion) .v2-glow { height: auto; margin-bottom: 0; }
html:not(.glow-motion) .v2-glow__sticky { position: relative; height: auto; padding-block: 14vh 6vh; }
html:not(.glow-js) .v2-glow__text { background: none; color: var(--lit); }

/* a page title: it lights once as the page opens, no pinned scroll */
.v2-glow--title { height: auto; margin-bottom: 0; }
.v2-glow--title .v2-glow__sticky { position: relative; height: auto; padding-block: clamp(120px, 17vh, 190px) 0; overflow: visible; contain: none; }
/* it stands on the page's own column, flush with the heading beneath it */
.v2-glow--title .v2-glow__sticky { width: min(var(--title-w, 900px), calc(100% - var(--gutter, 24px) * 2)); margin-inline: auto; justify-items: start; }
.v2-glow--title .v2-glow__text { margin-left: -.06em; }
.v2-glow--title .v2-glow__stage { transform: none; opacity: 1; }
.v2-glow--title .v2-glow__text { font-size: min(200px, 13vw, calc(140vw / var(--chars, 6)), calc(var(--title-w, 900px) * 1.6 / var(--chars, 6))); }
html:not(.glow-motion) .v2-glow--title .v2-glow__sticky { padding-block: clamp(120px, 17vh, 190px) 0; }
/* the page's own heading follows close beneath its word */
.v2-glow--title + section { padding-top: clamp(8px, 2vh, 24px) !important; }

/* ----------------------------------------------------------- the designs */
body[data-design="eclipse"] .v2-glow { --glow-font: "Instrument Heading", var(--f); --glow-stretch: 80%; --lit: var(--fg, #f1f4f7); }
body[data-design="horizon"] .v2-glow { --glow-font: "Funnel Heading", var(--fd); --lit: var(--n-fg, #f1f4f7); --unlit: #222634; }
body[data-design="horizon"] .day .v2-glow {
  --lit: var(--ink, #1d1d1f);
  --unlit: #dde0e7;
  --glow-core: rgba(var(--hue-rgb, 59, 85, 230), .5);
  --glow-a: rgba(var(--hue-rgb, 59, 85, 230), .42);
  --glow-b: rgba(var(--lux-rgb, 159, 176, 255), .6);
  --glow-sub: var(--ink-3, #6e6e73);
}
/* on paper the light is laid on, like ink: no screen, and it sits behind
   the word so the letters stay crisp in the product's deepest colour */
body[data-design="horizon"] .day .v2-glow { --lit: var(--deep, var(--ink, #1d1d1f)); }
body[data-design="horizon"] .day .v2-glow__sticky { mix-blend-mode: normal; }
body[data-design="horizon"] .day .v2-glow__canvas { z-index: 0; }

/* ---------------------------------------------------------- each product */
:is(body[data-product="mac"], body[data-world="mac"]) .v2-glow { --glow-a: rgba(149, 190, 255, .85); --glow-b: rgba(47, 110, 255, .7); }
:is(body[data-product="sound"], body[data-world="sound"]) .v2-glow { --glow-a: rgba(252, 166, 118, .85); --glow-b: rgba(255, 104, 36, .62); }
:is(body[data-product="load"], body[data-world="load"]) .v2-glow { --glow-a: rgba(239, 158, 227, .85); --glow-b: rgba(205, 64, 190, .62); }
:is(body[data-product="tube"], body[data-world="tube"]) .v2-glow { --glow-a: rgba(94, 215, 181, .85); --glow-b: rgba(14, 180, 132, .6); }
:is(body[data-product="extras"], body[data-world="extras"]) .v2-glow { --glow-a: rgba(130, 204, 215, .85); --glow-b: rgba(20, 160, 186, .62); }
:is(body[data-product="home"], body[data-world="home"]) .v2-glow { --glow-a: rgba(196, 181, 253, .85); --glow-b: rgba(124, 92, 255, .7); }
