/* What every effect shares (components/effect.tsx links this file and the
   effect's own): three tiled layers, ::before the near one, ::after the middle
   and .effect-fine the far one. Each starts one tile above the box and moves
   exactly one tile per cycle, so the loop is seamless. Tiles are drawn once
   and only translated, so their detail is never repainted: animating
   background-position would repaint the whole box every frame. An effect's
   file sets its tiles under .effect[data-effect="<name>"], which outranks
   these rules. Hidden under reduced motion. Still without a GPU
   (lib/client/low-gpu.ts), where moving the layers takes the CPU every
   frame. */

.effect {
  overflow: hidden;
  mask-image: linear-gradient(to bottom, black 40%, transparent 95%);
}

.effect::before,
.effect::after,
.effect-fine {
  content: "";
  position: absolute;
  inset: calc(-1 * var(--effect-tile)) 0 0;
  background-size: var(--effect-tile) var(--effect-tile);
  animation: effect-fall 24s linear infinite;
}

@keyframes effect-fall {
  to {
    transform: translateY(var(--effect-tile));
  }
}

@media (prefers-reduced-motion: reduce) {
  .effect {
    display: none;
  }
}

:root[data-low-gpu] .effect::before,
:root[data-low-gpu] .effect::after,
:root[data-low-gpu] .effect *,
:root[data-low-gpu] .effect *::before,
:root[data-low-gpu] .effect *::after {
  animation: none;
}
