/* NOTE: PHOTO GALLERY + LIGHTBOX (inc/new/sections/photo-gallery.php, javascript/new/lightbox.js).
   The lightbox is also used by the product gallery thumbnails. */

/* auto-fit: the visible photos fill the row while the rest are collapsed */
.kmd-photo-gallery__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
    gap: 10px;
}

.kmd-photo-gallery__item {
    display: block;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #EFEAE3;
}

.kmd-photo-gallery__item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .3s;
}

.kmd-photo-gallery__item:hover img {
    transform: scale(1.04);
}

@media screen and (max-width: 479px) {
    .kmd-photo-gallery__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
    }
}

/* NOTE: LIGHTBOX */

.kmd-lightbox {
    width: 100vw;
    max-width: none;
    height: 100vh;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: rgba(0, 0, 0, .92);
    color: var(--kmd-white);
}

.kmd-lightbox::backdrop {
    background: transparent;
}

.kmd-lightbox[open] {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.kmd-lightbox__figure {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin: 0;
    padding: 56px 64px 24px;
}

.kmd-lightbox__image {
    max-width: min(1200px, 100%);
    max-height: calc(100vh - 140px);
    object-fit: contain;
}

.kmd-lightbox__caption {
    color: var(--kmd-dark-text);
    font-size: 14px;
    text-align: center;
}

.kmd-lightbox__btn {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border: 0;
    background: rgba(255, 255, 255, .12);
    color: var(--kmd-white);
    cursor: pointer;
}

.kmd-lightbox__btn:hover {
    background: rgba(255, 255, 255, .25);
}

.kmd-lightbox__close {
    top: 12px;
    right: 12px;
}

.kmd-lightbox__prev {
    top: 50%;
    left: 8px;
    transform: translateY(-50%);
}

.kmd-lightbox__next {
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
}

@media screen and (max-width: 767px) {
    .kmd-lightbox__figure {
        padding: 64px 8px 24px;
    }

    .kmd-lightbox__prev,
    .kmd-lightbox__next {
        top: auto;
        bottom: 16px;
        transform: none;
    }
}
