/* motion.css: every movement on the site, in one place. All of it sits inside "no-preference": with reduced motion asked for, nothing here applies and nothing moves.
   Content is visible by default: the .rv classes are added by motion.js only to things still below the screen, never set in the page's HTML. */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }

  /* page to page: a short cross-fade where the browser supports it; the header holds still, and a clicked product photo
     grows into the product page's photo (motion.js names the clicked one "fp-shot") */
  @view-transition { navigation: auto; }
  ::view-transition-old(root) { animation: fp-leave .16s ease-in both; }
  ::view-transition-new(root) { animation: fp-arrive .3s var(--ease-out) both; }
  .fp-top { view-transition-name: fp-top; }
  .phero-media { view-transition-name: fp-shot; }
  ::view-transition-group(fp-shot) { animation-duration: .42s; animation-timing-function: var(--ease-out); }
  @keyframes fp-leave { to { opacity: 0; } }
  @keyframes fp-arrive { from { opacity: 0; transform: translateY(8px); } }

  /* home hero: the words arrive one after the other and the photo settles. The photo is never hidden (it is the page's largest paint). */
  .hero-text > * { animation: fp-rise .7s var(--ease-out) backwards; }
  .hero-text > :nth-child(2) { animation-delay: 70ms; }
  .hero-text > :nth-child(3) { animation-delay: 140ms; }
  .hero-text > :nth-child(4) { animation-delay: 210ms; }
  .hero-text > :nth-child(5) { animation-delay: 280ms; }
  .hero-media img { animation: fp-settle 1.4s var(--ease-out) backwards; }
  @keyframes fp-rise { from { opacity: 0; transform: translateY(14px); } }
  @keyframes fp-settle { from { transform: scale(1.06); } }

  /* scroll reveals (motion.js): sections rise as they come into view, headings slide in from the left, steps count in */
  .rv { opacity: 0; transform: translateY(18px); }
  .rv.rv-x { transform: translateX(-16px); }
  .rv.rv-in { opacity: 1; transform: none; transition: opacity .6s var(--ease-out) var(--rv-d, 0ms), transform .75s var(--ease-out) var(--rv-d, 0ms); }
  .how li.rv::before { transform: scale(.4); }
  .how li.rv.rv-in::before { transform: none; transition: transform .6s var(--ease-out) calc(var(--rv-d, 0ms) + 80ms); }

  /* product cards: the photo lifts and comes a little closer, the "See prices" arrow slides in */
  .pcard-img { transition: transform .5s var(--ease-out), box-shadow .5s var(--ease-out); }
  .pcard-img img { transition: transform .8s var(--ease-out); }
  .pcard-cta::after { content: "\2192" / ""; display: inline-block; margin-left: 6px; opacity: 0; transform: translateX(-6px); transition: opacity .25s ease, transform .35s var(--ease-out); }
  @media (hover: hover) {
    .pcard a:hover .pcard-img, .pcard a:focus-visible .pcard-img { transform: translateY(-4px); box-shadow: 0 18px 30px -18px rgba(23, 35, 28, .5); }
    .pcard a:hover .pcard-img img, .pcard a:focus-visible .pcard-img img { transform: scale(1.045); }
    .pcard a:hover .pcard-cta::after, .pcard a:focus-visible .pcard-cta::after { opacity: 1; transform: none; }
  }

  /* buttons and pills: colours ease instead of snapping, a press gives way a little, arrows lean forward */
  .btn, .btn-outline, a.pill-mustard, .finder-go, .finder-chip, .finder-clear { transition: background-color .18s ease, color .18s ease, border-color .18s ease, box-shadow .18s ease, transform .14s ease; }
  .btn:active, .btn-outline:active, a.pill-mustard:active, .finder-go:active, .finder-chip:active { transform: scale(.97); }
  .btn-outline span[aria-hidden], .finder-arrow { display: inline-block; transition: transform .3s var(--ease-out); }
  .btn-outline:hover span[aria-hidden], .finder-link:hover .finder-arrow { transform: translateX(4px); }

  /* main menu: the underline of the current page also draws under the link being pointed at (same place, 6 px from the bottom) */
  .fp-nav > ul > li > a:not(.pill-mustard) { background: linear-gradient(currentColor, currentColor) no-repeat left calc(100% + 4px) / 0 2px; background-origin: content-box; transition: background-size .3s var(--ease-out), color .18s ease; }
  .fp-nav > ul > li > a:not(.pill-mustard):hover { background-size: 100% 2px; }

  /* questions and answers: the answer eases open */
  .acc details[open] .acc-body { animation: fp-open .3s var(--ease-out); }
  @keyframes fp-open { from { opacity: 0; transform: translateY(-6px); } }

  /* product page: a changed price rolls into place (price-tick.js sets the class and the direction) */
  .is-ticking { animation: fp-tick .4s var(--ease-out); }
  @keyframes fp-tick { from { opacity: .15; transform: translateY(var(--tick-from, .3em)); } }

  /* waiting states breathe */
  .loading::before, .finder-skel .pcard-img, .finder-skel-l { animation: fp-breathe .9s ease-in-out infinite alternate; }
  @keyframes fp-breathe { to { opacity: .4; } }

  /* the finder: the list drops in under the box, the answer cards are dealt out one by one */
  .finder-box { transition: box-shadow .2s ease, border-color .2s ease; }
  .finder-list:not([hidden]) { animation: fp-drop .2s var(--ease-out); }
  .finder-card:not(.finder-skel) { animation: fp-deal .55s var(--ease-out) backwards; animation-delay: calc(var(--i, 0) * 70ms); }
  .finder-results-in > .finder-h, .finder-reply, .finder-next, .finder-note { animation: fp-rise .45s var(--ease-out) backwards; }
  @keyframes fp-drop { from { opacity: 0; transform: translateY(-6px); } }
  @keyframes fp-deal { from { opacity: 0; transform: translateY(18px) scale(.97); } }
}

/* paper never waits for a reveal */
@media print {
  .rv { opacity: 1 !important; transform: none !important; }
}
