/**
 * Gallery — live (1440px): #f1f2fb, ~100px above the heading (under the
 * 95px white ramp), ~150px below the photos (over the 92px black curve).
 * Photos: four columns of a masonry grid with a 3px gutter.
 */
.gallery {
    position: relative;
    padding: 150px 0 160px;
    background: var(--sf-wash, #f1f2fb);
}

.gallery .sf-row { position: relative; z-index: 2; }

.gallery-grid {
    columns: 4;
    column-gap: 3px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.gallery-item { break-inside: avoid; margin: 0 0 3px; }
.gallery-item[hidden] { display: none; }

.gallery-link { display: block; overflow: hidden; border-bottom: 0; background: #ddd; }
.gallery-link:hover,
.gallery-link:focus-visible { border-bottom: 0; }
.gallery-link:focus-visible { outline: 3px solid var(--sf-purple, #6a14d1); outline-offset: 2px; }

.gallery-image {
    display: block;
    width: 100%;
    height: auto;
    transition: transform 0.4s ease, opacity 0.2s ease;
}
.gallery-link:hover .gallery-image { transform: scale(1.04); opacity: 0.92; }

.gallery-more-wrap { margin: 32px 0 0; text-align: center; }

/* Lightbox (script.js). */
.gallery-lightbox {
    width: 100vw;
    max-width: none;
    height: 100vh;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: rgba(10, 10, 14, 0.94);
    color: #ffffff;
}
.gallery-lightbox::backdrop { background: rgba(10, 10, 14, 0.94); }
.gallery-lightbox[open] { display: flex; align-items: center; justify-content: center; }

.gallery-lightbox__img {
    display: block;
    max-width: calc(100vw - 140px);
    max-height: calc(100vh - 100px);
    width: auto;
    height: auto;
    object-fit: contain;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.gallery-lightbox__btn {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.2s ease;
}
.gallery-lightbox__btn:hover,
.gallery-lightbox__btn:focus-visible { background: rgba(255, 255, 255, 0.28); }
.gallery-lightbox__btn:focus-visible { outline: 2px solid #ffffff; outline-offset: 2px; }
.gallery-lightbox__close { top: 16px; right: 16px; }
.gallery-lightbox__prev { top: 50%; left: 16px; transform: translateY(-50%); }
.gallery-lightbox__next { top: 50%; right: 16px; transform: translateY(-50%); }
.gallery-lightbox__count { position: absolute; bottom: 18px; left: 0; right: 0; margin: 0; font-size: 14px; text-align: center; opacity: 0.8; }

@media (max-width: 980px) {
    .gallery { padding: 100px 0 110px; }
    .gallery-grid { columns: 3; }
}

@media (max-width: 600px) {
    .gallery { padding: 70px 0 80px; }
    .gallery-grid { columns: 2; }
    .gallery-lightbox__img { max-width: 100vw; max-height: calc(100vh - 140px); }
    .gallery-lightbox__prev, .gallery-lightbox__next { top: auto; bottom: 12px; transform: none; }
    .gallery-lightbox__count { bottom: 30px; }
}

@media (prefers-reduced-motion: reduce) {
    .gallery-image { transition: none; }
    .gallery-link:hover .gallery-image { transform: none; }
}
