.wp-block-northgate-project-gallery.northgate-project-gallery {
    --northgate-gallery-blue: #002c52;
    --northgate-gallery-orange: #e79200;
    box-sizing: border-box;
    width: 100%;
    max-width: 1280px;
    margin: 0 auto clamp(2.5rem, 6vw, 6rem);
}

.northgate-project-gallery__header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 2rem;
    margin-bottom: 1.75rem;
}

.northgate-project-gallery__eyebrow {
    margin: 0 0 .65rem;
    color: var(--northgate-gallery-orange);
    font-size: .875rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: .13em;
    text-transform: uppercase;
}

.northgate-project-gallery__heading {
    margin: 0;
    color: var(--northgate-gallery-blue);
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 700;
    line-height: 1.08;
}

.northgate-project-gallery__description {
    max-width: 50rem;
    margin: .75rem 0 0;
    color: #526071;
    font-size: 1rem;
    line-height: 1.6;
}

.northgate-project-gallery__count {
    flex: 0 0 auto;
    margin: 0 0 .3rem;
    color: #586174;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.3;
}

/* Collapse heading space when all optional text fields are empty. */
.wp-block-northgate-project-gallery.northgate-project-gallery--no-text {
    margin-top: 0;
}

.northgate-project-gallery--no-text .northgate-project-gallery__header {
    justify-content: flex-end;
    gap: 0;
    margin-bottom: 1rem;
}

.northgate-project-gallery--no-text .northgate-project-gallery__titles {
    display: none;
}

/* page-home.php wraps editor content in an additional spacing container. */
.section-spacing-y:has(> .northgate-project-gallery--no-text:first-child) {
    margin-top: 0;
}

.northgate-project-gallery__grid {
    display: grid;
    grid-auto-rows: clamp(180px, 19vw, 252px);
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.northgate-project-gallery__item {
    position: relative;
    display: block;
    min-width: 0;
    min-height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    background: #e7ebef;
    color: inherit;
    cursor: zoom-in;
    text-align: left;
}

.northgate-project-gallery__item:first-child {
    grid-column: span 2;
    grid-row: span 2;
}

.northgate-project-gallery__item img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .35s ease;
}

.northgate-project-gallery__item:hover img {
    transform: scale(1.025);
}

.northgate-project-gallery__item:focus-visible {
    outline: 3px solid var(--northgate-gallery-orange);
    outline-offset: 3px;
}

.northgate-project-gallery__caption {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    margin: 0;
    padding: 2.5rem 1rem .85rem;
    color: #fff;
    background: linear-gradient(transparent, rgba(0, 20, 38, .82));
    font-size: .9rem;
    line-height: 1.35;
}

.northgate-project-gallery__zoom {
    position: absolute;
    right: 1rem;
    bottom: 1rem;
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 0;
    background: var(--brand-primary, #dd9e17);
    color: #fff;
    font-size: 1.1rem;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity .25s ease, transform .25s ease;
}

.northgate-project-gallery__item:hover .northgate-project-gallery__zoom,
.northgate-project-gallery__item:focus-visible .northgate-project-gallery__zoom {
    opacity: 1;
    transform: translateY(0);
}

.northgate-project-lightbox {
    box-sizing: border-box;
    width: min(94vw, 1440px);
    max-width: none;
    height: min(92vh, 920px);
    max-height: none;
    margin: auto;
    padding: 3.5rem 5rem 2rem;
    overflow: hidden;
    border: 0;
    background: #071a2b;
    color: #fff;
}

.northgate-project-lightbox::backdrop {
    background: rgba(2, 10, 20, .9);
    backdrop-filter: blur(4px);
}

.northgate-project-lightbox__figure {
    display: flex;
    width: 100%;
    height: 100%;
    margin: 0;
    align-items: center;
    flex-direction: column;
    justify-content: center;
}

.northgate-project-lightbox__image {
    display: block;
    width: 100%;
    min-height: 0;
    max-height: calc(100% - 2.5rem);
    object-fit: contain;
}

.northgate-project-lightbox__caption {
    min-height: 2.5rem;
    padding-top: .85rem;
    color: #fff;
    font-size: .9rem;
    line-height: 1.4;
    text-align: center;
}

.northgate-project-lightbox__close,
.northgate-project-lightbox__nav {
    position: absolute;
    z-index: 2;
    display: grid;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .35);
    border-radius: 50%;
    background: rgba(0, 44, 82, .82);
    color: #fff;
    cursor: pointer;
    line-height: 1;
}

.northgate-project-lightbox__close:hover,
.northgate-project-lightbox__nav:hover,
.northgate-project-lightbox__close:focus-visible,
.northgate-project-lightbox__nav:focus-visible {
    border-color: var(--northgate-gallery-orange);
    background: var(--northgate-gallery-orange);
    outline: none;
}

.northgate-project-lightbox__close {
    top: .8rem;
    right: .8rem;
    font-size: 1.8rem;
}

.northgate-project-lightbox__nav {
    top: 50%;
    margin-top: -1.375rem;
    font-size: 2rem;
}

.northgate-project-lightbox__nav--prev {
    left: 1rem;
}

.northgate-project-lightbox__nav--next {
    right: 1rem;
}

.northgate-project-lightbox__nav[hidden] {
    display: none;
}

@media (max-width: 991px) {
    .wp-block-northgate-project-gallery.northgate-project-gallery {
        padding-right: 1rem;
        padding-left: 1rem;
    }

    .northgate-project-gallery__grid {
        grid-auto-rows: clamp(160px, 27vw, 230px);
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 575px) {
    .northgate-project-gallery__header {
        align-items: flex-start;
        flex-direction: column;
        gap: .75rem;
    }

    .northgate-project-gallery__count {
        margin: 0;
    }

    .northgate-project-gallery--no-text .northgate-project-gallery__header {
        align-items: flex-end;
    }

    .northgate-project-gallery__grid {
        display: block;
    }

    .northgate-project-gallery__item,
    .northgate-project-gallery__item:first-child {
        height: auto;
        min-height: 220px;
        margin-bottom: 12px;
    }

    .northgate-project-gallery__item img {
        position: absolute;
        inset: 0;
    }

    .northgate-project-lightbox {
        width: 100vw;
        height: 100vh;
        padding: 4rem .75rem 1rem;
    }

    .northgate-project-lightbox__nav {
        top: auto;
        bottom: 1rem;
        margin: 0;
    }

    .northgate-project-lightbox__nav--prev {
        left: 1rem;
    }

    .northgate-project-lightbox__nav--next {
        right: 1rem;
    }

    .northgate-project-lightbox__caption {
        padding-right: 3.5rem;
        padding-left: 3.5rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .northgate-project-gallery__item img {
        transition: none;
    }
}
