/* =====================================================================
   Gallery – Figma: 1440 × 1240.27, bg #FBFEFF, border-top 1px #D1E1E9 60%
   Grid: 4 columns × 324, gaps 17.6, rows 179.2  (tall = 324 × 376)
   Padding 109.28 top/bottom, 45px sides
   ===================================================================== */

.gallery {
    background: #FBFEFF;
    border-top: 1px solid rgba(209, 225, 233, 0.6);
}

.gallery__container {
    width: 100%;
    max-width: var(--frame);
    margin-inline: auto;
    padding: 108px 45px 109.28px;
}

.gallery__title {
    margin-top: 10px;
    font-family: var(--font-heading);
    font-size: 52px;
    font-weight: 700;
    line-height: 56px;
    color: var(--navy-heading);
}

.gallery__text {
    max-width: 520px;
    margin-top: 17px;
    font-family: var(--font-text);
    font-size: 14px;
    line-height: 26.4px;
    color: var(--text);
}

/* ---------- Filter buttons ---------- */
.gallery__filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 37px;
}

.gallery__filter {
    height: 35px;
    padding: 0 15px;
    border: 1px solid var(--border);
    border-radius: 3px;
    background: var(--white);
    font-family: var(--font-heading);
    font-size: 12px;
    font-weight: 800;
    color: var(--navy);
    cursor: pointer;
    transition: background-color .3s ease, border-color .3s ease, box-shadow .3s ease;
}

.gallery__filter:hover { border-color: var(--yellow); }

.gallery__filter.is-active {
    background: var(--yellow);
    border-color: var(--yellow);
    box-shadow: 0 6px 16px rgba(255, 186, 16, 0.35);
}

/* ---------- Photo grid ---------- */
.gallery__grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-auto-rows: 179.2px;
    grid-auto-flow: dense;
    gap: 17.6px;
    margin-top: 28px;
}

.gallery__item {
    position: relative;
    margin: 0;
    overflow: hidden;
    background: #d9e8f0;
    transition: opacity .35s ease, transform .35s ease;
}

.gallery__item--wide { grid-column: span 2; }
.gallery__item--tall { grid-row: span 2; }
.gallery__item--full { grid-column: 1 / -1; }

.gallery__item.is-hidden { display: none; }
.gallery__item.is-entering { opacity: 0; transform: scale(.97); }

.gallery__open {
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: none;
    cursor: zoom-in;
}

.gallery__open img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .8s cubic-bezier(.2, .7, .2, 1);
}

.gallery__item:hover .gallery__open img { transform: scale(1.08); }

/* Navy fade + caption at the bottom */
.gallery__item::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(12, 57, 112, 0) 35%, rgba(12, 57, 112, 0.78) 100%);
    pointer-events: none;
}

.gallery__caption {
    position: absolute;
    left: 20px;
    right: 20px;
    bottom: 20px;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.gallery__label {
    font-family: var(--font-heading);
    font-size: 10px;
    font-weight: 800;
    line-height: 16px;
    letter-spacing: 1px;
    color: var(--yellow);
    text-transform: uppercase;
}

.gallery__name {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
    line-height: 28px;
    color: var(--white);
}

/* ---------- Lightbox ---------- */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background: rgba(6, 28, 56, 0.9);
    animation: lightbox-in .25s ease;
}

.lightbox[hidden] { display: none; }

@keyframes lightbox-in { from { opacity: 0; } to { opacity: 1; } }

.lightbox__figure {
    margin: 0;
    max-width: min(1100px, 100%);
    max-height: 100%;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.lightbox__img {
    max-width: 100%;
    max-height: calc(100vh - 200px);
    object-fit: contain;
    margin-inline: auto;
}

.lightbox__caption { display: flex; flex-direction: column; gap: 4px; color: var(--white); }
.lightbox__title { font-family: var(--font-heading); font-size: 20px; font-weight: 700; }
.lightbox__text { font-family: var(--font-text); font-size: 14px; line-height: 22px; color: rgba(255, 255, 255, .8); }
.lightbox__text:empty, .lightbox__label:empty { display: none; }

.lightbox__close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: var(--white);
    cursor: pointer;
    transition: background-color .3s ease;
}
.lightbox__close:hover { background: var(--yellow); color: var(--navy); }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
    .gallery__container { padding-inline: 32px; }
    .gallery__grid { grid-auto-rows: 150px; }
}

@media (max-width: 992px) {
    .gallery__container { padding: 80px 24px; }
    .gallery__title { font-size: 44px; line-height: 48px; }
    .gallery__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 170px; gap: 14px; }
}

@media (max-width: 576px) {
    .gallery__container { padding: 56px 16px; }
    .gallery__title { font-size: 34px; line-height: 40px; }
    .gallery__grid { grid-template-columns: 1fr; grid-auto-rows: 220px; gap: 12px; }
    .gallery__item--wide, .gallery__item--full { grid-column: auto; }
    .gallery__item--tall { grid-row: auto; }
    .lightbox { padding: 16px; }
}
