/* ===== Retro arcade screen filter (decorative, non-blocking) =====
   An arcade monitor, not a PC CRT: a visible blocky pixel grid (not fine
   scanlines) plus a curved-glass vignette (darkening + a soft central
   highlight, to read as convex rather than flat), a faint RGB edge fringe
   (color bleed where the curve is steepest), a soft color-bleed glow in
   the corners (brightening, screen), and a slow single scan bar that
   rolls down the screen. All layers are pointer-events: none, and none of
   them clip or distort real content — the curve is an illusion, not a
   geometric transform, so forms/links stay exactly where they look. */

.crt-overlay,
.crt-glow,
.crt-curve {
    position: fixed;
    inset: 0;
    pointer-events: none;
}

.crt-overlay {
    z-index: 500;
    mix-blend-mode: multiply;
    opacity: 0.42;
    background-image:
        repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0.55) 0px, rgba(0, 0, 0, 0.55) 1px, transparent 1px, transparent 4px),
        repeating-linear-gradient(to right, rgba(0, 0, 0, 0.5) 0px, rgba(0, 0, 0, 0.5) 1px, transparent 1px, transparent 4px),
        radial-gradient(ellipse 75% 70% at 50% 50%, transparent 48%, rgba(0, 0, 0, 0.22) 78%, rgba(0, 0, 0, 0.6) 96%, rgba(0, 0, 0, 0.82) 100%);
    animation: crt-flicker 6s linear infinite;
}

.crt-overlay::before {
    content: '';
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    height: 10px;
    background: rgba(0, 0, 0, 0.6);
    opacity: 0.5;
    animation: crt-scanbar 9s linear infinite;
    will-change: transform;
}

/* The glass curve: a bright soft bulge dead-center (where convex glass
   catches the most light) fading to nothing a third of the way out, so it
   reads as a highlight on a dome rather than a flat screen glow. */
.crt-glow {
    z-index: 501;
    mix-blend-mode: screen;
    opacity: 0.12;
    background-image:
        radial-gradient(circle at 8% 10%, var(--color-pink), transparent 35%),
        radial-gradient(circle at 92% 88%, var(--color-green), transparent 35%),
        radial-gradient(ellipse 55% 50% at 50% 46%, rgba(255, 255, 255, 0.8) 0%, rgba(255, 255, 255, 0.15) 32%, transparent 60%);
}

/* RGB fringe at the extreme edges — where a curved screen bends light
   apart into its component colors. Kept very faint; it's a texture cue,
   not an effect you should consciously notice. */
.crt-curve {
    z-index: 499;
    mix-blend-mode: screen;
    opacity: 0.3;
    background-image:
        linear-gradient(to right, rgba(255, 40, 90, 0.16) 0%, transparent 3%, transparent 97%, rgba(70, 230, 255, 0.16) 100%),
        linear-gradient(to bottom, rgba(255, 40, 90, 0.12) 0%, transparent 3%, transparent 97%, rgba(70, 230, 255, 0.12) 100%);
}

@keyframes crt-flicker {
    0%, 100%, 48% { opacity: 0.4; }
    50%            { opacity: 0.34; }
    52%, 77%       { opacity: 0.4; }
    79%            { opacity: 0.36; }
    81%            { opacity: 0.4; }
}

@keyframes crt-scanbar {
    0%   { transform: translate3d(0, -10px, 0); }
    100% { transform: translate3d(0, 100vh, 0); }
}
