/* Landing page — motion graphics & animations */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .reveal,
    [data-animate] {
        opacity: 1 !important;
        transform: none !important;
    }
}

/* ——— Hero ambient motion ——— */
.hero-motion {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.hero-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.5;
}

.hero-orb-1 {
    width: 280px;
    height: 280px;
    top: -80px;
    left: -60px;
    background: rgba(59, 182, 93, 0.35);
    animation: orb-drift-1 14s ease-in-out infinite;
}

.hero-orb-2 {
    width: 220px;
    height: 220px;
    bottom: -40px;
    right: -40px;
    background: rgba(103, 126, 184, 0.28);
    animation: orb-drift-2 18s ease-in-out infinite;
}

.hero-grid-bg {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(10, 21, 48, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(10, 21, 48, 0.04) 1px, transparent 1px);
    background-size: 40px 40px;
    mask-image: radial-gradient(ellipse 70% 70% at 50% 50%, black 20%, transparent 75%);
    animation: grid-pan 25s linear infinite;
}

.hero-scan-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(59, 182, 93, 0.5), transparent);
    box-shadow: 0 0 20px rgba(59, 182, 93, 0.4);
    animation: scan-sweep 4s ease-in-out infinite;
    opacity: 0.6;
}

@keyframes orb-drift-1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(30px, 20px) scale(1.08); }
}

@keyframes orb-drift-2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-25px, -15px) scale(1.05); }
}

@keyframes grid-pan {
    0% { transform: translate(0, 0); }
    100% { transform: translate(40px, 40px); }
}

@keyframes scan-sweep {
    0% { top: -5%; opacity: 0; }
    15% { opacity: 0.7; }
    85% { opacity: 0.7; }
    100% { top: 105%; opacity: 0; }
}

/* ——— Entrance animations (only when motion JS is active) ——— */
html.js-motion [data-animate] {
    opacity: 0;
}

html.js-motion [data-animate].is-visible {
    animation-duration: 0.75s;
    animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
    animation-fill-mode: forwards;
}

html.js-motion [data-animate="fade-up"].is-visible {
    animation-name: fade-up-in;
}

html.js-motion [data-animate="fade-down"].is-visible {
    animation-name: fade-down-in;
}

html.js-motion [data-animate="fade-left"].is-visible {
    animation-name: fade-left-in;
}

html.js-motion [data-animate][data-delay="0"].is-visible { animation-delay: 0s; }
html.js-motion [data-animate][data-delay="1"].is-visible { animation-delay: 0.08s; }
html.js-motion [data-animate][data-delay="2"].is-visible { animation-delay: 0.16s; }
html.js-motion [data-animate][data-delay="3"].is-visible { animation-delay: 0.24s; }
html.js-motion [data-animate][data-delay="4"].is-visible { animation-delay: 0.32s; }
html.js-motion [data-animate][data-delay="5"].is-visible { animation-delay: 0.4s; }

@keyframes fade-up-in {
    from {
        opacity: 0;
        transform: translateY(28px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fade-down-in {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fade-left-in {
    from {
        opacity: 0;
        transform: translateX(40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ——— Scroll reveal ——— */
html.js-motion .reveal {
    opacity: 0;
    transform: translateY(36px);
    transition:
        opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
        transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

html.js-motion .reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.reveal[data-delay="0"] { transition-delay: 0s; }
.reveal[data-delay="1"] { transition-delay: 0.1s; }
.reveal[data-delay="2"] { transition-delay: 0.2s; }

.cards-grid .card.reveal:nth-child(1) { transition-delay: 0s; }
.cards-grid .card.reveal:nth-child(2) { transition-delay: 0.12s; }
.cards-grid .card.reveal:nth-child(3) { transition-delay: 0.24s; }

.benefits .mini-card.reveal:nth-child(1) { transition-delay: 0s; }
.benefits .mini-card.reveal:nth-child(2) { transition-delay: 0.06s; }
.benefits .mini-card.reveal:nth-child(3) { transition-delay: 0.12s; }
.benefits .mini-card.reveal:nth-child(4) { transition-delay: 0.18s; }
.benefits .mini-card.reveal:nth-child(5) { transition-delay: 0.24s; }
.benefits .mini-card.reveal:nth-child(6) { transition-delay: 0.3s; }

/* ——— Dashboard mock ——— */
.float-dashboard {
    animation: dashboard-float 5s ease-in-out infinite;
    position: relative;
}

.dashboard-glow {
    position: absolute;
    inset: -20%;
    background: radial-gradient(circle, rgba(59, 182, 93, 0.2), transparent 65%);
    animation: glow-pulse 3s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

.hero-dashboard {
    position: relative;
    z-index: 1;
}

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

@keyframes glow-pulse {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 0.85; transform: scale(1.05); }
}

.dashboard-live {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-right: auto;
    font-size: 0.6875rem;
    font-weight: 800;
    color: var(--primary-dark);
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--primary-soft);
}

.live-pulse {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 0 0 rgba(59, 182, 93, 0.5);
    animation: live-ring 1.8s ease-out infinite;
}

@keyframes live-ring {
    0% {
        box-shadow: 0 0 0 0 rgba(59, 182, 93, 0.55);
    }
    70% {
        box-shadow: 0 0 0 8px rgba(59, 182, 93, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(59, 182, 93, 0);
    }
}

html.js-motion .api-row {
    opacity: 0;
    transform: translateX(16px);
}

.hero-dashboard.is-live .api-row {
    animation: api-row-in 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.hero-dashboard.is-live .api-row[data-api-row="0"] { animation-delay: 0.5s; }
.hero-dashboard.is-live .api-row[data-api-row="1"] { animation-delay: 0.7s; }
.hero-dashboard.is-live .api-row[data-api-row="2"] { animation-delay: 0.9s; }
.hero-dashboard.is-live .api-row[data-api-row="3"] { animation-delay: 1.1s; }

@keyframes api-row-in {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.api-row.is-processing {
    background: rgba(59, 182, 93, 0.06);
    border-color: rgba(59, 182, 93, 0.3);
}

.api-row.is-processing .api-time::after {
    content: ' …';
    animation: dots 1s steps(3) infinite;
}

@keyframes dots {
    0% { content: ''; }
    33% { content: ' .'; }
    66% { content: ' ..'; }
    100% { content: ' ...'; }
}

.api-status {
    animation: status-glow 2.5s ease-in-out infinite;
}

@keyframes status-glow {
    0%, 100% { box-shadow: 0 0 0 rgba(59, 182, 93, 0); }
    50% { box-shadow: 0 0 12px rgba(59, 182, 93, 0.25); }
}

/* ——— Buttons ——— */
.btn-shimmer {
    position: relative;
    overflow: hidden;
}

.btn-shimmer::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.35),
        transparent
    );
    animation: shimmer 3s ease-in-out infinite;
}

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

/* ——— Stats counter highlight ——— */
.stat-item {
    transition: transform 0.3s ease;
}

.stat-item.is-counted {
    animation: stat-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes stat-pop {
    0% { transform: scale(0.92); }
    60% { transform: scale(1.04); }
    100% { transform: scale(1); }
}

/* ——— Trust strip ——— */
.trust-item {
    transition: transform 0.25s ease, color 0.25s ease;
}

.trust-item:hover {
    transform: translateY(-3px);
    color: var(--primary-dark);
}

.trust-item i {
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.trust-item:hover i {
    transform: scale(1.15) rotate(-5deg);
}

/* ——— Cards ——— */
.card {
    transition:
        transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow 0.35s ease,
        border-color 0.35s ease;
}

.card-icon {
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.card:hover .card-icon {
    transform: scale(1.08) rotate(-4deg);
}

.mini-card {
    transition:
        transform 0.3s ease,
        box-shadow 0.3s ease;
}

.mini-icon {
    transition: transform 0.35s ease, background 0.35s ease;
}

.mini-card:hover .mini-icon {
    transform: scale(1.1) rotate(8deg);
    background: rgba(59, 182, 93, 0.2);
}

/* ——— CTA ——— */
.cta-glow::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    background: linear-gradient(
        120deg,
        rgba(59, 182, 93, 0.6),
        transparent 40%,
        rgba(59, 182, 93, 0.4)
    );
    background-size: 200% 200%;
    animation: cta-border-flow 6s linear infinite;
    z-index: -1;
    opacity: 0.5;
}

.cta-card {
    position: relative;
    overflow: hidden;
}

.cta-card::after {
    content: '';
    position: absolute;
    width: 200px;
    height: 200px;
    top: -100px;
    right: -50px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.12), transparent 70%);
    animation: cta-sparkle 8s ease-in-out infinite;
    pointer-events: none;
}

@keyframes cta-border-flow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes cta-sparkle {
    0%, 100% { transform: translate(0, 0); opacity: 0.4; }
    50% { transform: translate(-30px, 20px); opacity: 0.8; }
}

/* ——— FAQ ——— */
.faq-item {
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.faq-item.active {
    animation: faq-open 0.35s ease;
}

@keyframes faq-open {
    from { transform: scale(0.995); }
    to { transform: scale(1); }
}

/* ——— Header scroll ——— */
.header.is-scrolled {
    box-shadow: var(--shadow-md);
    border-color: rgba(59, 182, 93, 0.15);
}

/* ——— Floating particles (page bg) ——— */
.page-container::after {
    content: '';
    position: fixed;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary);
    opacity: 0.15;
    top: 20%;
    left: 8%;
    box-shadow:
        120px 80px 0 2px rgba(59, 182, 93, 0.12),
        240px 200px 0 1px rgba(103, 126, 184, 0.15),
        80vw 40vh 0 3px rgba(59, 182, 93, 0.08),
        70vw 70vh 0 2px rgba(59, 182, 93, 0.1);
    animation: particles-float 20s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes particles-float {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(15px, -25px); }
}
