/* FlexSlider expands its track immediately, then sizes/floats slides 100ms
   later. Keep the first image at the gallery width until those inline slide
   dimensions exist. No-JavaScript galleries retain their native markup. */
html.ah-gallery-stable .woocommerce-product-gallery__wrapper:not(:has(> .woocommerce-product-gallery__image[style*="float: left"], > .woocommerce-product-gallery__image[style*="float: right"])) {
    width: 100% !important;
    transform: none !important;
}
html.ah-gallery-stable .woocommerce-product-gallery__wrapper:not(:has(> .woocommerce-product-gallery__image[style*="float: left"], > .woocommerce-product-gallery__image[style*="float: right"])) > .woocommerce-product-gallery__image:not(:first-child) {
    display: none !important;
}
html.ah-gallery-stable .woocommerce-product-gallery:has(.woocommerce-product-gallery__wrapper > .woocommerce-product-gallery__image:nth-child(2)):not(:has(.flex-control-thumbs)) {
    padding-bottom: var(--ah-gallery-thumb-reserve, 84px);
}
html.ah-gallery-stable .woocommerce-product-gallery .flex-control-thumbs li { aspect-ratio: 1; }
/* The fullscreen viewer must cover the mobile sticky navigation, including
   its top-right close control. Keep the normal page/header stacking intact. */
body.single-product .pswp { z-index: 2147483300; }
@media(max-width:768px){
    html.ah-gallery-stable .woocommerce-product-gallery:has(.woocommerce-product-gallery__wrapper > .woocommerce-product-gallery__image:nth-child(2)):not(:has(.flex-control-thumbs)) { padding-bottom: var(--ah-gallery-thumb-reserve, 76px); }
}
