/* Advanced Animations CSS */

/* Keyframe Animations */
@keyframes heroEntrance {
    0% {
        opacity: 0;
        transform: translateY(100px) scale(0.8);
    }
    50% {
        opacity: 0.5;
        transform: translateY(50px) scale(0.9);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes textReveal {
    0% {
        opacity: 0;
        transform: translateY(30px);
        letter-spacing: 0.5em;
    }
    50% {
        opacity: 0.7;
        letter-spacing: 0.2em;
    }
    100% {
        opacity: 1;
        transform: translateY(0);
        letter-spacing: normal;
    }
}

@keyframes glowPulse {
    0%, 100% {
        text-shadow: 0 0 10px rgba(212, 175, 55, 0.5),
                     0 0 20px rgba(212, 175, 55, 0.3),
                     0 0 30px rgba(212, 175, 55, 0.1);
    }
    50% {
        text-shadow: 0 0 20px rgba(212, 175, 55, 0.8),
                     0 0 40px rgba(212, 175, 55, 0.6),
                     0 0 60px rgba(212, 175, 55, 0.3);
    }
}

@keyframes slideInFromLeft {
    0% {
        opacity: 0;
        transform: translateX(-100px) rotateY(-30deg);
    }
    50% {
        opacity: 0.7;
        transform: translateX(-20px) rotateY(-10deg);
    }
    100% {
        opacity: 1;
        transform: translateX(0) rotateY(0deg);
    }
}

@keyframes slideInFromRight {
    0% {
        opacity: 0;
        transform: translateX(100px) rotateY(30deg);
    }
    50% {
        opacity: 0.7;
        transform: translateX(20px) rotateY(10deg);
    }
    100% {
        opacity: 1;
        transform: translateX(0) rotateY(0deg);
    }
}

@keyframes scaleInBounce {
    0% {
        opacity: 0;
        transform: scale(0.3) rotateZ(-10deg);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.1) rotateZ(5deg);
    }
    70% {
        transform: scale(0.95) rotateZ(-2deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotateZ(0deg);
    }
}

@keyframes cardHover3D {
    0% {
        transform: perspective(1000px) rotateX(0deg) rotateY(0deg) translateZ(0px);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    }
    100% {
        transform: perspective(1000px) rotateX(-5deg) rotateY(5deg) translateZ(20px);
        box-shadow: 0 30px 80px rgba(212, 175, 55, 0.3);
    }
}

@keyframes magicShimmer {
    0% {
        background-position: -200% center;
    }
    100% {
        background-position: 200% center;
    }
}

@keyframes orbitalMotion {
    0% {
        transform: rotate(0deg) translateX(100px) rotate(0deg);
    }
    100% {
        transform: rotate(360deg) translateX(100px) rotate(-360deg);
    }
}

@keyframes typingEffect {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes blinkCursor {
    0%, 50% {
        border-color: var(--primary-color);
    }
    51%, 100% {
        border-color: transparent;
    }
}

@keyframes morphing {
    0%, 100% {
        border-radius: 50% 20% 30% 40%;
        transform: rotate(0deg) scale(1);
    }
    25% {
        border-radius: 30% 50% 20% 40%;
        transform: rotate(90deg) scale(1.1);
    }
    50% {
        border-radius: 40% 30% 50% 20%;
        transform: rotate(180deg) scale(0.9);
    }
    75% {
        border-radius: 20% 40% 30% 50%;
        transform: rotate(270deg) scale(1.05);
    }
}

@keyframes waveAnimation {
    0%, 100% {
        clip-path: polygon(0% 47%, 10% 48%, 33% 54%, 54% 60%, 70% 61%, 84% 59%, 100% 52%, 100% 100%, 0% 100%);
    }
    50% {
        clip-path: polygon(0% 60%, 15% 65%, 34% 66%, 51% 62%, 67% 50%, 84% 45%, 100% 46%, 100% 100%, 0% 100%);
    }
}

@keyframes matrixRain {
    0% {
        transform: translateY(-100vh);
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(100vh);
        opacity: 0;
    }
}

/* Animation Classes */
.animate-hero-entrance {
    animation: heroEntrance 2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-text-reveal {
    animation: textReveal 1.5s ease forwards;
}

.animate-glow {
    animation: glowPulse 3s ease-in-out infinite;
}

.animate-slide-left {
    animation: slideInFromLeft 1s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-slide-right {
    animation: slideInFromRight 1s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-scale-bounce {
    animation: scaleInBounce 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

.animate-card-hover {
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.animate-card-hover:hover {
    animation: cardHover3D 0.6s ease forwards;
}

.animate-shimmer {
    background: linear-gradient(
        90deg,
        rgba(212, 175, 55, 0.1) 0%,
        rgba(212, 175, 55, 0.3) 50%,
        rgba(212, 175, 55, 0.1) 100%
    );
    background-size: 200% 100%;
    animation: magicShimmer 2s linear infinite;
}

.animate-orbital {
    animation: orbitalMotion 20s linear infinite;
}

.animate-typing {
    overflow: hidden;
    border-right: 2px solid var(--primary-color);
    white-space: nowrap;
    animation: typingEffect 3s steps(40, end), blinkCursor 0.75s step-end infinite;
}

.animate-morph {
    animation: morphing 8s ease-in-out infinite;
}

.animate-wave {
    animation: waveAnimation 4s ease-in-out infinite;
}

/* Intersection Observer Animations */
.fade-in-up {
    opacity: 0;
    transform: translateY(50px);
    transition: all 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.fade-in-up.visible {
    opacity: 1;
    transform: translateY(0);
}

.fade-in-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: all 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.fade-in-left.visible {
    opacity: 1;
    transform: translateX(0);
}

.fade-in-right {
    opacity: 0;
    transform: translateX(50px);
    transition: all 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.fade-in-right.visible {
    opacity: 1;
    transform: translateX(0);
}

.scale-in {
    opacity: 0;
    transform: scale(0.8);
    transition: all 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.scale-in.visible {
    opacity: 1;
    transform: scale(1);
}

.rotate-in {
    opacity: 0;
    transform: rotateY(-90deg);
    transition: all 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.rotate-in.visible {
    opacity: 1;
    transform: rotateY(0deg);
}

/* Stagger Animation */
.stagger-item {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.stagger-item.visible {
    opacity: 1;
    transform: translateY(0);
}

.stagger-item:nth-child(1) { transition-delay: 0.1s; }
.stagger-item:nth-child(2) { transition-delay: 0.2s; }
.stagger-item:nth-child(3) { transition-delay: 0.3s; }
.stagger-item:nth-child(4) { transition-delay: 0.4s; }
.stagger-item:nth-child(5) { transition-delay: 0.5s; }
.stagger-item:nth-child(6) { transition-delay: 0.6s; }

/* Loading Animations */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(212, 175, 55, 0.3);
    border-left: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-dots {
    display: inline-flex;
    gap: 4px;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    background: var(--primary-color);
    border-radius: 50%;
    animation: bounce-dots 1.4s ease-in-out infinite both;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }
.loading-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes bounce-dots {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* Parallax Effects */
.parallax-slow {
    transform: translateZ(0);
    will-change: transform;
}

.parallax-medium {
    transform: translateZ(0);
    will-change: transform;
}

.parallax-fast {
    transform: translateZ(0);
    will-change: transform;
}

/* Performance Optimizations */
.gpu-accelerated {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

.will-change-transform {
    will-change: transform;
}

.will-change-opacity {
    will-change: opacity;
}

.will-change-auto {
    will-change: auto;
}

/* Media Queries for Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .parallax-slow,
    .parallax-medium,
    .parallax-fast {
        transform: none !important;
    }
}
