/* ============================================
   Animation System
   ============================================ */

/* --- Scroll-triggered base --- */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Direction variants */
.animate-from-left {
    opacity: 0;
    transform: translateX(-40px);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.animate-from-right {
    opacity: 0;
    transform: translateX(40px);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.animate-from-left.visible,
.animate-from-right.visible {
    opacity: 1;
    transform: translateX(0);
}

/* Scale variant */
.animate-scale {
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* --- Stagger children --- */
.stagger-children > *:nth-child(1) { transition-delay: 0s; }
.stagger-children > *:nth-child(2) { transition-delay: 0.08s; }
.stagger-children > *:nth-child(3) { transition-delay: 0.16s; }
.stagger-children > *:nth-child(4) { transition-delay: 0.24s; }
.stagger-children > *:nth-child(5) { transition-delay: 0.32s; }
.stagger-children > *:nth-child(6) { transition-delay: 0.4s; }
.stagger-children > *:nth-child(7) { transition-delay: 0.48s; }
.stagger-children > *:nth-child(8) { transition-delay: 0.56s; }
.stagger-children > *:nth-child(9) { transition-delay: 0.64s; }
.stagger-children > *:nth-child(10) { transition-delay: 0.72s; }
.stagger-children > *:nth-child(11) { transition-delay: 0.8s; }
.stagger-children > *:nth-child(12) { transition-delay: 0.88s; }

/* --- Named Keyframes --- */

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes heroEntrance {
    0% { opacity: 0; transform: scale(0.85); }
    70% { opacity: 1; transform: scale(1.03); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes glowPulse {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.05); }
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes countPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Blah text drift animation */
@keyframes driftLeft {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(-8px); }
}

@keyframes driftRight {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(8px); }
}

/* Zzz bob */
@keyframes zzzFloat {
    0%, 100% { transform: translateY(0) rotate(-2deg); }
    33% { transform: translateY(-6px) rotate(0deg); }
    66% { transform: translateY(2px) rotate(-3deg); }
}

/* Badge slide badge pulse */
@keyframes badgePulse {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 0.5; }
}

/* Stats count-up finish pulse */
.stat-value.counted {
    animation: countPulse 0.4s ease-out;
}

/* Hero entrance sequence */
.hero-badge { animation: fadeInUp 0.6s 0.2s both; }
.hero-headline { animation: fadeInUp 0.8s 0.4s both; }
.hero-subtext { animation: fadeInUp 0.8s 0.6s both; }
.hero-ctas { animation: fadeInUp 0.8s 0.8s both; }
.hero-image-wrapper { animation: fadeInUp 1s 0.5s both; }

/* Diff illustration animations */
.diff-blah-row:nth-child(1) { animation: driftLeft 6s ease-in-out infinite; }
.diff-blah-row:nth-child(2) { animation: driftRight 7s ease-in-out infinite; }
.diff-blah-row:nth-child(3) { animation: driftLeft 5s ease-in-out infinite; }
.diff-blah-row:nth-child(4) { animation: driftRight 8s ease-in-out infinite; }
.diff-blah-row:nth-child(5) { animation: driftLeft 6.5s ease-in-out infinite; }

.diff-zzz { animation: zzzFloat 4s ease-in-out infinite; }
.diff-slide-badge { animation: badgePulse 3s ease-in-out infinite; }

/* Card glow on hover */
.service-card::before,
.industry-card::before,
.capability-tile::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    opacity: 0;
    background: radial-gradient(circle at 50% 0%, rgba(43, 136, 216, 0.08), transparent 70%);
    transition: opacity 0.4s;
    pointer-events: none;
}

.service-card,
.industry-card,
.capability-tile {
    position: relative;
    overflow: hidden;
}

.service-card:hover::before,
.industry-card:hover::before,
.capability-tile:hover::before {
    opacity: 1;
}

/* CX-Builder cards teal glow */
.cxbuilder-card {
    position: relative;
    overflow: hidden;
}

.cxbuilder-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    opacity: 0;
    background: radial-gradient(circle at 50% 0%, rgba(93, 196, 186, 0.08), transparent 70%);
    transition: opacity 0.4s;
    pointer-events: none;
}

.cxbuilder-card:hover::before {
    opacity: 1;
}
