/* Native WooCommerce galleries only. Product content and layout outside the gallery are unchanged. */
body.woocommerce.single-product div.product[id] .woocommerce-product-gallery.bbg-ready {
    --bbg-slide: 80%;
    --bbg-gap: 12px;
    position: relative;
    overflow: hidden;
    isolation: isolate;
    opacity: 1;
}
body.woocommerce.single-product div.product[id] .bbg-ready > .woocommerce-product-gallery__wrapper {
    border: 0 !important;
    box-shadow: none;
    direction: ltr;
    display: flex;
    gap: var(--bbg-gap);
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    touch-action: pan-x pan-y;
    margin: 0;
    padding: 0;
}
body.woocommerce.single-product div.product[id] .bbg-ready > .woocommerce-product-gallery__wrapper::-webkit-scrollbar { display: none; }
body.woocommerce.single-product div.product[id] .bbg-ready > .woocommerce-product-gallery__wrapper::after {
    content: '';
    flex: 0 0 calc(100% - var(--bbg-slide) - var(--bbg-gap));
}
body.woocommerce.single-product div.product[id] .bbg-ready .woocommerce-product-gallery__wrapper > .woocommerce-product-gallery__image {
    flex: 0 0 var(--bbg-slide);
    width: var(--bbg-slide);
    min-width: 0;
    aspect-ratio: 1;
    margin: 0;
    padding: 0;
    float: none;
    display: block;
    scroll-snap-align: start;
    overflow: hidden;
    border-radius: 12px;
    box-sizing: border-box;
    border: 1px solid #e7e3df;
    background: #fff;
}
body.woocommerce.single-product div.product[id] .bbg-ready .woocommerce-product-gallery__image > a {
    display: block;
    width: 100%;
    height: 100%;
    cursor: grab;
    -webkit-user-drag: none;
}
body.woocommerce.single-product div.product[id] .bbg-ready .woocommerce-product-gallery__image > a:active { cursor: grabbing; }
body.woocommerce.single-product div.product[id] .bbg-ready .woocommerce-product-gallery__image > a > img {
    display: block;
    width: 100%;
    height: 100%;
    max-height: none;
    object-fit: contain;
    object-position: center;
    user-select: none;
    -webkit-user-drag: none;
}
body.woocommerce.single-product div.product[id] .bbg-ready .bbg-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    aspect-ratio: auto;
    pointer-events: none;
    z-index: 5;
}
body.woocommerce.single-product div.product[id] .bbg-ready .bbg-arrow {
    position: absolute;
    top: calc(50% - 22px);
    width: 44px;
    height: 44px;
    min-width: 44px;
    padding: 0;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: #111;
    text-shadow: 0 0 2px #fff, 0 0 3px #fff;
    font: 400 18px Arial, sans-serif;
    line-height: 1;
    pointer-events: auto;
    opacity: 1;
    cursor: pointer;
    transition: opacity 140ms ease;
}
body.woocommerce.single-product div.product[id] .bbg-ready .bbg-prev { left: 24px; right: auto; top: calc(50% - 22px); bottom: auto; }
body.woocommerce.single-product div.product[id] .bbg-ready .bbg-next { right: 0; }
body.woocommerce.single-product div.product[id] .bbg-ready .bbg-arrow-icon {
    width: 26px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: drop-shadow(0 0 1px #fff) drop-shadow(0 0 2px #fff);
    transition: translate 160ms ease;
}
body.woocommerce.single-product div.product[id] .bbg-ready .bbg-prev .bbg-arrow-icon { rotate: 180deg; }
@media (hover: hover) and (pointer: fine) {
    body.woocommerce.single-product div.product[id] .bbg-ready .bbg-next:hover .bbg-arrow-icon { translate: 2px 0; }
    body.woocommerce.single-product div.product[id] .bbg-ready .bbg-prev:hover .bbg-arrow-icon { translate: -2px 0; }
}
body.woocommerce.single-product div.product[id] .bbg-ready .bbg-arrow[hidden],
body.woocommerce.single-product div.product[id] .bbg-ready .bbg-overlay[hidden] { display: none; }
body.woocommerce.single-product div.product[id] .bbg-ready .bbg-arrow:focus-visible {
    outline: 2px solid #111;
    outline-offset: -4px;
}
body.woocommerce.single-product div.product[id] .bbg-ready .bbg-count {
    position: absolute;
    bottom: 12px;
    left: 12px;
    background: rgba(255,255,255,.85);
    color: #433d37;
    padding: 6px 9px;
    border-radius: 16px;
    font: 400 11px/1.2 Arial, sans-serif;
    font-variant-numeric: tabular-nums;
    direction: ltr;
}
body.woocommerce.single-product div.product[id] .woocommerce-product-gallery.bbg-ready.bbg-single { --bbg-slide: min(100%, 560px); }
body.woocommerce.single-product div.product[id] .bbg-single > .woocommerce-product-gallery__wrapper::after { display: none; }
@media (max-width: 767px) {
    body.woocommerce.single-product div.product[id] .woocommerce-product-gallery.bbg-ready {
        /* Compact square images retain the whole photo and raise product information. */
        --bbg-slide: min(80%, 260px);
        width: 100% !important;
        max-width: none;
        margin-left: 0;
        margin-right: 0;
        --bbg-gap: 10px;
    }

    body.woocommerce.single-product div.product[id] .bbg-ready .woocommerce-product-gallery__wrapper > .woocommerce-product-gallery__image { aspect-ratio: 1; }
    body.woocommerce.single-product div.product[id] .woocommerce-product-gallery.bbg-ready.bbg-single { --bbg-slide: min(100%, 260px); }
    body.woocommerce.single-product div.product[id] .bbg-ready .bbg-overlay { width: 100%; height: 100%; aspect-ratio: auto; }
    body.woocommerce.single-product div.product[id] .bbg-ready .bbg-arrow { opacity: 1; top: auto; bottom: 8px; }
    body.woocommerce.single-product div.product[id] .bbg-ready .bbg-arrow { text-shadow: 0 0 2px #fff, 0 0 3px #fff; }
    body.woocommerce.single-product div.product[id] .bbg-ready .bbg-next { right: 0; top: calc(50% - 22px); bottom: auto; }
    body.woocommerce.single-product div.product[id] .bbg-ready .bbg-prev { left: 24px; right: auto; top: calc(50% - 22px); bottom: auto; }
}
@media (hover: none), (pointer: coarse) {
    body.woocommerce.single-product div.product[id] .bbg-ready .bbg-arrow { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
    body.woocommerce.single-product div.product[id] .bbg-ready .bbg-arrow { transition: none; }
    body.woocommerce.single-product div.product[id] .bbg-ready .bbg-arrow-icon { transition: none; translate: none; }
}


body.woocommerce.single-product div.product[id] .bbg-single > .woocommerce-product-gallery__wrapper { justify-content: center; }

/* Adapt existing BeRocket and savings overlays to the actual main-image card.
   Product lists, badge content and the native label stacking rules are untouched. */
body.woocommerce.single-product div.product[id] .bbg-ready > .berocket_better_labels_image {
    left: var(--bbg-label-card-left, 0px) !important;
    right: auto !important;
    width: var(--bbg-label-card-width, 80%) !important;
}
body.woocommerce.single-product div.product[id] .bbg-ready > .bbs-image-slot {
    right: calc(100% - var(--bbg-label-card-left, 0px) - var(--bbg-label-card-width, 80%) + 10px) !important;
}
/* The savings integration deliberately aligns its leading label to the full
   gallery via inline !important offsets. Compensate without fighting its writes. */
body.woocommerce.single-product div.product[id] .bbg-ready > .berocket_better_labels_image .bbs-leading-label {
    translate: var(--bbg-label-leading-shift, 0px) 0;
}
body.woocommerce.single-product div.product[id] .bbg-ready > .berocket_better_labels_image .br_alabel,
body.woocommerce.single-product div.product[id] .bbg-ready > .bbs-image-slot .bbs-savings {
    max-width: calc(var(--bbg-label-card-width, 260px) - 20px) !important;
    box-sizing: border-box;
}
