/**
 * VelTechLab — Unified animation layer
 * Scroll reveal, 3D tilt, particles, ripple, counters
 * @version 1.0.0
 */

/* ============================
   Scroll reveal
   ============================ */
.reveal-on-scroll {
    opacity: 0;
    transform: translateY(26px);
    transition:
        opacity 0.65s cubic-bezier(0.22, 0.61, 0.36, 1),
        transform 0.65s cubic-bezier(0.22, 0.61, 0.36, 1);
    will-change: opacity, transform;
}

.reveal-on-scroll[data-reveal="left"] {
    transform: translateX(-34px);
}

.reveal-on-scroll[data-reveal="right"] {
    transform: translateX(34px);
}

.reveal-on-scroll[data-reveal="zoom"] {
    transform: scale(0.92);
}

.reveal-on-scroll.revealed {
    opacity: 1;
    transform: none;
}

/* 3D flip entrance — applied by JS to card-type elements */
.reveal-on-scroll.reveal-3d {
    transform: perspective(1000px) rotateX(10deg) translateY(34px);
    transform-origin: 50% 100%;
}

.reveal-on-scroll.reveal-3d.revealed {
    transform: none;
}

/* ============================
   3D tilt on cards
   ============================ */
.tilt-3d {
    transform-style: preserve-3d;
    transition:
        transform 0.3s cubic-bezier(0.22, 0.61, 0.36, 1),
        box-shadow 0.3s ease;
    will-change: transform;
}

.tilt-3d > .tilt-glare {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    background: radial-gradient(
        340px circle at var(--mx, 50%) var(--my, 50%),
        rgba(255, 255, 255, 0.32),
        transparent 65%
    );
    z-index: 1;
}

.tilt-3d:hover > .tilt-glare {
    opacity: 1;
}

.tilt-3d > * {
    position: relative;
}

/* ============================
   Hero particles
   ============================ */
.hero-particle {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

@keyframes floatParticle {
    0%,
    100% {
        transform: translateY(0) translateX(0);
        opacity: 0.15;
    }
    30% {
        opacity: 0.6;
    }
    50% {
        transform: translateY(-28px) translateX(10px);
        opacity: 0.35;
    }
    70% {
        opacity: 0.55;
    }
}

/* ============================
   Button ripple
   ============================ */
.js-ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transform: scale(0);
    animation: btnRipple 0.55s ease-out forwards;
    pointer-events: none;
    z-index: 0;
}

@keyframes btnRipple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* ============================
   Floating hero card
   ============================ */
@keyframes heroCardFloat {
    0%,
    100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.hero-card {
    animation: heroCardFloat 7s ease-in-out infinite;
}

/* ============================
   Hero 3D depth parallax
   ============================ */
.hero-media {
    transform: translate3d(
        calc(var(--hx, 0) * -14px),
        calc(var(--hy, 0) * -10px),
        0
    ) scale(1.06);
    transition: transform 0.7s cubic-bezier(0.22, 0.61, 0.36, 1);
    will-change: transform;
}

.hero-text {
    transform: translate3d(
        calc(var(--hx, 0) * 8px),
        calc(var(--hy, 0) * 5px),
        0
    );
    transition: transform 0.5s ease;
    will-change: transform;
}

/* ============================
   Magnetic buttons (desktop)
   ============================ */
.magnetic {
    transition: transform 0.25s cubic-bezier(0.22, 0.61, 0.36, 1);
    will-change: transform;
}

/* ============================
   Nav shrink on scroll
   ============================ */
.main-nav.nav-scrolled,
header.nav-scrolled {
    box-shadow: 0 8px 30px -12px rgba(15, 23, 42, 0.22);
}

/* ============================
   Stats band
   ============================ */
.stats-band {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    padding: 2rem 0;
}

.stat-item {
    text-align: center;
    padding: 1.5rem 1rem;
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 1rem;
    box-shadow: 0 8px 24px -16px rgba(15, 23, 42, 0.18);
}

.stat-value {
    display: block;
    font-size: clamp(2rem, 4vw, 2.6rem);
    font-weight: 700;
    line-height: 1.1;
    color: var(--accent-primary, #2563eb);
    font-variant-numeric: tabular-nums;
}

.stat-label {
    display: block;
    margin-top: 0.4rem;
    font-size: 0.9rem;
    color: #475569;
}

/* ============================
   Reduced motion
   ============================ */
@media (prefers-reduced-motion: reduce) {
    .reveal-on-scroll,
    .reveal-on-scroll.reveal-3d {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }

    .hero-card {
        animation: none !important;
    }

    .hero-particle,
    .js-ripple {
        display: none !important;
    }

    .tilt-3d {
        transition: none !important;
    }
}
