/* Shared product continuity for normal same-origin document navigation. */
@view-transition {
  navigation: auto;
}

/*
 * WooCommerce intentionally hides the gallery until FlexSlider is ready.
 * That leaves the destination image absent from the browser's transition
 * snapshot. Keep the first image paintable and temporarily suppress the
 * remaining slides until FlexSlider creates its viewport.
 */
.single-product .woocommerce-product-gallery {
  opacity: 1 !important;
}

.single-product .woocommerce-product-gallery:not(:has(.flex-viewport))
  .woocommerce-product-gallery__wrapper
  > .woocommerce-product-gallery__image:not(:first-child) {
  display: none;
}

/*
 * Do not cross-fade the complete document. The page swap should stay quiet
 * behind the three shared product elements instead of looking like a reload.
 */
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
}

::view-transition-group(*) {
  animation-duration: 420ms;
  animation-timing-function: cubic-bezier(.16,1,.3,1);
}

::view-transition-group(root) {
  animation-duration: 1ms;
}

@media (prefers-reduced-motion: reduce) {
  @view-transition {
    navigation: none;
  }
}
