.product-gallery {
    display: grid;
    gap: 16px;
    width: 100%;
}

.product-gallery__stage {
    position: relative;
    border-radius: 30px;
    overflow: hidden;
    isolation: isolate;
    background: linear-gradient(160deg, rgba(var(--product-primary-rgb), 0.06), rgba(255, 255, 255, 0.88));
}

.product-gallery__background {
    position: absolute;
    inset: 0;
    z-index: 0;
    background:
        radial-gradient(circle at center, rgba(var(--product-primary-rgb), 0.18), transparent 60%),
        var(--gallery-background-image, none);
    background-size: cover;
    background-position: center;
    opacity: 0.16;
    filter: blur(34px) saturate(1.15);
    transform: scale(1.24);
    transition: opacity 0.35s ease, background-image 0.45s ease, transform 0.45s ease;
    pointer-events: none;
}

.product-gallery__track {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    height: clamp(360px, 48vw, 620px);
    background:
        radial-gradient(circle at top, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.5)),
        linear-gradient(160deg, rgba(255, 255, 255, 0.95), rgba(233, 240, 247, 0.96));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
    scrollbar-width: none;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    position: relative;
    z-index: 2;
}

.product-gallery__track::-webkit-scrollbar {
    display: none;
}

.product-gallery__slide {
    flex: 0 0 100%;
    scroll-snap-align: start;
    margin: 0;
    height: 100%;
    padding: 18px;
    display: grid;
    place-items: center;
    position: relative;
    overflow: hidden;
    isolation: isolate;
    border-radius: 28px;
}

.product-gallery__slide::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at center, rgba(var(--product-primary-rgb), 0.18), transparent 58%),
        var(--slide-background-image, none);
    background-size: cover;
    background-position: center;
    opacity: 0.1;
    transform: scale(1.48);
    filter: blur(78px) saturate(1.1) brightness(1.03);
    transition: opacity 0.45s ease, transform 0.55s ease;
    z-index: 0;
    pointer-events: none;
}

.product-gallery__slide::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(8, 15, 32, 0.35)),
        radial-gradient(circle at center, rgba(var(--product-primary-rgb), 0.4), transparent 72%);
    z-index: 0;
    pointer-events: none;
}

.product-gallery__zoom {
    width: 100%;
    height: 100%;
    border: 0;
    padding: 0;
    background: transparent;
    display: grid;
    place-items: center;
    cursor: zoom-in;
    position: relative;
    z-index: 2;
}

.product-gallery__zoom::before {
    content: "";
    position: absolute;
    inset: 12% 14%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(var(--product-primary-rgb), 0.34), transparent 70%);
    filter: blur(28px);
    opacity: 0.9;
    transform: scale(1.04);
    z-index: -1;
    pointer-events: none;
}

.product-gallery__zoom img {
    width: 100%;
    height: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.35s ease, filter 0.35s ease;
    filter:
        drop-shadow(0 30px 42px rgba(var(--product-primary-rgb), 0.28))
        drop-shadow(0 14px 24px rgba(15, 23, 42, 0.14));
}

.product-gallery__zoom:hover img {
    transform: scale(1.025);
}

.product-gallery__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 46px;
    height: 46px;
    border-radius: 999px;
    border: 0;
    background: rgba(15, 23, 42, 0.85);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.22);
    pointer-events: auto;
}

.product-gallery__nav--prev {
    left: 14px;
}

.product-gallery__nav--next {
    right: 14px;
}

.product-gallery__counter {
    position: absolute;
    right: 18px;
    bottom: 18px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.78);
    color: #fff;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    backdrop-filter: blur(10px);
    z-index: 5;
    pointer-events: none;
}

.product-gallery__thumbs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
    gap: 10px;
}

.product-gallery__thumbs-shell {
    padding: 12px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 24px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.64), rgba(241, 245, 249, 0.42)),
        rgba(255, 255, 255, 0.34);
    box-shadow:
        0 14px 36px rgba(15, 23, 42, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    position: relative;
    z-index: 4;
    pointer-events: auto;
}

.product-gallery__thumb {
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 18px;
    overflow: hidden;
    padding: 0;
    background: #fff;
    aspect-ratio: 1 / 1;
    opacity: 0.7;
    transition: transform 0.25s ease, opacity 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease, filter 0.25s ease;
}

.product-gallery__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-gallery__thumb.is-active {
    opacity: 1;
    border-color: rgba(var(--product-primary-rgb), 0.58);
    box-shadow:
        0 18px 30px rgba(var(--product-primary-rgb), 0.26),
        0 12px 20px rgba(15, 23, 42, 0.12);
    transform: translateY(-1px);
    filter:
        saturate(1.06)
        drop-shadow(0 16px 20px rgba(var(--product-primary-rgb), 0.18));
}

.product-gallery__thumb,
.product-gallery__thumb img {
    pointer-events: auto;
}

.product-gallery__empty {
    min-height: 360px;
    display: grid;
    place-items: center;
    text-align: center;
    padding: 24px;
    color: #475569;
}

.product-gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1055;
    display: grid;
    place-items: center;
    pointer-events: auto;
}

.product-gallery-lightbox[hidden] {
    display: none !important;
}

.product-gallery-lightbox__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, 0.8);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    pointer-events: none;
}

.product-gallery-lightbox__dialog {
    position: relative;
    z-index: 1;
    width: min(1120px, calc(100vw - 20px));
    max-height: calc(100vh - 20px);
    display: grid;
    gap: 10px;
    align-items: center;
    justify-items: center;
    pointer-events: auto;
}

.product-gallery-lightbox__media {
    position: relative;
    width: 100%;
    padding: 24px;
    border-radius: 30px;
    background:
        radial-gradient(circle at top, rgba(var(--product-primary-rgb), 0.18), transparent 38%),
        rgba(8, 15, 32, 0.94);
    box-shadow:
        0 28px 90px rgba(2, 6, 23, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.08);
    pointer-events: none;
}

.product-gallery-lightbox__media img {
    width: 100%;
    max-height: calc(100vh - 120px);
    object-fit: contain;
    pointer-events: none;
}

.product-gallery-lightbox__close {
    position: absolute;
    top: -10px;
    right: 0;
    width: 44px;
    height: 44px;
    border-radius: 999px;
    border: 0;
    background: rgba(255, 255, 255, 0.96);
    color: #0f172a;
    z-index: 2;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.26);
    pointer-events: auto;
}

.product-gallery-lightbox__hint {
    color: rgba(255, 255, 255, 0.78);
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: center;
    pointer-events: none;
}

@media (max-width: 991px) {
    .product-gallery__track {
        height: clamp(320px, 68vw, 520px);
    }
}

@media (max-width: 767px) {
    .product-gallery__stage {
        border-radius: 22px;
    }

    .product-gallery__track {
        height: clamp(280px, 78vw, 460px);
    }

    .product-gallery__slide {
        border-radius: 22px;
        padding: 14px;
    }

    .product-gallery__slide::before {
        opacity: 0.08;
        transform: scale(1.56);
        filter: blur(92px) saturate(1.06) brightness(1.02);
    }

    .product-gallery__zoom::before {
        inset: 14% 12%;
        filter: blur(22px);
    }

    .product-gallery__thumbs {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .product-gallery__thumbs-shell {
        padding: 10px;
        border-radius: 20px;
    }

    .product-gallery__nav {
        display: none;
    }

    .product-gallery__counter {
        right: 12px;
        bottom: 12px;
    }

    .product-gallery-lightbox__dialog {
        width: min(100vw - 12px, 100%);
    }

    .product-gallery-lightbox__media {
        padding: 18px;
        border-radius: 22px;
    }
}
