/**
 * SISTEMA DE ANIMACIONES ELEGANTES
 * Animaciones suaves para mejorar la experiencia de usuario
 */

/* ============================================
   CONFIGURACIÓN BASE
   ============================================ */

/* Elementos que se van a animar comienzan ocultos */
.animate-fade,
.animate-slide-up,
.animate-slide-left,
.animate-slide-right,
.animate-scale,
.animate-zoom {
    opacity: 0;
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Cuando el elemento es visible, se anima */
.animate-fade.is-visible,
.animate-slide-up.is-visible,
.animate-slide-left.is-visible,
.animate-slide-right.is-visible,
.animate-scale.is-visible,
.animate-zoom.is-visible {
    opacity: 1;
}

/* ============================================
   FADE IN (Aparición gradual)
   ============================================ */

.animate-fade {
    opacity: 0;
}

.animate-fade.is-visible {
    opacity: 1;
}

/* ============================================
   SLIDE UP (Deslizar desde abajo)
   ============================================ */

.animate-slide-up {
    opacity: 0;
    transform: translateY(50px);
}

.animate-slide-up.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   SLIDE FROM SIDES (Deslizar desde los lados)
   ============================================ */

.animate-slide-left {
    opacity: 0;
    transform: translateX(-50px);
}

.animate-slide-left.is-visible {
    opacity: 1;
    transform: translateX(0);
}

.animate-slide-right {
    opacity: 0;
    transform: translateX(50px);
}

.animate-slide-right.is-visible {
    opacity: 1;
    transform: translateX(0);
}

/* ============================================
   SCALE UP (Escalar desde pequeño)
   ============================================ */

.animate-scale {
    opacity: 0;
    transform: scale(0.9);
}

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

/* ============================================
   ZOOM IN (Zoom con fade)
   ============================================ */

.animate-zoom {
    opacity: 0;
    transform: scale(0.95);
}

.animate-zoom.is-visible {
    opacity: 1;
    transform: scale(1);
}

/* ============================================
   STAGGER (Animaciones secuenciales)
   ============================================ */

/* Para elementos en lista que se animan uno tras otro */
.animate-stagger > * {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.animate-stagger.is-visible > *:nth-child(1) {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.1s;
}

.animate-stagger.is-visible > *:nth-child(2) {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.2s;
}

.animate-stagger.is-visible > *:nth-child(3) {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.3s;
}

.animate-stagger.is-visible > *:nth-child(4) {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.4s;
}

.animate-stagger.is-visible > *:nth-child(5) {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.5s;
}

.animate-stagger.is-visible > *:nth-child(6) {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.6s;
}

.animate-stagger.is-visible > *:nth-child(7) {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.7s;
}

.animate-stagger.is-visible > *:nth-child(8) {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.8s;
}

.animate-stagger.is-visible > *:nth-child(9) {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.9s;
}

.animate-stagger.is-visible > *:nth-child(n+10) {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 1s;
}

/* ============================================
   DURACIONES PERSONALIZADAS
   ============================================ */

.animate-fast {
    transition-duration: 0.4s !important;
}

.animate-normal {
    transition-duration: 0.8s !important;
}

.animate-slow {
    transition-duration: 1.2s !important;
}

/* ============================================
   DELAYS PERSONALIZADOS
   ============================================ */

.animate-delay-1 {
    transition-delay: 0.1s !important;
}

.animate-delay-2 {
    transition-delay: 0.2s !important;
}

.animate-delay-3 {
    transition-delay: 0.3s !important;
}

.animate-delay-4 {
    transition-delay: 0.4s !important;
}

.animate-delay-5 {
    transition-delay: 0.5s !important;
}

/* ============================================
   ANIMACIÓN DEL HEADER (Hero sections)
   ============================================ */

.hero-animate {
    opacity: 0;
    transform: translateY(30px);
    animation: heroFadeIn 1s cubic-bezier(0.4, 0, 0.2, 1) 0.2s forwards;
}

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

/* ============================================
   HOVER EFFECTS (Efectos al pasar el mouse)
   ============================================ */

.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.hover-scale {
    transition: transform 0.3s ease;
}

.hover-scale:hover {
    transform: scale(1.05);
}

.hover-fade {
    transition: opacity 0.3s ease;
}

.hover-fade:hover {
    opacity: 0.8;
}

/* ============================================
   ANIMACIONES PARA IMÁGENES
   ============================================ */

.image-reveal {
    overflow: hidden;
    position: relative;
}

.image-reveal img {
    transform: scale(1.1);
    transition: transform 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.image-reveal.is-visible img {
    transform: scale(1);
}

/* ============================================
   ANIMACIONES PARA TEXTO
   ============================================ */

.text-reveal {
    overflow: hidden;
    display: inline-block;
}

.text-reveal span {
    display: inline-block;
    opacity: 0;
    transform: translateY(100%);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.text-reveal.is-visible span {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   REDUCE MOTION (Accesibilidad)
   ============================================ */

/* Respetar preferencias de usuario que no quieren animaciones */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .animate-fade,
    .animate-slide-up,
    .animate-slide-left,
    .animate-slide-right,
    .animate-scale,
    .animate-zoom,
    .animate-stagger > * {
        opacity: 1 !important;
        transform: none !important;
    }
}

/* ============================================
   LOADING STATE (Estado de carga)
   ============================================ */

.page-transition {
    opacity: 0;
    animation: pageLoad 0.5s ease forwards;
}

@keyframes pageLoad {
    to {
        opacity: 1;
    }
}

/* ============================================
   UTILIDADES ESPECIALES
   ============================================ */

/* Animación de pulsación suave */
.pulse-soft {
    animation: pulseSoft 2s ease-in-out infinite;
}

@keyframes pulseSoft {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Animación de flotación */
.float {
    animation: float 3s ease-in-out infinite;
}

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

/* Underline animado para enlaces */
.link-underline {
    position: relative;
    text-decoration: none;
}

.link-underline::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: currentColor;
    transition: width 0.3s ease;
}

.link-underline:hover::after {
    width: 100%;
}

