/* BT San demo motion layer for the 4 WordPress demos. Scroll-reveal hidden states are added inline by
   btsan-demo-style.php (same selector list as _motion.js). Per-site colors: --wpm-accent in each <site>.css. */
:root { --wpm-ease: cubic-bezier(.22, 1, .36, 1); --wpm-spring: cubic-bezier(.34, 1.56, .64, 1); --wpm-accent: currentColor; }
.wp-block-cover { overflow: hidden; }
ul.products li.product figure, ul.products li.product .ct-media-container, .loop-entry .post-thumbnail, .wp-block-latest-posts__featured-image { overflow: hidden; }

/* animated underline on menu links (no motion = it still appears, just without the slide) */
header :is(.wp-block-navigation-item__content, .main-navigation .menu-item > a, .ct-menu-link) {
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat; transition: background-size .45s var(--wpm-ease);
}
header :is(.wp-block-navigation-item__content, .main-navigation .menu-item > a, .ct-menu-link):is(:hover, :focus-visible, [aria-current="page"]) { background-size: 100% 1px; }

@media (prefers-reduced-motion: no-preference) {
  /* page to page: cross-document crossfade where the browser supports it */
  @view-transition { navigation: auto; }
  ::view-transition-old(root) { animation: .25s ease-in both wpm-fade-out; }
  ::view-transition-new(root) { animation: .45s var(--wpm-ease) both wpm-page; }

  /* opening cover: content rises in order, picture settles from a slow zoom */
  :is(.entry-content, .wp-block-post-content) > .wp-block-cover:first-child .wp-block-cover__inner-container > * { animation: wpm-up 1.1s var(--wpm-ease) backwards; }
  :is(.entry-content, .wp-block-post-content) > .wp-block-cover:first-child .wp-block-cover__inner-container > :nth-child(1) { animation-delay: .15s; }
  :is(.entry-content, .wp-block-post-content) > .wp-block-cover:first-child .wp-block-cover__inner-container > :nth-child(2) { animation-delay: .35s; }
  :is(.entry-content, .wp-block-post-content) > .wp-block-cover:first-child .wp-block-cover__inner-container > :nth-child(3) { animation-delay: .55s; }
  :is(.entry-content, .wp-block-post-content) > .wp-block-cover:first-child .wp-block-cover__inner-container > :nth-child(n+4) { animation-delay: .75s; }
  :is(.entry-content, .wp-block-post-content) > .wp-block-cover:first-child .wp-block-cover__image-background { animation: wpm-zoom 2.6s var(--wpm-ease) backwards; }

  /* cover pictures drift with the scroll (scroll timelines only) */
  @supports (animation-timeline: view()) {
    .wp-block-cover .wp-block-cover__image-background { scale: 1.14; animation: wpm-parallax linear both; animation-timeline: view(); }
    :is(.entry-content, .wp-block-post-content) > .wp-block-cover:first-child .wp-block-cover__image-background {
      animation: wpm-zoom 2.6s var(--wpm-ease) backwards, wpm-parallax linear both; animation-timeline: auto, view();
    }
    body:is(.single-post, .single-product)::after {
      content: ""; position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 99999; pointer-events: none; transform-origin: 0 50%;
      background: var(--wpm-accent); scale: 0 1; animation: wpm-progress linear both; animation-timeline: scroll(root);
    }
  }

  /* hover / press */
  :is(.wp-block-button__link, .button, .ct-button, .wp-element-button, button[type="submit"], input[type="submit"]) {
    transition: translate .35s var(--wpm-ease), box-shadow .35s var(--wpm-ease), background-color .25s, color .25s, filter .25s, scale .15s;
  }
  :is(.wp-block-button__link, .button, .ct-button, .wp-element-button):hover { translate: 0 -2px; }
  :is(.wp-block-button__link, .button, .ct-button, .wp-element-button, button[type="submit"], input[type="submit"]):active { scale: .97; translate: none; }
  :is(ul.products li.product, .loop-entry, .wp-block-latest-posts > li) img { transition: scale 1.1s var(--wpm-ease), filter .5s; }
  :is(ul.products li.product, .loop-entry, .wp-block-latest-posts > li):hover img { scale: 1.05; }
  main .wp-block-image a img, main figure > a img { transition: scale 1.1s var(--wpm-ease); }
  main .wp-block-image a:hover img, main figure > a:hover img { scale: 1.04; }
  main .wp-block-image:has(> a) { overflow: hidden; }
  :is(ul.products li.product, .loop-entry) { transition: translate .45s var(--wpm-ease), box-shadow .45s var(--wpm-ease); }
  :is(ul.products li.product, .loop-entry).is-done:hover { translate: 0 -4px; }
  details > :not(summary) { animation: wpm-up .5s var(--wpm-ease) backwards; }
  details summary { transition: color .2s; }

  /* WooCommerce feedback */
  .added_to_cart, .woocommerce-message, .woocommerce-info, .wc-block-components-notice-banner { animation: wpm-pop .5s var(--wpm-spring) backwards; }
  .ct-dynamic-count-cart, .ct-cart-item [data-count] { animation: wpm-pop .5s var(--wpm-spring) backwards; }
  .add_to_cart_button.added { animation: wpm-press .45s var(--wpm-spring); }
}

@keyframes wpm-up { from { opacity: 0; translate: 0 28px; } }
@keyframes wpm-zoom { from { scale: 1.32; opacity: .5; } }
@keyframes wpm-parallax { from { translate: 0 -6%; } to { translate: 0 6%; } }
@keyframes wpm-progress { to { scale: 1 1; } }
@keyframes wpm-page { from { opacity: 0; translate: 0 10px; } }
@keyframes wpm-fade-out { to { opacity: 0; } }
@keyframes wpm-pop { from { opacity: 0; scale: .85; } }
@keyframes wpm-press { 40% { scale: .94; } }
