/* ============================
   SCROLL ANIMATION SYSTEM
   Intersection Observer-based
   ============================ */

/* Animation Base Classes */
.animate {
    --animation-duration: 0.6s;
    --animation-delay: 0s;
    transition: opacity var(--animation-duration) ease,
        transform var(--animation-duration) cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transition-delay: var(--animation-delay);
}

/* Initial States (Hidden) */
.animate-fade-in {
    opacity: 0;
}

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

.animate-fade-in-down {
    opacity: 0;
    transform: translateY(-30px);
}

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

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

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

.animate-rotate-in {
    opacity: 0;
    transform: rotate(-5deg) scale(0.95);
}

/* Active State - When in view */
.animate-fade-in.in-view,
.animate-fade-in-up.in-view,
.animate-fade-in-down.in-view,
.animate-slide-in-left.in-view,
.animate-slide-in-right.in-view,
.animate-scale-up.in-view,
.animate-rotate-in.in-view {
    opacity: 1;
    transform: translateY(0) translateX(0) scale(1) rotate(0);
}

/* ============================
   STAGGER DELAYS
   For sequential card animations
   ============================ */
.animate-stagger:nth-child(1) {
    --animation-delay: 0.05s;
}

.animate-stagger:nth-child(2) {
    --animation-delay: 0.1s;
}

.animate-stagger:nth-child(3) {
    --animation-delay: 0.15s;
}

.animate-stagger:nth-child(4) {
    --animation-delay: 0.2s;
}

.animate-stagger:nth-child(5) {
    --animation-delay: 0.25s;
}

.animate-stagger:nth-child(6) {
    --animation-delay: 0.3s;
}

.animate-stagger:nth-child(7) {
    --animation-delay: 0.35s;
}

.animate-stagger:nth-child(8) {
    --animation-delay: 0.4s;
}

/* ============================
   LOADING STATES
   ============================ */
.loading-skeleton {
    background: linear-gradient(90deg,
            hsla(145, 20%, 12%, 0.5) 0%,
            hsla(145, 30%, 18%, 0.8) 50%,
            hsla(145, 20%, 12%, 0.5) 100%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

@keyframes skeleton-shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* ============================
   PULSE ANIMATIONS
   For CTAs and important elements
   ============================ */
@keyframes pulse-glow {

    0%,
    100% {
        box-shadow: 0 0 20px hsla(var(--primary-hue), 85%, 50%, 0.3);
    }

    50% {
        box-shadow: 0 0 40px hsla(var(--primary-hue), 85%, 50%, 0.6);
    }
}

.animate-pulse-glow {
    animation: pulse-glow 2s ease-in-out infinite;
}

/* ============================
   HOVER LIFT
   Micro-interaction for cards
   ============================ */
.hover-lift {
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94),
        box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4),
        0 0 30px hsla(var(--primary-hue), 85%, 50%, 0.2);
}

/* ============================
   SCROLL PROGRESS INDICATOR
   ============================ */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: var(--gradient-primary);
    z-index: 9999;
    transition: width 0.1s linear;
}

/* ============================
   MOBILE OPTIMIZATIONS
   Faster animations on mobile
   ============================ */
@media (max-width: 767px) {
    .animate {
        --animation-duration: 0.4s;
    }

    .hover-lift:hover {
        transform: translateY(-3px);
    }
}

/* ============================
   ACCESSIBILITY: REDUCED MOTION
   Disable animations for users who prefer reduced motion
   ============================ */
@media (prefers-reduced-motion: reduce) {

    .animate,
    .animate-fade-in,
    .animate-fade-in-up,
    .animate-fade-in-down,
    .animate-slide-in-left,
    .animate-slide-in-right,
    .animate-scale-up,
    .animate-rotate-in,
    .hover-lift,
    .animate-pulse-glow,
    .loading-skeleton {
        animation: none !important;
        transition: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
}

/* ============================
   SPRING PHYSICS ANIMATIONS
   Overshoot for natural feel
   ============================ */

@keyframes spring-entrance {
    0% {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }

    60% {
        transform: translateY(-8px) scale(1.02);
        /* Overshoot */
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes spring-scale {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }

    60% {
        transform: scale(1.05);
        /* Overshoot */
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* CTA Enhanced Glow Pulse */
@keyframes enhanced-glow-pulse {

    0%,
    100% {
        box-shadow:
            0 0 20px hsla(var(--primary-hue), 85%, 50%, 0.3),
            0 4px 20px rgba(0, 0, 0, 0.3);
    }

    50% {
        box-shadow:
            0 0 40px hsla(var(--primary-hue), 85%, 50%, 0.5),
            0 0 60px hsla(var(--primary-hue), 85%, 50%, 0.2),
            0 8px 30px rgba(0, 0, 0, 0.4);
    }
}

.btn-primary:hover,
.btn-cta:hover {
    animation: enhanced-glow-pulse 1.5s ease-in-out infinite;
}

/* Card Spring Entrance */
.benefit-card,
.feature-card,
.differential-card,
.pricing-card {
    animation: spring-entrance 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}

/* Stagger with spring physics */
.benefit-card:nth-child(1) {
    animation-delay: 0.1s;
}

.benefit-card:nth-child(2) {
    animation-delay: 0.2s;
}

.benefit-card:nth-child(3) {
    animation-delay: 0.3s;
}

.feature-card:nth-child(1) {
    animation-delay: 0.05s;
}

.feature-card:nth-child(2) {
    animation-delay: 0.15s;
}

.feature-card:nth-child(3) {
    animation-delay: 0.25s;
}

.feature-card:nth-child(4) {
    animation-delay: 0.35s;
}

.feature-card:nth-child(5) {
    animation-delay: 0.45s;
}

.feature-card:nth-child(6) {
    animation-delay: 0.55s;
}

.differential-card:nth-child(1) {
    animation-delay: 0.1s;
}

.differential-card:nth-child(2) {
    animation-delay: 0.2s;
}

.differential-card:nth-child(3) {
    animation-delay: 0.3s;
}

.differential-card:nth-child(4) {
    animation-delay: 0.4s;
}

.differential-card:nth-child(5) {
    animation-delay: 0.5s;
}

.differential-card:nth-child(6) {
    animation-delay: 0.6s;
}