/* CFPPA Galerie — Galerie d'images avec lightbox */

/* ===========================================
   Galerie principale
   =========================================== */

.cfppa-galerie {
    max-width: 800px;
    margin: 0 auto;
}

.cfppa-galerie__main {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    background: #1a1a1a;
    cursor: pointer;
    line-height: 0;
}

.cfppa-galerie__img {
    width: 100%;
    height: auto;
    display: block;
    transition: opacity 0.3s ease;
}

.cfppa-galerie__img.is-loading {
    opacity: 0.4;
}

/* Fleches de navigation */
.cfppa-galerie__arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.56);
    color: #333;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    transition: background 0.2s, transform 0.2s;
    z-index: 2;
    padding: 0;
}

.cfppa-galerie__arrow:hover {
    background: #fff;
    transform: translateY(-50%) scale(1.08);
    color: #000;
}
.cfppa-galerie__arrow:focus {
    background: #fff;
    color: #000;
}
.cfppa-galerie__arrow--prev {
    left: 12px;
}

.cfppa-galerie__arrow--next {
    right: 12px;
}

/* Compteur */
.cfppa-galerie__counter {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 13px;
    padding: 4px 10px;
    border-radius: 12px;
    z-index: 2;
    pointer-events: none;
}

/* ===========================================
   Thumbnails
   =========================================== */

.cfppa-galerie__thumbs {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
}

.cfppa-galerie__thumb {
    flex: 0 0 auto;
    width: 72px;
    height: 54px;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
    background: #eee;
    transition: border-color 0.2s, opacity 0.2s;
    opacity: 0.6;
}

.cfppa-galerie__thumb:hover {
    opacity: 0.9;
}

.cfppa-galerie__thumb--active {
    border-color: var(--couleur-domaine, #3caae5);
    opacity: 1;
}

.cfppa-galerie__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ===========================================
   Lightbox
   =========================================== */

.cfppa-lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

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

.cfppa-lightbox__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
}

.cfppa-lightbox__content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cfppa-lightbox__img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.4);
    transition: opacity 0.25s ease;
}

.cfppa-lightbox__img.is-loading {
    opacity: 0.3;
}

/* Bouton fermer */
.cfppa-lightbox__close {
    position: fixed;
    top: 16px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 2;
    line-height: 1;
    padding: 0;
}

.cfppa-lightbox__close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Fleches lightbox */
.cfppa-lightbox__arrow {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 2;
    padding: 0;
}

.cfppa-lightbox__arrow:hover {
    background: rgba(255, 255, 255, 0.3);
}

.cfppa-lightbox__arrow--prev {
    left: 16px;
}

.cfppa-lightbox__arrow--next {
    right: 16px;
}

/* Compteur lightbox */
.cfppa-lightbox__counter {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    z-index: 2;
}

/* ===========================================
   Responsive
   =========================================== */

@media (max-width: 767px) {
    .cfppa-galerie__main {
        border-radius: 6px;
    }

    .cfppa-galerie__arrow {
        width: 36px;
        height: 36px;
    }

    .cfppa-galerie__arrow--prev {
        left: 8px;
    }

    .cfppa-galerie__arrow--next {
        right: 8px;
    }

    .cfppa-galerie__arrow svg {
        width: 18px;
        height: 18px;
    }

    .cfppa-galerie__thumb {
        width: 56px;
        height: 42px;
    }

    .cfppa-lightbox__arrow {
        width: 40px;
        height: 40px;
    }

    .cfppa-lightbox__arrow svg {
        width: 24px;
        height: 24px;
    }
}
