/* ==========================================================================
   LeadSave AI - Motion layer
   Deliberately restrained: a soft page cross-fade, the hero settling in on
   load, and content easing up as it scrolls into view. Nothing here hides
   content unless motion.js has started (html.ms-ready), and
   prefers-reduced-motion turns all of it off.
   ========================================================================== */

:root {
    --ms-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Page transitions (cross-document View Transitions) ---------- */
@view-transition {
    navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
    animation-duration: 220ms;
    animation-timing-function: ease;
}

.navbar { view-transition-name: ms-nav; }
.promo-bar { view-transition-name: ms-promo; }

/* ---------- Hero settles in on load ---------- */
@keyframes msUp {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: none; }
}

.hero .container > *,
.hero-copy > *,
.hero .stage {
    animation: msUp 0.8s var(--ms-ease) both;
}

.hero .container > :nth-child(2),
.hero-copy > :nth-child(2) { animation-delay: 0.08s; }
.hero .container > :nth-child(3),
.hero-copy > :nth-child(3) { animation-delay: 0.16s; }
.hero .container > :nth-child(n+4),
.hero-copy > :nth-child(n+4) { animation-delay: 0.24s; }
/* The homepage hero grid is itself the container: animate the copy's
   children and the phone, not the copy column as a whole */
.hero .hero-grid > .hero-copy {
    animation: none;
}

.hero .hero-grid > .stage {
    animation: msUp 0.9s var(--ms-ease) 0.2s both;
}

/* ---------- Scroll reveal (only hidden once motion.js runs) ---------- */
.ms-reveal {
    transition: opacity 0.7s var(--ms-ease), transform 0.7s var(--ms-ease);
    transition-delay: var(--ms-delay, 0ms);
}

.ms-ready .ms-reveal:not(.ms-in) {
    opacity: 0;
    transform: translateY(16px);
}

/* ---------- Navbar gains a solid edge once you scroll ---------- */
.navbar {
    transition: background 0.3s ease, border-color 0.3s ease;
}

/* ---------- Accessibility ---------- */
@media (prefers-reduced-motion: reduce) {
    ::view-transition-old(root),
    ::view-transition-new(root) {
        animation: none;
    }

    .hero .container > *,
    .hero-copy > *,
    .hero .stage {
        animation: none !important;
    }

    .ms-reveal {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
}
