/* ========================================
   ANIMATIONS
   Keyframes, Entrance Animations, Effects
   ======================================== */

/* ----------------------------------------
   Staggered Entrance Animations
   ---------------------------------------- */

/* Hero staggered reveal */
.hero .badge {
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-delay: 0.1s;
    opacity: 0;
}

.hero h1 {
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-delay: 0.2s;
    opacity: 0;
}

.hero-subtitle {
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-delay: 0.3s;
    opacity: 0;
}

.hero .install-box {
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-delay: 0.4s;
    opacity: 0;
}

.hero .btn-group {
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-delay: 0.5s;
    opacity: 0;
}

.hero .trust-badges {
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-delay: 0.6s;
    opacity: 0;
}

/* ASCII art SVG fade-in */
[data-theme="cli"] .hero .ascii-art {
    animation: fadeIn 0.8s ease forwards;
    opacity: 0;
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ----------------------------------------
   Scroll-triggered Fade In
   ---------------------------------------- */

.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

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

/* ----------------------------------------
   CLI Theme - Blinking Cursor
   ---------------------------------------- */

[data-theme="cli"] .cursor {
    display: inline-block;
    width: 10px;
    height: 1.2em;
    background: var(--cyan);
    margin-left: 4px;
    animation: blink 1s step-end infinite;
    vertical-align: text-bottom;
}

.cursor {
    display: none;
}

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

/* ----------------------------------------
   CLI Theme - Typing Animation
   ---------------------------------------- */

[data-theme="cli"] .typing-text {
    overflow: hidden;
    border-right: 3px solid var(--cyan);
    white-space: nowrap;
    animation: typing 3s steps(40, end), blink-caret 0.75s step-end infinite;
}

@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blink-caret {
    from, to { border-color: transparent; }
    50% { border-color: var(--cyan); }
}

/* ----------------------------------------
   Glitch Animation (Theme Switch)
   ---------------------------------------- */

@keyframes glitch {
    0% {
        transform: translate(0);
        filter: hue-rotate(0deg);
    }
    10% {
        transform: translate(-5px, -3px);
        filter: hue-rotate(90deg);
    }
    20% {
        transform: translate(5px, 3px);
        filter: hue-rotate(180deg);
    }
    30% {
        transform: translate(-3px, 2px);
        filter: hue-rotate(270deg);
    }
    40% {
        transform: translate(3px, -2px);
        filter: hue-rotate(360deg);
    }
    50% {
        transform: translate(-2px, 1px);
    }
    60% {
        transform: translate(2px, -1px);
    }
    70% {
        transform: translate(-1px, 2px);
    }
    80% {
        transform: translate(1px, -2px);
    }
    90% {
        transform: translate(0);
    }
    100% {
        transform: translate(0);
        filter: hue-rotate(0deg);
    }
}

/* ----------------------------------------
   CLI Theme - Terminal Type-in Animation
   ---------------------------------------- */

[data-theme="cli"] .terminal-body .terminal-line {
    animation: typeIn 0.5s ease forwards;
    opacity: 0;
}

[data-theme="cli"] .terminal-body .terminal-line:nth-child(1) { animation-delay: 0.1s; }
[data-theme="cli"] .terminal-body .terminal-line:nth-child(2) { animation-delay: 0.3s; }
[data-theme="cli"] .terminal-body .terminal-line:nth-child(3) { animation-delay: 0.5s; }
[data-theme="cli"] .terminal-body .terminal-line:nth-child(4) { animation-delay: 0.7s; }
[data-theme="cli"] .terminal-body .terminal-line:nth-child(5) { animation-delay: 0.9s; }
[data-theme="cli"] .terminal-body .terminal-line:nth-child(6) { animation-delay: 1.1s; }
[data-theme="cli"] .terminal-body .terminal-line:nth-child(7) { animation-delay: 1.3s; }
[data-theme="cli"] .terminal-body .terminal-line:nth-child(8) { animation-delay: 1.5s; }

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

/* ----------------------------------------
   CLI Theme - Flicker Effect
   ---------------------------------------- */

[data-theme="cli"] .hero-content {
    animation: flicker 0.15s ease-in-out;
}

@keyframes flicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
    75% { opacity: 0.9; }
}

/* ----------------------------------------
   CLI Theme - Glow Animation
   ---------------------------------------- */

/* Note: Hero ASCII art animation is defined above with fadeIn + glow */

@keyframes glow {
    from {
        text-shadow: 0 0 5px var(--cyan), 0 0 10px var(--cyan);
        opacity: 0.7;
    }
    to {
        text-shadow: 0 0 10px var(--cyan), 0 0 20px var(--cyan), 0 0 30px var(--cyan);
        opacity: 1;
    }
}

/* CLI Theme - Extra glow on hero */
[data-theme="cli"] .hero h1 {
    animation: textPulse 4s ease-in-out infinite;
}

@keyframes textPulse {
    0%, 100% {
        text-shadow: 0 0 10px var(--cyan), 0 0 20px var(--cyan);
    }
    50% {
        text-shadow: 0 0 20px var(--cyan), 0 0 40px var(--cyan), 0 0 60px var(--cyan);
    }
}

/* ----------------------------------------
   Clean Theme - Refined Hover Effects
   ---------------------------------------- */

.feature-card,
.pricing-card,
.step-number {
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.3s ease,
                border-color 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-4px);
}

.pricing-card:hover {
    transform: translateY(-2px);
}

.btn-primary {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
}

/* CLI Theme - Disable transform on hover (keep it blocky) */
[data-theme="cli"] .feature-card:hover,
[data-theme="cli"] .pricing-card:hover,
[data-theme="cli"] .btn-primary:hover {
    transform: none;
}
