/* css/pages/studio.css · the studio: one warm light behind the whole home page (partials/_studio.html, js/studio.js)
 * The variables on .studio are written by js/studio.js; the values below are the resting light (no JS, reduced motion).
 *   --lx         beam column, % of the viewport width
 *   --tilt       beam angle, deg
 *   --mx --my    the cursor pool, % of the viewport
 *   --intensity  beam strength 0..1        --power  the entrance (filament) 0..1
 *   --dim        0 lit .. 1 dark           --light  the light colour as "r, g, b" (warmth) */
@layer base {
  .studio {
    --lx: 47%; --tilt: 14deg; --mx: 62%; --my: 42%;
    --intensity: 1; --power: 1; --dim: 0; --light: var(--beam-rgb);
    --lit: calc(var(--intensity) * var(--power) * (1 - var(--dim)));
    position: fixed; inset: 0; z-index: var(--z-studio); pointer-events: none; overflow: clip; contain: strict;
    background:
      radial-gradient(120% 70% at 50% 120%, var(--color-studio-floor) 0%, transparent 60%),
      radial-gradient(90% 60% at 50% -10%, var(--color-studio-ceiling) 0%, transparent 70%),
      var(--color-stage);
  }
  .studio > * { position: absolute; }
  /* a warm floor glow under the beam */
  .studio__floor { inset: auto -10% -30% -10%; height: 60%;
    background: radial-gradient(50% 50% at var(--lx) 30%, rgba(var(--light), .08), transparent 70%);
    opacity: calc(var(--power) * (1 - var(--dim))); }
  /* the beam: a column from above the frame, leaning with --tilt and widening as it falls */
  .studio__beam { left: var(--lx); top: -20vh; width: 0; height: 150vh; transform: rotate(var(--tilt)); transform-origin: 50% 0; }
  .studio__beam i { position: absolute; left: -26vw; top: 0; width: 52vw; height: 100%;
    background: radial-gradient(40% 70% at 50% 0%, rgba(var(--light), .17), rgba(var(--light), .05) 45%, transparent 75%);
    filter: blur(28px); mix-blend-mode: screen; opacity: var(--lit); }
  /* the pool: a soft light where the cursor is (it wanders on touch screens) */
  .studio__pool { left: var(--mx); top: var(--my); width: 70vmax; height: 70vmax; margin: -35vmax 0 0 -35vmax;
    background: radial-gradient(closest-side, rgba(var(--light), .06), transparent 70%); mix-blend-mode: screen;
    opacity: calc(var(--power) * (1 - var(--dim) * .7)); }
  .studio__motes { inset: 0; width: 100%; height: 100%; opacity: calc(1 - var(--dim) * .6); }
  /* stepped grain: one tiled noise, moved in steps (never smooth, never on reduced motion) */
  .studio__grain { inset: -50%; opacity: .08; mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1.2 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    animation: studio-grain 1s steps(6) infinite; }
  .studio__vignette { inset: 0; background: radial-gradient(130% 100% at 50% 45%, transparent 55%, color-mix(in srgb, var(--color-shadow) 70%, transparent) 100%); }
  /* dim: the room goes darker around whatever a section keeps lit */
  .studio::after { content: ""; position: absolute; inset: 0; background: var(--color-stage); opacity: calc(var(--dim) * .55); }
  @keyframes studio-grain {
    0% { transform: translate(0, 0); } 20% { transform: translate(-3%, 2%); } 40% { transform: translate(2%, -4%); }
    60% { transform: translate(-4%, -1%); } 80% { transform: translate(3%, 3%); } 100% { transform: translate(0, 0); }
  }
  /* reduced motion: no canvas, no grain motion; the light is on and still */
  @media (prefers-reduced-motion: reduce) {
    .studio__grain { animation: none; }
    .studio__motes { display: none; }
  }
  @media (forced-colors: active) { .studio { display: none; } }
  @media print { .studio { display: none; } }
}
