/* ==========================================================================
   Animations — transform / opacity only (GPU-friendly).
   Every motion has a static fallback under prefers-reduced-motion.
   ========================================================================== */

/* Intro offset: hero content waits for the garage door (first visit per session) */
:root { --intro: 520ms; }
html.intro-skip { --intro: 0ms; }

@keyframes pulse-ring {
    0% { transform: scale(1); opacity: 0.7; }
    100% { transform: scale(3); opacity: 0; }
}

@keyframes rise {
    from { opacity: 0; transform: translateY(22px); }
    to { opacity: 1; transform: none; }
}

@keyframes line-up {
    to { transform: none; }
}

@keyframes door-up {
    0% { transform: translate3d(0, 0, 0); }
    100% { transform: translate3d(0, -101%, 0); visibility: hidden; }
}

@keyframes hero-zoom {
    from { transform: scale(1.06); }
    to { transform: scale(1); }
}

@keyframes shine {
    0% { transform: translateX(-180%) skewX(-18deg); }
    24%, 100% { transform: translateX(380%) skewX(-18deg); }
}

@keyframes ring {
    0%, 70%, 100% { rotate: 0deg; }
    74% { rotate: -16deg; }
    78% { rotate: 14deg; }
    82% { rotate: -12deg; }
    86% { rotate: 9deg; }
    90% { rotate: -5deg; }
    94% { rotate: 0deg; }
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes zoom-in {
    from { opacity: 0; transform: scale(0.94); }
    to { opacity: 1; transform: none; }
}

@keyframes faq-open {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: none; }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes marquee {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

/* Garage door intro ------------------------------------------------------- */
.js .hero__door {
    display: block;
    will-change: transform;
    animation: door-up 1.05s var(--ease-in-out) 0.15s forwards;
}

html.intro-skip .hero__door {
    display: none;
}

/* Hero entrance (staggered, after the door) -------------------------------- */
.js .rise {
    opacity: 0;
    animation: rise 0.9s var(--ease-out) forwards;
}

.js .rise-1 { animation-delay: calc(var(--intro) + 60ms); }
.js .rise-3 { animation-delay: calc(var(--intro) + 380ms); }
.js .rise-4 { animation-delay: calc(var(--intro) + 480ms); }
.js .rise-5 { animation-delay: calc(var(--intro) + 580ms); }

.js .hero__title .line > span {
    transform: translateY(112%);
    animation: line-up 0.95s var(--ease-out) forwards;
}

.js .hero__title .line:nth-child(1) > span { animation-delay: calc(var(--intro) + 120ms); }
.js .hero__title .line:nth-child(2) > span { animation-delay: calc(var(--intro) + 210ms); }
.js .hero__title .line:nth-child(3) > span { animation-delay: calc(var(--intro) + 300ms); }

/* Micro-interactions ---------------------------------------------------- */
.js .btn--shine::after {
    animation: shine 4.8s ease-in-out calc(var(--intro) + 1.6s) infinite;
}

.js .nav__phone svg,
.js .mobile-bar .btn-primary svg,
.js .contact__phone-icon svg {
    transform-origin: 50% 50%;
    animation: ring 5s ease-in-out 2.5s infinite;
}

/* Reveal on scroll (only when JS is running) ------------------------------ */
.js .reveal {
    opacity: 0;
    translate: 0 26px;
    transition: opacity var(--dur-slow) var(--ease-out), translate var(--dur-slow) var(--ease-out);
}

.js .reveal.is-visible {
    opacity: 1;
    translate: 0 0;
}

.js .reveal[data-delay='1'] { transition-delay: 90ms; }
.js .reveal[data-delay='2'] { transition-delay: 180ms; }
.js .reveal[data-delay='3'] { transition-delay: 270ms; }
.js .reveal[data-delay='4'] { transition-delay: 360ms; }

/* Variant: garage-door wipe — a slatted mini door covers the item and rolls up.
   (The element itself stays unclipped so IntersectionObserver can see it.) */
.js .reveal--wipe {
    opacity: 1;
    translate: none;
}

.js .reveal--wipe::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 3;
    background: repeating-linear-gradient(180deg, var(--primary-color) 0 calc(25% - 3px), var(--primary-dark) calc(25% - 3px) 25%);
    transform: translate3d(0, 0, 0);
    transition: transform 0.95s var(--ease-in-out);
    transition-delay: inherit;
    pointer-events: none;
}

.js .reveal--wipe.is-visible::before {
    transform: translate3d(0, -101%, 0);
}

/* Variant: pop (chips) */
.js .reveal--pop {
    translate: none;
    scale: 0.8;
    transition: opacity 0.45s var(--ease-out), scale 0.45s var(--ease-out);
}

.js .reveal--pop.is-visible {
    scale: 1;
}

/* Service photos settle in (zoom-out) */
.js .service.reveal .service__media img {
    transform: scale(1.18);
    transition: transform 1.5s var(--ease-out);
}

.js .service.reveal.is-visible .service__media img {
    transform: scale(1);
}

/* Eyebrow rules draw in */
.js .reveal .eyebrow::before,
.js .reveal .eyebrow::after {
    transform: scaleX(0);
    transition: transform 0.7s var(--ease-out) 0.25s;
}

.js .reveal .eyebrow::before { transform-origin: right center; }
.js .reveal .eyebrow::after { transform-origin: left center; }

.js .reveal.is-visible .eyebrow::before,
.js .reveal.is-visible .eyebrow::after {
    transform: scaleX(1);
}

/* Stats: amber rule grows */
.js .stats__item {
    border-left-color: transparent;
    background: linear-gradient(var(--secondary-color), var(--secondary-color)) 0 0 / 2px 0% no-repeat;
}

.js .stats__item.reveal {
    transition: opacity var(--dur-slow) var(--ease-out), translate var(--dur-slow) var(--ease-out), background-size 1s var(--ease-out);
}

.js .stats__item.is-visible {
    background-size: 2px 100%;
}

/* Mobile: shorter entrances so fast scrolling never feels laggy */
@media (max-width: 768px) {
    :root { --intro: 470ms; }
    html.intro-skip { --intro: 0ms; }

    .js .reveal {
        translate: 0 14px;
        transition-duration: 420ms;
    }

    .js .reveal[data-delay] {
        transition-delay: 0ms;
    }

    .js .rise {
        animation-duration: 0.6s;
    }

    .js .hero__door {
        animation-duration: 0.9s;
    }
}

/* Reduced motion ------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-delay: 0ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        transition-delay: 0ms !important;
        scroll-behavior: auto !important;
    }

    .hero__door,
    .js .hero__door,
    .btn--shine::after {
        display: none !important;
    }

    .js .rise,
    .js .reveal {
        opacity: 1;
        translate: none;
        transform: none;
    }

    .js .hero__title .line > span,
    .js .service.reveal .service__media img {
        transform: none;
    }

    .js .reveal--wipe::before {
        display: none;
    }

    .js .reveal--pop {
        scale: 1;
    }

    .js .reveal .eyebrow::before,
    .js .reveal .eyebrow::after {
        transform: none;
    }

    .js .stats__item {
        background-size: 2px 100%;
    }
}
