/* ============================================================
   CRT EFFECTS — MEMBURU PEMANGSA
   Monitor CRT simulation layers — pointer-events: none throughout
   ============================================================ */

/* ── BASE LAYER STYLES ── */
.crt-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: var(--z-crt-scan);
}

/* ── SCANLINES ── */
.crt-scan {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: var(--z-crt-scan);
  opacity: var(--crt-scan-opacity);
  background: repeating-linear-gradient(
    180deg,
    transparent 0,
    transparent 2px,
    rgba(0, 0, 0, 0.26) 2px,
    rgba(0, 0, 0, 0.26) 4px
  );
  mix-blend-mode: multiply;
  transition: opacity var(--t-slow);
}

/* ── VIGNETTE ── */
.crt-vig {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: var(--z-crt-vig);
  background: radial-gradient(
    120% 100% at 50% 45%,
    transparent 52%,
    var(--crt-vig-end) 100%
  );
  transition: background var(--t-slow);
}

/* ── FLICKER ── */
.crt-flicker {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: var(--z-crt-flicker);
  background: var(--crt-flicker-color);
  animation: crt-flick 6s infinite steps(60);
  transition: background var(--t-slow);
}

@keyframes crt-flick {
  0%, 100% { opacity: 0.02; }
  7%        { opacity: 0.10; }
  9%        { opacity: 0.02; }
  40%       { opacity: 0.06; }
  42%       { opacity: 0.02; }
  71%       { opacity: 0.08; }
  73%       { opacity: 0.02; }
}

/* ── HALFTONE DOT PATTERN ── */
.crt-halftone {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: var(--z-halftone);
  opacity: var(--halftone-opacity);
  background-image: radial-gradient(
    rgba(0, 26, 0, 0.12) 0.5px,
    transparent 0.6px
  );
  background-size: 7px 7px;
  transition: opacity var(--t-slow);
}

/* ── HORIZONTAL GLITCH LINE (sporadic) ── */
.crt-glitch-line {
  position: fixed;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(51, 255, 119, 0.15);
  pointer-events: none;
  z-index: var(--z-crt-vig);
  opacity: 0;
  animation: glitch-scan 8s infinite;
  top: 30%;
}

@keyframes glitch-scan {
  0%, 89%, 100% {
    opacity: 0;
    transform: translateY(0);
  }
  90% {
    opacity: 1;
    transform: translateY(-40px);
  }
  91% {
    opacity: 0;
    transform: translateY(120px);
  }
  92% {
    opacity: 0.6;
    transform: translateY(-80px);
  }
  93% {
    opacity: 0;
  }
}

/* ── REDUCED MOTION: disable all CRT animations ── */
@media (prefers-reduced-motion: reduce) {
  .crt-flicker {
    animation: none !important;
    opacity: 0.01;
  }
  .crt-glitch-line {
    animation: none !important;
    display: none;
  }
}
