/* ============================================================
   FPAM — Galerie Photos
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
    --gallery-green:        #2d7a3a;
    --gallery-green-dark:   #1b5e20;
    --gallery-green-light:  #4caf50;
    --gallery-accent:       #81c784;
    --gallery-bg:           #f4f7f4;
    --gallery-card-radius:  10px;
    --gallery-gap:          14px;
    --gallery-transition:   0.35s ease;
}

/* ── Page wrapper ───────────────────────────────────────────── */
.gallery-page {
    background: var(--gallery-bg);
    min-height: 60vh;
}

/* ================================================================
   HERO
   ================================================================ */
.gallery-hero {
    position: relative;
    background: linear-gradient(135deg, var(--gallery-green-dark) 0%, var(--gallery-green) 55%, #1a1a2e 100%);
    padding: 90px 0 70px;
    overflow: hidden;
    text-align: center;
}

.gallery-hero-bg {
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 20% 50%, rgba(255,255,255,0.06) 0%, transparent 60%),
        radial-gradient(circle at 80% 20%, rgba(255,255,255,0.04) 0%, transparent 50%);
    pointer-events: none;
}

.gallery-hero-content {
    position: relative;
    z-index: 1;
}

.gallery-hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(4px);
    color: rgba(255,255,255,0.9);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 6px 16px;
    border-radius: 30px;
    border: 1px solid rgba(255,255,255,0.25);
    margin-bottom: 18px;
}

.gallery-hero-title {
    font-family: 'Poppins', sans-serif;
    font-size: clamp(2rem, 5vw, 3.4rem);
    font-weight: 700;
    color: #fff;
    margin: 0 0 14px;
    text-shadow: 0 2px 8px rgba(0,0,0,0.18);
    line-height: 1.15;
}

.gallery-hero-sub {
    font-size: clamp(0.95rem, 2vw, 1.15rem);
    color: rgba(255,255,255,0.82);
    max-width: 540px;
    margin: 0 auto 20px;
    line-height: 1.6;
}

.gallery-hero-count {
    display: inline-block;
    background: rgba(255,255,255,0.2);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 5px 18px;
    border-radius: 20px;
    letter-spacing: 0.04em;
}

.gallery-hero-wave {
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    line-height: 0;
}

.gallery-hero-wave svg {
    width: 100%;
    height: 60px;
    display: block;
}

/* ================================================================
   FILTRES
   ================================================================ */
.gallery-filters {
    background: #fff;
    padding: 18px 0;
    border-bottom: 1px solid #e8f5e9;
    position: sticky;
    top: 0;
    z-index: 20;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.filter-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 22px;
    border: 2px solid var(--gallery-green);
    border-radius: 30px;
    background: transparent;
    color: var(--gallery-green);
    font-family: 'Poppins', sans-serif;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--gallery-transition), color var(--gallery-transition), box-shadow var(--gallery-transition);
    white-space: nowrap;
}

.filter-btn .filter-count {
    background: var(--gallery-green);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 12px;
    transition: background var(--gallery-transition), color var(--gallery-transition);
}

.filter-btn:hover,
.filter-btn.active {
    background: var(--gallery-green);
    color: #fff;
    box-shadow: 0 4px 14px rgba(45,122,58,0.3);
}

.filter-btn:hover .filter-count,
.filter-btn.active .filter-count {
    background: rgba(255,255,255,0.25);
    color: #fff;
}

/* ================================================================
   SECTION GALERIE
   ================================================================ */
.gallery-section {
    padding: 50px 0 90px;
}

/* ── Grille ──────────────────────────────────────────────────── */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--gallery-gap);
}

/* ── Carte photo ──────────────────────────────────────────────── */
.gallery-item {
    position: relative;
    border-radius: var(--gallery-card-radius);
    overflow: hidden;
    cursor: pointer;
    outline: none;
    background: #ddd;
    box-shadow: 0 2px 10px rgba(0,0,0,0.10);
    transition:
        transform var(--gallery-transition),
        box-shadow var(--gallery-transition);
}

.gallery-item:hover {
    transform: translateY(-5px) scale(1.01);
    box-shadow: 0 12px 32px rgba(0,0,0,0.20);
    z-index: 1;
}

.gallery-item:focus-visible {
    outline: 3px solid var(--gallery-green-light);
    outline-offset: 3px;
}

/* Aspect ratio uniforme 4:3 */
.gallery-item-inner {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
}

.gallery-item-inner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform 0.55s var(--gallery-transition);
    /* skeleton avant chargement */
    background: linear-gradient(90deg, #e8f5e9 25%, #d4ebd6 50%, #e8f5e9 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.6s infinite;
}

.gallery-item-inner img.loaded {
    animation: none;
    background: none;
}

@keyframes skeleton-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.gallery-item:hover .gallery-item-inner img {
    transform: scale(1.10);
}

/* ── Overlay ─────────────────────────────────────────────────── */
.gallery-item-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(27, 94, 32, 0.80) 0%,
        rgba(45, 122, 58, 0.40) 60%,
        transparent 100%
    );
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--gallery-transition);
}

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

.gallery-overlay-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 16px;
    text-align: center;
}

.gallery-zoom-icon {
    width: 52px;
    height: 52px;
    border: 2px solid rgba(255,255,255,0.85);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.1rem;
    background: rgba(255,255,255,0.12);
    backdrop-filter: blur(3px);
    transition: transform 0.25s ease, background 0.25s ease;
}

.gallery-item:hover .gallery-zoom-icon {
    transform: scale(1.12);
    background: rgba(255,255,255,0.22);
}

.gallery-item-title {
    color: #fff;
    font-family: 'Poppins', sans-serif;
    font-size: 0.82rem;
    font-weight: 500;
    text-shadow: 0 1px 4px rgba(0,0,0,0.6);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 8px;
}

/* ── Item masqué (filtre) ──────────────────────────────────────── */
.gallery-item.hidden {
    display: none;
}

/* ── Pas de résultats ──────────────────────────────────────────── */
.gallery-no-results {
    text-align: center;
    padding: 70px 20px;
    color: #90a68f;
}

.gallery-no-results i {
    font-size: 3rem;
    margin-bottom: 14px;
    display: block;
    opacity: 0.4;
}

/* ── État vide ─────────────────────────────────────────────────── */
.gallery-empty {
    text-align: center;
    padding: 90px 20px;
    color: #90a68f;
}

.gallery-empty i {
    font-size: 4.5rem;
    display: block;
    margin-bottom: 18px;
    opacity: 0.3;
}

.gallery-empty h3 {
    font-family: 'Poppins', sans-serif;
    font-size: 1.3rem;
    color: #555;
    margin-bottom: 8px;
}

.gallery-empty p {
    font-size: 1rem;
    margin-bottom: 24px;
}

.gallery-empty-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--gallery-green);
    color: #fff;
    padding: 12px 28px;
    border-radius: 30px;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    transition: background 0.25s, box-shadow 0.25s;
}

.gallery-empty-btn:hover {
    background: var(--gallery-green-dark);
    box-shadow: 0 6px 20px rgba(45,122,58,0.35);
    color: #fff;
}

/* ================================================================
   LIGHTBOX
   ================================================================ */
.fpam-lightbox {
    position: fixed;
    inset: 0;
    z-index: 99990;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.fpam-lightbox.active {
    opacity: 1;
    visibility: visible;
}

/* Fond sombre */
.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 15, 5, 0.93);
    cursor: zoom-out;
}

/* Stage image */
.lightbox-stage {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: calc(100vw - 140px);
    max-height: calc(100vh - 120px);
}

.lightbox-img {
    max-width: 100%;
    max-height: calc(100vh - 130px);
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 12px 60px rgba(0,0,0,0.65);
    opacity: 0;
    transition: opacity 0.35s ease;
    display: block;
    position: relative;
    z-index: 1;
}

.lightbox-img.loaded {
    opacity: 1;
}

.lightbox-loader {
    position: absolute;
    color: rgba(255,255,255,0.6);
    font-size: 2.2rem;
    z-index: 2;
    transition: opacity 0.2s ease;
}

.lightbox-loader.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Bouton fermer */
.lightbox-close {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 99999;
    width: 46px;
    height: 46px;
    border: 2px solid rgba(255,255,255,0.45);
    border-radius: 50%;
    background: rgba(0,0,0,0.55);
    color: rgba(255,255,255,0.85);
    font-size: 1.05rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.22s ease;
    backdrop-filter: blur(4px);
}

.lightbox-close:hover {
    background: #fff;
    border-color: #fff;
    color: #111;
    transform: rotate(90deg);
}

/* Flèches navigation */
.lightbox-prev,
.lightbox-next {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 99999;
    width: 52px;
    height: 52px;
    border: 2px solid rgba(255,255,255,0.40);
    border-radius: 50%;
    background: rgba(0,0,0,0.50);
    color: rgba(255,255,255,0.85);
    font-size: 1.05rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.22s ease;
    backdrop-filter: blur(4px);
}

.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }

.lightbox-prev:hover,
.lightbox-next:hover {
    background: var(--gallery-green);
    border-color: var(--gallery-green);
    color: #fff;
    transform: translateY(-50%) scale(1.08);
}

/* Pied de page lightbox */
.lightbox-footer {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: calc(100vw - 140px);
    padding: 14px 4px 0;
    gap: 20px;
}

.lightbox-title {
    color: rgba(255,255,255,0.85);
    font-family: 'Poppins', sans-serif;
    font-size: 0.92rem;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lightbox-counter {
    color: rgba(255,255,255,0.50);
    font-family: 'Poppins', sans-serif;
    font-size: 0.82rem;
    font-weight: 500;
    white-space: nowrap;
    background: rgba(255,255,255,0.08);
    padding: 3px 12px;
    border-radius: 12px;
}

/* ── Animation ouverture ─────────────────────────────────────── */
.fpam-lightbox.active .lightbox-stage {
    animation: lightbox-in 0.3s ease;
}

@keyframes lightbox-in {
    from { transform: scale(0.94); }
    to   { transform: scale(1); }
}

/* ================================================================
   RESPONSIVE
   ================================================================ */

/* Tablette large */
@media (max-width: 1200px) {
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Tablette */
@media (max-width: 900px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .gallery-hero {
        padding: 70px 0 55px;
    }

    .lightbox-stage {
        max-width: calc(100vw - 90px);
    }

    .lightbox-footer {
        max-width: calc(100vw - 90px);
    }

    .lightbox-prev { left: 8px; }
    .lightbox-next { right: 8px; }

    .lightbox-prev,
    .lightbox-next {
        width: 44px;
        height: 44px;
        font-size: 0.95rem;
    }
}

/* Mobile */
@media (max-width: 580px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .gallery-hero {
        padding: 55px 0 45px;
    }

    .gallery-zoom-icon {
        width: 42px;
        height: 42px;
        font-size: 0.95rem;
    }

    .lightbox-stage {
        max-width: 100vw;
        max-height: calc(100vh - 100px);
    }

    .lightbox-footer {
        max-width: 100vw;
        padding: 10px 12px 0;
    }

    .lightbox-prev,
    .lightbox-next {
        width: 40px;
        height: 40px;
        border-radius: 6px;
        font-size: 0.9rem;
    }

    .lightbox-prev { left: 6px; }
    .lightbox-next { right: 6px; }

    .lightbox-close {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
    }

    .gallery-filters {
        padding: 12px 0;
    }

    .filter-list {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 4px;
        scrollbar-width: none;
    }

    .filter-list::-webkit-scrollbar {
        display: none;
    }
}

/* Très petit mobile */
@media (max-width: 360px) {
    .gallery-grid {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }
}
