/* Animation CSS */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInFromRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes glowPulse {
    0% {
        box-shadow: 0 0 5px rgba(0, 255, 0, 0.2);
    }
    50% {
        box-shadow: 0 0 20px rgba(0, 255, 0, 0.4);
    }
    100% {
        box-shadow: 0 0 5px rgba(0, 255, 0, 0.2);
    }
}

/* Apply animations to elements */
.fade-in {
    opacity: 0;
    animation: fadeIn 0.6s ease forwards;
}

.fade-in-left {
    opacity: 0;
    animation: fadeInFromLeft 0.6s ease forwards;
}

.fade-in-right {
    opacity: 0;
    animation: fadeInFromRight 0.6s ease forwards;
}

.scale-in {
    opacity: 0;
    animation: scaleIn 0.6s ease forwards;
}

.glow {
    animation: glowPulse 2s infinite;
}

/* Delay utility classes */
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }
.delay-5 { animation-delay: 0.5s; }
.delay-6 { animation-delay: 0.6s; }
.delay-7 { animation-delay: 0.7s; }
.delay-8 { animation-delay: 0.8s; }
.delay-9 { animation-delay: 0.9s; }
.delay-10 { animation-delay: 1s; }

/* Text animation with typing effect */
.typing {
    position: relative;
    white-space: nowrap;
    overflow: hidden;
    border-right: 2px solid var(--color-primary);
    animation: typing 3.5s steps(40, end),
               blink-caret .75s step-end infinite;
}

@keyframes typing {
    from { width: 0 }
    to { width: 100% }
}

@keyframes blink-caret {
    from, to { border-color: transparent }
    50% { border-color: var(--color-primary); }
}

/* Glitch text effect */
.glitch-text {
    position: relative;
    animation: glitch 1s linear infinite;
}

@keyframes glitch {
    2%, 64% {
        transform: translate(2px, 0) skew(0deg);
    }
    4%, 60% {
        transform: translate(-2px, 0) skew(0deg);
    }
    62% {
        transform: translate(0, 0) skew(5deg);
    }
}

.glitch-text:before,
.glitch-text:after {
    content: attr(title);
    position: absolute;
    left: 0;
}

.glitch-text:before {
    animation: glitchTop 1s linear infinite;
    clip-path: polygon(0 0, 100% 0, 100% 33%, 0 33%);
    -webkit-clip-path: polygon(0 0, 100% 0, 100% 33%, 0 33%);
}

@keyframes glitchTop {
    2%, 64% {
        transform: translate(2px, -2px);
    }
    4%, 60% {
        transform: translate(-2px, 2px);
    }
    62% {
        transform: translate(13px, -1px) skew(-13deg);
    }
}

.glitch-text:after {
    animation: glitchBottom 1.5s linear infinite;
    clip-path: polygon(0 67%, 100% 67%, 100% 100%, 0 100%);
    -webkit-clip-path: polygon(0 67%, 100% 67%, 100% 100%, 0 100%);
}

@keyframes glitchBottom {
    2%, 64% {
        transform: translate(-2px, 0);
    }
    4%, 60% {
        transform: translate(-2px, 0);
    }
    62% {
        transform: translate(-22px, 5px) skew(21deg);
    }
}

/* Scrolling reveal */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* Matrix rain effect for special sections */
.matrix-bg {
    position: relative;
}

.matrix-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0.9)),
                url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><text y="10" font-family="monospace" fill="rgba(0, 255, 0, 0.15)">10110011</text><text y="20" font-family="monospace" fill="rgba(0, 255, 0, 0.15)">01001010</text><text y="30" font-family="monospace" fill="rgba(0, 255, 0, 0.15)">11100101</text><text y="40" font-family="monospace" fill="rgba(0, 255, 0, 0.15)">00110011</text><text y="50" font-family="monospace" fill="rgba(0, 255, 0, 0.15)">10101100</text><text y="60" font-family="monospace" fill="rgba(0, 255, 0, 0.15)">01001101</text><text y="70" font-family="monospace" fill="rgba(0, 255, 0, 0.15)">11010001</text><text y="80" font-family="monospace" fill="rgba(0, 255, 0, 0.15)">00110110</text><text y="90" font-family="monospace" fill="rgba(0, 255, 0, 0.15)">10111001</text><text y="100" font-family="monospace" fill="rgba(0, 255, 0, 0.15)">01010011</text></svg>');
    z-index: -1;
    opacity: 0.1;
}