/* Hyva snap gallery only. Keep Alpine, slider track, markers and lightbox intact.
   The flex child must shrink below the intrinsic image width. Otherwise native
   scrollIntoView scrolls the outer overflow:hidden gallery and hides the pager. */
body.catalog-product-view #gallery[data-slider-type="gallery"]{
    min-width:0!important;
    max-width:100%;
    box-sizing:border-box;
    overflow:clip!important;
}
body.catalog-product-view #gallery[data-slider-type="gallery"] > div:has(> #gallery-main){
    min-width:0!important;
    max-width:100%;
    flex:1 1 0%!important;
    align-self:flex-start;
}
body.catalog-product-view #gallery[data-slider-type="gallery"] #gallery-main{
    width:100%!important;
    min-width:0!important;
    height:auto!important;
    max-height:520px;
    aspect-ratio:1 / 1!important;
    box-sizing:border-box;
}
body.catalog-product-view #gallery[data-slider-type="gallery"] #gallery-main > div{
    min-width:0;
    width:100%!important;
    flex:0 0 100%!important;
    height:100%;
}
body.catalog-product-view #gallery[data-slider-type="gallery"] #gallery-main > div > button[data-media-type]{
    width:100%;
    height:100%;
    min-width:0;
    min-height:0;
}
body.catalog-product-view #gallery[data-slider-type="gallery"] #gallery-main > div > button[data-media-type] > img{
    display:block;
    width:100%!important;
    height:100%!important;
    max-width:100%!important;
    max-height:100%!important;
    min-width:0;
    min-height:0;
    aspect-ratio:auto!important;
    object-fit:contain!important;
    object-position:center!important;
    box-sizing:border-box;
    padding:20px!important;
}
/* Main-gallery controls only: respect Alpine visibility for a single image. */
body.catalog-product-view #gallery[data-slider-type="gallery"] :is(button[data-prev],button[data-next]){
    color:#16374b!important;
    background:#fff!important;
    border:1px solid #c7d5dc!important;
    min-width:40px;
    min-height:40px;
}
body.catalog-product-view #gallery[data-slider-type="gallery"] :is(button[data-prev],button[data-next]):focus-visible{
    outline:3px solid #009b8b;
    outline-offset:2px;
}
@media (max-width:767px){
    body.catalog-product-view #gallery[data-slider-type="gallery"] #gallery-main{
        height:210px!important;
        max-height:210px;
        aspect-ratio:auto!important;
    }
    body.catalog-product-view #gallery[data-slider-type="gallery"] #gallery-main > div > button[data-media-type] > img{
        padding:12px!important;
    }
}
