/* ============================================================
   Animations & Micro-interactions
   ============================================================ */

/* Glitch effect for name */
.glitch {
    position: relative;
    animation: glitch-skew 4s infinite linear alternate-reverse;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    left: 0;
    width: 100%;
    clip: rect(0, 900px, 0, 0);
}

.glitch::before {
    animation: glitch-anim-1 2s infinite linear alternate-reverse;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    opacity: 0.6;
}

.glitch::after {
    animation: glitch-anim-2 2s infinite linear alternate-reverse;
    background: linear-gradient(135deg, var(--accent), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    opacity: 0.4;
}

@keyframes glitch-anim-1 {
    0% {
        clip: rect(42px, 9999px, 44px, 0);
        transform: skew(0.6deg);
    }

    20% {
        clip: rect(12px, 9999px, 59px, 0);
        transform: skew(0.2deg);
    }

    40% {
        clip: rect(80px, 9999px, 96px, 0);
        transform: skew(0.8deg);
    }

    60% {
        clip: rect(55px, 9999px, 78px, 0);
        transform: skew(0.1deg);
    }

    80% {
        clip: rect(24px, 9999px, 37px, 0);
        transform: skew(0.4deg);
    }

    100% {
        clip: rect(66px, 9999px, 79px, 0);
        transform: skew(0.7deg);
    }
}

@keyframes glitch-anim-2 {
    0% {
        clip: rect(65px, 9999px, 99px, 0);
        transform: skew(0.4deg);
        left: 2px;
    }

    20% {
        clip: rect(88px, 9999px, 58px, 0);
        transform: skew(0.8deg);
        left: -2px;
    }

    40% {
        clip: rect(33px, 9999px, 76px, 0);
        transform: skew(0.1deg);
        left: 2px;
    }

    60% {
        clip: rect(19px, 9999px, 43px, 0);
        transform: skew(0.6deg);
        left: -2px;
    }

    80% {
        clip: rect(74px, 9999px, 23px, 0);
        transform: skew(0.3deg);
        left: 2px;
    }

    100% {
        clip: rect(48px, 9999px, 87px, 0);
        transform: skew(0.5deg);
        left: -2px;
    }
}

@keyframes glitch-skew {
    0% {
        transform: skew(0deg);
    }

    20% {
        transform: skew(-0.5deg);
    }

    40% {
        transform: skew(0.5deg);
    }

    60% {
        transform: skew(-0.2deg);
    }

    80% {
        transform: skew(0.2deg);
    }

    100% {
        transform: skew(0deg);
    }
}

/* Particle canvas */
#particles-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

/* Shimmer on hover */
.shimmer {
    position: relative;
    overflow: hidden;
}

.shimmer::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
    transition: left 0.5s ease;
}

.shimmer:hover::before {
    left: 150%;
}

/* Neon glow on primary buttons */
.btn-primary {
    animation: neon-pulse 3s ease-in-out infinite;
}

@keyframes neon-pulse {

    0%,
    100% {
        box-shadow: 0 4px 20px var(--primary-glow);
    }

    50% {
        box-shadow: 0 4px 30px rgba(0, 212, 255, 0.4), 0 0 60px rgba(124, 58, 237, 0.2);
    }
}

/* Spin animation for loading */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.spin {
    animation: spin 1s linear infinite;
}

/* Counter animation */
.counter {
    transition: all 1s ease;
}

/* Card entrance cascade */
.stagger-1 {
    animation-delay: 0.1s;
}

.stagger-2 {
    animation-delay: 0.2s;
}

.stagger-3 {
    animation-delay: 0.3s;
}

.stagger-4 {
    animation-delay: 0.4s;
}

.stagger-5 {
    animation-delay: 0.5s;
}

.stagger-6 {
    animation-delay: 0.6s;
}