/* Glitch Effects CSS */

/* Main Glitch Animation */
.glitch {
    position: relative;
    color: #00ff41;
    font-size: 2rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    animation: glitch-skew 1s infinite linear alternate-reverse;
}

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

.glitch::before {
    animation: glitch-top 1s infinite linear alternate-reverse;
    color: #ff0040;
    clip-path: polygon(0 0, 100% 0, 100% 33%, 0 33%);
}

.glitch::after {
    animation: glitch-bottom 1.5s infinite linear alternate-reverse;
    color: #0040ff;
    clip-path: polygon(0 67%, 100% 67%, 100% 100%, 0 100%);
}

@keyframes glitch-top {
    2%, 64% {
        transform: translate(2px, -2px);
    }
    4%, 60% {
        transform: translate(-2px, 2px);
    }
    62% {
        transform: translate(13px, -1px) skew(-13deg);
    }
}

@keyframes glitch-bottom {
    2%, 64% {
        transform: translate(-2px, 0);
    }
    4%, 60% {
        transform: translate(-2px, 0);
    }
    62% {
        transform: translate(-22px, 5px) skew(21deg);
    }
}

@keyframes glitch-skew {
    2%, 64% {
        transform: skew(0deg);
    }
    4%, 60% {
        transform: skew(5deg);
    }
    62% {
        transform: skew(0deg);
    }
}

/* Glitch Text Variants */
.glitch-small {
    font-size: 1rem;
    animation-duration: 2s;
}

.glitch-large {
    font-size: 3rem;
    animation-duration: 0.5s;
}

/* RGB Split Effect */
.rgb-split {
    position: relative;
    color: #ffffff;
}

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

.rgb-split::before {
    color: #ff0000;
    animation: rgb-split-red 2s infinite;
}

.rgb-split::after {
    color: #00ffff;
    animation: rgb-split-cyan 2s infinite;
}

@keyframes rgb-split-red {
    0%, 100% { transform: translate(0); }
    20% { transform: translate(-2px, 2px); }
    40% { transform: translate(-2px, -2px); }
    60% { transform: translate(2px, 2px); }
    80% { transform: translate(2px, -2px); }
}

@keyframes rgb-split-cyan {
    0%, 100% { transform: translate(0); }
    20% { transform: translate(2px, -2px); }
    40% { transform: translate(2px, 2px); }
    60% { transform: translate(-2px, -2px); }
    80% { transform: translate(-2px, 2px); }
}

/* Digital Noise Effect */
.digital-noise {
    position: relative;
    overflow: hidden;
}

.digital-noise::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><defs><filter id="noise"><feTurbulence baseFrequency="0.9" numOctaves="4" stitchTiles="stitch"/><feColorMatrix values="0 0 0 0 0 0 0 0 0 0.4 0 0 0 0 0.2 0 0 0 0.1 0"/></filter></defs><rect width="100%" height="100%" filter="url(%23noise)" opacity="0.4"/></svg>');
    pointer-events: none;
    animation: noise-anim 0.2s infinite;
    mix-blend-mode: overlay;
}

@keyframes noise-anim {
    0%, 100% { 
        opacity: 0.1; 
        transform: translate(0, 0);
    }
    10% { 
        opacity: 0.4; 
        transform: translate(-1px, 1px);
    }
    20% { 
        opacity: 0.2; 
        transform: translate(1px, -1px);
    }
    30% { 
        opacity: 0.3; 
        transform: translate(-1px, -1px);
    }
    40% { 
        opacity: 0.1; 
        transform: translate(1px, 1px);
    }
    50% { 
        opacity: 0.4; 
        transform: translate(0, -1px);
    }
    60% { 
        opacity: 0.2; 
        transform: translate(-1px, 0);
    }
    70% { 
        opacity: 0.3; 
        transform: translate(1px, 0);
    }
    80% { 
        opacity: 0.1; 
        transform: translate(0, 1px);
    }
    90% { 
        opacity: 0.4; 
        transform: translate(-1px, -1px);
    }
}

/* Scanline Effect */
.scanlines {
    position: relative;
    overflow: hidden;
}

.scanlines::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        transparent 50%, 
        rgba(0, 255, 65, 0.03) 50%
    );
    background-size: 100% 4px;
    pointer-events: none;
    animation: scanlines-move 0.1s linear infinite;
}

@keyframes scanlines-move {
    0% { transform: translateY(0); }
    100% { transform: translateY(4px); }
}

/* Chromatic Aberration */
.chromatic {
    position: relative;
    color: #ffffff;
}

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

.chromatic::before {
    color: #ff0040;
    animation: chromatic-red 3s infinite;
}

.chromatic::after {
    color: #0040ff;
    animation: chromatic-blue 3s infinite;
}

@keyframes chromatic-red {
    0%, 100% { transform: translate(0); }
    25% { transform: translate(-1px, 0); }
    50% { transform: translate(1px, 0); }
    75% { transform: translate(-1px, 0); }
}

@keyframes chromatic-blue {
    0%, 100% { transform: translate(0); }
    25% { transform: translate(1px, 0); }
    50% { transform: translate(-1px, 0); }
    75% { transform: translate(1px, 0); }
}

/* Pixel Distortion */
.pixel-distort {
    position: relative;
    animation: pixel-distort-anim 4s infinite;
}

@keyframes pixel-distort-anim {
    0%, 100% { 
        transform: scale(1); 
        filter: blur(0px);
    }
    10% { 
        transform: scale(1.01) skew(0.5deg); 
        filter: blur(0.5px);
    }
    20% { 
        transform: scale(0.99) skew(-0.5deg); 
        filter: blur(0px);
    }
    30% { 
        transform: scale(1.02) skew(0.2deg); 
        filter: blur(0.3px);
    }
    40% { 
        transform: scale(0.98) skew(-0.2deg); 
        filter: blur(0px);
    }
    50% { 
        transform: scale(1.01) skew(0.3deg); 
        filter: blur(0.2px);
    }
    60% { 
        transform: scale(0.99) skew(-0.3deg); 
        filter: blur(0px);
    }
    70% { 
        transform: scale(1.02) skew(0.1deg); 
        filter: blur(0.4px);
    }
    80% { 
        transform: scale(0.98) skew(-0.1deg); 
        filter: blur(0px);
    }
    90% { 
        transform: scale(1.01) skew(0.4deg); 
        filter: blur(0.1px);
    }
}

/* Data Corruption Effect */
.data-corrupt {
    position: relative;
    font-family: 'Courier New', monospace;
}

.data-corrupt::before {
    content: attr(data-corrupt);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    color: #ff0040;
    animation: data-corrupt-anim 5s infinite;
    opacity: 0;
}

@keyframes data-corrupt-anim {
    0%, 90%, 100% { opacity: 0; }
    91%, 99% { opacity: 1; }
}

/* Hologram Flicker */
.hologram {
    position: relative;
    color: #00ff41;
    animation: hologram-flicker 2s infinite;
}

.hologram::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(0, 255, 65, 0.1) 50%,
        transparent 70%
    );
    background-size: 20px 20px;
    animation: hologram-scan 3s linear infinite;
    pointer-events: none;
}

@keyframes hologram-flicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
    51% { opacity: 1; }
    52% { opacity: 0.9; }
    53% { opacity: 1; }
}

@keyframes hologram-scan {
    0% { background-position: 0 0; }
    100% { background-position: 40px 40px; }
}

/* Terminal Glitch */
.terminal-glitch {
    position: relative;
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid #00ff41;
    animation: terminal-glitch-anim 6s infinite;
}

@keyframes terminal-glitch-anim {
    0%, 96%, 100% { 
        transform: translate(0);
        border-color: #00ff41;
    }
    97% { 
        transform: translate(2px, 0);
        border-color: #ff0040;
    }
    98% { 
        transform: translate(-2px, 0);
        border-color: #0040ff;
    }
    99% { 
        transform: translate(1px, 0);
        border-color: #00ff41;
    }
}

/* Matrix Glitch */
.matrix-glitch {
    position: relative;
    overflow: hidden;
}

.matrix-glitch::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 2px,
        rgba(0, 255, 65, 0.1) 2px,
        rgba(0, 255, 65, 0.1) 4px
    );
    animation: matrix-glitch-scan 0.1s infinite;
    pointer-events: none;
}

@keyframes matrix-glitch-scan {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Error State Glitch */
.error-glitch {
    position: relative;
    color: #ff0040;
    animation: error-glitch-shake 0.5s infinite;
}

.error-glitch::before {
    content: 'ERROR: ';
    color: #ff0040;
    animation: error-blink 1s infinite;
}

@keyframes error-glitch-shake {
    0%, 100% { transform: translate(0); }
    10% { transform: translate(-1px, -1px); }
    20% { transform: translate(1px, 1px); }
    30% { transform: translate(-1px, 1px); }
    40% { transform: translate(1px, -1px); }
    50% { transform: translate(-1px, -1px); }
    60% { transform: translate(1px, 1px); }
    70% { transform: translate(-1px, 1px); }
    80% { transform: translate(1px, -1px); }
    90% { transform: translate(-1px, -1px); }
}

@keyframes error-blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Loading Glitch */
.loading-glitch {
    position: relative;
    color: #00ff41;
}

.loading-glitch::after {
    content: '...';
    animation: loading-dots 1.5s infinite;
}

@keyframes loading-dots {
    0%, 20% { content: ''; }
    21%, 40% { content: '.'; }
    41%, 60% { content: '..'; }
    61%, 80% { content: '...'; }
    81%, 100% { content: ''; }
}

/* Utility Classes */
.glitch-hover:hover {
    animation: glitch-skew 0.3s infinite linear alternate-reverse;
}

.glitch-click:active {
    animation: glitch-skew 0.1s linear;
}

.no-glitch {
    animation: none !important;
}

.no-glitch::before,
.no-glitch::after {
    display: none !important;
}

