/**
 * Product gallery — stage, inner zoom and the fullscreen viewer theme.
 * Loaded after products.css so the stage rules win over `.product-basic__image img`.
 */

.fs-gallery__stage {
    position: relative;
    display: block;
    flex: 1 1 100%;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 12px;
    background-color: var(--Base-White, #ffffff);
    cursor: zoom-in;
    outline: none;
    touch-action: pan-y;
    isolation: isolate;
    -webkit-tap-highlight-color: transparent;
}

/* The stage is positioned and sits after the badge in the markup, so pin the
   painting order explicitly instead of relying on document order. */
.product-basic__image .fs-gallery__stage {
    z-index: 0;
}

.product-basic__image .product-discount,
.product-basic__image .product-additional__labels {
    z-index: 1;
}

.fs-gallery__stage:focus-visible {
    outline: 2px solid var(--Base-Dark, #171717);
    outline-offset: 2px;
}

.fs-gallery__frame,
.fs-gallery__zoom {
    position: absolute;
    inset: 0;
}

.fs-gallery__frame {
    z-index: 1;
    will-change: transform, opacity;
}

.fs-gallery__stage .fs-gallery__frame .fs-gallery__image {
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    aspect-ratio: auto;
    object-fit: contain;
    object-position: center;
    user-select: none;
    -webkit-user-drag: none;
}

.fs-gallery__zoom {
    z-index: 2;
    background-color: var(--Base-White, #ffffff);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 220ms ease, visibility 0s linear 220ms;
}

.fs-gallery__zoom.is-active {
    opacity: 1;
    visibility: visible;
    transition: opacity 140ms ease, visibility 0s;
}

.fs-gallery__stage .fs-gallery__zoom .fs-gallery__zoom-image {
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    aspect-ratio: auto;
    object-fit: contain;
    object-position: center;
    transform-origin: 0 0;
    will-change: transform;
}

/* Affordance ---------------------------------------------------------- */

.fs-gallery__hint {
    position: absolute;
    right: 12px;
    bottom: 12px;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: var(--Base-Dark, #171717);
    background-color: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--Gray-3, #e5e5e6);
    opacity: 0;
    transform: translateY(4px);
    pointer-events: none;
    transition: opacity 200ms ease, transform 200ms ease;
}

.fs-gallery__stage:hover .fs-gallery__hint,
.fs-gallery__stage:focus-visible .fs-gallery__hint {
    opacity: 1;
    transform: translateY(0);
}

.fs-gallery__stage.is-zooming .fs-gallery__hint {
    opacity: 0;
    transform: translateY(4px);
}

@media (hover: none) {
    .fs-gallery__stage {
        cursor: default;
    }

    .fs-gallery__hint {
        opacity: 1;
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .fs-gallery__frame,
    .fs-gallery__hint,
    .fs-gallery__zoom {
        transition-duration: 1ms;
    }
}

/* Fullscreen viewer --------------------------------------------------- */

.pswp--finespirits {
    --pswp-bg: #ffffff;
    --pswp-placeholder-bg: #fafafa;
    --pswp-icon-color: #171717;
    --pswp-icon-color-secondary: #ffffff;
    /* A white halo behind the glyphs: invisible on the white backdrop, keeps
       them readable once a dark photo is zoomed in under them. */
    --pswp-icon-stroke-color: rgba(255, 255, 255, 0.92);
    --pswp-icon-stroke-width: 2;
    --pswp-preloader-color: rgba(23, 23, 23, 0.12);
    --pswp-preloader-color-secondary: #171717;
    --pswp-root-z-index: 100000;
}

/* PhotoSwipe offsets the prev/next glyphs asymmetrically (left: 9px against
   right: 14px). That only shows once the buttons carry a visible box, so they
   stay flat here: quiet icons, no plates and no shadows. */
.pswp--finespirits .pswp__button {
    opacity: 0.5;
}

.pswp--touch.pswp--finespirits .pswp__button {
    opacity: 0.85;
}

/* PhotoSwipe sets `transition: none` on the interactive states. */
.pswp--finespirits .pswp__button,
.pswp--finespirits .pswp__button:hover,
.pswp--finespirits .pswp__button:active,
.pswp--finespirits .pswp__button:focus {
    transition: opacity 200ms ease;
}

.pswp--finespirits .pswp__button:hover,
.pswp--finespirits .pswp__button:focus-visible {
    opacity: 1;
}

.pswp--finespirits .pswp__counter {
    height: 60px;
    margin-left: 20px;
    color: var(--Gray-7, #7a7a85);
    font-size: 13px;
    font-weight: 500;
    line-height: 60px;
    letter-spacing: 0.08em;
    opacity: 1;
    text-shadow: none;
}

.pswp--finespirits .pswp__button--arrow--prev {
    left: 8px;
}

.pswp--finespirits .pswp__button--arrow--next {
    right: 8px;
}

@media (max-width: 720px) {
    .pswp--finespirits .pswp__counter {
        margin-left: 12px;
        font-size: 12px;
    }
}
