/* ============================================================
   awesome.init — CRT Effects
   ============================================================ */

/* ---- Static noise overlay ---- */
.ai-crt-noise {
    pointer-events: none;
    position: fixed;
    inset: 0;
    z-index: 9997;
    /* opacity overridden via inline style from PHP (ai_noise_opacity) */
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.2'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 200px 200px;
    animation: ai-noise-shift 0.08s steps(1) infinite;
}

@keyframes ai-noise-shift {
    0%   { background-position: 0 0; }
    25%  { background-position: -50px -30px; }
    50%  { background-position: 20px -60px; }
    75%  { background-position: -70px 40px; }
    100% { background-position: 30px 20px; }
}

/* ---- Scanline overlay ---- */
.ai-crt-overlay {
    pointer-events: none;
    position: fixed;
    inset: 0;
    z-index: 9998;
    /* intensity overridden via inline style from PHP */
    background: repeating-linear-gradient(
        180deg,
        rgba(0, 0, 0, 0)    0,
        rgba(0, 0, 0, 0.2)  50%,
        rgba(0, 0, 0, 0)    100%
    );
    background-size: auto 4px;
}

/* ---- Scan beam ---- */
.ai-crt-overlay::before {
    content: "";
    pointer-events: none;
    position: absolute;
    inset: 0;
    background-image: linear-gradient(
        0deg,
        transparent                   0%,
        rgba(32, 128, 32, 0.08)       2%,
        rgba(32, 128, 32, 0.25)       3%,
        rgba(32, 128, 32, 0.08)       4%,
        transparent                   100%
    );
    background-repeat: no-repeat;
    /* duration overridden via inline style from PHP */
    animation: ai-crt-scan 9.5s linear infinite;
}

@keyframes ai-crt-scan {
    0%       { background-position: 0 -100vh; }
    35%, 100% { background-position: 0 110vh; }
}

/* ---- Phosphor color variants for scan beam ---- */
body.ai-amber .ai-crt-overlay::before {
    background-image: linear-gradient(
        0deg,
        transparent                    0%,
        rgba(180, 100, 0, 0.08)        2%,
        rgba(180, 100, 0, 0.25)        3%,
        rgba(180, 100, 0, 0.08)        4%,
        transparent                    100%
    );
}

body.ai-blue .ai-crt-overlay::before {
    background-image: linear-gradient(
        0deg,
        transparent                    0%,
        rgba(20, 80, 160, 0.08)        2%,
        rgba(20, 80, 160, 0.25)        3%,
        rgba(20, 80, 160, 0.08)        4%,
        transparent                    100%
    );
}

body.ai-white .ai-crt-overlay::before {
    background-image: linear-gradient(
        0deg,
        transparent                    0%,
        rgba(200, 200, 200, 0.06)      2%,
        rgba(200, 200, 200, 0.18)      3%,
        rgba(200, 200, 200, 0.06)      4%,
        transparent                    100%
    );
}

/* ---- Vignette ---- */
.ai-crt-overlay::after {
    content: "";
    pointer-events: none;
    position: absolute;
    inset: 0;
    background: radial-gradient(
        ellipse at center,
        transparent 60%,
        rgba(0, 0, 0, 0.4) 100%
    );
}
