/* ==========================================================================
   PERSINOVAA - ANIMATIONS.CSS
   Animaciones globales, keyframes y utilidades para Intersection Observer
   Agencia: Web Total México
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. TRANSICIONES BASE
   -------------------------------------------------------------------------- */
   :root {
    --transition-fast: 0.2s ease-in-out;
    --transition-normal: 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --transition-slow: 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --transition-bounce: 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Aplicar transiciones suaves a todos los elementos interactivos */
a, button, input, select, textarea, .card-image-wrapper img {
    transition: all var(--transition-normal);
}

/* --------------------------------------------------------------------------
   2. CLASES PARA INTERSECTION OBSERVER (Animaciones al hacer scroll)
   -------------------------------------------------------------------------- */

/* Estado inicial (oculto) */
.animate-on-scroll {
    opacity: 0;
    will-change: opacity, transform; /* Optimización de hardware */
}

/* Variantes de animación de entrada */

/* Fade In Simple */
.fade-in {
    transform: translateY(0);
}
.fade-in.is-visible {
    animation: fadeIn var(--transition-slow) forwards;
}

/* Deslizar hacia arriba */
.slide-up {
    transform: translateY(40px);
}
.slide-up.is-visible {
    animation: slideUp var(--transition-slow) forwards;
}

/* Deslizar desde la izquierda (Ideal para imágenes o texto izquierdo) */
.slide-left {
    transform: translateX(-50px);
}
.slide-left.is-visible {
    animation: slideLeft var(--transition-slow) forwards;
}

/* Deslizar desde la derecha (Ideal para formularios, incita a la acción) */
.slide-right {
    transform: translateX(50px);
}
.slide-right.is-visible {
    animation: slideRight var(--transition-slow) forwards;
}

/* Pop In (Efecto de rebote ligero, excelente para tarjetas de producto) */
.pop-in {
    transform: scale(0.9);
}
.pop-in.is-visible {
    animation: popIn var(--transition-bounce) forwards;
}

/* Zoom In (Para secciones de alto impacto como el video) */
.zoom-in {
    transform: scale(0.95);
}
.zoom-in.is-visible {
    animation: zoomIn var(--transition-slow) forwards;
}

/* --------------------------------------------------------------------------
   3. RETARDOS EN CASCADA (Staggering)
   Estrategia visual para leer de izquierda a derecha o en orden de importancia
   -------------------------------------------------------------------------- */
.delay-1 { animation-delay: 0.15s; }
.delay-2 { animation-delay: 0.30s; }
.delay-3 { animation-delay: 0.45s; }
.delay-4 { animation-delay: 0.60s; }

/* --------------------------------------------------------------------------
   4. ANIMACIONES CONTINUAS (Atención y Marketing)
   -------------------------------------------------------------------------- */

/* Animación inicial del Hero (Carga sin esperar al scroll) */
.animate-fade-in-up {
    animation: slideUp 1s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* Bounce para el indicador de scroll del Hero */
.animate-bounce {
    animation: bounce 2s infinite;
}

/* Pulse Animation (Exclusivo para CTA principales y WhatsApp) */
.pulse-animation {
    animation: pulseGlow 2s infinite;
}

/* --------------------------------------------------------------------------
   5. HOVER EFFECTS (Microinteracciones)
   -------------------------------------------------------------------------- */

/* Escala sutil para botones */
.btn-hover-scale:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

/* Botón con resplandor (Glow) */
.btn-glow {
    position: relative;
    z-index: 1;
}
.btn-glow::after {
    content: '';
    position: absolute;
    top: -2px; left: -2px; right: -2px; bottom: -2px;
    background: inherit;
    z-index: -1;
    filter: blur(10px);
    opacity: 0;
    transition: opacity var(--transition-normal);
    border-radius: inherit;
}
.btn-glow:hover::after {
    opacity: 0.6;
}

/* Efecto de elevación para tarjetas (Categorías, Proyectos) */
.shadow-hover {
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}
.shadow-hover:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
}

/* --------------------------------------------------------------------------
   6. KEYFRAMES
   -------------------------------------------------------------------------- */

@keyframes fadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

@keyframes slideUp {
    0% {
        opacity: 0;
        transform: translateY(40px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideLeft {
    0% {
        opacity: 0;
        transform: translateX(-50px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideRight {
    0% {
        opacity: 0;
        transform: translateX(50px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes popIn {
    0% {
        opacity: 0;
        transform: scale(0.9);
    }
    70% {
        transform: scale(1.03);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes zoomIn {
    0% {
        opacity: 0;
        transform: scale(0.95);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-15px);
    }
    60% {
        transform: translateY(-7px);
    }
}

/* Genera ondas concéntricas para llamar la atención (WhatsApp) */
@keyframes pulseGlow {
    0% {
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.7); /* Verde WhatsApp */
    }
    70% {
        box-shadow: 0 0 0 15px rgba(37, 211, 102, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0);
    }
}

/* Animación para el banner superior (anuncio) */
@keyframes slideDownBanner {
    0% {
        transform: translateY(-100%);
    }
    100% {
        transform: translateY(0);
    }
}

/* Animación de carga para botones */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --------------------------------------------------------------------------
   7. PREFERENCIAS DEL USUARIO (Accesibilidad)
   -------------------------------------------------------------------------- */
/* Respeta si el usuario tiene desactivadas las animaciones en su sistema operativo */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .animate-on-scroll {
        opacity: 1 !important;
        transform: none !important;
    }
}