/* ============================================================
   gallery.css — ong_cade
   Page Galerie Photos
   ============================================================ */

/* ──────────────────────────────────────────────
   1. HERO
────────────────────────────────────────────── */
.gal-hero {
    background: linear-gradient(155deg, #0F2547 0%, #1B3A6B 50%, #2C5282 100%);
    padding: 80px 0 0;
    text-align: center;
    overflow: hidden;
    position: relative;
}

.gal-hero-inner {
    max-width: 680px;
    margin: 0 auto;
    padding: 0 24px 60px;
    position: relative;
    z-index: 1;
}

.gal-hero-badge {
    display: inline-flex; align-items: center; gap: 8px;
    background: rgba(245,166,35,.18); border: 1px solid rgba(245,166,35,.4);
    color: #F5A623; padding: 6px 18px; border-radius: 20px;
    font-size: 12px; font-weight: 800; letter-spacing: .5px;
    margin-bottom: 20px; text-transform: uppercase;
}

.gal-hero-title {
    font-family: 'Montserrat', Georgia, serif;
    font-size: clamp(2.2rem, 4.5vw, 3.2rem);
    color: #ffffff; margin-bottom: 16px; line-height: 1.15;
}

.gal-hero-sub {
    font-size: 1rem; color: rgba(255,255,255,.75);
    line-height: 1.8; margin-bottom: 24px;
}

.gal-hero-count {
    display: inline-flex; align-items: center; gap: 8px;
    background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2);
    color: rgba(255,255,255,.9); padding: 8px 20px; border-radius: 20px;
    font-size: 13px; font-weight: 700;
}

.gal-hero-wave { line-height: 0; }
.gal-hero-wave svg { display: block; width: 100%; height: 50px; }

/* ──────────────────────────────────────────────
   2. BARRE DE FILTRES — sticky
────────────────────────────────────────────── */
.gal-filters-bar {
    background: #ffffff;
    border-bottom: 1px solid rgba(27,58,107,.08);
    padding: 14px 0;
    position: sticky;
    top: 107px; /* hauteur du header CADE */
    z-index: 100;
    box-shadow: 0 2px 16px rgba(27,58,107,.06);
    transition: box-shadow 200ms ease;
}

.gal-filters-bar.is-scrolled {
    box-shadow: 0 4px 24px rgba(27,58,107,.12);
}

.gal-filters {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.gal-filter-btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 7px 16px; border-radius: 20px;
    font-size: 12px; font-weight: 700;
    color: #444; background: #F0F4F8;
    border: 1.5px solid transparent;
    text-decoration: none;
    transition: all 200ms ease;
    white-space: nowrap;
}

.gal-filter-btn:hover {
    border-color: #1B3A6B;
    color: #1B3A6B;
    background: #EBF4FF;
}

.gal-filter-btn.is-active {
    background: #1B3A6B;
    color: #ffffff;
    border-color: #1B3A6B;
}

.gal-filter-count {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 20px; height: 20px; padding: 0 5px;
    border-radius: 10px;
    background: rgba(255,255,255,.25);
    font-size: 10px; font-weight: 800;
    transition: background 200ms ease;
}

.gal-filter-btn:not(.is-active) .gal-filter-count {
    background: rgba(27,58,107,.1);
    color: #1B3A6B;
}

/* ──────────────────────────────────────────────
   3. GRILLE PHOTOS
────────────────────────────────────────────── */
.gal-main { background: #F0F4F8; }

.gal-grid {
    columns: 4;
    column-gap: 16px;
}

.gal-item {
    break-inside: avoid;
    margin-bottom: 16px;
    border-radius: 16px;
    overflow: hidden;
    position: relative;
}

/* Bouton wrapper (pour accessibilité) */
.gal-item-btn {
    display: block; width: 100%;
    background: none; border: none; padding: 0; margin: 0;
    cursor: pointer; border-radius: 16px; overflow: hidden;
    position: relative;
}

/* Figure */
.gal-item-figure {
    margin: 0; position: relative;
    display: block; width: 100%;
    background: #D0DCEA;
}

/* Image */
.gal-item-img {
    width: 100%; height: auto;
    display: block;
    transition: transform 450ms ease;
    border-radius: 16px;
}

.gal-item-btn:hover .gal-item-img,
.gal-item-btn:focus-visible .gal-item-img {
    transform: scale(1.04);
}

/* Overlay hover */
.gal-item-overlay {
    position: absolute; inset: 0;
    background: linear-gradient(to top,
        rgba(15,37,71,.75) 0%,
        rgba(15,37,71,.2) 50%,
        transparent 100%);
    opacity: 0;
    transition: opacity 300ms ease;
    border-radius: 16px;
    display: flex; align-items: flex-end;
}

.gal-item-btn:hover .gal-item-overlay,
.gal-item-btn:focus-visible .gal-item-overlay {
    opacity: 1;
}

.gal-item-overlay-inner {
    padding: 20px; width: 100%;
    display: flex; flex-direction: column; gap: 6px;
}

.gal-item-overlay-inner i {
    font-size: 28px; color: #ffffff;
    align-self: flex-end;
    text-shadow: 0 2px 8px rgba(0,0,0,.3);
}

.gal-item-overlay-title {
    font-size: 13px; font-weight: 700;
    color: rgba(255,255,255,.95); line-height: 1.4;
    text-align: left;
}

/* ── Overlay crédit ──────────────────────────── */
.gal-item-overlay-credit {
    display: block;
    font-size: 0.72rem;
    color: rgba(255,255,255,0.75);
    margin-top: 4px;
    letter-spacing: 0.02em;
}

/* Figcaption — visually hidden (SEO + accessibilité) */
.gal-item-caption {
    position: absolute;
    width: 1px; height: 1px;
    overflow: hidden; clip: rect(0,0,0,0);
    white-space: nowrap; border: 0;
}

/* Placeholder image absente */
.gal-item-placeholder {
    min-height: 180px;
    background: #E2E8F0;
    border-radius: 16px;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 10px; padding: 24px;
    color: #8AB4D9;
}

.gal-item-placeholder i { font-size: 36px; opacity: .5; }
.gal-item-placeholder span {
    font-size: 12px; color: #444444;
    text-align: center; line-height: 1.5;
}

/* État vide */
.gal-empty {
    text-align: center; padding: 80px 24px;
    color: #444444;
}

.gal-empty i {
    font-size: 64px; color: #D0DCEA;
    display: block; margin-bottom: 20px;
}

.gal-empty h2 {
    font-size: 1.4rem; color: #1B3A6B; margin-bottom: 10px;
}

/* ──────────────────────────────────────────────
   4. LIGHTBOX
────────────────────────────────────────────── */
.gal-lightbox {
    position: fixed; inset: 0;
    z-index: 999999;
    display: flex; align-items: center; justify-content: center;
    visibility: hidden; opacity: 0;
    transition: opacity 300ms ease, visibility 300ms ease;
}

.gal-lightbox.is-open {
    visibility: visible; opacity: 1;
}

/* Fond sombre */
.gal-lightbox-backdrop {
    position: absolute; inset: 0;
    background: rgba(5,15,35,.92);
    backdrop-filter: blur(6px);
    cursor: pointer;
}

/* Boîte principale */
.gal-lightbox-box {
    position: relative; z-index: 1;
    width: 100%; max-width: 1100px;
    max-height: 92vh;
    margin: 0 20px;
    display: flex; flex-direction: column;
    align-items: center; gap: 0;
}

/* Bouton fermer */
.gal-lb-close {
    position: absolute; top: -44px; right: 0;
    width: 40px; height: 40px; border-radius: 50%;
    background: rgba(255,255,255,.15);
    border: 1px solid rgba(255,255,255,.25);
    color: #ffffff; font-size: 16px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all 200ms ease;
    z-index: 2;
}

.gal-lb-close:hover {
    background: rgba(255,255,255,.3);
    transform: rotate(90deg);
}

/* Navigation prev / next */
.gal-lb-nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 48px; height: 48px; border-radius: 50%;
    background: rgba(255,255,255,.15);
    border: 1px solid rgba(255,255,255,.25);
    color: #ffffff; font-size: 20px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all 200ms ease;
    z-index: 2;
}

.gal-lb-nav:hover {
    background: rgba(255,255,255,.3);
    transform: translateY(-50%) scale(1.08);
}

.gal-lb-nav--prev { left: -64px; }
.gal-lb-nav--next { right: -64px; }

/* Wrap image */
.gal-lb-img-wrap {
    width: 100%;
    max-height: 88vh;
    display: flex; align-items: center; justify-content: center;
    position: relative;
    border-radius: 12px 0 0 12px;
    overflow: hidden;
    background: rgba(0,0,0,.6);
}

/* Image lightbox */
.gal-lb-img {
    max-width: 100%; max-height: 88vh;
    width: auto; height: auto;
    display: block;
    border-radius: 12px 0 0 12px;
    transition: opacity 250ms ease;
    object-fit: contain;
}

.gal-lb-img.is-loading { opacity: 0; }

/* Spinner chargement */
.gal-lb-loader {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    pointer-events: none;
}

.gal-lb-loader[aria-hidden="true"] { display: none; }

.gal-lb-spinner {
    width: 36px; height: 36px; border-radius: 50%;
    border: 3px solid rgba(255,255,255,.2);
    border-top-color: #F5A623;
    animation: lb-spin 700ms linear infinite;
}

.gal-lb-info {
    flex: 1;
    min-width: 0;
}

@keyframes lb-spin {
    to { transform: rotate(360deg); }
}

.gal-lb-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 6px;
    line-height: 1.4;
}

/* Footer légende + compteur */
.gal-lb-footer {
    width: 100%;
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 16px; padding: 14px 16px;
    background: #0F1E38;
    border-top: 1px solid rgba(245,166,35,.2);
}

.gal-lb-caption {
    font-size: 0.82rem;
    color: rgba(255,255,255,.6);
    margin: 0 0 8px;
    line-height: 1.6;
    border-left: 3px solid #F5A623;
    padding-left: 10px;
}

.gal-lb-credit {
    font-size: 0.75rem;
    color: rgba(255,255,255,.45);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255,255,255,.08);
}

.gal-lb-credit span {
    display: flex; align-items: center; gap: 6px;
}

.gal-lb-credit i {
    color: #F5A623;
    opacity: 1;
    font-size: 0.78rem;
}

.gal-lb-counter {
    font-size: 11px;
    color: rgba(255,255,255,.3);
    white-space: nowrap;
    flex-shrink: 0;
    align-self: flex-end;
}

/* ──────────────────────────────────────────────
   5. FADE-IN ANIMATIONS
────────────────────────────────────────────── */
.gfade {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 450ms ease, transform 450ms ease;
}

.gfade.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* ──────────────────────────────────────────────
   6. RESPONSIVE
────────────────────────────────────────────── */
@media (max-width: 1200px) {
    .gal-grid { columns: 3; }
    .gal-lb-nav--prev { left: -52px; }
    .gal-lb-nav--next { right: -52px; }
}

@media (max-width: 900px) {
    .gal-filters-bar { top: 80px; }
    .gal-lb-nav--prev { left: 8px; }
    .gal-lb-nav--next { right: 8px; }
    .gal-lb-nav { background: rgba(0,0,0,.5); }
}

@media (max-width: 768px) {
    .gal-grid { columns: 2; }
}

@media (max-width: 480px) {
    .gal-grid { columns: 1; }
    .gal-filters { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
    .gal-filters::-webkit-scrollbar { height: 0; }
    .gal-lb-close { top: -48px; }
}
/* ── Lightbox layout grand écran : image + infos côte à côte ── */
@media (min-width: 900px) {
    .gal-lightbox-box {
        display: grid;
        grid-template-columns: 1fr 280px;
        grid-template-rows: 1fr auto;
        grid-template-areas:
            "img-wrap  info"
            "nav       nav";
        max-width: 1200px;
        max-height: 88vh;
        border-radius: 16px;
        overflow: hidden;
        box-shadow: 0 32px 80px rgba(0,0,0,.6);
    }

    .gal-lb-img-wrap { grid-area: img-wrap; max-height: 88vh; }

    .gal-lb-close {
        position: fixed;
        top: 20px; right: 20px;
        grid-area: unset;
    }

    .gal-lb-footer {
        grid-area: info;
        flex-direction: column;
        justify-content: space-between;
        border-top: none;
        border-left: none;
        padding: 32px 24px;
        background: #0F1E38;
        border-radius: 0 16px 16px 0;
        min-height: 100%;
    }

    .gal-lb-info { flex: 1; display: flex; flex-direction: column; gap: 12px; }

    .gal-lb-title {
        font-size: 1.1rem;
        font-weight: 700;
        color: #ffffff;
        white-space: normal;
        line-height: 1.4;
        margin: 0;
        padding-top: 48px; /* espace sous le bouton fermer */
    }

    .gal-lb-caption {
        font-size: 0.82rem;
        color: rgba(255,255,255,.6);
        line-height: 1.6;
        border-left: 3px solid #F5A623;
        padding-left: 10px;
        margin: 0;
    }

    .gal-lb-credit {
        display: flex;
        flex-direction: column;
        gap: 8px;
        margin-top: auto;
        padding-top: 20px;
        border-top: 1px solid rgba(255,255,255,.08);
        font-size: 0.75rem;
        color: rgba(255,255,255,.45);
    }

    .gal-lb-credit span {
        display: flex; align-items: center; gap: 8px;
    }

    .gal-lb-credit i { color: #F5A623; opacity: 1; font-size: 0.8rem; }

    .gal-lb-counter {
        font-size: 11px;
        color: rgba(255,255,255,.3);
        padding-top: 12px;
        border-top: 1px solid rgba(255,255,255,.06);
        text-align: right;
    }

    .gal-lb-nav--prev { left: 12px; }
    .gal-lb-nav--next { right: 300px; margin-right: 12px; }
}