/* ============================================================
   CTC – Car Tech Center | Animations v2
   Scroll reveals, shimmer, parallax, micro-interactions
   ============================================================ */

/* ═══════════════════════════════════
   SCROLL REVEAL ANIMATIONS
   ═══════════════════════════════════ */

.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition:
        opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered children reveal with spring easing */
.reveal-stagger>* {
    opacity: 0;
    transform: translateY(24px);
    transition:
        opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-stagger.visible>* {
    opacity: 1;
    transform: translateY(0);
}

/* Generate stagger delays (13 items max for services grid) */
.reveal-stagger.visible>*:nth-child(1) {
    transition-delay: 0.04s;
}

.reveal-stagger.visible>*:nth-child(2) {
    transition-delay: 0.08s;
}

.reveal-stagger.visible>*:nth-child(3) {
    transition-delay: 0.12s;
}

.reveal-stagger.visible>*:nth-child(4) {
    transition-delay: 0.16s;
}

.reveal-stagger.visible>*:nth-child(5) {
    transition-delay: 0.20s;
}

.reveal-stagger.visible>*:nth-child(6) {
    transition-delay: 0.24s;
}

.reveal-stagger.visible>*:nth-child(7) {
    transition-delay: 0.28s;
}

.reveal-stagger.visible>*:nth-child(8) {
    transition-delay: 0.32s;
}

.reveal-stagger.visible>*:nth-child(9) {
    transition-delay: 0.36s;
}

.reveal-stagger.visible>*:nth-child(10) {
    transition-delay: 0.40s;
}

.reveal-stagger.visible>*:nth-child(11) {
    transition-delay: 0.44s;
}

.reveal-stagger.visible>*:nth-child(12) {
    transition-delay: 0.48s;
}

.reveal-stagger.visible>*:nth-child(13) {
    transition-delay: 0.52s;
}

/* Reveal from left */
.reveal-left {
    opacity: 0;
    transform: translateX(-50px);
    transition:
        opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-left.visible {
    opacity: 1;
    transform: translateX(0);
}

/* Reveal from right */
.reveal-right {
    opacity: 0;
    transform: translateX(50px);
    transition:
        opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-right.visible {
    opacity: 1;
    transform: translateX(0);
}

/* Scale reveal */
.reveal-scale {
    opacity: 0;
    transform: scale(0.85);
    transition:
        opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* ═══════════════════════════════════
   HERO ANIMATIONS
   ═══════════════════════════════════ */

.hero__content>* {
    opacity: 0;
    transform: translateY(24px);
    animation: heroFadeIn 0.9s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.hero__content>*:nth-child(1) {
    animation-delay: 0.3s;
}

.hero__content>*:nth-child(2) {
    animation-delay: 0.5s;
}

.hero__content>*:nth-child(3) {
    animation-delay: 0.7s;
}

.hero__content>*:nth-child(4) {
    animation-delay: 0.9s;
}

.hero__content>*:nth-child(5) {
    animation-delay: 1.1s;
}

@keyframes heroFadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Page hero entrance */
.page-hero__content>* {
    opacity: 0;
    transform: translateY(20px);
    animation: heroFadeIn 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.page-hero__content>*:nth-child(1) {
    animation-delay: 0.15s;
}

.page-hero__content>*:nth-child(2) {
    animation-delay: 0.3s;
}

.page-hero__content>*:nth-child(3) {
    animation-delay: 0.45s;
}

/* ═══════════════════════════════════
   COUNTER ANIMATION
   ═══════════════════════════════════ */

.counter {
    display: inline-block;
}

/* ═══════════════════════════════════
   PULSE ANIMATION (CTA emphasis)
   ═══════════════════════════════════ */

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 68, 204, 0.4);
    }

    70% {
        box-shadow: 0 0 0 14px rgba(0, 68, 204, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(0, 68, 204, 0);
    }
}

.btn--pulse {
    animation: pulse 2.5s ease infinite;
}

[data-theme="dark"] .btn--pulse {
    animation: pulseDark 2.5s ease infinite;
}

@keyframes pulseDark {
    0% {
        box-shadow: 0 0 0 0 rgba(34, 102, 255, 0.4);
    }

    70% {
        box-shadow: 0 0 0 14px rgba(34, 102, 255, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(34, 102, 255, 0);
    }
}

/* ═══════════════════════════════════
   FLOAT ANIMATION
   ═══════════════════════════════════ */

@keyframes float {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    33% {
        transform: translateY(-8px) rotate(1deg);
    }

    66% {
        transform: translateY(-4px) rotate(-1deg);
    }
}

.float-animation {
    animation: float 4s ease-in-out infinite;
}

/* ═══════════════════════════════════
   GLOW ANIMATION
   ═══════════════════════════════════ */

@keyframes glow {

    0%,
    100% {
        filter: drop-shadow(0 0 8px rgba(34, 102, 255, 0.3));
    }

    50% {
        filter: drop-shadow(0 0 20px rgba(34, 102, 255, 0.5));
    }
}

.glow-animation {
    animation: glow 3s ease-in-out infinite;
}

/* ═══════════════════════════════════
   TEXT SHIMMER (Gradient moving)
   ═══════════════════════════════════ */

@keyframes shimmerText {
    0% {
        background-position: -200% center;
    }

    100% {
        background-position: 200% center;
    }
}

.text-gradient {
    background-size: 200% auto;
    animation: shimmerText 4s linear infinite;
}

/* ═══════════════════════════════════
   MAGNETIC HOVER (buttons, cards)
   ═══════════════════════════════════ */

.magnetic {
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ═══════════════════════════════════
   3D CARD TILT (Service cards)
   ═══════════════════════════════════ */

.service-card,
.service-teaser,
.review-card {
    transform-style: preserve-3d;
    perspective: 1000px;
}

/* ═══════════════════════════════════
   SCROLL PROGRESS BAR
   ═══════════════════════════════════ */

.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: var(--ctc-blue-gradient);
    z-index: 9999;
    transition: width 0.1s linear;
}

/* ═══════════════════════════════════
   PAGE TRANSITION
   ═══════════════════════════════════ */

.page-transition {
    animation: pageIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes pageIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ═══════════════════════════════════
   PARALLAX LAYER
   ═══════════════════════════════════ */

.parallax-bg {
    will-change: transform;
}

/* ═══════════════════════════════════
   HOVER LIFT (Enhanced cards)
   ═══════════════════════════════════ */

.service-card:hover,
.review-card:hover {
    box-shadow:
        0 20px 40px -12px rgba(0, 0, 0, 0.15),
        0 0 0 1px var(--ctc-blue-primary);
}

[data-theme="dark"] .service-card:hover,
[data-theme="dark"] .review-card:hover {
    box-shadow:
        0 20px 40px -12px rgba(0, 0, 0, 0.4),
        0 0 20px rgba(34, 102, 255, 0.1),
        0 0 0 1px var(--ctc-blue-primary);
}

/* ═══════════════════════════════════
   BUTTON HOVER ANIMATIONS
   ═══════════════════════════════════ */

.btn--primary::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.btn--primary {
    position: relative;
    overflow: hidden;
}

.btn--primary:hover::after {
    opacity: 1;
}

/* ═══════════════════════════════════
   NAV LINK HOVER (Underline draw)
   ═══════════════════════════════════ */

.nav__link::after {
    transition: width 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ═══════════════════════════════════
   BADGE HOVER
   ═══════════════════════════════════ */

.badge {
    transition:
        transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
        box-shadow 0.3s ease;
}

.badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 68, 204, 0.15);
}

/* ═══════════════════════════════════
   FORM FOCUS ANIMATION
   ═══════════════════════════════════ */

.form-input:focus,
.form-textarea:focus {
    transform: translateY(-1px);
}

/* ═══════════════════════════════════
   REDUCED MOTION
   ═══════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .reveal,
    .reveal-stagger>*,
    .reveal-left,
    .reveal-right,
    .reveal-scale {
        opacity: 1;
        transform: none;
    }

    .hero__content>*,
    .page-hero__content>* {
        opacity: 1;
        transform: none;
        animation: none;
    }
}