/* ============================================ */
/* BUDA DIGITAL GROUP - ANIMACIONES */
/* ============================================ */

/* ============================================ */
/* ANIMACIONES AL SCROLL (Intersection Observer) */
/* ============================================ */

/* Estado inicial: invisible y desplazado */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

/* Estado visible: cuando entra en viewport */
.animate-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Delays progresivos para elementos múltiples */
.animate-on-scroll:nth-child(1) { transition-delay: 0ms; }
.animate-on-scroll:nth-child(2) { transition-delay: 100ms; }
.animate-on-scroll:nth-child(3) { transition-delay: 200ms; }
.animate-on-scroll:nth-child(4) { transition-delay: 300ms; }
.animate-on-scroll:nth-child(5) { transition-delay: 400ms; }
.animate-on-scroll:nth-child(6) { transition-delay: 500ms; }

/* ============================================ */
/* FADE IN ANIMATIONS */
/* ============================================ */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.fade-in {
    animation: fadeIn 1s ease forwards;
}

/* ============================================ */
/* SLIDE UP ANIMATION */
/* ============================================ */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-up {
    animation: slideUp 0.8s ease forwards;
}

/* ============================================ */
/* SLIDE IN FROM LEFT */
/* ============================================ */
@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.slide-in-left {
    animation: slideInLeft 0.8s ease forwards;
}

/* ============================================ */
/* SLIDE IN FROM RIGHT */
/* ============================================ */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.slide-in-right {
    animation: slideInRight 0.8s ease forwards;
}

/* ============================================ */
/* SCALE IN ANIMATION */
/* ============================================ */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.scale-in {
    animation: scaleIn 0.6s ease forwards;
}

/* ============================================ */
/* GLOW EFFECT (para textos destacados) */
/* ============================================ */
@keyframes glow {
    0%, 100% {
        text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
    }
    50% {
        text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
    }
}

.text-glow {
    animation: glow 3s ease-in-out infinite;
}

/* ============================================ */
/* FLOAT ANIMATION (para elementos flotantes) */
/* ============================================ */
@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.float {
    animation: float 3s ease-in-out infinite;
}

/* ============================================ */
/* PULSE ANIMATION */
/* ============================================ */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

.pulse {
    animation: pulse 2s ease-in-out infinite;
}

/* ============================================ */
/* SHIMMER EFFECT (para loading states) */
/* ============================================ */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.shimmer {
    background: linear-gradient(
        90deg,
        var(--color-background-card) 0%,
        var(--color-background-alt) 50%,
        var(--color-background-card) 100%
    );
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}

/* ============================================ */
/* GRADIENT TEXT ANIMATION */
/* ============================================ */
@keyframes gradientMove {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.gradient-animate {
    background: linear-gradient(
        90deg,
        #ffffff,
        #9ca3af,
        #ffffff,
        #9ca3af
    );
    background-size: 300% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientMove 4s ease infinite;
}

/* ============================================ */
/* BOUNCE ANIMATION (para CTAs) */
/* ============================================ */
@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

.bounce {
    animation: bounce 1s ease infinite;
}

/* ============================================ */
/* ROTATE ANIMATION */
/* ============================================ */
@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.rotate {
    animation: rotate 2s linear infinite;
}

/* ============================================ */
/* BLUR IN ANIMATION */
/* ============================================ */
@keyframes blurIn {
    from {
        opacity: 0;
        filter: blur(10px);
    }
    to {
        opacity: 1;
        filter: blur(0);
    }
}

.blur-in {
    animation: blurIn 1s ease forwards;
}

/* ============================================ */
/* SLIDE DOWN (para dropdowns) */
/* ============================================ */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-down {
    animation: slideDown 0.4s ease forwards;
}

/* ============================================ */
/* TYPEWRITER EFFECT */
/* ============================================ */
@keyframes typing {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes blink {
    50% {
        border-color: transparent;
    }
}

.typewriter {
    overflow: hidden;
    border-right: 2px solid var(--color-primary);
    white-space: nowrap;
    animation: 
        typing 3s steps(40) forwards,
        blink 0.75s step-end infinite;
}

/* ============================================ */
/* PARALLAX EFFECT (se aplica con JS) */
/* ============================================ */
.parallax {
    transition: transform 0.1s ease-out;
}

/* ============================================ */
/* HOVER EFFECTS */
/* ============================================ */

/* Hover Lift */
.hover-lift {
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

/* Hover Grow */
.hover-grow {
    transition: transform var(--transition-base);
}

.hover-grow:hover {
    transform: scale(1.05);
}

/* Hover Glow */
.hover-glow {
    transition: box-shadow var(--transition-base);
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
}

/* ============================================ */
/* STAGGER ANIMATION (para listas) */
/* ============================================ */
.stagger-item {
    opacity: 0;
    animation: slideUp 0.6s ease 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; }
.stagger-item:nth-child(7) { animation-delay: 0.7s; }
.stagger-item:nth-child(8) { animation-delay: 0.8s; }

/* ============================================ */
/* LOADING ANIMATIONS */
/* ============================================ */
@keyframes dotPulse {
    0%, 80%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }
    40% {
        opacity: 1;
        transform: scale(1.3);
    }
}

.dot-pulse {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-primary);
    animation: dotPulse 1.4s ease-in-out infinite;
}

.dot-pulse:nth-child(2) {
    animation-delay: 0.2s;
}

.dot-pulse:nth-child(3) {
    animation-delay: 0.4s;
}

/* ============================================ */
/* REVEAL ANIMATIONS (para imágenes) */
/* ============================================ */
@keyframes revealImage {
    0% {
        clip-path: inset(0 100% 0 0);
    }
    100% {
        clip-path: inset(0 0 0 0);
    }
}

.reveal-image {
    animation: revealImage 1.2s ease forwards;
}

/* ============================================ */
/* GLITCH EFFECT (opcional, efecto cinematográfico) */
/* ============================================ */
@keyframes glitch {
    0% {
        text-shadow: 2px 2px 0 rgba(255,255,255,0.1);
    }
    25% {
        text-shadow: -2px -2px 0 rgba(255,255,255,0.1);
    }
    50% {
        text-shadow: 2px -2px 0 rgba(255,255,255,0.1);
    }
    75% {
        text-shadow: -2px 2px 0 rgba(255,255,255,0.1);
    }
    100% {
        text-shadow: 2px 2px 0 rgba(255,255,255,0.1);
    }
}

.glitch {
    animation: glitch 0.3s ease infinite;
}

/* ============================================ */
/* REDUCE MOTION (Accesibilidad) */
/* ============================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .animate-on-scroll {
        opacity: 1;
        transform: none;
    }
}

/* ============================================ */
/* PERFORMANCE OPTIMIZATION */
/* ============================================ */
.will-animate {
    will-change: transform, opacity;
}

/* Desactivar will-change después de la animación para mejor performance */
.animation-end {
    will-change: auto;
}
