.product-image-link {
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #fff;
}

.product-image-link .product-photo {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.marketplace-gallery {
    display: grid;
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
}

.marketplace-gallery .gallery-thumbs {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: min(620px, 66vw);
    margin: 0;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: thin;
}

.marketplace-gallery .gallery-thumb {
    position: relative;
    z-index: 1;
    width: 74px;
    height: 74px;
    min-height: 74px;
    padding: 4px;
    border: 1px solid #d9e0ea;
    border-radius: 9px;
    background: #fff;
    cursor: pointer;
    pointer-events: auto;
}

.marketplace-gallery .gallery-thumb:hover,
.marketplace-gallery .gallery-thumb:focus-visible,
.marketplace-gallery .gallery-thumb.active {
    border: 2px solid var(--primary-700);
    outline: none;
}

.marketplace-gallery .gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

.gallery-stage {
    position: relative;
    min-width: 0;
}

.marketplace-gallery .gallery-main {
    position: relative;
    display: grid;
    width: 100%;
    aspect-ratio: 1 / 1;
    height: auto;
    padding: 0;
    place-items: center;
    overflow: hidden;
    border: 1px solid #e0e5ed;
    border-radius: 12px;
    background: #fbfcfd;
    z-index: 1;
    pointer-events: auto;
}

button.gallery-main {
    cursor: zoom-in;
}

.marketplace-gallery .gallery-main img {
    position: relative;
    z-index: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform .2s ease;
    opacity: 1;
    visibility: visible;
    pointer-events: none;
}

@media (hover: hover) {
    .marketplace-gallery button.gallery-main:hover img {
        transform: scale(1.04);
    }
}

.gallery-zoom-hint {
    position: absolute;
    right: 12px;
    bottom: 12px;
    padding: 7px 10px;
    border-radius: 999px;
    color: #33435e;
    background: rgba(255,255,255,.92);
    box-shadow: 0 3px 14px rgba(16,33,63,.12);
    font-size: 10px;
    font-weight: 700;
    pointer-events: none;
}

.marketplace-gallery .gallery-badge {
    pointer-events: none;
}

.gallery-indicators {
    display: none;
    justify-content: center;
    gap: 7px;
    padding-top: 12px;
}

.gallery-indicators button {
    width: 8px;
    height: 8px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #c4ccd8;
}

.gallery-indicators button.active {
    background: var(--primary-700);
}

.gallery-lightbox {
    width: min(94vw, 1100px);
    height: min(92vh, 900px);
    padding: 56px 70px 34px;
    overflow: hidden;
    border: 0;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 24px 80px rgba(8,20,45,.3);
}

.gallery-lightbox::backdrop {
    background: rgba(8,15,28,.82);
}

.gallery-lightbox[open] {
    display: grid;
    place-items: center;
}

.gallery-lightbox img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.lightbox-close,
.lightbox-nav {
    position: absolute;
    z-index: 2;
    display: grid;
    width: 48px;
    height: 48px;
    padding: 0;
    place-items: center;
    border: 1px solid #d8dee8;
    border-radius: 50%;
    color: #1d2d4d;
    background: rgba(255,255,255,.96);
    cursor: pointer;
}

.lightbox-close {
    top: 12px;
    right: 12px;
    font-size: 30px;
}

.lightbox-nav {
    top: 50%;
    transform: translateY(-50%);
    font-size: 38px;
}

.lightbox-nav.previous { left: 12px; }
.lightbox-nav.next { right: 12px; }

@media (max-width: 720px) {
    .marketplace-gallery {
        grid-template-columns: 1fr;
    }

    .gallery-stage {
        order: -1;
    }

    .marketplace-gallery .gallery-thumbs {
        flex-direction: row;
        max-height: none;
        padding-bottom: 4px;
        overflow-x: auto;
        overflow-y: hidden;
    }

    .marketplace-gallery .gallery-thumb {
        width: 62px;
        height: 62px;
        min-width: 62px;
        min-height: 62px;
    }

    .gallery-indicators {
        display: flex;
    }

    .gallery-zoom-hint {
        min-height: 40px;
        display: grid;
        place-items: center;
    }

    .gallery-lightbox {
        width: 100vw;
        height: 100dvh;
        max-width: none;
        max-height: none;
        padding: 64px 12px 80px;
        border-radius: 0;
    }

    .lightbox-close,
    .lightbox-nav {
        width: 52px;
        height: 52px;
    }

    .lightbox-nav {
        top: auto;
        bottom: 14px;
        transform: none;
    }

    .lightbox-nav.previous { left: calc(50% - 64px); }
    .lightbox-nav.next { right: calc(50% - 64px); }
}
