/* Carte normale : dimensions multipliées par 3 */
#manifestations-2026 #afm-zone-carte {
    width: min(900px, 100%) !important;
    max-width: 100% !important;
    min-width: 0 !important;
}

#manifestations-2026 #afm-carte {
    width: 100% !important;
    height: 780px !important;
    max-height: none !important;
}

/* Bouton visible */
#manifestations-2026 #afm-bouton-carte {
    display: inline-block !important;
    cursor: pointer !important;
    padding: 10px 18px !important;
    background: #8b0055 !important;
    color: white !important;
    border: 0 !important;
    border-radius: 7px !important;
    margin-top: 10px !important;
}

/* Carte encore plus grande au clic, sans plein écran */
#manifestations-2026 #afm-zone-carte.afm-agrandie {
    width: 100% !important;
    max-width: none !important;
    grid-column: 1 / -1 !important;
}

#manifestations-2026 #afm-zone-carte.afm-agrandie #afm-carte {
    width: 100% !important;
    height: 85vh !important;
    min-height: 780px !important;
}

/* Grande fenêtre des affiches */
#afm-affiches-commune {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    background: rgba(0,0,0,.88);
    align-items: center;
    justify-content: center;
    padding: 50px 25px 25px;
    box-sizing: border-box;
}

#afm-affiches-commune.visible {
    display: flex;
}

#afm-affiches-commune .afm-affiches-contenu {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 20px;
    width: 100%;
    max-height: 100%;
    overflow: auto;
}

#afm-affiches-commune .afm-affiches-contenu img,
#afm-affiches-commune .afm-affiches-contenu img:nth-child(2) {
    display: block !important;
    width: auto !important;
    height: 90vh !important;
    max-width: 95vw !important;
    max-height: 90vh !important;
    object-fit: contain !important;
    flex-shrink: 0 !important;
}

#afm-affiches-commune .afm-fermer-commune {
    position: absolute;
    top: 12px;
    right: 20px;
    width: 48px;
    height: 48px;
    border: 0;
    border-radius: 50%;
    background: white;
    color: black;
    font-size: 32px;
    cursor: pointer;
}

/* Grille des affiches sous la carte */
#manifestations-2026 #afm-affiches {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 20px !important;
    width: 100% !important;
    max-width: none !important;
    align-items: stretch !important;
}

#manifestations-2026 #afm-affiches article,
#manifestations-2026 #afm-affiches .afm-affiche-card {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    box-sizing: border-box !important;
    padding: 16px !important;
}

#manifestations-2026 #afm-affiches img {
    display: block !important;
    width: 100% !important;
    height: 260px !important;
    max-width: 100% !important;
    object-fit: contain !important;
}

#manifestations-2026 #afm-affiches strong,
#manifestations-2026 #afm-affiches h3 {
    overflow-wrap: break-word;
    line-height: 1.4;
}

@media (max-width: 900px) {
    #manifestations-2026 #afm-affiches {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 550px) {
    #manifestations-2026 #afm-affiches {
        grid-template-columns: 1fr !important;
    }
}


/* CORRECTION : carte et affiches superposees verticalement */

/* Conteneur principal */
#manifestations-2026 {
    display: block !important;
    width: 95% !important;
    max-width: 1200px !important;
    margin: 25px auto 40px !important;
}

/* Carte sur toute la largeur */
#manifestations-2026 #afm-zone-carte {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    float: none !important;
    clear: both !important;
}

/* Bouton sous la carte */
#manifestations-2026 #afm-bouton-carte {
    display: inline-block !important;
    margin: 12px 0 25px !important;
}

/* Grille des affiches sous la carte */
#manifestations-2026 #afm-affiches {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 20px !important;
    width: 100% !important;
    max-width: 100% !important;
    float: none !important;
    clear: both !important;
}

/* Cartes des manifestations */
#manifestations-2026 #afm-affiches article,
#manifestations-2026 #afm-affiches .afm-affiche-card {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    box-sizing: border-box !important;
}

/* Images */
#manifestations-2026 #afm-affiches img {
    width: 100% !important;
    height: 300px !important;
    max-width: 100% !important;
    object-fit: contain !important;
}

@media (max-width: 800px) {
    #manifestations-2026 #afm-affiches {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 500px) {
    #manifestations-2026 #afm-affiches {
        grid-template-columns: 1fr !important;
    }
}


/* Correction du conteneur qui regroupe carte et affiches */
#manifestations-2026 #afm-disposition-2026 {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 25px !important;
    width: 100% !important;
    max-width: none !important;
}

/* Carte pleine largeur */
#manifestations-2026 #afm-disposition-2026 > #afm-zone-carte {
    width: 100% !important;
    max-width: none !important;
    flex: none !important;
}

/* Bloc affiches pleine largeur */
#manifestations-2026 #afm-disposition-2026 > #afm-affiches {
    width: 100% !important;
    max-width: none !important;
    flex: none !important;
}

/* Grille de trois affiches par ligne */
#manifestations-2026 #afm-affiches {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 20px !important;
}

@media (max-width: 800px) {
    #manifestations-2026 #afm-affiches {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 500px) {
    #manifestations-2026 #afm-affiches {
        grid-template-columns: 1fr !important;
    }
}


/* Carte Téléthon 87 : hauteur doublée */
#manifestations-2026 #afm-carte {
    height: 600px !important;
    min-height: 600px !important;
}

@media (max-width: 600px) {
    #manifestations-2026 #afm-carte {
        height: 450px !important;
        min-height: 450px !important;
    }
}


/* AFM CARTE COMPACTE - VERSION FINALE */

/* Carte normale */
body #manifestations-2026 #afm-zone-carte:not(.afm-agrandie) #afm-carte {
    height: 300px !important;
    min-height: 0 !important;
    max-height: 300px !important;
}

/* Carte agrandie au clic */
body #manifestations-2026 #afm-zone-carte.afm-agrandie #afm-carte {
    height: 85vh !important;
    min-height: 600px !important;
    max-height: none !important;
}

/* Version mobile */
@media (max-width: 600px) {
    body #manifestations-2026 #afm-zone-carte:not(.afm-agrandie) #afm-carte {
        height: 240px !important;
        min-height: 0 !important;
        max-height: 240px !important;
    }
}

/* AFM 2026 - Alignement des affiches */
#manifestations-2026 #afm-disposition-2026 {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100% !important;
}

#manifestations-2026 #afm-zone-affiches {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    flex: none !important;
    float: none !important;
    clear: both !important;
    box-sizing: border-box !important;
}

#manifestations-2026 #afm-zone-affiches > h2 {
    width: 100%;
    text-align: left;
}

#manifestations-2026 #afm-zone-affiches #afm-affiches {
    display: grid !important;
    width: 100% !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 20px !important;
    align-items: stretch !important;
}

#manifestations-2026 #afm-affiches .afm-affiche-card {
    min-width: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

@media (max-width: 800px) {
    #manifestations-2026 #afm-zone-affiches #afm-affiches {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 500px) {
    #manifestations-2026 #afm-zone-affiches #afm-affiches {
        grid-template-columns: 1fr !important;
    }
}

/* AFM 2026 - Alignement des affiches */
#manifestations-2026 #afm-disposition-2026 {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100% !important;
}

#manifestations-2026 #afm-zone-affiches {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    flex: none !important;
    float: none !important;
    clear: both !important;
    box-sizing: border-box !important;
}

#manifestations-2026 #afm-zone-affiches > h2 {
    width: 100%;
    text-align: left;
}

#manifestations-2026 #afm-zone-affiches #afm-affiches {
    display: grid !important;
    width: 100% !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 20px !important;
    align-items: stretch !important;
}

#manifestations-2026 #afm-affiches .afm-affiche-card {
    min-width: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

@media (max-width: 800px) {
    #manifestations-2026 #afm-zone-affiches #afm-affiches {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 500px) {
    #manifestations-2026 #afm-zone-affiches #afm-affiches {
        grid-template-columns: 1fr !important;
    }
}

/* AFM 2026 - Communes côte à côte */

/* Grille principale des communes */
#manifestations-2026 #afm-disposition-2026
#afm-zone-affiches #afm-affiches {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 24px !important;
    align-items: start !important;
}

/* Chaque commune dans sa propre colonne */
#manifestations-2026 #afm-affiches .afm-groupe-commune {
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
}

/* Affiches à l'intérieur de chaque commune */
#manifestations-2026 #afm-affiches .afm-groupe-grille {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 12px !important;
}

/* Tablette */
@media (max-width: 900px) {
    #manifestations-2026 #afm-disposition-2026
    #afm-zone-affiches #afm-affiches {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

/* Mobile */
@media (max-width: 550px) {
    #manifestations-2026 #afm-disposition-2026
    #afm-zone-affiches #afm-affiches {
        grid-template-columns: 1fr !important;
    }
}
