.product-gallery {
    margin-top: 2rem;
    border-top: 1px solid rgb(255 255 255 / 0.1);
    padding-top: 2rem;
}

.product-gallery__title {
    margin: 0 0 0.75rem;
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
}

.product-gallery__thumbnails {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.product-gallery__thumbnail {
    width: 9rem;
    height: 9rem;
    overflow: hidden;
    border: 1px solid rgb(255 255 255 / 0.18);
    border-radius: 0.75rem;
    background: rgb(248 250 252);
    padding: 0.5rem;
    cursor: zoom-in;
    transition: border-color 150ms ease, transform 150ms ease;
}

.product-gallery__thumbnail:hover {
    border-color: rgb(56 189 248 / 0.8);
    transform: translateY(-2px);
}

.product-gallery__thumbnail:focus-visible,
.product-gallery__close:focus-visible,
.product-gallery__previous:focus-visible,
.product-gallery__next:focus-visible,
.product-gallery__done:focus-visible {
    outline: 3px solid rgb(56 189 248);
    outline-offset: 3px;
}

.product-gallery__thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.product-gallery__dialog {
    width: min(68rem, calc(100% - 2rem));
    max-width: none;
    max-height: calc(100dvh - 2rem);
    overflow: hidden;
    border: 1px solid rgb(255 255 255 / 0.18);
    border-radius: 1.5rem;
    background: #020617;
    color: #fff;
    padding: 0;
    box-shadow: 0 25px 80px rgb(0 0 0 / 0.65);
}

.product-gallery__dialog::backdrop {
    background: rgb(2 6 23 / 0.88);
    backdrop-filter: blur(4px);
}

.product-gallery__modal {
    display: flex;
    max-height: calc(100dvh - 2rem);
    flex-direction: column;
}

.product-gallery__header,
.product-gallery__footer {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
}

.product-gallery__header {
    border-bottom: 1px solid rgb(255 255 255 / 0.12);
}

.product-gallery__header h2 {
    margin: 0;
    overflow: hidden;
    font-size: 1rem;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.product-gallery__footer {
    border-top: 1px solid rgb(255 255 255 / 0.12);
    color: #cbd5e1;
    font-size: 0.875rem;
}

.product-gallery__stage {
    position: relative;
    display: flex;
    min-height: 18rem;
    height: min(68dvh, 46rem);
    flex: 1 1 auto;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 1rem 4.75rem;
    touch-action: pan-y;
}

.product-gallery__stage img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.product-gallery__close,
.product-gallery__previous,
.product-gallery__next,
.product-gallery__done {
    border: 1px solid rgb(255 255 255 / 0.18);
    background: rgb(255 255 255 / 0.08);
    color: #fff;
    cursor: pointer;
}

.product-gallery__close {
    display: inline-flex;
    width: 2.5rem;
    height: 2.5rem;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    font-size: 1.5rem;
    line-height: 1;
}

.product-gallery__previous,
.product-gallery__next {
    position: absolute;
    top: 50%;
    display: inline-flex;
    width: 3.25rem;
    height: 3.25rem;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    font-size: 1.5rem;
    transform: translateY(-50%);
}

.product-gallery__previous {
    left: 1rem;
}

.product-gallery__next {
    right: 1rem;
}

.product-gallery__done {
    border-radius: 0.75rem;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.product-gallery__close:hover,
.product-gallery__previous:hover,
.product-gallery__next:hover,
.product-gallery__done:hover {
    background: rgb(255 255 255 / 0.16);
}

@media (max-width: 640px) {
    .product-gallery__thumbnail {
        width: calc(50% - 0.375rem);
        height: auto;
        aspect-ratio: 1;
    }

    .product-gallery__dialog {
        width: calc(100% - 1rem);
        max-height: calc(100dvh - 1rem);
        border-radius: 1rem;
    }

    .product-gallery__modal {
        max-height: calc(100dvh - 1rem);
    }

    .product-gallery__stage {
        min-height: 14rem;
        height: 62dvh;
        padding: 0.75rem 3.75rem;
    }

    .product-gallery__previous,
    .product-gallery__next {
        width: 2.75rem;
        height: 2.75rem;
    }

    .product-gallery__previous {
        left: 0.5rem;
    }

    .product-gallery__next {
        right: 0.5rem;
    }
}
