/* Keep detail inspection in the existing photograph frame. */
body.single-product { --ml-product-watermark-opacity: .045; }
.ml-product-loupe { position: relative; }
.ml-product-loupe > .ml-gallery-watermark {
    position: absolute;
    inset: 0;
    z-index: 0;
    background-position: center;
    background-repeat: no-repeat;
    background-size: 84% auto;
    opacity: var(--ml-product-watermark-opacity);
    pointer-events: none;
    user-select: none;
}
.ml-product-detail {
    display: none;
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 2;
    /* The original image is hidden during zoom; retain the same paper and logo below. */
    background: transparent;
}
.ml-product-loupe.is-detail-visible .ml-product-detail { display: block; }
.ml-product-loupe.is-detail-visible .wp-post-image { opacity: 0; }
body.ml-cellar-page.single-product.woocommerce #content div.product div.images .ml-product-detail-image {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: var(--ml-detail-width) !important;
    height: var(--ml-detail-height) !important;
    max-width: none !important;
    max-height: none !important;
    min-width: 0 !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    filter: none !important;
    transform: translate3d(var(--ml-detail-x), var(--ml-detail-y), 0) !important;
    pointer-events: none;
}
body.single-product .ml-product-expand {
    position: absolute;
    z-index: 3;
    right: 12px;
    top: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid rgba(143,98,29,.18);
    border-radius: 2px;
    background: rgba(255,255,255,.88);
    color: #211b17;
    box-shadow: none;
    cursor: pointer;
    transform: none;
}
body.single-product .ml-product-expand:hover { background: #fff; color: #71531e; transform: none; }
body.single-product .ml-product-expand:focus-visible,
body.single-product .woocommerce-product-gallery__image a:focus-visible { outline: 2px solid #71531e; outline-offset: 4px; }
.ml-product-expand svg { pointer-events: none; }

/* The full photograph sits above the fixed header and uses the catalog paper. */
body.single-product .pswp { z-index: 10080 !important; }
body.single-product .pswp__bg,
body.single-product .pswp__img--placeholder--blank { background: #eeece7; }
body.single-product .pswp__bg .ml-product-watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    display: block;
    width: min(84vw, 1100px);
    height: auto;
    max-height: 45vh;
    object-fit: contain;
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
    opacity: var(--ml-product-watermark-opacity);
    transform: translate(-50%, -50%);
    pointer-events: none;
    user-select: none;
}
body.single-product .pswp__top-bar { display: flex; align-items: center; justify-content: flex-end; background: rgba(238,236,231,.96); }
body.single-product .pswp__counter { color: #211b17; margin-right: auto; }
body.single-product .pswp__top-bar .pswp__preloader { position: absolute; left: auto; right: 96px; top: 0; margin: 0; }
body.single-product .pswp__button { flex: 0 0 44px; margin: 0; opacity: 1; filter: invert(1); transform: none !important; box-shadow: none !important; }
/* The icon filter also inverts the focus outline back to the brand's dark gold. */
body.single-product .pswp__button:focus-visible { outline: 2px solid #8eace1; outline-offset: -5px; }
body.single-product .pswp__caption { display: none; }
body.single-product .pswp__button--share,
body.single-product .pswp__button--fs { display: none; }

@media (hover: hover) and (pointer: fine) and (min-width: 981px) and (prefers-reduced-motion: no-preference) {
    .ml-product-loupe .woocommerce-product-gallery__image a { cursor: zoom-in; }
}
@media (prefers-reduced-motion: reduce) {
    body.single-product .pswp, body.single-product .pswp * { transition: none !important; animation: none !important; }
}
