/* Full-size image viewer used by [data-lightbox-src] triggers (product images).
   Plain CSS on purpose: web.css is generated from web.less by the Web Compiler VS extension,
   so a self-contained component file keeps this shippable without a Less build.
   Behaviour lives in /assets/js/imageLightbox.js. */

.image-lightbox {
    position: fixed;
    inset: 0;
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: #fff;
    overflow: hidden;
    overscroll-behavior: contain;
    opacity: 0;
    /* Drives the backdrop alpha so swipe-to-dismiss can fade the dim as you drag. */
    --image-lightbox-dim: .93;
    transition: opacity .18s ease, overlay .18s ease allow-discrete, display .18s ease allow-discrete;
}

    .image-lightbox[open] {
        opacity: 1;
    }

@starting-style {
    .image-lightbox[open] {
        opacity: 0;
    }
}

.image-lightbox::backdrop {
    background: rgba(0, 0, 0, var(--image-lightbox-dim, .93));
}

.image-lightbox:focus-visible {
    outline: none;
}

/* The stage owns every pointer gesture (pinch, pan, swipe-to-dismiss), so touch-action
   has to be none — otherwise the browser eats the moves for scrolling/zooming the page. */
.image-lightbox__stage {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    cursor: zoom-in;
}

.image-lightbox.is-zoomed .image-lightbox__stage {
    cursor: grab;
}

.image-lightbox.is-panning .image-lightbox__stage {
    cursor: grabbing;
}

/* No cropping: the image is only ever scaled down to fit, never cut. */
.image-lightbox__image {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    transform-origin: center center;
    -webkit-user-drag: none;
    opacity: 0;
    transition: opacity .15s ease;
}

    .image-lightbox__image.is-ready {
        opacity: 1;
    }

.image-lightbox.is-animating .image-lightbox__image {
    transition: opacity .15s ease, transform .2s ease;
}

.image-lightbox__close {
    position: absolute;
    z-index: 2;
    top: calc(env(safe-area-inset-top, 0px) + .75rem);
    right: calc(env(safe-area-inset-right, 0px) + .75rem);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    /* Scrim + hairline so the X stays readable on both dark and blown-out images. */
    background: rgba(0, 0, 0, .55);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .28);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    color: #fff;
    cursor: pointer;
    transition: background-color .15s ease, transform .15s ease;
}

    .image-lightbox__close:hover,
    .image-lightbox__close:focus-visible {
        background: rgba(0, 0, 0, .85);
    }

    .image-lightbox__close:focus-visible {
        outline: 2px solid #fff;
        outline-offset: 2px;
    }

    .image-lightbox__close:active {
        transform: scale(.94);
    }

    .image-lightbox__close svg {
        width: 1.25rem;
        height: 1.25rem;
        display: block;
    }

.image-lightbox__caption {
    position: absolute;
    z-index: 2;
    left: 50%;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 1rem);
    transform: translateX(-50%);
    max-width: min(90%, 40rem);
    margin: 0;
    padding: .4rem .9rem;
    border-radius: 999px;
    background: rgba(0, 0, 0, .55);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    font-size: .875rem;
    line-height: 1.3;
    text-align: center;
    pointer-events: none;
    transition: opacity .15s ease;
}

.image-lightbox.is-zoomed .image-lightbox__caption {
    opacity: 0;
}

.image-lightbox__caption:empty {
    display: none;
}

.image-lightbox__spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2.5rem;
    height: 2.5rem;
    margin: -1.25rem 0 0 -1.25rem;
    border: 3px solid rgba(255, 255, 255, .25);
    border-top-color: #fff;
    border-radius: 50%;
    animation: image-lightbox-spin .8s linear infinite;
}

    .image-lightbox__spinner[hidden] {
        display: none;
    }

@keyframes image-lightbox-spin {
    to {
        transform: rotate(360deg);
    }
}

/* The trigger wrapping the product thumbnail — a real button so Enter/Space work. */
.product-modal__image-zoom {
    display: block;
    width: 100%;
    padding: 0;
    margin: 0;
    border: 0;
    background: none;
    cursor: zoom-in;
}

    .product-modal__image-zoom:focus-visible {
        outline: 2px solid #fff;
        outline-offset: -4px;
    }

@media (prefers-reduced-motion: reduce) {
    .image-lightbox,
    .image-lightbox__image,
    .image-lightbox__close {
        transition: none;
    }

    .image-lightbox.is-animating .image-lightbox__image {
        transition: none;
    }

    .image-lightbox__spinner {
        animation-duration: 2s;
    }
}
