/* Home page motion, "Layers". Owner-approved 2026-11-07.
   Content comes forward from slightly behind as it scrolls into view, and a jump
   to a section (menu, Get Started, footer links) zooms through instead of gliding.
   Pairs with js/landing_motion.js.

   To turn it off: remove data-motion="layers" from <html> in
   branding/v-dashboard-landing.html and remove the two tags that load this file
   and js/landing_motion.js. Nothing else depends on them.

   Rules it keeps to:
   - transform and opacity only.
   - The page's own reveal system ([data-animate] + .is-visible, set by
     js/landing.js) stays the only thing that shows or hides an element. This file
     retunes its distance and timing; it never adds a second animation to the same
     element, and it never touches .hero__visual (the hero card has its own float
     and tilt).
   - Under prefers-reduced-motion every rule below is skipped, so the page is
     exactly as it is without this file. */

@media (prefers-reduced-motion: no-preference) {

  /* With landing_motion.js running, an anchor jump is covered (a view transition,
     or a dissolve) instead of gliding past every section on the way. */
  html[data-motion="layers"].mo-on { scroll-behavior: auto; }

  html[data-motion="layers"] {
    --mo-o: 600ms;  --mo-oe: ease-out;
    --mo-t: 800ms;  --mo-te: cubic-bezier(.22, .6, .25, 1);
  }
  /* The hero keeps the page's own quick-start fade, so the headline is not later. */
  html[data-motion="layers"] #hero { --mo-o: 600ms; --mo-oe: cubic-bezier(.16, 1, .3, 1); }

  /* Hidden state: a little smaller and lower. The visible state is the page's own. */
  html[data-motion="layers"] [data-animate]:not(.is-visible, .hero__visual *) {
    transform: translateY(18px) scale(.94);
    transform-origin: 50% 40%;
  }
  html[data-motion="layers"] [data-animate].is-visible:not(.hero__visual *) {
    transition:
      opacity var(--mo-o) var(--mo-oe),
      transform var(--mo-t) var(--mo-te);
  }
  /* Elements already in view when a jump lands are shown at once, under the cover. */
  html[data-motion="layers"] [data-animate].mo-now.is-visible { transition: none; }

  /* Jumps use a view transition where the browser has one: the old view moves
     toward you and fades, the new one comes forward from behind. The navbar keeps
     its own layer so it stays still. */
  html[data-motion="layers"].mo-vt .navbar { view-transition-name: mo-nav; }
  html[data-motion="layers"].mo-vt::view-transition-old(root) {
    animation: mo-zoom-out 200ms cubic-bezier(.4, 0, 1, 1) both;
  }
  html[data-motion="layers"].mo-vt::view-transition-new(root) {
    animation: mo-zoom-in 380ms cubic-bezier(0, 0, .2, 1) 110ms both;
  }
  @keyframes mo-zoom-out { to { opacity: 0; transform: scale(1.04); } }
  @keyframes mo-zoom-in { from { opacity: 0; transform: scale(.96); } }

  /* The dissolve (added by landing_motion.js): the fallback for jumps on phones
     with under 4 GB of memory or no view transitions, and the dim when leaving
     the page. In the page background colour, under the navbar (z 100) and the
     mobile menu (z 200). */
  html[data-motion="layers"].mo-on .mo-veil {
    position: fixed;
    inset: 0;
    z-index: 99;
    pointer-events: none;
    opacity: 0;
    background: var(--color-bg);
  }
}
