/* ==========================================================================
   Bati ASC - Fiches realisations (Avant / Apres + galerie par chantier)
   ---------------------------------------------------------------------------
   Ajoute pour corriger les points 4, 5 et 6 signales par la cliente.
   Cette feuille est chargee APRES style.css : elle remplace volontairement les
   anciennes regles .gallery / .project / .images qui s'y trouvaient (bloc
   ajoute a la va-vite en fin de fichier) et qui donnaient une presentation
   desordonnee : titres sur bandeau gris, photos minuscules, pas de mise en
   avant des Avant / Apres.
   ========================================================================== */

/* ------------------------------------------------------------- conteneur */
section.gallery {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    column-gap: 40px;
    row-gap: 56px;
    max-width: 1240px;
    margin: 0 auto;
    padding: 70px 20px 50px;
    background: transparent;
}

section.gallery > .project {
    display: block;
    grid-column: 1 / -1;          /* fiche large par defaut */
    width: auto;
    max-width: none;
    margin: 0;
    padding: 0;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
}

/* fiche compacte : une seule photo ou deux, affichee sur une demi-largeur */
section.gallery > .project--compact {
    grid-column: span 1;
}

section.gallery > .project--compact .images.images-solo {
    max-width: none;
}

section.gallery > .project--compact > h2 {
    font-size: 18px;
}

/* ----------------------------------------------------------- titre de fiche */
section.gallery .project > h2 {
    background: none;
    color: #1c1c1c;
    text-align: left;
    padding: 0;
    margin: 0 0 10px;
    font-size: 26px;
    line-height: 1.3;
    letter-spacing: .03em;
    text-transform: uppercase;
}

section.gallery .project > h2::after {
    content: "";
    display: block;
    width: 46px;
    height: 2px;
    background: #c8a97e;
    margin-top: 14px;
}

section.gallery .project .project-meta {
    font-size: 14px;
    color: #8a8a8a;
    margin: 0 0 4px;
}

/* compteur de photos de la fiche (ajoute par js/realisations.js) */
section.gallery .project .project-count {
    display: inline-block;
    font-size: 11px;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: #8a8a8a;
    border: 1px solid #e0ddd8;
    border-radius: 40px;
    padding: 5px 14px;
    margin: 14px 0 24px;
}

/* --------------------------------------------------------- bloc Avant/Apres */
section.gallery .project .images {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
    justify-content: initial;
    padding: 0;
    margin: 0 0 28px;
}

/* fiche sans "avant" : une seule colonne, visuel plus large */
section.gallery .project .images.images-solo,
section.gallery .project .images:has(> .image-container:only-child) {
    grid-template-columns: minmax(0, 1fr);
    max-width: 760px;
}

section.gallery .project .image-container,
section.gallery .project .image-container-2 {
    display: block;
    flex: none;
    padding: 0;
    margin: 0;
    text-align: left;
}

section.gallery .project .image-container h3,
section.gallery .project .image-container-2 h3 {
    font-size: 12px;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: #1c1c1c;
    margin: 0 0 10px;
    padding: 0;
}

section.gallery .project .image-container h3::before {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #b5b5b5;
    margin-right: 9px;
    vertical-align: middle;
}

section.gallery .project .image-container.is-after h3::before {
    background: #c8a97e;
}

/* ------------------------------------------------------------- autres photos */
section.gallery .project .new-images {
    padding: 0;
    margin: 0;
    text-align: left;
}

section.gallery .project .title-picture {
    font-size: 12px;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: #7a7a7a;
    margin: 0 0 14px;
}

section.gallery .project .container-img-new {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
    justify-content: initial;
}

section.gallery .project .image-container-new {
    display: block;
    margin: 0;
    padding: 0;
}

/* ------------------------------------------------------------------- visuels */
section.gallery .project a.popup-btn {
    display: block;
    position: relative;
    overflow: hidden;
    border-radius: 6px;
    background: #eeebe7;
}

section.gallery .project .images a.popup-btn {
    aspect-ratio: 4 / 3;
}

section.gallery .project .container-img-new a.popup-btn {
    aspect-ratio: 1 / 1;
}

section.gallery .project a.popup-btn img,
section.gallery .project .image-container img,
section.gallery .project .image-container-2 img,
section.gallery .project .image-container-new img,
section.gallery .project .new-images img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    object-fit: cover;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    transition: transform .5s ease;
}

section.gallery .project a.popup-btn:hover img {
    transform: scale(1.05);
}

/* loupe au survol : indique que la photo s'ouvre en grand */
section.gallery .project a.popup-btn::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background-color: rgba(20, 20, 20, .34);
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='42' height='42' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='1.4' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-4.3-4.3M11 8v6M8 11h6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0;
    transition: opacity .35s ease;
    pointer-events: none;
}

section.gallery .project a.popup-btn:hover::after {
    opacity: 1;
}

/* -------------------------------------------------------------- responsive */
@media (max-width: 991px) {
    section.gallery {
        grid-template-columns: 1fr;
        row-gap: 44px;
        padding: 45px 18px 25px;
    }

    section.gallery > .project--compact {
        grid-column: 1 / -1;
    }

    section.gallery .project > h2 {
        font-size: 20px;
    }

    section.gallery .project .images {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    section.gallery .project .container-img-new {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 10px;
    }
}

/* ------------------------- lightbox : compteur, titre et fleches lisibles */
.mfp-counter {
    font-size: 13px;
    letter-spacing: .1em;
    color: #ddd;
}

.mfp-title {
    font-size: 14px;
    letter-spacing: .04em;
    color: #f0f0f0;
    padding-right: 44px;
}

.mfp-arrow {
    opacity: .85;
}

.mfp-arrow:hover {
    opacity: 1;
}
