/* Da Vinci Virus Glitch Effects */

/* Main glitch animation */
.glitch {
    animation: glitch 0.3s infinite;
}

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

/* Scanline effect */
.scanlines::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.1),
        rgba(0, 0, 0, 0.1) 1px,
        transparent 1px,
        transparent 2px
    );
    pointer-events: none;
    z-index: 10000;
}

/* RGB split effect */
.rgb-split {
    position: relative;
}

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

.rgb-split::before {
    color: #ff0000;
    animation: rgb-shift-r 0.5s infinite;
    clip-path: inset(0 0 50% 0);
}

.rgb-split::after {
    color: #00ffff;
    animation: rgb-shift-b 0.5s infinite;
    clip-path: inset(50% 0 0 0);
}

@keyframes rgb-shift-r {
    0%, 100% { transform: translate(0); }
    50% { transform: translate(-3px, 0); }
}

@keyframes rgb-shift-b {
    0%, 100% { transform: translate(0); }
    50% { transform: translate(3px, 0); }
}

/* Text corruption effect */
.corrupted {
    animation: corrupt 0.1s infinite;
}

@keyframes corrupt {
    0% { opacity: 1; }
    10% { opacity: 0.8; transform: skewX(5deg); }
    20% { opacity: 1; transform: skewX(0deg); }
    30% { opacity: 0.9; }
    40% { opacity: 1; }
    50% { opacity: 0.7; transform: skewX(-3deg); }
    60% { opacity: 1; transform: skewX(0deg); }
    70% { opacity: 0.85; }
    80% { opacity: 1; }
    90% { opacity: 0.9; transform: skewX(2deg); }
    100% { opacity: 1; transform: skewX(0deg); }
}

/* Flicker effect - gentler CRT-style flicker */
.flicker {
    animation: flicker 2s infinite;
}

@keyframes flicker {
    0%, 100% { opacity: 1; }
    5% { opacity: 0.85; }
    10% { opacity: 1; }
    15% { opacity: 0.9; }
    30% { opacity: 1; }
    50% { opacity: 0.95; }
    55% { opacity: 0.7; }
    60% { opacity: 1; }
    80% { opacity: 0.92; }
    85% { opacity: 1; }
}

/* Screen tear effect */
.screen-tear {
    animation: tear 2s infinite;
}

@keyframes tear {
    0%, 100% {
        clip-path: inset(0 0 0 0);
    }
    25% {
        clip-path: inset(10% 0 80% 0);
    }
    50% {
        clip-path: inset(40% 0 50% 0);
    }
    75% {
        clip-path: inset(70% 0 20% 0);
    }
}

/* Matrix rain effect for background */
.matrix-bg {
    background: linear-gradient(
        rgba(0, 0, 0, 0.9),
        rgba(0, 0, 0, 0.9)
    );
    background-color: #000;
}

/* Infected text highlight */
.infected {
    background-color: #000000;
    color: #00FF00 !important;
    font-family: 'Courier New', monospace !important;
    padding: 2px 4px;
}

/* CRT effect */
.crt::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(
        ellipse at center,
        transparent 0%,
        rgba(0, 0, 0, 0.2) 80%,
        rgba(0, 0, 0, 0.4) 100%
    );
    pointer-events: none;
    z-index: 9998;
}

/* Static noise overlay */
.static-noise {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('data:image/svg+xml,<svg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"><filter id="noise"><feTurbulence type="fractalNoise" baseFrequency="0.9" numOctaves="3" stitchTiles="stitch"/></filter><rect width="100%" height="100%" filter="url(%23noise)" opacity="0.1"/></svg>');
    pointer-events: none;
    z-index: 9997;
    opacity: 0;
    animation: static 0.5s infinite;
}

@keyframes static {
    0%, 100% { opacity: 0.05; }
    50% { opacity: 0.1; }
}

/* Takeover progress bar */
#takeover-progress {
    position: fixed;
    bottom: 0;
    left: 0;
    height: 5px;
    background: #FF0000;
    z-index: 9999;
    width: 0%;
    transition: width 0.5s ease;
}

/* Warning banner */
.warning-banner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: #FF0000;
    color: #FFFFFF;
    text-align: center;
    padding: 10px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    z-index: 9000;
    animation: warning-flash 0.5s infinite;
}

@keyframes warning-flash {
    0%, 100% { background: #FF0000; }
    50% { background: #990000; }
}

/* Final state - full takeover */
.fully-compromised {
    background: #000000 !important;
    color: #00FF00 !important;
}

.fully-compromised * {
    color: #00FF00 !important;
    border-color: #00FF00 !important;
    background-color: transparent !important;
}

.fully-compromised a {
    color: #FF0000 !important;
}
