.gallerySection {
    width: min(1380px, calc(100% - (2 * var(--page-gutter))));
    margin-inline: auto;
    padding: clamp(42px, 5vw, 70px) 0 clamp(60px, 7vw, 100px);
}

.galleryHeading {
    margin-bottom: clamp(28px, 4vw, 44px);
}

.galleryHeading > span {
    display: block;
    margin-bottom: 8px;
    color: var(--brand-blue);
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .18em;
}

.galleryHeading h1 {
    margin: 0;
    color: #172033;
    font-size: clamp(2rem, 4vw, 3.5rem);
    line-height: 1;
    letter-spacing: -.04em;
}

#imagesContainer {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(14px, 1.8vw, 24px);
}

.imageBox {
    position: relative;
    min-width: 0;
    aspect-ratio: 4 / 3;
    display: block;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 18px;
    background: #eef2f6;
    box-shadow: 0 10px 28px rgba(25, 43, 70, .08);
    cursor: zoom-in;
    text-align: left;
    font: inherit;
}


.imageBox img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .45s cubic-bezier(.22, 1, .36, 1);
}

.imageShade {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(10, 18, 31, .68), rgba(10, 18, 31, 0) 58%);
    opacity: .78;
    transition: opacity .3s ease;
    pointer-events: none;
}

.imageText {
    position: absolute;
    left: clamp(16px, 2vw, 24px);
    right: 62px;
    bottom: clamp(16px, 2vw, 22px);
    color: #fff;
    font-size: clamp(1rem, 1.4vw, 1.35rem);
    font-weight: 700;
    line-height: 1.25;
    text-shadow: 0 2px 12px rgba(0, 0, 0, .3);
    overflow-wrap: anywhere;
}

.imageZoom {
    position: absolute;
    right: 18px;
    bottom: 16px;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .52);
    border-radius: 50%;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    font-size: 1.45rem;
    font-weight: 300;
    line-height: 1;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

@media (hover: hover) and (pointer: fine) {
    .imageBox:hover img {
        transform: scale(1.045);
    }

    .imageBox:hover .imageShade {
        opacity: 1;
    }
}

#lightbox {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(24px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
    background: rgba(7, 12, 21, .93);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .25s ease, visibility 0s linear .25s;
}

#lightbox.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: opacity .25s ease;
}

.lightboxContent {
    max-width: min(88vw, 1320px);
    max-height: 88dvh;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    opacity: 0;
    transform: translateY(14px) scale(.97);
    transition: opacity .28s ease, transform .28s cubic-bezier(.22, 1, .36, 1);
}

#lightbox.active .lightboxContent {
    opacity: 1;
    transform: none;
}

#lightboxImage {
    display: block;
    max-width: 100%;
    max-height: 76dvh;
    width: auto;
    height: auto;
    margin-inline: auto;
    object-fit: contain;
    border-radius: 14px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .35);
    touch-action: pan-y;
    user-select: none;
    -webkit-user-drag: none;
    cursor: grab;
}

#lightboxImage:active {
    cursor: grabbing;
}

.lightboxMeta {
    min-width: min(100%, 540px);
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: center;
    margin: 14px auto 0;
    padding: 0 4px;
    color: #fff;
}

#lightboxText {
    min-width: 0;
    font-size: clamp(.96rem, 1.2vw, 1.15rem);
    font-weight: 600;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

#lightboxCounter {
    flex: 0 0 auto;
    color: rgba(255, 255, 255, .62);
    font-size: .86rem;
    font-weight: 700;
    letter-spacing: .08em;
}

.lightboxButton,
.lightboxClose {
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 50%;
    background: rgba(255, 255, 255, .08);
    color: #fff;
    cursor: pointer;
    z-index: 10000;
    transition: background .2s ease, transform .2s ease;
}

.lightboxButton {
    position: absolute;
    top: 50%;
    width: 54px;
    height: 54px;
    transform: translateY(-50%);
}

.lightboxPrev { left: clamp(12px, 2vw, 30px); }
.lightboxNext { right: clamp(12px, 2vw, 30px); }

.lightboxButton::before {
    content: "";
    width: 13px;
    height: 13px;
    border-top: 3px solid #fff;
    border-right: 3px solid #fff;
}

.lightboxPrev::before { transform: rotate(-135deg); margin-left: 4px; }
.lightboxNext::before { transform: rotate(45deg); margin-right: 4px; }

.lightboxClose {
    position: absolute;
    top: max(16px, env(safe-area-inset-top));
    right: max(16px, env(safe-area-inset-right));
    width: 46px;
    height: 46px;
    font-size: 1.9rem;
    font-weight: 300;
}

@media (hover: hover) and (pointer: fine) {
    .lightboxButton:hover,
    .lightboxClose:hover {
        background: rgba(255, 255, 255, .16);
    }

    .lightboxButton:hover { transform: translateY(-50%) scale(1.06); }
    .lightboxClose:hover { transform: rotate(90deg); }
}

@media (max-width: 900px) {
    #imagesContainer {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }


    .lightboxButton {
        top: auto;
        bottom: max(16px, env(safe-area-inset-bottom));
        width: 46px;
        height: 46px;
        transform: none;
    }

    .lightboxPrev { left: calc(50% - 56px); }
    .lightboxNext { right: calc(50% - 56px); }

    #lightboxImage {
        max-height: 69dvh;
    }

    .lightboxMeta {
        margin-bottom: 58px;
    }
}

@media (max-width: 560px) {
    .gallerySection {
        width: calc(100% - 32px);
        padding-top: 34px;
    }

    #imagesContainer {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .imageBox {
        aspect-ratio: 16 / 11;
        border-radius: 15px;
    }

    .imageText {
        right: 58px;
    }

    .lightboxContent {
        max-width: 94vw;
    }

    .lightboxMeta {
        width: 100%;
        min-width: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .imageBox img,
    #lightbox,
    .lightboxContent,
    .lightboxButton,
    .lightboxClose {
        transition: none;
    }
}
