/* ═══════════════════════════════════════════════════════════
   ANIMATIONS STYLESHEET - GSAP & CSS Animations
   Smooth Scroll, Parallax, Micro-Interactions
   ═══════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────────────────── */
/* FADE-IN ANIMATIONS */
/* ─────────────────────────────────────────────────────────── */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ─────────────────────────────────────────────────────────── */
/* SCALE ANIMATIONS */
/* ─────────────────────────────────────────────────────────── */

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

/* ─────────────────────────────────────────────────────────── */
/* ROTATION & SPIN */
/* ─────────────────────────────────────────────────────────── */

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.fa-spin {
    animation: spin 1s linear infinite;
}

/* ─────────────────────────────────────────────────────────── */
/* BOUNCE & SHAKE */
/* ─────────────────────────────────────────────────────────── */

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-20px);
    }
    60% {
        transform: translateY(-10px);
    }
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-10px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(10px);
    }
}

/* ─────────────────────────────────────────────────────────── */
/* GRADIENT ANIMATIONS */
/* ─────────────────────────────────────────────────────────── */

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.animated-gradient {
    background: linear-gradient(270deg, var(--primary), var(--accent), var(--info));
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

/* ─────────────────────────────────────────────────────────── */
/* GLOW EFFECTS */
/* ─────────────────────────────────────────────────────────── */

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(99, 102, 241, 0.4);
    }
    50% {
        box-shadow: 0 0 40px rgba(99, 102, 241, 0.8), 0 0 60px rgba(236, 72, 153, 0.4);
    }
}

.glow-effect {
    animation: glow 3s ease-in-out infinite;
}

/* ─────────────────────────────────────────────────────────── */
/* LOADING ANIMATIONS */
/* ─────────────────────────────────────────────────────────── */

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.shimmer {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.1) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}

/* ─────────────────────────────────────────────────────────── */
/* HOVER LIFT EFFECTS */
/* ─────────────────────────────────────────────────────────── */

.hover-lift {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-lift:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

/* ─────────────────────────────────────────────────────────── */
/* TEXT REVEAL ANIMATIONS */
/* ─────────────────────────────────────────────────────────── */

@keyframes textReveal {
    from {
        opacity: 0;
        transform: translateY(20px);
        clip-path: polygon(0 0, 100% 0, 100% 0, 0 0);
    }
    to {
        opacity: 1;
        transform: translateY(0);
        clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
    }
}

.text-reveal {
    animation: textReveal 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* ─────────────────────────────────────────────────────────── */
/* STAGGER ANIMATIONS (For multiple elements) */
/* ─────────────────────────────────────────────────────────── */

.stagger-item {
    opacity: 0;
    animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.stagger-item:nth-child(1) { animation-delay: 0.1s; }
.stagger-item:nth-child(2) { animation-delay: 0.2s; }
.stagger-item:nth-child(3) { animation-delay: 0.3s; }
.stagger-item:nth-child(4) { animation-delay: 0.4s; }
.stagger-item:nth-child(5) { animation-delay: 0.5s; }
.stagger-item:nth-child(6) { animation-delay: 0.6s; }

/* ─────────────────────────────────────────────────────────── */
/* PARALLAX SCROLLING HELPERS */
/* ─────────────────────────────────────────────────────────── */

.parallax-layer {
    will-change: transform;
    transition: transform 0.1s linear;
}

.parallax-slow {
    transform: translateY(calc(var(--scroll-y, 0) * -0.3));
}

.parallax-medium {
    transform: translateY(calc(var(--scroll-y, 0) * -0.5));
}

.parallax-fast {
    transform: translateY(calc(var(--scroll-y, 0) * -0.8));
}

/* ─────────────────────────────────────────────────────────── */
/* REVEAL ON SCROLL (GSAP ScrollTrigger Classes) */
/* ─────────────────────────────────────────────────────────── */

.reveal {
    opacity: 0;
    transform: translateY(50px);
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

/* ─────────────────────────────────────────────────────────── */
/* TYPEWRITER EFFECT */
/* ─────────────────────────────────────────────────────────── */

@keyframes typewriter {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes blinkCursor {
    50% {
        border-color: transparent;
    }
}

.typewriter {
    overflow: hidden;
    border-right: 3px solid var(--primary);
    white-space: nowrap;
    animation: 
        typewriter 3s steps(40) 1s 1 normal both,
        blinkCursor 0.75s step-end infinite;
}

/* ─────────────────────────────────────────────────────────── */
/* SMOOTH SCROLL SNAP */
/* ─────────────────────────────────────────────────────────── */

.scroll-snap-container {
    scroll-snap-type: y mandatory;
    overflow-y: scroll;
    height: 100vh;
}

.scroll-snap-section {
    scroll-snap-align: start;
    min-height: 100vh;
}

/* ─────────────────────────────────────────────────────────── */
/* BUTTON RIPPLE EFFECT */
/* ─────────────────────────────────────────────────────────── */

@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 0.6;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    pointer-events: none;
}

.btn-ripple:active::after {
    animation: ripple 0.6s ease-out;
}

/* ─────────────────────────────────────────────────────────── */
/* MAGNETIC BUTTON EFFECT */
/* ─────────────────────────────────────────────────────────── */

.magnetic {
    transition: transform 0.2s ease-out;
}

/* Applied via JavaScript on mousemove */

/* ─────────────────────────────────────────────────────────── */
/* CARD TILT EFFECT */
/* ─────────────────────────────────────────────────────────── */

.card-tilt {
    transition: transform 0.3s ease;
    transform-style: preserve-3d;
}

.card-tilt:hover {
    transform: perspective(1000px) rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg)) scale(1.02);
}

/* ─────────────────────────────────────────────────────────── */
/* FLOATING ANIMATION */
/* ─────────────────────────────────────────────────────────── */

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
}

.floating {
    animation: float 6s ease-in-out infinite;
}

.floating-delayed {
    animation: float 8s ease-in-out infinite;
    animation-delay: 2s;
}

/* ─────────────────────────────────────────────────────────── */
/* PERFORMANCE OPTIMIZATIONS */
/* ─────────────────────────────────────────────────────────── */

/* GPU Acceleration */
.gpu-accelerated {
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
