@layer reset, base, fx;

@layer reset {
  *, *::before, *::after { box-sizing: border-box; margin: 0; }
}

@layer base {
  :root {
    color-scheme: dark;
    --black: #0a0908;
  }

  html, body { block-size: 100%; }

  body {
    background: var(--black);
    overflow: hidden;
    /* nothing here to click on. the eyes follow the pointer, so it can go unseen */
    cursor: none;
  }

  canvas {
    position: fixed;
    inset: 0;
    inline-size: 100%;
    block-size: 100%;
    display: block;
  }
}

/* the screen sits between us and the glyphs: scanlines and grain */
@layer fx {
  body::before,
  body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
  }

  body::before {
    background: repeating-linear-gradient(
      to bottom,
      transparent 0 2px,
      oklch(0% 0 0 / 0.07) 2px 3px
    );
  }

  body::after {
    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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    opacity: 0.35;
    mix-blend-mode: multiply;
    animation: grain 0.6s steps(6) infinite;
  }

  @keyframes grain {
    0%   { background-position: 0 0; }
    20%  { background-position: -60px 40px; }
    40%  { background-position: 80px -30px; }
    60%  { background-position: -20px -90px; }
    80%  { background-position: 110px 70px; }
    100% { background-position: 0 0; }
  }

  @media (prefers-reduced-motion: reduce) {
    body::after { animation: none; }
  }
}
