/**
 * Gallery — live (1440px): #f7f7f7 band; thumbnails 225 x 291px (portrait
 * crop) four to a 1080px row, ~57px apart; the dialog shows the photo up to
 * 90vw x 85vh on a dark backdrop.
 */
.gallery { padding: 80px 0 90px; }
.gallery-heading { margin-bottom: 40px; }

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(var(--gallery-cols, 4), minmax(0, 1fr));
    gap: 40px 57px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.gallery-thumb { display: block; overflow: hidden; }

.gallery-thumb img {
    display: block;
    width: 100%;
    aspect-ratio: 225 / 291;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.gallery-thumb:hover img,
.gallery-thumb:focus-visible img { transform: scale(1.04); }
.gallery-thumb:focus-visible { outline: 3px solid var(--mh-accent, #f3a31a); outline-offset: 3px; }

.gallery-dialog {
    max-width: none;
    max-height: none;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
}

.gallery-dialog::backdrop { background: rgba(10, 15, 25, 0.92); }

.gallery-dialog[open] { display: flex; align-items: center; justify-content: center; }

.gallery-figure { margin: 0; text-align: center; }

.gallery-full {
    display: block;
    max-width: 90vw;
    max-height: 85vh;
    width: auto;
    height: auto;
    margin: 0 auto;
}

.gallery-caption { margin-top: 12px; color: #ffffff; font-size: 15px; }

.gallery-nav,
.gallery-close {
    position: fixed;
    border: 0;
    background: rgba(0, 0, 0, 0.4);
    color: #ffffff;
    font-size: 40px;
    line-height: 1;
    cursor: pointer;
}

.gallery-nav { top: 50%; width: 52px; height: 72px; margin-top: -36px; }
.gallery-nav--prev { left: 12px; }
.gallery-nav--next { right: 12px; }
.gallery-close { top: 12px; right: 12px; width: 48px; height: 48px; font-size: 34px; }

.gallery-nav:hover, .gallery-close:hover { background: rgba(0, 0, 0, 0.7); }
.gallery-nav:focus-visible, .gallery-close:focus-visible { outline: 3px solid var(--mh-accent, #f3a31a); }

@media (max-width: 767px) {
    .gallery { padding-bottom: 56px; }
    .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .gallery-nav { width: 40px; height: 56px; margin-top: -28px; font-size: 32px; }
}

@media (prefers-reduced-motion: reduce) { .gallery-thumb img { transition: none; } }

@media (max-width: 980px) {
    .gallery-grid { gap: 24px; }
}

@media (max-width: 600px) {
    .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
}
