/* ==========================================================================
   Animations — Scroll Animations, Transitions, Stagger Effects
   ========================================================================== */

/* ── Scroll-triggered Animations ── */
.animate-in {
    opacity: 0;
    transform: translateY(24px);
    transition:
        opacity var(--transition-slow),
        transform var(--transition-slow);
}

.animate-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger delay for grid children */
.animate-in[data-delay="1"] { transition-delay: 80ms; }
.animate-in[data-delay="2"] { transition-delay: 160ms; }
.animate-in[data-delay="3"] { transition-delay: 240ms; }
.animate-in[data-delay="4"] { transition-delay: 320ms; }
.animate-in[data-delay="5"] { transition-delay: 400ms; }
.animate-in[data-delay="6"] { transition-delay: 480ms; }

/* ── Fade In Variants ── */
.animate-fade-in-up {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 600ms ease, transform 600ms ease;
}

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

.animate-fade-in-right {
    opacity: 0;
    transform: translateX(-30px);
    transition: opacity 600ms ease, transform 600ms ease;
}

html[dir="rtl"] .animate-fade-in-right {
    transform: translateX(30px);
}

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

.animate-fade-in-left {
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 600ms ease, transform 600ms ease;
}

html[dir="rtl"] .animate-fade-in-left {
    transform: translateX(-30px);
}

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

/* ── Scale In ── */
.animate-scale-in {
    opacity: 0;
    transform: scale(0.9);
    transition: opacity var(--transition-slow), transform var(--transition-slow);
}

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

/* ── Counter Animation ── */
@keyframes countUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.counter-animate {
    animation: countUp 600ms ease-out forwards;
}

/* ── Pulse Glow ── */
@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 10px rgba(47, 183, 106, 0.1);
    }
    50% {
        box-shadow: 0 0 25px rgba(47, 183, 106, 0.25);
    }
}

.pulse-glow {
    animation: pulseGlow 3s ease-in-out infinite;
}

/* ── Floating Animation ── */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-8px); }
}

.float-animation {
    animation: float 4s ease-in-out infinite;
}

/* ── Line Draw Animation ── */
@keyframes lineGrow {
    from { width: 0; }
    to   { width: 48px; }
}

.animate-in.visible .divider-accent {
    animation: lineGrow 600ms ease-out forwards;
    animation-delay: 200ms;
}

/* ── Spinner ── */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(47, 183, 106, 0.2);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: spin 600ms linear infinite;
}

/* ── Reduce Motion Preference ── */
@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-in,
    .animate-fade-in-up,
    .animate-fade-in-right,
    .animate-fade-in-left,
    .animate-scale-in {
        opacity: 1;
        transform: none;
    }
}
@media (max-width: 768px) {
    .animate-in,
    .animate-fade-in-up,
    .animate-fade-in-right,
    .animate-fade-in-left,
    .animate-scale-in {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
}
