/* Animations CSS for AI/ML Portfolio */

/* Glitch Text Effect */
.glitch-text {
    position: relative;
    animation: glitch 5s infinite;
}

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

.glitch-text::before {
    left: 2px;
    text-shadow: -2px 0 #ff00c1;
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-anim 5s infinite linear alternate-reverse;
}

.glitch-text::after {
    left: -2px;
    text-shadow: -2px 0 #00fff9, 2px 2px #ff00c1;
    animation: glitch-anim2 1s infinite linear alternate-reverse;
}

@keyframes glitch {
    1% {
        transform: rotateX(10deg) skewX(90deg);
    }
    2% {
        transform: rotateX(0deg) skewX(0deg);
    }
}

@keyframes glitch-anim {
    0% {
        clip: rect(31px, 9999px, 94px, 0);
    }
    10% {
        clip: rect(112px, 9999px, 76px, 0);
    }
    20% {
        clip: rect(85px, 9999px, 41px, 0);
    }
    30% {
        clip: rect(24px, 9999px, 23px, 0);
    }
    40% {
        clip: rect(76px, 9999px, 6px, 0);
    }
    50% {
        clip: rect(42px, 9999px, 84px, 0);
    }
    60% {
        clip: rect(36px, 9999px, 91px, 0);
    }
    70% {
        clip: rect(23px, 9999px, 53px, 0);
    }
    80% {
        clip: rect(66px, 9999px, 86px, 0);
    }
    90% {
        clip: rect(10px, 9999px, 87px, 0);
    }
    100% {
        clip: rect(87px, 9999px, 4px, 0);
    }
}

@keyframes glitch-anim2 {
    0% {
        clip: rect(65px, 9999px, 119px, 0);
    }
    15% {
        clip: rect(84px, 9999px, 115px, 0);
    }
    30% {
        clip: rect(106px, 9999px, 2px, 0);
    }
    45% {
        clip: rect(115px, 9999px, 86px, 0);
    }
    60% {
        clip: rect(30px, 9999px, 60px, 0);
    }
    75% {
        clip: rect(15px, 9999px, 87px, 0);
    }
    90% {
        clip: rect(66px, 9999px, 122px, 0);
    }
    100% {
        clip: rect(91px, 9999px, 66px, 0);
    }
}

/* Animated Gradient */
.gradient-text {
    background: linear-gradient(135deg, #6e44ff, #eb2f64, #00fff9, #6e44ff);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradient-shift 8s ease infinite;
}

@keyframes gradient-shift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Fade In Up Animation */
.fade-in-up {
    opacity: 0;
    transform: translateY(30px);
    animation: fadeInUp 0.8s ease forwards;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Staggered animation delays */
.stagger-1 {
    animation-delay: 0.1s;
}

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

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

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

/* Float Animation */
.float {
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
    100% {
        transform: translateY(0px);
    }
}

/* Pulse Animation */
.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* Circular Rotation */
.rotate {
    animation: rotate 10s linear infinite;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Typing text animation */
.typing {
    overflow: hidden;
    border-right: 2px solid var(--primary-color);
    white-space: nowrap;
    margin: 0 auto;
    animation: 
        typing 3.5s steps(40, end),
        blink-caret 0.75s step-end infinite;
}

@keyframes typing {
    from { width: 0 }
    to { width: 100% }
}

@keyframes blink-caret {
    from, to { border-color: transparent }
    50% { border-color: var(--primary-color) }
}

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

.shimmer::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        to right,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.05) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    transform: rotate(30deg);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    from {
        transform: translateX(-100%) rotate(30deg);
    }
    to {
        transform: translateX(100%) rotate(30deg);
    }
}

/* Reveal Animation */
.reveal {
    position: relative;
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s ease;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* Loading Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Background Gradient Animation */
.bg-animated {
    background: linear-gradient(-45deg, #6e44ff, #121212, #eb2f64, #1e1e1e);
    background-size: 400% 400%;
    animation: gradient 15s ease infinite;
}

@keyframes gradient {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}
