.product-gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: clamp(.75rem, 2vw, 1.5rem);
    color: #fff;
}

.product-gallery-lightbox.hidden {
    display: none;
}

.product-gallery-lightbox__backdrop {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 50% 35%, rgba(67, 79, 96, .3), transparent 45%),
        rgba(7, 10, 15, .92);
    backdrop-filter: blur(16px);
    animation: product-gallery-fade-in .22s ease-out both;
}

.product-gallery-lightbox__panel {
    position: relative;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    width: min(100%, 1440px);
    height: min(94dvh, 940px);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 24px;
    background: rgba(18, 22, 29, .82);
    box-shadow: 0 30px 100px rgba(0, 0, 0, .55);
    animation: product-gallery-panel-in .28s cubic-bezier(.2, .8, .2, 1) both;
}

.product-gallery-lightbox__header {
    position: relative;
    z-index: 4;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 1rem;
    min-height: 74px;
    padding: .8rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, .09);
    background: rgba(20, 25, 33, .78);
    backdrop-filter: blur(18px);
}

.product-gallery-lightbox__heading {
    min-width: 0;
}

.product-gallery-lightbox__heading h2 {
    overflow: hidden;
    margin: .15rem 0 0;
    font-size: clamp(.9rem, 2vw, 1.1rem);
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.product-gallery-lightbox__eyebrow {
    color: rgba(255, 255, 255, .5);
    font-size: .72rem;
}

.product-gallery-lightbox__counter {
    display: flex;
    align-items: center;
    gap: .35rem;
    min-width: 66px;
    padding: .45rem .75rem;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 999px;
    background: rgba(255, 255, 255, .07);
    direction: ltr;
    font-variant-numeric: tabular-nums;
    justify-content: center;
}

.product-gallery-lightbox__icon-button,
.product-gallery-lightbox__nav,
.product-gallery-lightbox__zoom-tools button {
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .13);
    color: #fff;
    background: rgba(255, 255, 255, .08);
    transition: transform .2s ease, border-color .2s ease, background .2s ease, opacity .2s ease;
}

.product-gallery-lightbox__icon-button {
    width: 44px;
    height: 44px;
    border-radius: 14px;
}

.product-gallery-lightbox__icon-button:hover,
.product-gallery-lightbox__nav:hover,
.product-gallery-lightbox__zoom-tools button:hover {
    border-color: rgba(255, 255, 255, .32);
    background: rgba(255, 255, 255, .16);
    transform: translateY(-1px);
}

.product-gallery-lightbox__stage {
    position: relative;
    min-height: 0;
    overflow: hidden;
    background-image:
        linear-gradient(45deg, rgba(255, 255, 255, .025) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(255, 255, 255, .025) 25%, transparent 25%);
    background-size: 28px 28px;
}

.product-gallery-modern-swiper,
.product-gallery-modern-swiper .swiper-wrapper,
.product-gallery-modern-swiper .swiper-slide {
    width: 100%;
    height: 100%;
}

.product-gallery-modern-swiper .swiper-slide {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.product-gallery-modern-swiper .swiper-zoom-container {
    width: 100%;
    height: 100%;
}

.product-gallery-lightbox__image {
    display: block;
    width: auto;
    height: auto;
    max-width: calc(100% - 7rem);
    max-height: calc(100% - 2rem);
    object-fit: contain;
    cursor: zoom-in;
    user-select: none;
    filter: drop-shadow(0 18px 35px rgba(0, 0, 0, .35));
}

.product-gallery-modern-swiper .swiper-slide-zoomed .product-gallery-lightbox__image {
    cursor: grab;
}

.product-gallery-modern-swiper .swiper-slide-zoomed .product-gallery-lightbox__image:active {
    cursor: grabbing;
}

.product-gallery-lightbox__nav {
    position: absolute;
    z-index: 3;
    top: 50%;
    width: 50px;
    height: 50px;
    border-radius: 17px;
    backdrop-filter: blur(14px);
    transform: translateY(-50%);
}

.product-gallery-lightbox__nav:hover {
    transform: translateY(calc(-50% - 1px));
}

.product-gallery-lightbox__nav--next {
    right: 1rem;
}

.product-gallery-lightbox__nav--prev {
    left: 1rem;
}

.product-gallery-lightbox__nav.swiper-button-disabled {
    pointer-events: none;
    opacity: .25;
}

.product-gallery-lightbox__zoom-tools {
    position: absolute;
    z-index: 4;
    bottom: 1rem;
    left: 50%;
    display: flex;
    gap: .35rem;
    padding: .35rem;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 16px;
    background: rgba(12, 16, 22, .72);
    backdrop-filter: blur(16px);
    transform: translateX(-50%);
}

.product-gallery-lightbox__zoom-tools button {
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 11px;
}

.product-gallery-lightbox__hint {
    position: absolute;
    z-index: 2;
    right: 1rem;
    bottom: 1rem;
    margin: 0;
    padding: .45rem .7rem;
    border-radius: 10px;
    color: rgba(255, 255, 255, .6);
    background: rgba(12, 16, 22, .55);
    font-size: .72rem;
    pointer-events: none;
}

.product-gallery-lightbox__thumbs {
    display: flex;
    gap: .65rem;
    min-height: 94px;
    overflow-x: auto;
    padding: .75rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, .09);
    background: rgba(20, 25, 33, .82);
    scrollbar-color: rgba(255, 255, 255, .2) transparent;
}

.product-gallery-lightbox__thumbs button {
    flex: 0 0 68px;
    width: 68px;
    height: 68px;
    overflow: hidden;
    padding: 3px;
    border: 1px solid transparent;
    border-radius: 14px;
    background: rgba(255, 255, 255, .06);
    opacity: .58;
    transition: opacity .2s ease, border-color .2s ease, transform .2s ease;
}

.product-gallery-lightbox__thumbs button:hover,
.product-gallery-lightbox__thumbs button.is-active {
    border-color: #ef4444;
    opacity: 1;
    transform: translateY(-2px);
}

.product-gallery-lightbox__thumbs img {
    width: 100%;
    height: 100%;
    border-radius: 10px;
    object-fit: cover;
}

body.product-gallery-is-open {
    overflow: hidden;
}

@media (max-width: 767px) {
    .product-gallery-lightbox {
        padding: 0;
    }

    .product-gallery-lightbox__panel {
        width: 100%;
        height: 100dvh;
        border: 0;
        border-radius: 0;
    }

    .product-gallery-lightbox__header {
        min-height: 64px;
        padding: .6rem .75rem;
    }

    .product-gallery-lightbox__eyebrow,
    .product-gallery-lightbox__hint {
        display: none;
    }

    .product-gallery-lightbox__nav {
        top: auto;
        bottom: .9rem;
        width: 42px;
        height: 42px;
        border-radius: 14px;
        transform: none;
    }

    .product-gallery-lightbox__nav:hover {
        transform: translateY(-1px);
    }

    .product-gallery-lightbox__nav--next {
        right: .75rem;
    }

    .product-gallery-lightbox__nav--prev {
        left: .75rem;
    }

    .product-gallery-lightbox__image {
        max-width: calc(100% - 1rem);
        max-height: calc(100% - 1rem);
    }

    .product-gallery-lightbox__thumbs {
        min-height: 80px;
        padding: .55rem .75rem;
    }

    .product-gallery-lightbox__thumbs button {
        flex-basis: 56px;
        width: 56px;
        height: 56px;
        border-radius: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .product-gallery-lightbox__backdrop,
    .product-gallery-lightbox__panel {
        animation: none;
    }

    .product-gallery-lightbox *,
    .product-gallery-lightbox *::before,
    .product-gallery-lightbox *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
    }
}

@keyframes product-gallery-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes product-gallery-panel-in {
    from {
        opacity: 0;
        transform: translateY(18px) scale(.985);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}
