/* ==========================================================================
   Component: media-grain  →  assets/component-media-grain.css
   Figma's Noise effect over a photo (white noise, size 0.5, 51% density, opacity per layer):
   Testimonials 1164-3160 (12%), Instagram feed 1164-3226 (15%, one post 20%).
   It lifts a photo by about half its opacity on average, so leaving it out reads as a darker image.

   Usage: add .media-grain to a positioned box that clips its photo (overflow hidden); the grain is
   its ::after, drawn over the photo and under anything given a z-index.
     --grain-opacity   Figma's noise colour alpha (default 0.12); 0 turns the grain off
     .media-grain--dark  black grain instead of white (footer store photo 1352-3644, 20%)

   The tile (assets/images/textures/noise-grain.png) is 256px of independent white pixels at 51%
   density, drawn at 128px so one tile pixel is one device pixel at 2x. Its two alpha levels sit
   at 0.59 of a full on/off mask, which matches the strength of Figma's grain in its 2x export at
   the same average lift. Figma exports the effect as an feTurbulence filter, but at frequency 2 a
   browser samples the noise on its lattice points and draws a flat 50% veil, so the tile stands in.
   ========================================================================== */
.media-grain::after {
  content: "";
  position: absolute;
  inset: 0;
  background: url("../../images/textures/noise-grain.png") 0 0 / 128px 128px;
  opacity: var(--grain-opacity, 0.12);
  pointer-events: none;
}

/* the same tile turned black; its alpha, and so the grain, is unchanged */
.media-grain--dark::after {
  filter: brightness(0);
}
