/* Kit pictures, collage, catalog grid and the kit page gallery. */

.kit-picture {
    position: relative;
    height: 220px;
    background: var(--bss-photo-bg);
    overflow: hidden;
}

.kit-picture-photo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: var(--bss-photo-bg);
}

.kit-picture-empty {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: var(--bss-muted);
    background: var(--bss-surface-alt);
}

/* Collage: 1 photo full, 2 side by side, 3 = one tall + two stacked, 4 = 2x2. */
.kit-collage {
    width: 100%;
    height: 100%;
    display: grid;
    gap: 4px;
    background: var(--bss-photo-gap);
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}

.kit-collage.tiles-1 {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
}

.kit-collage.tiles-2 {
    grid-template-rows: 1fr;
}

.kit-collage.tiles-3 .kit-collage-tile:first-child {
    grid-row: span 2;
}

.kit-collage-tile {
    position: relative;
    min-height: 0;
    background: var(--bss-photo-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.kit-collage-tile img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 4px;
}

.kit-collage-qty {
    position: absolute;
    right: 6px;
    bottom: 6px;
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 999px;
    padding: 1px 8px;
}

/* Catalog grid */
.kit-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.kit-card:hover {
    transform: translateY(-3px);
    border-color: var(--bss-text);
}

.kit-card .stretched-link-area {
    color: inherit;
    text-decoration: none;
}

/* Kit page gallery */
.gallery-main {
    position: relative;
    height: 440px;
    background: var(--bss-photo-bg);
    border: 1px solid var(--bss-border);
    border-radius: 12px;
    overflow: hidden;
    cursor: zoom-in;
    touch-action: pan-y;
}

.gallery-main img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
}

.gallery-main .kit-collage {
    cursor: default;
}

.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.12);
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.gallery-nav.prev {
    left: 10px;
}

.gallery-nav.next {
    right: 10px;
}

.gallery-counter {
    position: absolute;
    right: 10px;
    top: 10px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 0.75rem;
    border-radius: 999px;
    padding: 2px 10px;
    z-index: 2;
}

.gallery-thumbs {
    flex: 0 0 auto;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.gallery-thumb {
    flex: 0 0 auto;
    width: 64px;
    height: 64px;
    padding: 2px;
    border: 2px solid var(--bss-border);
    border-radius: 8px;
    background: var(--bss-photo-bg);
    overflow: hidden;
}

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

.gallery-thumb .kit-collage {
    gap: 1px;
}

.gallery-thumb .kit-collage-qty {
    display: none;
}

.gallery-thumb.active {
    border-color: var(--bss-text);
}

@media (min-width: 768px) {
    .gallery-thumbs {
        width: 76px;
        flex-direction: column;
        overflow-x: visible;
        overflow-y: auto;
        max-height: 440px;
        padding-bottom: 0;
        padding-right: 4px;
    }
}

@media (max-width: 767.98px) {
    .gallery-main {
        height: 320px;
    }
}

/* Full-screen viewer */
.lightbox .modal-content {
    background: #111;
}

.lightbox-stage {
    position: relative;
    height: calc(100vh - 130px);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: pan-y;
}

.lightbox-stage img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    cursor: zoom-in;
    transition: transform 0.15s ease;
    user-select: none;
    -webkit-user-drag: none;
}

.lightbox-stage img.zoomed {
    transform: scale(2.2);
    cursor: zoom-out;
}

.include-thumb {
    width: 44px;
    height: 44px;
    object-fit: contain;
    background: var(--bss-photo-bg);
    border: 1px solid var(--bss-border);
    border-radius: 6px;
}

.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Home page cards keep their original picture height. */
.product-image.kit-picture {
    height: 200px;
}
