.gallery {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    margin: 0;
}
.gallery-photo { display: block; overflow: hidden; background: #eee; }
.gallery-photo img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; transition: opacity .2s; }
.gallery-photo:hover img { opacity: .85; }
.gallery-photo:focus-visible { outline: 3px solid #029ca4; outline-offset: 4px; }
.gallery-lightbox {
    position: fixed;
    inset: 0;
    box-sizing: border-box;
    width: 100%;
    max-width: none;
    height: 100%;
    height: 100dvh;
    max-height: none;
    margin: 0;
    padding: 16px max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    border: 0;
    background: #121718;
    color: #fff;
    overscroll-behavior: contain;
}
.gallery-lightbox[open] { display: flex; align-items: center; justify-content: center; }
.gallery-lightbox::backdrop { background: #121718; }
.gallery-frame {
    width: min(var(--photo-width, 900px), 100%, calc((100dvh - 160px) * var(--photo-ratio, 1.5)));
    display: grid;
    grid-template-rows: 48px auto 48px;
    gap: 8px;
}
.gallery-toolbar { display: flex; align-items: center; justify-content: space-between; }
.gallery-counter { font-size: 17px; font-variant-numeric: tabular-nums; }
.gallery-lightbox button {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border: 1px solid #768184;
    border-radius: 50%;
    background: #263033;
    color: #fff;
    font: 32px/1 Arial, sans-serif;
    cursor: pointer;
    touch-action: manipulation;
}
.gallery-lightbox button:hover { background: #3e5156; }
.gallery-lightbox button:focus-visible { outline: 3px solid #80e2df; outline-offset: 3px; }
.gallery-stage { display: flex; justify-content: center; align-items: center; min-height: 0; touch-action: pan-y pinch-zoom; user-select: none; }
.gallery-full-image { display: block; width: 100%; height: auto; object-fit: contain; pointer-events: none; }
.gallery-controls { display: flex; align-items: center; justify-content: center; gap: 24px; }
.gallery-controls button { border: 0; border-radius: 0; background: transparent; font-size: 44px; }
.gallery-controls button:hover { background: transparent; color: #80e2df; }
@media (max-width: 767px) {
    .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 28px; }
    header nav { margin-top: 0; }
    .sf-menu { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; margin: 16px 0; }
    .sf-menu > li, .sf-menu > li + li { float: none; padding: 0; margin: 0; }
    .sf-menu > li > a { font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) {
    .gallery-photo img { transition: none; }
}
