/* AFTER DWN - CRT Glitch Frames Effect */

.glitch-frame {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9000;
    opacity: 0;
    mix-blend-mode: screen;
    background: transparent;
    transition: opacity 0.05s linear;
}

.glitch-frame.active {
    opacity: 1;
}

.red-scanline-error {
    position: absolute;
    width: 100%;
    height: 5px;
    background-color: var(--signal-red);
    opacity: 0.8;
    box-shadow: 0 0 15px var(--signal-red);
    animation: redScanlineGlitch 0.2s linear;
}

.crt-artifact {
    position: absolute;
    background-color: var(--signal-red);
    opacity: 0.3;
    mix-blend-mode: screen;
    filter: blur(2px);
}

.horizontal-distortion {
    position: absolute;
    width: 100%;
    height: 20px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(232, 42, 42, 0.2) 10%, 
        rgba(232, 42, 42, 0.1) 20%,
        transparent 30%,
        rgba(232, 42, 42, 0.3) 40%,
        transparent 50%,
        rgba(232, 42, 42, 0.2) 60%,
        rgba(232, 42, 42, 0.3) 70%,
        transparent 80%,
        rgba(232, 42, 42, 0.1) 90%,
        transparent 100%
    );
    transform: skewY(-0.5deg);
    animation: horizontalDistort 0.2s ease-in-out;
}

@keyframes redScanlineGlitch {
    0% {
        transform: translateY(-100vh);
    }
    100% {
        transform: translateY(100vh);
    }
}

@keyframes horizontalDistort {
    0%, 100% {
        transform: skewY(0);
        opacity: 0.3;
    }
    25% {
        transform: skewY(-1deg);
        opacity: 0.4;
    }
    50% {
        transform: skewY(0.5deg);
        opacity: 0.5;
    }
    75% {
        transform: skewY(-0.5deg);
        opacity: 0.3;
    }
}
