/*
 * D&H Huawei Child Theme v2.2.21
 * Product gallery smooth JS follow layout.
 * Desktop only. Mobile/tablet keeps the existing WooCommerce/Astra flow.
 *
 * Purpose:
 * - Do not constrain the whole right summary to gallery height.
 * - Do not create internal summary/description scrolling.
 * - Use a JS transform follow fallback instead of relying only on CSS sticky,
 *   because some Astra/WooCommerce wrappers can prevent sticky from taking effect.
 */

@media (min-width: 1025px) {
  body.dhh-single-product.dhh-product-gallery-follow-v2221 div.product {
    --dh-gallery-follow-top: 96px;
    --dh-gallery-follow-offset: 0px;
  }

  /* Explicitly cancel the previous compact summary experiment. */
  body.dhh-single-product.dhh-product-gallery-follow-v2221 .summary.entry-summary,
  body.dhh-single-product.dhh-product-gallery-follow-v2221 div.product .entry-summary {
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    overflow: visible !important;
    display: block !important;
  }

  body.dhh-single-product.dhh-product-gallery-follow-v2221 .dhh-summary-scroll-region,
  body.dhh-single-product.dhh-product-gallery-follow-v2221 .dhh-summary-purchase-region {
    display: contents !important;
  }

  body.dhh-single-product.dhh-product-gallery-follow-v2221 .summary.entry-summary > .woocommerce-product-details__short-description,
  body.dhh-single-product.dhh-product-gallery-follow-v2221 div.product .entry-summary > .woocommerce-product-details__short-description {
    overflow: visible !important;
    max-height: none !important;
  }

  /* Allow the transformed gallery to remain visible outside tight theme wrappers. */
  body.dhh-single-product.dhh-product-gallery-follow-v2221 .site,
  body.dhh-single-product.dhh-product-gallery-follow-v2221 .site-content,
  body.dhh-single-product.dhh-product-gallery-follow-v2221 .content-area,
  body.dhh-single-product.dhh-product-gallery-follow-v2221 .ast-container,
  body.dhh-single-product.dhh-product-gallery-follow-v2221 .ast-woocommerce-container,
  body.dhh-single-product.dhh-product-gallery-follow-v2221 div.product,
  body.dhh-single-product.dhh-product-gallery-follow-v2221 div.product div.images,
  body.dhh-single-product.dhh-product-gallery-follow-v2221 div.product .woocommerce-product-gallery {
    overflow: visible !important;
  }

  /* JS applies translateY to the gallery. This is more reliable than CSS sticky on this layout. */
  body.dhh-single-product.dhh-product-gallery-follow-v2221 div.product .woocommerce-product-gallery,
  body.dhh-single-product.dhh-product-gallery-follow-v2221 div.product .images,
  body.dhh-single-product.dhh-product-gallery-follow-v2221 div.product .dhh-product-gallery,
  body.dhh-single-product.dhh-product-gallery-follow-v2221 div.product .product-gallery {
    position: relative !important;
    top: auto !important;
    z-index: 3;
    transform: translate3d(0, var(--dh-gallery-follow-offset, 0px), 0);
  }

  body.dhh-single-product.dhh-product-gallery-follow-v2221 div.product .dhh-gallery-follow-ready {
    transition: none !important;
    backface-visibility: hidden;
  }

  /* Prevent the moving gallery from sitting above later WooCommerce sections. */
  body.dhh-single-product.dhh-product-gallery-follow-v2221 div.product .woocommerce-tabs,
  body.dhh-single-product.dhh-product-gallery-follow-v2221 div.product .related,
  body.dhh-single-product.dhh-product-gallery-follow-v2221 div.product .upsells {
    position: relative;
    z-index: 4;
  }
}

@media (max-width: 1024px) {
  body.dhh-single-product.dhh-product-gallery-follow-v2221 div.product .woocommerce-product-gallery,
  body.dhh-single-product.dhh-product-gallery-follow-v2221 div.product .images,
  body.dhh-single-product.dhh-product-gallery-follow-v2221 div.product .dhh-product-gallery,
  body.dhh-single-product.dhh-product-gallery-follow-v2221 div.product .product-gallery {
    position: relative !important;
    top: auto !important;
    transform: none !important;
  }

  body.dhh-single-product.dhh-product-gallery-follow-v2221 .dhh-summary-scroll-region,
  body.dhh-single-product.dhh-product-gallery-follow-v2221 .dhh-summary-purchase-region {
    display: contents !important;
  }
}
