/* ===== Site animations ===== */
/* Use .animate-on-load for elements that animate on page load (with optional .delay-1 to .delay-5) */
/* Use .animate-on-scroll for elements that animate when they enter the viewport (requires animations.js) */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.92);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

@keyframes pulseSoft {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.85; }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes gradientShift {
    0% { filter: hue-rotate(0deg); }
    100% { filter: hue-rotate(10deg); }
}

/* ---- Animate on load (run once when page loads) ---- */
.animate-on-load {
    opacity: 0;
    animation-fill-mode: forwards;
}

.animate-on-load.anim-fade-in {
    animation: fadeIn 0.6s ease forwards;
}

.animate-on-load.anim-fade-in-up {
    animation: fadeInUp 0.9s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.animate-on-load.anim-fade-in-down {
    animation: fadeInDown 0.6s ease forwards;
}

.animate-on-load.anim-slide-in-left {
    animation: slideInLeft 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.animate-on-load.anim-slide-in-right {
    animation: slideInRight 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.animate-on-load.anim-scale-in {
    animation: scaleIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.animate-on-load.delay-1 { animation-delay: 0.1s; }
.animate-on-load.delay-2 { animation-delay: 0.2s; }
.animate-on-load.delay-3 { animation-delay: 0.35s; }
.animate-on-load.delay-4 { animation-delay: 0.5s; }
.animate-on-load.delay-5 { animation-delay: 0.65s; }
.animate-on-load.delay-6 { animation-delay: 0.8s; }

/* Stagger children: add .stagger-children to parent, each child gets incremental delay */
.stagger-children > * {
    opacity: 0;
    animation: fadeInUp 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.stagger-children > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.15s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.25s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.35s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.45s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.55s; }
.stagger-children > *:nth-child(7) { animation-delay: 0.65s; }
.stagger-children > *:nth-child(8) { animation-delay: 0.75s; }

/* ---- Animate on scroll (initial state; .in-view added by JS) ---- */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(60px);
    transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.animate-on-scroll.in-view {
    opacity: 1;
    transform: translateY(0);
}

.animate-on-scroll.anim-scale-in {
    transform: translateY(40px) scale(0.94);
}
.animate-on-scroll.anim-scale-in.in-view {
    transform: translateY(0) scale(1);
}

/* Stagger scroll children */
.stagger-scroll > * {
    opacity: 0;
    transform: translateY(48px) scale(0.96);
    transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.stagger-scroll.in-view > *:nth-child(1) { transition-delay: 0s; }
.stagger-scroll.in-view > *:nth-child(2) { transition-delay: 0.1s; }
.stagger-scroll.in-view > *:nth-child(3) { transition-delay: 0.2s; }
.stagger-scroll.in-view > *:nth-child(4) { transition-delay: 0.3s; }
.stagger-scroll.in-view > *:nth-child(5) { transition-delay: 0.4s; }
.stagger-scroll.in-view > *:nth-child(6) { transition-delay: 0.5s; }
.stagger-scroll.in-view > *:nth-child(7) { transition-delay: 0.6s; }
.stagger-scroll.in-view > *:nth-child(8) { transition-delay: 0.7s; }
.stagger-scroll.in-view > * {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* ---- Subtle continuous animations ---- */
.anim-float {
    animation: float 4s ease-in-out infinite;
}

.anim-pulse-soft {
    animation: pulseSoft 2.5s ease-in-out infinite;
}

/* ---- Same hover animation for all buttons and cards (lift + orange glow) ---- */
.card-hover,
.btn-primary,
button.btn-primary,
a.btn-primary {
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 0.35s ease,
                border-color 0.35s ease,
                background 0.35s ease !important;
}

.card-hover:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 16px 48px rgba(210, 105, 30, 0.35),
                0 8px 24px rgba(205, 127, 50, 0.25);
    border-color: rgba(210, 105, 30, 0.4);
}

/* Force button hover so it's not overridden by * or other rules */
.btn-primary:hover,
button.btn-primary:hover,
a.btn-primary:hover {
    transform: translateY(-6px) !important;
    box-shadow: 0 12px 36px rgba(210, 105, 30, 0.5),
                0 6px 20px rgba(205, 127, 50, 0.35) !important;
}

/* Stop float on hover so button hover animation shows; keep visible (animate-on-load uses opacity: 0) */
.btn-primary.anim-float:hover,
a.btn-primary.anim-float:hover {
    animation: none;
    opacity: 1;
}

/* Nav and footer link hover – slight lift */
a.link-hover,
a.footer-link {
    transition: color 0.25s ease, transform 0.25s ease, opacity 0.25s ease;
}
a.link-hover:hover,
a.footer-link:hover {
    transform: translateY(-2px);
}

/* Gradient text subtle animation (optional) */
.gradient-text-animate {
    background-size: 200% auto;
    animation: shimmer 4s linear infinite;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    .animate-on-load,
    .animate-on-scroll,
    .stagger-children > *,
    .stagger-scroll > * {
        animation: none !important;
        transition: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
    .anim-float,
    .anim-pulse-soft,
    .gradient-text-animate {
        animation: none !important;
    }
}
