/* light-shafts.css — ambient shafts of light on a dark ground. Zero JS, zero images.
 *
 * WHAT THIS IS. Volumetric light bands crossing a dark section, brighter toward
 * one edge, drifting so slowly you never catch them moving.
 *
 * WHY IT IS NOT A SHADER. Harvested from CodePen vanholtzco/JoPxmvz, which spends
 * PIXI (292KB) + 95 lines of GLSL + six octaves of 3-D Perlin noise PER PIXEL PER
 * FRAME on this. We measured its output: correlating two rows 200px apart gives
 * r = 0.9996 — the field is ONE-DIMENSIONAL. Every pixel of that computation
 * resolves to a function of a single number, which is precisely what a
 * linear-gradient already is. The pen's author suspected it; his first line of
 * HTML is a comment saying he should try 1-D noise instead. He was right.
 *
 * So: the stops below are 1-D fractal noise (5 octaves, lacunarity 2, gain .5,
 * abs() folded — the fold is what makes shafts instead of clouds), baked once at
 * a fixed seed. NOT a pixel copy of that pen's field — the same construction with
 * our own seed. No runtime cost, no dependency, works in every browser.
 *
 * USE WHEN: a dark section needs depth and there is no photograph to give it.
 *   Pairs with a single light source the rest of the section obeys — see
 *   foundations/light-and-physics.md.
 * DON'T USE WHEN: the section is light. Screen-blended light on a pale ground is
 *   invisible; you get a faint dirty smear. This is a dark-ground technique.
 *
 * MARKUP
 *   <section class="band band--dark">
 *     <div class="shafts" aria-hidden="true"></div>
 *     … content, which must sit above via position:relative + z-index …
 *   </section>
 */

.shafts {
  --shaft-rgb: 255 255 255;   /* the colour of the LIGHT, not of the brand ink */
  --shaft-angle: 139deg;      /* direction of the band normal */
  --shaft-zoom: 105%;         /* >100% widens the bands. See the mobile note below. */

  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  mix-blend-mode: screen;     /* emitted light. NEVER overlay — light-and-physics.md */

  /* the light has an origin: full strength at the bottom, gone at the top */
  -webkit-mask-image: linear-gradient(to top, #000 0%, rgb(0 0 0 / .35) 55%, transparent 100%);
          mask-image: linear-gradient(to top, #000 0%, rgb(0 0 0 / .35) 55%, transparent 100%);
}

/* Two fields drifting at different rates. Because the periods are coprime-ish they
 * never come back into phase, so the light keeps changing shape and never loops.
 * Both are transforms, so this composites on the GPU and repaints nothing. */
.shafts::before,
.shafts::after {
  content: '';
  position: absolute;
  inset: -35%;                /* oversized so the drift never exposes an edge */
  background-repeat: no-repeat;
  background-position: center;
  background-size: var(--shaft-zoom) var(--shaft-zoom);
  will-change: transform;
}

.shafts::before {
  background-image: linear-gradient(var(--shaft-angle),
      rgb(var(--shaft-rgb) / 0.073) 0.0%,
      rgb(var(--shaft-rgb) / 0.053) 1.8%,
      rgb(var(--shaft-rgb) / 0.093) 3.6%,
      rgb(var(--shaft-rgb) / 0.091) 5.5%,
      rgb(var(--shaft-rgb) / 0.086) 7.3%,
      rgb(var(--shaft-rgb) / 0.098) 9.1%,
      rgb(var(--shaft-rgb) / 0.118) 10.9%,
      rgb(var(--shaft-rgb) / 0.133) 12.7%,
      rgb(var(--shaft-rgb) / 0.148) 14.5%,
      rgb(var(--shaft-rgb) / 0.168) 16.4%,
      rgb(var(--shaft-rgb) / 0.197) 18.2%,
      rgb(var(--shaft-rgb) / 0.141) 20.0%,
      rgb(var(--shaft-rgb) / 0.126) 21.8%,
      rgb(var(--shaft-rgb) / 0.095) 23.6%,
      rgb(var(--shaft-rgb) / 0.068) 25.5%,
      rgb(var(--shaft-rgb) / 0.109) 27.3%,
      rgb(var(--shaft-rgb) / 0.119) 29.1%,
      rgb(var(--shaft-rgb) / 0.07) 30.9%,
      rgb(var(--shaft-rgb) / 0.04) 32.7%,
      rgb(var(--shaft-rgb) / 0.02) 34.5%,
      rgb(var(--shaft-rgb) / 0.006) 36.4%,
      rgb(var(--shaft-rgb) / 0.003) 38.2%,
      rgb(var(--shaft-rgb) / 0.0) 40.0%,
      rgb(var(--shaft-rgb) / 0.0) 41.8%,
      rgb(var(--shaft-rgb) / 0.005) 43.6%,
      rgb(var(--shaft-rgb) / 0.024) 45.5%,
      rgb(var(--shaft-rgb) / 0.079) 47.3%,
      rgb(var(--shaft-rgb) / 0.097) 49.1%,
      rgb(var(--shaft-rgb) / 0.087) 50.9%,
      rgb(var(--shaft-rgb) / 0.101) 52.7%,
      rgb(var(--shaft-rgb) / 0.061) 54.5%,
      rgb(var(--shaft-rgb) / 0.029) 56.4%,
      rgb(var(--shaft-rgb) / 0.038) 58.2%,
      rgb(var(--shaft-rgb) / 0.045) 60.0%,
      rgb(var(--shaft-rgb) / 0.016) 61.8%,
      rgb(var(--shaft-rgb) / 0.009) 63.6%,
      rgb(var(--shaft-rgb) / 0.005) 65.5%,
      rgb(var(--shaft-rgb) / 0.001) 67.3%,
      rgb(var(--shaft-rgb) / 0.007) 69.1%,
      rgb(var(--shaft-rgb) / 0.025) 70.9%,
      rgb(var(--shaft-rgb) / 0.033) 72.7%,
      rgb(var(--shaft-rgb) / 0.039) 74.5%,
      rgb(var(--shaft-rgb) / 0.086) 76.4%,
      rgb(var(--shaft-rgb) / 0.205) 78.2%,
      rgb(var(--shaft-rgb) / 0.29) 80.0%,
      rgb(var(--shaft-rgb) / 0.417) 81.8%,
      rgb(var(--shaft-rgb) / 0.5) 83.6%,
      rgb(var(--shaft-rgb) / 0.463) 85.5%,
      rgb(var(--shaft-rgb) / 0.455) 87.3%,
      rgb(var(--shaft-rgb) / 0.497) 89.1%,
      rgb(var(--shaft-rgb) / 0.358) 90.9%,
      rgb(var(--shaft-rgb) / 0.252) 92.7%,
      rgb(var(--shaft-rgb) / 0.152) 94.5%,
      rgb(var(--shaft-rgb) / 0.039) 96.4%,
      rgb(var(--shaft-rgb) / 0.007) 98.2%,
      rgb(var(--shaft-rgb) / 0.008) 100.0%);
  animation: shaft-drift-a 91s linear infinite alternate;
}

.shafts::after {
  background-image: linear-gradient(var(--shaft-angle),
      rgb(var(--shaft-rgb) / 0.036) 0.0%,
      rgb(var(--shaft-rgb) / 0.034) 1.8%,
      rgb(var(--shaft-rgb) / 0.061) 3.6%,
      rgb(var(--shaft-rgb) / 0.153) 5.5%,
      rgb(var(--shaft-rgb) / 0.252) 7.3%,
      rgb(var(--shaft-rgb) / 0.276) 9.1%,
      rgb(var(--shaft-rgb) / 0.257) 10.9%,
      rgb(var(--shaft-rgb) / 0.2) 12.7%,
      rgb(var(--shaft-rgb) / 0.212) 14.5%,
      rgb(var(--shaft-rgb) / 0.251) 16.4%,
      rgb(var(--shaft-rgb) / 0.3) 18.2%,
      rgb(var(--shaft-rgb) / 0.267) 20.0%,
      rgb(var(--shaft-rgb) / 0.2) 21.8%,
      rgb(var(--shaft-rgb) / 0.104) 23.6%,
      rgb(var(--shaft-rgb) / 0.046) 25.5%,
      rgb(var(--shaft-rgb) / 0.013) 27.3%,
      rgb(var(--shaft-rgb) / 0.01) 29.1%,
      rgb(var(--shaft-rgb) / 0.029) 30.9%,
      rgb(var(--shaft-rgb) / 0.051) 32.7%,
      rgb(var(--shaft-rgb) / 0.061) 34.5%,
      rgb(var(--shaft-rgb) / 0.08) 36.4%,
      rgb(var(--shaft-rgb) / 0.102) 38.2%,
      rgb(var(--shaft-rgb) / 0.1) 40.0%,
      rgb(var(--shaft-rgb) / 0.072) 41.8%,
      rgb(var(--shaft-rgb) / 0.064) 43.6%,
      rgb(var(--shaft-rgb) / 0.067) 45.5%,
      rgb(var(--shaft-rgb) / 0.072) 47.3%,
      rgb(var(--shaft-rgb) / 0.057) 49.1%,
      rgb(var(--shaft-rgb) / 0.042) 50.9%,
      rgb(var(--shaft-rgb) / 0.035) 52.7%,
      rgb(var(--shaft-rgb) / 0.027) 54.5%,
      rgb(var(--shaft-rgb) / 0.03) 56.4%,
      rgb(var(--shaft-rgb) / 0.027) 58.2%,
      rgb(var(--shaft-rgb) / 0.018) 60.0%,
      rgb(var(--shaft-rgb) / 0.013) 61.8%,
      rgb(var(--shaft-rgb) / 0.019) 63.6%,
      rgb(var(--shaft-rgb) / 0.038) 65.5%,
      rgb(var(--shaft-rgb) / 0.038) 67.3%,
      rgb(var(--shaft-rgb) / 0.043) 69.1%,
      rgb(var(--shaft-rgb) / 0.025) 70.9%,
      rgb(var(--shaft-rgb) / 0.005) 72.7%,
      rgb(var(--shaft-rgb) / 0.0) 74.5%,
      rgb(var(--shaft-rgb) / 0.018) 76.4%,
      rgb(var(--shaft-rgb) / 0.015) 78.2%,
      rgb(var(--shaft-rgb) / 0.056) 80.0%,
      rgb(var(--shaft-rgb) / 0.07) 81.8%,
      rgb(var(--shaft-rgb) / 0.07) 83.6%,
      rgb(var(--shaft-rgb) / 0.054) 85.5%,
      rgb(var(--shaft-rgb) / 0.074) 87.3%,
      rgb(var(--shaft-rgb) / 0.063) 89.1%,
      rgb(var(--shaft-rgb) / 0.042) 90.9%,
      rgb(var(--shaft-rgb) / 0.024) 92.7%,
      rgb(var(--shaft-rgb) / 0.016) 94.5%,
      rgb(var(--shaft-rgb) / 0.0) 96.4%,
      rgb(var(--shaft-rgb) / 0.006) 98.2%,
      rgb(var(--shaft-rgb) / 0.011) 100.0%);
  animation: shaft-drift-b 143s linear infinite alternate;
}

@keyframes shaft-drift-a {
  from { transform: translate3d(0, 0, 0) }
  to   { transform: translate3d(-9%, -7%, 0) }
}
@keyframes shaft-drift-b {
  from { transform: translate3d(0, 0, 0) }
  to   { transform: translate3d(7%, 6%, 0) }
}

/* MOBILE. Percentage stops scale with the box, so on a 390px screen the same 56
 * bands land ~7px apart and read as moiré stripes, not as light. Zoom the tile in
 * so fewer, wider bands are visible. (The general rule: scale an effect to the
 * viewport, then go and look at 390px.) */
@media (max-width: 700px) {
  .shafts { --shaft-zoom: 260%; --shaft-angle: 150deg }
}

@media (prefers-reduced-motion: reduce) {
  .shafts::before, .shafts::after { animation: none }
}
