/* ─────────────────────────────────────────
   GALLERY SECTION
───────────────────────────────────────── */
.gallery {
    padding: 40px 0 40px;
}

.gallery__label {
    display: block;
}

.gallery__title {
    margin-bottom: 12px;
    margin-top: 0;
}

@media (min-width: 768px)  { .gallery__title { margin-bottom: 32px; } }
@media (min-width: 1024px) { .gallery__title { margin-bottom: 36px; } }

/* ─────────────────────────────────────────
   TABS — MOBILE: Swiper strip
───────────────────────────────────────── */
.gallery__tabs-wrap {
    position: relative;
    margin-bottom: 12px;
}

/* Fade edge on mobile */
.gallery__tabs-wrap::after {
    content: '';
    position: absolute;
    right: 0; top: 0; bottom: 0;
    width: 40px;
    /*background: linear-gradient(to right, transparent, rgba(242,242,240,.95));*/
    pointer-events: none;
}

.gallery__tabs-wrap::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 40px;
    /*background: linear-gradient(to left, transparent, rgba(242,242,240,.95));*/
    pointer-events: none;
}

.tabs-arr.swiper-button-disabled{
    display: none;
}

.gallery__tabs-wrap:has(.t-prev.swiper-button-disabled)::before{
    content: none;
}

.gallery__tabs-wrap:has(.t-next.swiper-button-disabled)::after{
    content: none;
}

/* ─── Tab button ─── */

/* TABLET+: wrap tabs naturally */
@media (min-width: 768px) {
    .gallery__tabs-wrap::after { display: none; }
}

/* ─────────────────────────────────────────
   GRID PANEL
───────────────────────────────────────── */
.tab-panel        { display: none; }
.tab-panel.active { display: block; }

/* ─── Masonry-style photo grid ─── */
.photo-grid {
    display: grid;
    gap: 8px;
    grid-template-columns: 1fr 1fr;
    grid-auto-rows: auto;
}

.photo-grid__item {
    break-inside: avoid;
    cursor: pointer;
    overflow: hidden;
    border-radius: 1px;
    position: relative;
}

.photo-grid__item img {
    display: block;
    width: 100%;
    height: 100%;
    transition: transform .35s ease, filter .35s ease;
    pointer-events: none;
    object-fit: cover;
}

.photo-grid__item::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0);
    transition: background .25s;
}

.photo-grid__item:hover::after {
    background: rgba(0,0,0,.18);
}

.photo-grid__item:hover img {
    transform: scale(1.04);
}

/* Zoom icon on hover */
.photo-grid__item::before {
    content: '⊕';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: #fff;
    opacity: 0;
    z-index: 2;
    transition: opacity .25s;
    pointer-events: none;
}

.photo-grid__item:hover::before {
    opacity: 1;
}

/* Mobile: alternating tall/short pattern
   Items 1,4,5,8,9,12,13... = tall  (left-tall, right-short alternation)
   We achieve the "stagger" by making odd items in odd pairs tall */
/* Row 1 items — single row height */
.photo-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 40px;
    gap: 8px;
}
.photo-grid__item { aspect-ratio: unset; }

.photo-grid__item:nth-child(1)  {
    grid-column: 1;
    grid-row: 1 / 4;
}
.photo-grid__item:nth-child(2)  {
    grid-column: 2;
    grid-row: 1 / 6;
}
.photo-grid__item:nth-child(3)  {
    grid-column: 1;
    grid-row: 4 / 8;
} /* tall */
.photo-grid__item:nth-child(4)  {
    grid-column: 2;
    grid-row: 6 / 10;
}
.photo-grid__item:nth-child(5)  {
    grid-column: 1;
    grid-row: 8 / 14;
}

/* Row 2 */
.photo-grid__item:nth-child(6)  {
    grid-column: 2;
    grid-row: 10 / 16;
} /* tall */
.photo-grid__item:nth-child(7)  {
    grid-column: 1;
    grid-row: 14 / 18;
}
/* item 3 occupies col 3 row 2 (already spanned above) */
.photo-grid__item:nth-child(8)  {
    grid-column: 2;
    grid-row: 16 / 22;
}
.photo-grid__item:nth-child(9)  {
    grid-column: 1;
    grid-row: 18 / 23;
}

/* Row 3 */
/* item 6 occupies col 1 row 3 (already spanned above) */
.photo-grid__item:nth-child(10) {
    grid-column: 2;
    grid-row: 22 / 26;
}
.photo-grid__item:nth-child(11) {
    grid-column: 1;
    grid-row: 23 / 27;
}
.photo-grid__item:nth-child(12) {
    grid-column: 2;
    grid-row: 26 / 30;
}
.photo-grid__item:nth-child(13) {
    grid-column: 1;
    grid-row: 27 / 30;
}

.photo-grid__item:nth-child(14) {
    grid-column: 2;
    grid-row: 30 / 34;
}

.photo-grid__item:nth-child(15) {
    grid-column: 1;
    grid-row: 30 / 34;
}

@media (min-width: 768px) {
    .photo-grid {
        grid-template-columns: repeat(3, 1fr);
        grid-auto-rows: 60px;
        gap: 8px;
    }

    .photo-grid__item:nth-child(1)  {
        grid-column: 1;
        grid-row: 1 / 5;
    }
    .photo-grid__item:nth-child(2)  {
        grid-column: 2;
        grid-row: 1 / 6;
    }
    .photo-grid__item:nth-child(3)  {
        grid-column: 3;
        grid-row: 1 / 5;
    } /* tall */
    .photo-grid__item:nth-child(4)  {
        grid-column: 1;
        grid-row: 5 / 12;
    }
    .photo-grid__item:nth-child(5)  {
        grid-column: 2;
        grid-row: 6 / 10;
    }

    /* Row 2 */
    .photo-grid__item:nth-child(6)  {
        grid-column: 3;
        grid-row: 5 / 12;
    } /* tall */
    .photo-grid__item:nth-child(7)  {
        grid-column: 1;
        grid-row: 12 / 16;
    }
    /* item 3 occupies col 3 row 2 (already spanned above) */
    .photo-grid__item:nth-child(8)  {
        grid-column: 2;
        grid-row: 10 / 14;
    }
    .photo-grid__item:nth-child(9)  {
        grid-column: 3;
        grid-row: 12 / 16;
    }

    /* Row 3 */
    /* item 6 occupies col 1 row 3 (already spanned above) */
    .photo-grid__item:nth-child(10) {
        grid-column: 1;
        grid-row: 16 / 20;
    }
    .photo-grid__item:nth-child(11) {
        grid-column: 2;
        grid-row: 14 / 20;
    }
    .photo-grid__item:nth-child(12) {
        grid-column: 3;
        grid-row: 16 / 20;
    }
    .photo-grid__item:nth-child(13) {
        grid-column: 1;
        grid-row: 20 / 26;
    }

    .photo-grid__item:nth-child(14) {
        grid-column: 2;
        grid-row: 20 / 26;
    }

    .photo-grid__item:nth-child(15) {
        grid-column: 3;
        grid-row: 20 / 26;
    }
}

@media (min-width: 1024px) {
    .gallery {
        padding: 48px 0 120px;
    }
    .photo-grid {
        grid-template-columns: repeat(5, 1fr);
        grid-auto-rows: 40px;
        gap: 8px;
    }

    /* Reset all mobile aspect-ratio overrides */
    .photo-grid__item { aspect-ratio: unset; }

    /* Row 1 items — single row height */
    .photo-grid__item:nth-child(1)  {
        grid-column: 1;
        grid-row: 1 / 5;
    }
    .photo-grid__item:nth-child(2)  {
        grid-column: 2;
        grid-row: 1 / 7;
    }
    .photo-grid__item:nth-child(3)  {
        grid-column: 3;
        grid-row: 1 / 6;
    } /* tall */
    .photo-grid__item:nth-child(4)  {
        grid-column: 4;
        grid-row: 1 / 7;
    }
    .photo-grid__item:nth-child(5)  {
        grid-column: 5;
        grid-row: 1 / 8;
    }

    /* Row 2 */
    .photo-grid__item:nth-child(6)  {
        grid-column: 1;
        grid-row: 5 / 12;
    } /* tall */
    .photo-grid__item:nth-child(7)  {
        grid-column: 2;
        grid-row: 7 / 13;
    }
    /* item 3 occupies col 3 row 2 (already spanned above) */
    .photo-grid__item:nth-child(8)  {
        grid-column: 3;
        grid-row: 6 / 12;
    }
    .photo-grid__item:nth-child(9)  {
        grid-column: 4;
        grid-row: 7 / 13;
    }

    /* Row 3 */
    /* item 6 occupies col 1 row 3 (already spanned above) */
    .photo-grid__item:nth-child(10) {
        grid-column: 5;
        grid-row: 8 / 12;
    }
    .photo-grid__item:nth-child(11) {
        grid-column: 1;
        grid-row: 12 / 17;
    }
    .photo-grid__item:nth-child(12) {
        grid-column: 2;
        grid-row: 13 / 17;
    }
    .photo-grid__item:nth-child(13) {
        grid-column: 3;
        grid-row: 12 / 17;
    }

    .photo-grid__item:nth-child(14) {
        grid-column: 4;
        grid-row: 13 / 17;
    }

    .photo-grid__item:nth-child(15) {
        grid-column: 5;
        grid-row: 12 / 17;
    }
}

/* ─────────────────────────────────────────
   PLACEHOLDER IMAGES (grey boxes with labels)
   — replace src with real images in prod
───────────────────────────────────────── */
.photo-grid__item img[data-placeholder] {
    background: #ddd;
    min-height: 120px;
}


/* ═══════════════════════════════════════════
   MODAL GALLERY  (.modal-gallery)
═══════════════════════════════════════════ */
.modal-gallery {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9000;
    background: rgba(10,10,10,.92);
    flex-direction: column;
    align-items: stretch;
}

.modal-gallery.is-open {
    display: flex;
    animation: modalFadeIn .25s ease both;
    background-color: var(--white);
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ─── MODAL HEADER: tabs + close ─── */
.modal-gallery__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 16px 20px 12px;
    gap: 16px;
    flex-shrink: 0;
}

.modal-gallery__tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

/* ─── Close btn ─── */
.modal-gallery__close {
    width: 42px; height: 42px;
    border-radius: 50%;
    border: 1.5px solid rgba(255,255,255,.25);
    background: var(--grey-1);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
    transition: background .15s;
    line-height: 1;
}

.modal-gallery__close:hover { background: rgba(255,255,255,.12); }

/* ─── MAIN IMAGE AREA ─── */
.modal-gallery__stage {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    padding: 0 60px;
}

.modal-gallery__img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    border-radius: 2px;
    transition: opacity .2s ease;
}

.modal-gallery__img.fading {
    opacity: 0;
}

/* Prev / Next arrows */
.modal-gallery__arrow {
    position: absolute;
    top: 50%; transform: translateY(-50%);
    width: 44px; height: 44px;
    border-radius: 50%;
    border: 1.5px solid rgba(255,255,255,.3);
    background: var(--grey-1);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    transition: background .15s;
    z-index: 2;
    user-select: none;
}

.modal-gallery__arrow:hover { background: rgba(0,0,0,.7); }
.modal-gallery__arrow--prev { left: 12px; }
.modal-gallery__arrow--next { right: 12px; }

/* ─── THUMBNAIL STRIP ─── */
.modal-gallery__thumbs {
    flex-shrink: 0;
    display: flex;
    gap: 8px;
    padding: 12px 20px 16px;
    overflow-x: auto;
    scrollbar-width: none;
    justify-content: center;
}

.modal-gallery__thumbs::-webkit-scrollbar { display: none; }

.modal-gallery__thumb {
    width: 72px; height: 52px;
    object-fit: cover;
    border-radius: 2px;
    cursor: pointer;
    opacity: .5;
    border: 2px solid transparent;
    transition: opacity .2s, border-color .2s;
    flex-shrink: 0;
}

.modal-gallery__thumb.active,
.modal-gallery__thumb:hover {
    opacity: 1;
    border-color: var(--primary);
}

@media (min-width: 768px) {
    .modal-gallery__header { padding: 20px 32px 16px; }
    .modal-gallery__stage  { padding: 0 80px; }
    .modal-gallery__thumbs { padding: 16px 32px 20px; }
    .modal-gallery__thumb  { width: 88px; height: 62px; }
}
