/*
 * Galeries en grille : portfolio filtrable (/portfolio) et séries de l'espace privé.
 * Va avec style/js/galerie.js (filtres + visionneuse).
 */

.gg-galerie {
    --gg-accent: #d447a4;
    --gg-fond-vignette: #1b1b1b;
    padding: 40px 0 60px;
}

/* ---------- Filtres ---------- */

.gg-filtres {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    max-width: 1100px;
    margin: 0 auto 32px;
    padding: 0 16px;
    list-style: none;
}

.gg-filtres a {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    padding: 9px 16px;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 2px;
    color: #e6e6e6;
    font-family: "Poppins", sans-serif;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    white-space: nowrap;
    text-decoration: none;
    transition: background-color .2s, border-color .2s, color .2s;
}

.gg-filtres a span {
    font-weight: 400;
    opacity: .55;
}

.gg-filtres a:hover,
.gg-filtres a:focus-visible {
    border-color: var(--gg-accent);
    color: #fff;
}

.gg-filtres a[aria-current="true"] {
    background: var(--gg-accent);
    border-color: var(--gg-accent);
    color: #fff;
}

.gg-filtres a[aria-current="true"] span {
    opacity: .8;
}

/* Téléphone : une seule ligne qui défile au doigt */
@media (max-width: 767px) {
    .gg-galerie {
        padding: 24px 0 40px;
    }

    .gg-filtres {
        flex-wrap: nowrap;
        justify-content: flex-start;
        overflow-x: auto;
        scroll-snap-type: x proximity;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        margin-bottom: 18px;
        padding-bottom: 4px;
    }

    .gg-filtres::-webkit-scrollbar {
        display: none;
    }

    .gg-filtres li {
        scroll-snap-align: start;
    }
}

/* ---------- Grille de vignettes ---------- */

.gg-grille {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 6px;
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 16px;
    list-style: none;
}

@media (min-width: 1800px) {
    .gg-grille {
        max-width: 1800px;
        grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    }
}

@media (max-width: 767px) {
    .gg-grille {
        grid-template-columns: repeat(3, 1fr);
        gap: 3px;
        padding: 0 3px;
    }
}

.gg-grille [hidden] {
    display: none !important;
}

.gg-photo a {
    position: relative;
    display: block;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: var(--gg-fond-vignette);
}

.gg-photo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 50% 30%;
    transition: filter .45s ease, transform .6s ease, opacity .4s ease;
}

.gg-nb .gg-photo img {
    filter: grayscale(1) contrast(1.05);
}

@media (hover: hover) {
    .gg-photo a:hover img,
    .gg-photo a:focus-visible img {
        filter: none;
        transform: scale(1.04);
    }
}

.gg-photo a:focus-visible {
    outline: 2px solid var(--gg-accent);
    outline-offset: 2px;
}

/* Apparition douce après un changement de filtre */
.gg-photo.gg-apparait {
    animation: gg-apparition .35s ease both;
}

@keyframes gg-apparition {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .gg-photo img,
    .gg-photo.gg-apparait {
        transition: none;
        animation: none;
    }
}

.gg-suite {
    margin: 36px auto 0;
    padding: 0 16px;
    text-align: center;
    color: #bbb;
}

/* ---------- Visionneuse (lightbox) ---------- */

.gg-lb {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(8, 8, 8, .97);
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease, visibility 0s linear .25s;
    touch-action: pan-y pinch-zoom;
    -webkit-user-select: none;
    user-select: none;
}

.gg-lb.gg-ouverte {
    opacity: 1;
    visibility: visible;
    transition: opacity .25s ease;
}

.gg-lb-scene {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 64px 80px 72px;
    box-sizing: border-box;
}

.gg-lb-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    box-shadow: 0 10px 50px rgba(0, 0, 0, .6);
    opacity: 0;
    transition: opacity .3s ease, transform .3s ease;
}

.gg-lb-image.gg-chargee {
    opacity: 1;
}

.gg-lb-bouton {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .06);
    color: #fff;
    cursor: pointer;
    transition: background-color .2s;
}

.gg-lb-bouton:hover,
.gg-lb-bouton:focus-visible {
    background: rgba(255, 255, 255, .16);
    outline: none;
}

.gg-lb-bouton:focus-visible {
    box-shadow: 0 0 0 2px #d447a4;
}

.gg-lb-bouton svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    stroke-width: 1.8;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.gg-lb-fermer    { top: 10px; right: 12px; }
.gg-lb-precedent { left: 14px; top: 50%; margin-top: -26px; }
.gg-lb-suivant   { right: 14px; top: 50%; margin-top: -26px; }

.gg-lb-infos {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 18px 70px 22px;
    color: #cfcfcf;
    font-family: "Poppins", sans-serif;
    font-size: 12px;
    letter-spacing: 1px;
    text-align: center;
    text-transform: uppercase;
    pointer-events: none;
}

.gg-lb-compteur {
    margin-left: 10px;
    opacity: .55;
}

.gg-lb-chargement {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 34px;
    height: 34px;
    margin: -17px 0 0 -17px;
    border: 2px solid rgba(255, 255, 255, .15);
    border-top-color: #d447a4;
    border-radius: 50%;
    animation: gg-rotation .8s linear infinite;
    opacity: 0;
    transition: opacity .2s;
}

.gg-lb.gg-attente .gg-lb-chargement {
    opacity: 1;
}

@keyframes gg-rotation {
    to { transform: rotate(360deg); }
}

/* Téléphone : photo bord à bord, boutons en bas à portée du pouce */
@media (max-width: 767px) {
    .gg-lb-scene {
        padding: 56px 0 96px;
    }

    .gg-lb-image {
        box-shadow: none;
    }

    .gg-lb-fermer    { top: 4px; right: 4px; }
    .gg-lb-precedent,
    .gg-lb-suivant   { top: auto; bottom: 14px; margin-top: 0; }
    .gg-lb-precedent { left: 16px; }
    .gg-lb-suivant   { right: 16px; }

    .gg-lb-infos {
        bottom: 18px;
        padding: 16px 80px;
        font-size: 11px;
    }
}

body.gg-lb-active {
    overflow: hidden;
}
