.gallery-page {
    display: grid;
    gap: 12px;
    margin-top: 10px;
}

.gallery-grid-wide {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.gallery-panel {
    min-width: 0;
}

.gallery-panel--preview {
    border: 0;
    background: transparent;
}

.gallery-panel--preview .panel-body {
    padding: 0;
}

.gallery-panel + .gallery-panel {
    padding-top: 10px;
    border-top: 2px solid #9ab57f;
}

.gallery-coming-soon {
    margin: 0;
    color: var(--green-700);
    font-weight: bold;
}

.gallery-grid-large {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}

.gallery-grid-preview {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.gallery-photo {
    display: block;
    width: 100%;
    height: 180px;
    padding: 0;
    overflow: hidden;
    border: 2px solid #bdcdaa;
    background: #dfe8d1;
    content-visibility: auto;
    cursor: pointer;
}

.gallery-photo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .18s ease;
}

.gallery-photo:hover img,
.gallery-photo:focus-visible img {
    transform: scale(1.04);
}

.lightbox[hidden] {
    display: none;
}

.lightbox {
    position: fixed;
    z-index: 1000;
    inset: 0;
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr) 64px;
    align-items: center;
    gap: 10px;
    padding: 24px;
    background: rgba(9, 40, 25, .94);
}

.lightbox img {
    grid-column: 2;
    position: relative;
    z-index: 0;
    width: 100%;
    max-height: calc(100vh - 48px);
    object-fit: contain;
    cursor: zoom-in;
    touch-action: none;
    transform-origin: center;
}

.lightbox-close,
.lightbox-arrow {
    display: grid;
    place-items: center;
    border: 2px outset #c4d7ab;
    background: var(--green-700);
    color: #fff;
    font-family: inherit;
    font-weight: bold;
    cursor: pointer;
}

.lightbox-close {
    position: absolute;
    z-index: 2;
    top: 12px;
    right: 12px;
    width: 44px;
    height: 44px;
    font-size: 30px;
    line-height: 1;
}

.lightbox-arrow {
    position: relative;
    z-index: 1;
    width: 64px;
    height: 64px;
    font-size: 44px;
}

.lightbox-previous {
    grid-column: 1;
}

.lightbox-next {
    grid-column: 3;
}

body.lightbox-open {
    overflow: hidden;
}

@media (max-width: 800px) {
    .gallery-grid-large {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .gallery-grid-wide {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 460px) {
    .gallery-grid-large,
    .gallery-grid-wide {
        grid-auto-flow: column;
        grid-auto-columns: minmax(72vw, 1fr);
        grid-template-columns: none;
        overflow-x: auto;
        gap: 6px;
        padding-bottom: 8px;
        overscroll-behavior-x: contain;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
    }

    .gallery-photo {
        height: clamp(150px, 54vw, 240px);
        scroll-snap-align: start;
    }

    .lightbox {
        grid-template-columns: 44px minmax(0, 1fr) 44px;
        gap: 4px;
        padding: 8px;
    }

    .lightbox-arrow {
        width: 44px;
        height: 44px;
        font-size: 34px;
    }
}
