/* ============================================================
   BARFmenu B2B - Product Zoom V2
   Asset: bm-product-zoom.css
   ============================================================ */

/* ============================================================
   PRODUCT PAGE / SOURCE IMAGE
   ============================================================ */

.bm-b2b-product-page .bm-b2b-product-media .product-images .swiper-slide img[data-original-image] {
    display: block;
    backface-visibility: hidden;
}

@media (hover: hover) and (pointer: fine) {
    .bm-b2b-product-page .bm-b2b-product-media .product-images .swiper-slide img[data-original-image] {
        cursor: zoom-in;
    }
}

.bm-b2b-product-page .bm-b2b-product-media .product-images a.zoom {
    z-index: 20;
    cursor: zoom-in;
}

/* ============================================================
   DESKTOP HIGH-RES HOVER BLOW-UP

   This is a separate high-res copy using data-original-image.
   It sits above the page and is not clipped by the Swiper frame.
   ============================================================ */

.bm-product-zoom-hover {
    position: fixed;
    z-index: 99990;
    overflow: hidden;
    background: #ffffff;
    border-radius: 7px;
    box-shadow: 0 12px 38px rgba(0, 0, 0, 0.20);
    transform: scale(1);
    transform-origin: center center;
    opacity: 0;
    pointer-events: none;
    transition:
        transform 180ms ease,
        opacity 120ms ease;
}

.bm-product-zoom-hover.bm-product-zoom-hover-visible {
    opacity: 1;
}

.bm-product-zoom-hover-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #ffffff;
}

/* ============================================================
   FULLSCREEN VIEWER
   ============================================================ */

html.bm-product-zoom-open,
html.bm-product-zoom-open body {
    overflow: hidden !important;
}

.bm-product-zoom-viewer {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px;
    opacity: 0;
    visibility: hidden;
    transition:
        opacity 160ms ease,
        visibility 160ms ease;
}

.bm-product-zoom-viewer.bm-product-zoom-viewer-visible {
    opacity: 1;
    visibility: visible;
}

.bm-product-zoom-backdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background: rgba(0, 0, 0, 0.86);
    cursor: zoom-out;
}

.bm-product-zoom-frame {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: min(1400px, calc(100vw - 56px));
    height: calc(100vh - 56px);
    overflow: hidden;
    pointer-events: none;
}

.bm-product-zoom-large {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.28);
    cursor: zoom-in;
    pointer-events: auto;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    transform: translate3d(0, 0, 0) scale(1);
    transform-origin: center center;
    transition: transform 180ms ease;
    will-change: transform;
}

.bm-product-zoom-large.bm-product-zoom-large-zoomed {
    cursor: grab;
}

.bm-product-zoom-large.bm-product-zoom-large-dragging {
    cursor: grabbing;
    transition: none;
}

.bm-product-zoom-close {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #ffffff;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 32px;
    font-weight: 400;
    line-height: 1;
    cursor: pointer;
    pointer-events: auto;
}

/* ============================================================
   MOBILE
   ============================================================ */

@media (max-width: 700px) {
    .bm-product-zoom-viewer {
        padding: 12px;
    }

    .bm-product-zoom-frame {
        width: calc(100vw - 24px);
        height: calc(100vh - 24px);
    }

    .bm-product-zoom-close {
        top: 8px;
        right: 8px;
        width: 42px;
        height: 42px;
    }

    .bm-b2b-product-page .bm-b2b-product-media .product-images .swiper-slide img[data-original-image] {
        cursor: zoom-in;
    }

    .bm-product-zoom-large {
        transition: transform 160ms ease;
    }

    .bm-product-zoom-large.bm-product-zoom-large-dragging {
        transition: none;
    }
}

/* Hover blow-up is desktop-only */
@media (hover: none), (pointer: coarse) {
    .bm-product-zoom-hover {
        display: none !important;
    }
}
