/* =============================================================================
   metaball.css — layout for the liquid-glass hero overlay
   -----------------------------------------------------------------------------
   The overlay is additive: the hero keeps the CSS background it already has
   (theme.yaml -> images.hero_background) and the WebGL2 canvas only draws the
   glass on top of it. Nothing here replaces a background.

   Loaded from base.html only when theme.yaml -> metaball.enabled is true.
   All the *look* parameters live in theme.yaml -> `metaball:` (see
   docs/METABALL.md); this file only positions the canvas.
   ============================================================================= */

:root {
  /* The hero background dissolves into the page background at its bottom edge
     (theme.css.j2: linear-gradient(180deg, transparent 55%, var(--bg))). The
     canvas is masked with roughly the same falloff so the glass fades out with
     the artwork instead of floating over the empty page. */
  --metaball-mask: linear-gradient(180deg, #000 0%, #000 58%, rgba(0, 0, 0, 0.35) 82%, transparent 100%);
}

/* The hero / project header becomes the containing block of its own overlay. */
[data-metaball] { position: relative; }

.metaball__canvas {
  position: absolute;
  inset: 0;
  z-index: 0;                 /* above the section background, below the copy */
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;       /* the cursor still reaches the links underneath */
  -webkit-mask-image: var(--metaball-mask);
  mask-image: var(--metaball-mask);
}

/* Copy, buttons and covers always sit on top of the glass. */
[data-metaball] > .container { position: relative; z-index: 1; }

/* No WebGL2 (or metaball.js failed): the hero renders exactly as before. */
[data-metaball].metaball-off .metaball__canvas { display: none; }
