/* Animations & Transitions */

/* Fade-in on scroll animation
   Se usa :not(.visible) en vez de un par .fade-in / .fade-in.visible porque
   animations.css carga después de components.css y ambos selectores pesan
   lo mismo (0,2,0): .fade-in.visible ganaba y dejaba clavado el transform,
   anulando el translateY de los :hover de las tarjetas. Así, en cuanto el
   elemento es visible la regla deja de aplicar y el transform vuelve a ser
   del componente. */
.fade-in {
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in:not(.visible) {
    opacity: 0;
    transform: translateY(30px);
}

/* Stagger delay for multiple elements */
.fade-in:nth-child(1) { transition-delay: 0ms; }
.fade-in:nth-child(2) { transition-delay: 100ms; }
.fade-in:nth-child(3) { transition-delay: 200ms; }
.fade-in:nth-child(4) { transition-delay: 300ms; }
.fade-in:nth-child(5) { transition-delay: 400ms; }
.fade-in:nth-child(6) { transition-delay: 500ms; }

/* Hover lift effect */
.hover-lift {
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

/* Pulse animation for accent elements */
@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;
}

/* Gradient animation for hero title */
@keyframes gradient-shift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.gradient-animate {
    background-size: 200% 200%;
    animation: gradient-shift 8s ease infinite;
}

/* Floating animation for decorative elements */
@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
}

.float {
    animation: float 6s ease-in-out infinite;
}

/* Shimmer effect for loading states */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.shimmer {
    background: linear-gradient(
        to right,
        var(--color-bg-elevated) 0%,
        var(--color-bg) 50%,
        var(--color-bg-elevated) 100%
    );
    background-size: 1000px 100%;
    animation: shimmer 2s infinite linear;
}

/* Smooth slide-in from left */
@keyframes slide-in-left {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.slide-in-left {
    animation: slide-in-left 0.6s ease-out;
}

/* Smooth slide-in from right */
@keyframes slide-in-right {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.slide-in-right {
    animation: slide-in-right 0.6s ease-out;
}

/* Scale-in animation */
@keyframes scale-in {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.scale-in {
    animation: scale-in 0.4s ease-out;
}

/* Bounce-in for interactive elements */
@keyframes bounce-in {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
    }
}

.bounce-in {
    animation: bounce-in 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Rotate-in animation */
@keyframes rotate-in {
    from {
        opacity: 0;
        transform: rotate(-10deg) scale(0.9);
    }
    to {
        opacity: 1;
        transform: rotate(0deg) scale(1);
    }
}

.rotate-in {
    animation: rotate-in 0.5s ease-out;
}

/* Glow pulse for accent elements */
@keyframes glow-pulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(var(--navy-200-rgb), 0.3);
    }
    50% {
        box-shadow: 0 0 40px rgba(var(--navy-200-rgb), 0.6);
    }
}

.glow-pulse {
    animation: glow-pulse 2s ease-in-out infinite;
}

/* Text reveal animation */
@keyframes text-reveal {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.text-reveal {
    animation: text-reveal 0.8s ease-out;
}

/* Loading spinner */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.spinner {
    animation: spin 1s linear infinite;
}

/* Page load animations */
.page-load {
    animation: fade-in 0.6s ease-out;
}

@keyframes fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Hover glow effect */
.hover-glow {
    position: relative;
    transition: all var(--transition-base);
}

.hover-glow::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: linear-gradient(45deg, var(--color-accent), var(--color-accent-light));
    border-radius: inherit;
    opacity: 0;
    z-index: -1;
    transition: opacity var(--transition-base);
    filter: blur(10px);
}

.hover-glow:hover::before {
    opacity: 0.6;
}

/* Accessibility: Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .fade-in,
    .fade-in:not(.visible) {
        opacity: 1;
        transform: none;
    }
    
    .float,
    .pulse,
    .gradient-animate,
    .glow-pulse {
        animation: none;
    }
}

/* Page transitions */
body {
    animation: fade-in 0.4s ease-out;
}

/* Stagger animations for lists */
.stagger-item {
    opacity: 0;
    animation: fade-in 0.5s ease-out 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; }
