/* ==========================================================================
   AI Animations - Keyframes, reveal effects, micro-interactions
   ========================================================================== */

/* --- Scroll Reveal Base --- */
.ai-reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s var(--ease-out-expo), transform 0.8s var(--ease-out-expo);
}
.ai-reveal.visible {
    opacity: 1;
    transform: translateY(0);
}
.ai-reveal--delay-1 { transition-delay: 0.1s; }
.ai-reveal--delay-2 { transition-delay: 0.2s; }
.ai-reveal--delay-3 { transition-delay: 0.3s; }
.ai-reveal--delay-4 { transition-delay: 0.4s; }
.ai-reveal--delay-5 { transition-delay: 0.5s; }

/* --- Hero typing cursor --- */
.ai-cursor {
    display: inline-block;
    width: 3px;
    height: 0.9em;
    background: var(--accent-primary);
    margin-left: 4px;
    vertical-align: text-bottom;
    animation: ai-blink 1s step-end infinite;
}

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

/* --- Status dot pulse --- */
.ai-hero__status-dot {
    animation: ai-pulse-dot 2s ease-in-out infinite;
}
@keyframes ai-pulse-dot {
    0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
}

/* --- Orbit rotation --- */
.ai-orbit-ring--1 { animation: ai-orbit-spin 30s linear infinite; }
.ai-orbit-ring--2 { animation: ai-orbit-spin 50s linear infinite reverse; }
.ai-orbit-ring--3 { animation: ai-orbit-spin 70s linear infinite; }

@keyframes ai-orbit-spin {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* --- Orbit center glow pulse --- */
.ai-orbit-center {
    animation: ai-core-pulse 4s ease-in-out infinite;
}
@keyframes ai-core-pulse {
    0%, 100% { box-shadow: 0 0 40px rgba(0,212,255,0.3), 0 0 80px rgba(0,212,255,0.1); }
    50% { box-shadow: 0 0 60px rgba(0,212,255,0.5), 0 0 120px rgba(0,212,255,0.15); }
}

/* --- Float animation for orbit nodes --- */
.ai-orbit-node { animation: ai-float 6s ease-in-out infinite; }
.ai-orbit-node:nth-child(2) { animation-delay: -1s; }
.ai-orbit-node:nth-child(3) { animation-delay: -2s; }
.ai-orbit-node:nth-child(4) { animation-delay: -3s; }
.ai-orbit-node:nth-child(5) { animation-delay: -4s; }
.ai-orbit-node:nth-child(6) { animation-delay: -5s; }

@keyframes ai-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

/* --- Card entrance stagger --- */
.ai-mission-card.ai-reveal { transform: translateY(60px) scale(0.97); }
.ai-mission-card.ai-reveal.visible { transform: translateY(0) scale(1); }

.ai-pillar.ai-reveal { transform: translateY(40px) scale(0.95); }
.ai-pillar.ai-reveal.visible { transform: translateY(0) scale(1); }

/* --- Gradient line animation (used on section headers) --- */
.ai-divider {
    position: relative;
    overflow: hidden;
}
.ai-divider::after {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: ai-shimmer 3s ease-in-out infinite;
}
@keyframes ai-shimmer {
    0% { left: -100%; }
    100% { left: 200%; }
}

/* --- Metric counter glow --- */
.ai-hero__metric-value {
    text-shadow: 0 0 30px rgba(0, 212, 255, 0.1);
}

/* --- Smooth section transitions --- */
.ai-section {
    transition: opacity 0.6s ease;
}

/* --- Link hover underline animation --- */
.ai-contact__value a::after {
    content: '';
    position: absolute;
    bottom: -2px; left: 0;
    width: 0; height: 1px;
    background: var(--accent-primary);
    transition: width var(--transition-fast);
}
.ai-contact__value a:hover::after { width: 100%; }
.ai-contact__value a { position: relative; }

/* --- Loading screen --- */
.ai-loader {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: var(--bg-void);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}
.ai-loader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
.ai-loader__bar {
    width: 120px; height: 2px;
    background: var(--bg-card);
    border-radius: 2px;
    overflow: hidden;
}
.ai-loader__progress {
    width: 0;
    height: 100%;
    background: var(--gradient-accent);
    border-radius: 2px;
    animation: ai-load 1.5s var(--ease-out-expo) forwards;
}
@keyframes ai-load {
    0% { width: 0; }
    100% { width: 100%; }
}

/* --- Mobile: reduce heavy animations for scroll performance --- */
@media (max-width: 768px) {
    /* Slow down orbit rotations and simplify */
    .ai-orbit-ring--1,
    .ai-orbit-ring--2,
    .ai-orbit-ring--3 {
        animation-duration: 60s;
    }
    /* Remove box-shadow pulse (paint-heavy) */
    .ai-orbit-center {
        /* animation: none; */
        box-shadow: 0 0 40px rgba(0,212,255,0.3);
    }
    /* Remove float animation on orbit nodes */
    /* .ai-orbit-node { animation: none; } */
    /* Simplify card transitions */
    .ai-mission-card,
    .ai-pillar,
    .ai-venture-card,
    .ai-media-item {
        transition: none;
    }
    /* Let touch events pass through immediately */
    .ai-section {
        touch-action: pan-y;
        -webkit-overflow-scrolling: touch;
    }
}
