/* ==========================================================================
   ePOC Animations - Smooth, Professional Micro-interactions
   ========================================================================== */

/* ==========================================================================
   Scroll-triggered reveals
   --------------------------------------------------------------------------
   js/animations.js adds `.reveal-frame` to every element it will animate
   (individual blocks tagged .animate-fade-up/-left/-right, grid children,
   and whole <section>s) then adds `.triggered` once IntersectionObserver
   reports it has entered the viewport. Only `.reveal-frame` carries the
   hidden starting state, so if JS is ever blocked, content simply stays
   visible instead of being stuck invisible.
   ========================================================================== */
.reveal-frame {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1), transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: opacity, transform;
}

.reveal-frame.animate-fade-left {
    transform: translateX(30px);
}

.reveal-frame.animate-fade-right {
    transform: translateX(-30px);
}

.reveal-frame.triggered {
    opacity: 1;
    transform: translate(0, 0);
}

/* Whole-section arrivals as you scroll from one section to the next */
.reveal-frame.section-reveal {
    transform: translateY(36px);
    transition-duration: 0.9s;
}

@media (prefers-reduced-motion: reduce) {
    .reveal-frame {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
}

/* Stagger Animation for Grid Items (transition-delay is also set inline by
   animations.js for grids with more than 6 children) */
.stagger-animate > *:nth-child(1) { transition-delay: 0.08s; }
.stagger-animate > *:nth-child(2) { transition-delay: 0.16s; }
.stagger-animate > *:nth-child(3) { transition-delay: 0.24s; }
.stagger-animate > *:nth-child(4) { transition-delay: 0.32s; }
.stagger-animate > *:nth-child(5) { transition-delay: 0.4s; }
.stagger-animate > *:nth-child(6) { transition-delay: 0.48s; }

/* Delay Classes */
.delay-1 { transition-delay: 0.15s !important; }
.delay-2 { transition-delay: 0.3s !important; }
.delay-3 { transition-delay: 0.45s !important; }

/* Counter Animation Base */
.counter {
    display: inline-block;
}

/* Hover Lift Effect */
.hover-lift {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

/* Pulse Animation for Badges */
@keyframes badgePulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(98, 102, 254, 0.4);
    }
    50% {
        box-shadow: 0 0 0 15px rgba(98, 102, 254, 0);
    }
}

/* Gradient Flow Animation */
@keyframes gradientFlow {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Shimmer Effect for Loading States */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.shimmer {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.03) 25%,
        rgba(255, 255, 255, 0.08) 50%,
        rgba(255, 255, 255, 0.03) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

/* Scale In Animation */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.scale-in {
    animation: scaleIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Slide In from Bottom */
@keyframes slideInBottom {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-in-bottom {
    animation: slideInBottom 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Rotate In */
@keyframes rotateIn {
    from {
        opacity: 0;
        transform: rotate(-10deg) scale(0.9);
    }
    to {
        opacity: 1;
        transform: rotate(0) scale(1);
    }
}

.rotate-in {
    animation: rotateIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Bounce In */
@keyframes bounceIn {
    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: bounceIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

/* Glow Pulse */
@keyframes glowPulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(98, 102, 254, 0.3);
    }
    50% {
        box-shadow: 0 0 40px rgba(98, 102, 254, 0.6);
    }
}

.glow-pulse {
    animation: glowPulse 2s ease-in-out infinite;
}

/* Float Animation */
@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.float {
    animation: float 3s ease-in-out infinite;
}

/* Ripple Effect on Click */
@keyframes rippleEffect {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

.ripple-effect {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transform: scale(0);
    animation: rippleEffect 0.6s linear;
    pointer-events: none;
}

/* Skeleton Loading */
@keyframes skeleton-loading {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.skeleton {
    background: linear-gradient(
        90deg,
        var(--glass-bg) 25%,
        var(--glass-bg-hover) 50%,
        var(--glass-bg) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius-md);
}

/* Progress Bar Animation */
@keyframes progressFill {
    from {
        width: 0;
    }
}

.progress-fill {
    animation: progressFill 1s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Icon Spin */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.spin {
    animation: spin 1s linear infinite;
}

/* Typing Effect */
@keyframes typing {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes blink {
    50% {
        border-color: transparent;
    }
}

.typing-effect {
    overflow: hidden;
    white-space: nowrap;
    border-right: 2px solid var(--color-primary);
    animation: typing 3s steps(40, end), blink 0.75s step-end infinite;
}

/* Fade Out */
@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

.fade-out {
    animation: fadeOut 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Zoom In */
@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.zoom-in {
    animation: zoomIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Elastic Bounce */
@keyframes elasticBounce {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.1);
    }
    70% {
        transform: scale(0.95);
    }
    100% {
        transform: scale(1);
    }
}

.elastic-bounce {
    animation: elasticBounce 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

/* Reduce Motion for Accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
