/* =====================================================
   Gallery Lightbox – Styles
   ===================================================== */

/* ── Grille masonry (columns) ── */
.gl-grid {
    column-gap: 12px;
    max-width: 960px;
    margin: 0 auto;
}

.gl-cols-1 { columns: 1; }
.gl-cols-2 { columns: 2; }
.gl-cols-3 { columns: 3; }
.gl-cols-4 { columns: 4; }

/* ── Item ── */
.gl-item {
    overflow: hidden;
    border-radius: 10px;
    cursor: pointer;
    break-inside: avoid;
    margin-bottom: 12px;
}

.gl-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 10px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Hauteurs dépareillées */
.gl-item:nth-child(6n+1) { height: 300px; }
.gl-item:nth-child(6n+2) { height: 220px; }
.gl-item:nth-child(6n+3) { height: 260px; }
.gl-item:nth-child(6n+4) { height: 240px; }
.gl-item:nth-child(6n+5) { height: 310px; }
.gl-item:nth-child(6n+6) { height: 230px; }

.gl-item:hover img {
    transform: scale(1.04);
    opacity: 0.9;
}

/* ── Lightbox ── */
.gl-lightbox {
    position: fixed;
    inset: 0;
    z-index: 2147483647;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    isolation: isolate;
}

.gl-lightbox[aria-hidden="false"] {
    opacity: 1;
    visibility: visible;
}

/* Overlay */
.gl-lightbox__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
}

/* Contenu centré */
.gl-lightbox__content {
    position: relative;
    z-index: 1;
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.gl-lightbox__img {
    max-width: 90vw;
    max-height: 75vh;
    object-fit: contain;
    display: block;
    border-radius: 6px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}

/* Caption */
.gl-lightbox__caption {
    color: #fff;
    font-size: 0.95rem;
    line-height: 1.5;
    text-align: center;
    margin-top: 16px;
    padding: 0 20px;
    max-width: 700px;
    opacity: 0.9;
}

.gl-lightbox__caption:empty {
    display: none;
}

/* Bouton fermer */
.gl-lightbox__close {
    position: absolute;
    top: 16px;
    right: 20px;
    z-index: 2;
    background: none;
    border: none;
    color: #fff;
    font-size: 36px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
    line-height: 1;
    padding: 4px 8px;
}

.gl-lightbox__close:hover {
    opacity: 1;
}

/* Flèches navigation */
.gl-lightbox__prev,
.gl-lightbox__next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    background: rgba(255, 255, 255, 0.12);
    border: none;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    transition: opacity 0.2s, background 0.2s;
}

.gl-lightbox__prev:hover,
.gl-lightbox__next:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.25);
}

.gl-lightbox__prev {
    left: 16px;
}

.gl-lightbox__next {
    right: 16px;
}

/* ── État vide ── */
.gl-empty {
    color: #888;
    font-style: italic;
    text-align: center;
    padding: 24px;
}

/* ══════════════════════════════
   Responsive — Tablette
══════════════════════════════ */
@media (max-width: 768px) {
    .gl-cols-3,
    .gl-cols-4 {
        columns: 2;
    }

    .gl-grid {
        column-gap: 10px;
    }

    .gl-item {
        margin-bottom: 10px;
    }

    .gl-lightbox__prev { left: 8px; }
    .gl-lightbox__next { right: 8px; }
    .gl-lightbox__close { top: 10px; right: 12px; }
}

/* ══════════════════════════════
   Responsive — Mobile
══════════════════════════════ */
@media (max-width: 480px) {
    .gl-cols-2,
    .gl-cols-3,
    .gl-cols-4 {
        columns: 1;
    }

    .gl-grid {
        column-gap: 8px;
    }

    .gl-item {
        margin-bottom: 8px;
    }

    .gl-lightbox__img {
        max-width: 95vw;
        max-height: 65vh;
    }

    .gl-lightbox__caption {
        font-size: 0.85rem;
        margin-top: 12px;
    }

    .gl-lightbox__prev,
    .gl-lightbox__next {
        width: 40px;
        height: 40px;
        font-size: 22px;
    }
}
