/* Motion (Nov 2026). Everything here runs only when the visitor allows motion,
   and reveal styles apply only once js/motion.js has added .js-motion. */
@media (prefers-reduced-motion: no-preference) {
  /* 1. Fade up on scroll */
  .js-motion .reveal { opacity: 0; transform: translateY(24px); transition: opacity .6s cubic-bezier(.2,.8,.2,1), transform .6s cubic-bezier(.2,.8,.2,1); transition-delay: var(--d, 0s); }
  .js-motion .reveal.is-in { opacity: 1; transform: none; }

  /* 2. Buttons: lift and a fill that sweeps across */
  .btn { position: relative; overflow: hidden; isolation: isolate; transition: transform .2s ease, box-shadow .2s ease, color .25s ease, border-color .25s ease, background-color .15s ease; }
  .btn::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--navy-soft); transform: scaleX(0); transform-origin: left; transition: transform .35s cubic-bezier(.2,.8,.2,1); }
  .btn:hover::before, .btn:focus-visible::before { transform: scaleX(1); }
  .btn:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(21, 32, 57, .18); }
  .btn:active { transform: translateY(0); box-shadow: none; }
  .btn-primary:hover { background: var(--navy); }
  .btn-outline::before { background: var(--navy); }
  .btn-outline:hover { background: transparent; color: var(--white); }
  .plan-top .btn::before { background: var(--paper); }
  .plan-top .btn:hover { background: var(--white); border-color: var(--white); }
  .btn[disabled]:hover { transform: none; box-shadow: none; }
  .btn[disabled]::before { display: none; }

  /* 4. Hero feed: the word on a tile rolls up and a new one rolls in.
     Only the label and the separate `scale` property move, so the tile's
     entrance animation is never restarted. */
  .feed .tile { transition: scale .35s cubic-bezier(.2,.8,.2,1); }
  .feed .tile.is-pressed { scale: .96; }
  .feed .tile span { display: block; transition: transform .38s cubic-bezier(.4,0,.2,1), opacity .38s ease; }
  .feed .tile span.is-out { transform: translateY(-140%); opacity: 0; }
  .feed .tile span.is-below { transform: translateY(140%); opacity: 0; transition: none; }

  /* 4b. Hero feed in 3D. Starts tilted with tiles floating at different depths,
     drifts slowly on its own and leans toward the mouse; as the visitor scrolls
     down it turns to face them flat (--f goes 0 -> 1). Tiles use the separate
     `translate` property so their entrance animation is untouched. */
  .js-motion .hero .feed {
    --k: calc(1 - var(--f, 0));
    max-width: 360px; justify-self: center; transform-style: preserve-3d; translate: var(--shift, 0px) 0;
    transform: perspective(1100px)
      rotateX(calc((16deg - var(--my, 0) * 9deg) * var(--k)))
      rotateY(calc((-20deg + var(--mx, 0) * 14deg) * var(--k)))
      rotateZ(calc(3deg * var(--k)));
  }
  .js-motion .hero .feed .tile {
    --zz: calc(var(--z, 0px) * var(--k) * var(--b, 1));
    transform-style: preserve-3d; translate: 0 0 var(--zz);
    box-shadow: 0 calc(var(--zz) * .22) calc(var(--zz) * .45) rgba(21, 32, 57, .26);
  }
  .js-motion .hero .feed .tile.t-white { box-shadow: inset 0 0 0 1px var(--line), 0 calc(var(--zz) * .22) calc(var(--zz) * .45) rgba(21, 32, 57, .2); }
  .js-motion .hero .feed .tile:nth-child(1) { --z: 30px; }
  .js-motion .hero .feed .tile:nth-child(2) { --z: 10px; }
  .js-motion .hero .feed .tile:nth-child(3) { --z: 48px; }
  .js-motion .hero .feed .tile:nth-child(4) { --z: 5px; }
  .js-motion .hero .feed .tile:nth-child(5) { --z: 64px; }
  .js-motion .hero .feed .tile:nth-child(6) { --z: 20px; }
  .js-motion .hero .feed .tile:nth-child(7) { --z: 40px; }
  .js-motion .hero .feed .tile:nth-child(8) { --z: 14px; }
  .js-motion .hero .feed .tile:nth-child(9) { --z: 54px; }
  @media (max-width: 900px) { .js-motion .hero .feed { max-width: 270px; } }

  /* 6. How It Works: a line grows down the steps and ticks each one */
  .js-motion .steps { position: relative; padding-left: 30px; }
  .js-motion .steps::before, .js-motion .steps::after { content: ""; position: absolute; left: 5px; top: 0; width: 2px; }
  .js-motion .steps::before { bottom: 0; background: var(--line); }
  .js-motion .steps::after { height: calc(var(--p, 0) * 100%); background: var(--navy); transition: height .15s linear; }
  .js-motion .steps li { position: relative; }
  .js-motion .steps li::after {
    content: ""; position: absolute; left: -30px; top: 24px; width: 12px; height: 12px;
    background: var(--paper); border: 2px solid var(--line); transition: background-color .3s ease, border-color .3s ease, transform .3s ease;
  }
  .js-motion .steps li.is-done::after { background: var(--navy); border-color: var(--navy); transform: scale(1.15); }
  .js-motion .steps li::before { transition: color .3s ease; }
  .js-motion .steps li.is-done::before { color: var(--navy); font-weight: 500; }

  /* 7. Stat bars fill behind each figure */
  .stat-bar { display: block; height: 6px; margin: 0 0 20px; background: var(--paper); overflow: hidden; }
  .stat-bar i { display: block; height: 100%; width: calc(var(--v, 1) * 100%); background: var(--navy); transform: scaleX(0); transform-origin: left; transition: transform 1.1s cubic-bezier(.2,.8,.2,1) .15s; }
  .stat.is-in .stat-bar i { transform: scaleX(1); }

  /* 8. Why page hero photo drifts slower than the page */
  .page-hero.with-media .page-hero-media { overflow: hidden; }
  .js-motion .page-hero.with-media .page-hero-media img { transform: translateY(var(--py, 0)) scale(1.08); will-change: transform; }

  /* 9. Plan cards: lift on hover, Grow gets a soft highlight when it arrives */
  .plan { transition: transform .25s ease, box-shadow .25s ease, opacity .6s cubic-bezier(.2,.8,.2,1); }
  .js-motion .plan.reveal { transition: opacity .6s cubic-bezier(.2,.8,.2,1), transform .6s cubic-bezier(.2,.8,.2,1), box-shadow .25s ease; transition-delay: var(--d, 0s), var(--d, 0s), 0s; }
  .js-motion .plan.reveal.is-in { transition: transform .3s cubic-bezier(.2,.8,.2,1), box-shadow .3s ease; }
  .plan:hover, .js-motion .plan.reveal.is-in:hover { transform: translateY(-12px); box-shadow: 0 26px 40px rgba(21, 32, 57, .22); transition-delay: 0s; }
  .plan-top.is-in { animation: glow 1.6s ease 1s 1; }
  @keyframes glow { 0% { box-shadow: 0 0 0 0 rgba(38, 52, 90, .45); } 100% { box-shadow: 0 0 0 18px rgba(38, 52, 90, 0); } }

  /* 11. What We Handle cards pop up as you scroll (both directions) and lift on hover.
     Browsers with scroll-driven animation do it natively (smooth, off the main thread);
     the script only drives it where that is missing. */
  .js-motion .service-cards .c { translate: 0 calc((1 - var(--pop, 1)) * 40px); scale: calc(.93 + .07 * var(--pop, 1)); opacity: calc(.3 + .7 * var(--pop, 1)); }
  .service-cards .c { transition: transform .3s cubic-bezier(.2,.8,.2,1), box-shadow .3s ease; }
  .service-cards .c:hover { transform: translateY(-12px); box-shadow: 0 26px 40px rgba(21, 32, 57, .22); }
  @supports (animation-timeline: view()) {
    .js-motion .service-cards .c { animation: card-pop linear both; animation-timeline: view(); animation-range: cover 0% cover 100%; }
    @keyframes card-pop {
      0% { translate: 0 44px; scale: .93; opacity: .25; }
      30% { translate: 0 0; scale: 1; opacity: 1; }
      70% { translate: 0 0; scale: 1; opacity: 1; }
      100% { translate: 0 -24px; scale: .95; opacity: .35; }
    }
  }

  /* 12. How It Works steps slide in from the right */
  .js-motion .steps li.reveal { transform: translateX(32px); }
  .js-motion main { overflow-x: hidden; overflow-x: clip; }
  .js-motion .steps li.reveal.is-in { transform: none; }

  /* 13. Sound Familiar cards flip */
  .is-flip .flip-inner { transition: transform .7s cubic-bezier(.2,.8,.2,1); }

  /* 10. FAQ answers slide open */
  .faq-item .faq-body { overflow: hidden; }
  .faq-item summary::after { transition: transform .3s ease; }
  .faq-item[open] summary::after { transform: rotate(180deg); }
}
