/* ═══════════════════════════════════════════════════════
   EFFECTS.CSS — CRT, Scanlines, Glitch, Flicker
   ═══════════════════════════════════════════════════════ */

/* ═══════ SCANLINE OVERLAY ═══════ */
#scanline-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 255, 65, 0.03) 2px,
        rgba(0, 255, 65, 0.03) 4px
    );
}

/* ═══════ CRT FLICKER ═══════ */
#crt-flicker {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9998;
    animation: crtFlicker 0.15s infinite;
    opacity: 0.02;
    background: var(--green-primary);
}

@keyframes crtFlicker {
    0%   { opacity: 0.02; }
    5%   { opacity: 0.04; }
    10%  { opacity: 0.02; }
    15%  { opacity: 0.06; }
    20%  { opacity: 0.02; }
    100% { opacity: 0.02; }
}

/* ═══════ VIGNETTE ═══════ */
#vignette-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9997;
    background: radial-gradient(
        ellipse at center,
        transparent 60%,
        rgba(0, 0, 0, 0.7) 100%
    );
}

/* ═══════ GLITCH EFFECT ═══════ */
.glitch-active {
    animation: glitch 0.3s infinite;
}

@keyframes glitch {
    0% {
        transform: translate(0);
        filter: hue-rotate(0deg);
    }
    10% {
        transform: translate(-3px, 2px);
        filter: hue-rotate(90deg);
    }
    20% {
        transform: translate(3px, -2px);
        filter: hue-rotate(180deg);
    }
    30% {
        transform: translate(-1px, 1px);
        filter: hue-rotate(270deg);
    }
    40% {
        transform: translate(1px, -1px) skewX(2deg);
    }
    50% {
        transform: translate(-2px, 2px);
    }
    60% {
        transform: translate(2px, 0px) skewX(-1deg);
        filter: hue-rotate(360deg);
    }
    70% {
        transform: translate(0, -2px);
    }
    80% {
        transform: translate(-3px, 0) skewX(1deg);
    }
    90% {
        transform: translate(3px, 2px);
    }
    100% {
        transform: translate(0);
        filter: hue-rotate(0deg);
    }
}

/* Text glitch with RGB split */
.glitch-text {
    position: relative;
}

.glitch-text::before,
.glitch-text::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.glitch-text::before {
    animation: glitchTextBefore 2s infinite;
    color: var(--red);
    clip-path: polygon(0 0, 100% 0, 100% 45%, 0 45%);
    transform: translate(-2px);
}

.glitch-text::after {
    animation: glitchTextAfter 2s infinite;
    color: var(--cyan);
    clip-path: polygon(0 55%, 100% 55%, 100% 100%, 0 100%);
    transform: translate(2px);
}

@keyframes glitchTextBefore {
    0%   { clip-path: polygon(0 0, 100% 0, 100% 45%, 0 45%); transform: translate(-2px); }
    20%  { clip-path: polygon(0 20%, 100% 20%, 100% 60%, 0 60%); transform: translate(2px); }
    40%  { clip-path: polygon(0 40%, 100% 40%, 100% 80%, 0 80%); transform: translate(-1px); }
    60%  { clip-path: polygon(0 10%, 100% 10%, 100% 50%, 0 50%); transform: translate(1px); }
    80%  { clip-path: polygon(0 30%, 100% 30%, 100% 70%, 0 70%); transform: translate(-2px); }
    100% { clip-path: polygon(0 0, 100% 0, 100% 45%, 0 45%); transform: translate(-2px); }
}

@keyframes glitchTextAfter {
    0%   { clip-path: polygon(0 55%, 100% 55%, 100% 100%, 0 100%); transform: translate(2px); }
    20%  { clip-path: polygon(0 65%, 100% 65%, 100% 100%, 0 100%); transform: translate(-2px); }
    40%  { clip-path: polygon(0 45%, 100% 45%, 100% 90%, 0 90%); transform: translate(1px); }
    60%  { clip-path: polygon(0 55%, 100% 55%, 100% 95%, 0 95%); transform: translate(-1px); }
    80%  { clip-path: polygon(0 50%, 100% 50%, 100% 100%, 0 100%); transform: translate(2px); }
    100% { clip-path: polygon(0 55%, 100% 55%, 100% 100%, 0 100%); transform: translate(2px); }
}

/* ═══════ TYPING CURSOR ═══════ */
@keyframes blink {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0; }
}

.blink-cursor {
    animation: blink 1s step-end infinite;
}

/* ═══════ FLICKER ON SCREEN ═══════ */
.screen-flicker {
    animation: screenFlicker 0.05s linear 3;
}

@keyframes screenFlicker {
    0%   { opacity: 1; }
    25%  { opacity: 0.3; }
    50%  { opacity: 0.8; }
    75%  { opacity: 0.2; }
    100% { opacity: 1; }
}

/* ═══════ NEON GLOW PULSE ═══════ */
.neon-pulse {
    animation: neonPulse 2s ease-in-out infinite alternate;
}

@keyframes neonPulse {
    from {
        text-shadow: 0 0 5px var(--green-primary),
                     0 0 10px var(--green-primary),
                     0 0 20px var(--green-dim);
    }
    to {
        text-shadow: 0 0 10px var(--green-primary),
                     0 0 20px var(--green-primary),
                     0 0 40px var(--green-dim),
                     0 0 80px var(--green-dark);
    }
}

/* ═══════ HACK PROGRESS BAR ═══════ */
.hack-progress {
    width: 100%;
    height: 8px;
    background: #1a1a1a;
    border: 1px solid var(--green-dark);
    margin: 8px 0;
    position: relative;
    overflow: hidden;
}

.hack-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--green-dark), var(--green-primary), var(--green-bright));
    width: 0%;
    transition: width 0.1s linear;
    box-shadow: 0 0 10px var(--green-glow);
}

/* ═══════ MATRIX RAIN INTENSIFY ═══════ */
.matrix-intense #matrix-rain {
    opacity: 0.6 !important;
}
