/**
 * Gallery — live Projects photos: thumbnails ~205 x 146px (4:3 crop) four to
 * a row on the navy band, ~70px apart. Here the grid fills the row with 4:3
 * crops; the dialog shows the photo up to 90vw x 85vh on a dark backdrop.
 */
.gallery { padding: 0 0 90px; }

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

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

.gallery-thumb img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    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(--ccr-accent, #8ddaec); 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(--ccr-accent, #8ddaec); }

@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; } }
