/* Structure des pages : bandeau supérieur, en-tête, menus, pied de page. */

.bandeau-demo { margin: 0; padding: 8px 16px; background: var(--reserve-fond); color: #5C3800; text-align: center; font-weight: 700; font-size: 15px; }

.barre-territoire { background: var(--couleur-secondaire); color: #fff; font-size: 14px; }
.barre-territoire .conteneur { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 24px; padding-block: 8px; }
.barre-territoire a { color: #fff; }
.barre-territoire__liens { display: flex; flex-wrap: wrap; gap: 6px 20px; }
.barre-territoire__liens a { text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.barre-territoire__liens a:hover { text-decoration: underline; color: #fff; }

/* En-tête */
.entete { position: relative; z-index: 40; background: #fff; border-bottom: 1px solid var(--bordure); }
.entete__ligne { display: flex; align-items: center; gap: 16px 32px; padding-block: 14px; }
.entete__marque { display: inline-flex; align-items: center; gap: 12px; flex: none; }
.entete__marque .logo { font-size: 34px; }
.entete__navigation { flex: 1 1 auto; }
.entete__actions { display: flex; align-items: center; gap: 6px; flex: none; }
.entete__compteur {
    position: absolute; top: 3px; right: 0; min-width: 20px; height: 20px; padding: 0 5px;
    border-radius: 999px; background: var(--couleur-principale); color: #fff; font-size: 12px; font-weight: 700;
    display: grid; place-items: center; border: 2px solid #fff;
}
.entete__compte { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px; font-weight: 700; text-decoration: none; }
.entete__burger { display: none; }

.menu-principal { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 26px; font-weight: 700; font-size: 16px; }
.menu-principal > li { position: relative; }
.menu-principal a, .menu-principal__bouton {
    display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 0;
    border: 0; background: none; font: inherit; color: var(--texte); text-decoration: none; cursor: pointer;
}
.menu-principal a[aria-current="page"] { text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 8px; text-decoration-color: var(--couleur-principale); }
.menu-principal__bouton[aria-expanded="true"] svg { transform: rotate(180deg); }

.sous-menu {
    position: absolute; top: calc(100% + 10px); left: -16px; min-width: 260px; z-index: 50;
    list-style: none; margin: 0; padding: 10px; background: #fff;
    border: 2px solid var(--anthracite); border-radius: var(--rayon); box-shadow: 0 6px 0 var(--anthracite);
}
.sous-menu[hidden] { display: none; }
.sous-menu a { display: flex; min-height: 40px; padding: 0 12px; border-radius: 10px; font-weight: 600; }
.sous-menu a:hover { background: var(--fond-doux); color: var(--texte); }

.mega-menu {
    position: absolute; top: calc(100% + 10px); left: -16px; z-index: 50; width: min(880px, 90vw);
    padding: 22px; background: #fff; border: 2px solid var(--anthracite); border-radius: var(--rayon-grand); box-shadow: 0 6px 0 var(--anthracite);
    display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px 18px;
}
.mega-menu[hidden] { display: none; }
.mega-menu__groupe { list-style: none; margin: 0; padding: 0; }
.mega-menu__groupe > li > a { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 700; }
.mega-menu__groupe ul { list-style: none; margin: 0 0 8px; padding: 0 0 0 34px; }
.mega-menu__groupe ul a { min-height: 34px; font-weight: 500; color: var(--texte-moyen); }
.mega-menu__icone { width: 26px; height: 26px; border-radius: 8px; display: inline-grid; place-items: center; background: var(--principale-douce); color: var(--couleur-principale); }

@media (max-width: 1100px) {
    .entete__burger { display: inline-grid; }
    .entete__ligne { flex-wrap: wrap; }
    .entete__navigation {
        order: 10; flex: 1 1 100%; display: none;
        padding: 12px 0 8px; border-top: 1px solid var(--bordure);
    }
    .entete__navigation.est-ouvert { display: block; }
    .menu-principal { flex-direction: column; align-items: stretch; gap: 0; }
    .menu-principal > li { border-bottom: 1px solid var(--bordure); }
    .menu-principal a, .menu-principal__bouton { width: 100%; min-height: 52px; justify-content: space-between; }
    .sous-menu, .mega-menu { position: static; width: auto; box-shadow: none; border: 0; padding: 0 0 12px; }
    .entete__actions { margin-left: auto; }
    .entete__compte-libelle { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
/* Mobile : en-tête à la couleur principale du site, actions déplacées dans la barre d'onglets */
.barre-mobile, .entete__alertes, .menu-principal__mobile { display: none; }
@media (max-width: 600px) {
    .barre-territoire { display: none; }
    .menu-principal__mobile { display: list-item; }
    .entete { background: var(--couleur-principale); border-bottom: 0; color: #fff; border-radius: 0 0 24px 24px; }
    /* accueil : l'accroche et la recherche prolongent l'en-tête (templates/front/partials/home/bloc_home.html.twig) */
    .entete--accueil { border-radius: 0; }
    .entete__alertes { display: inline-grid; color: #fff; border: 1px solid rgba(255, 255, 255, 0.55); }
    .entete__alertes:hover { background: rgba(255, 255, 255, 0.16); color: #fff; }
    .entete__ligne { padding-block: 12px; gap: 12px; }
    .entete__marque { gap: 8px; }
    .entete__marque .logo { font-size: 28px; }
    .entete .logo, .entete .logo__accent, .entete .logo__boucle, .entete .logo__exclamation { color: #fff; }
    .entete__bureau { display: none !important; }
    .entete__burger { color: #fff; border: 1px solid rgba(255, 255, 255, 0.55); }
    /* portail en mode présentation : bouton de démonstration blanc sur l'en-tête coloré, sans icône pour tenir sur la ligne */
    .entete__demo { background: #fff; border-color: #fff; color: var(--texte); padding-inline: 16px; }
    .entete__demo:hover, .entete__demo:focus-visible { background: rgba(255, 255, 255, 0.88); color: var(--texte); }
    .entete__demo svg { display: none; }
    .entete__burger:hover { background: rgba(255, 255, 255, 0.16); color: #fff; }
    /* menu ouvert : carte flottante sous l'en-tête */
    .entete__navigation.est-ouvert {
        position: absolute; left: 12px; right: 12px; top: calc(100% + 8px); z-index: 50;
        padding: 6px 18px 18px; border: 0; border-radius: 22px; background: #fff; color: var(--texte);
        box-shadow: 0 18px 40px rgba(18, 31, 38, 0.22), 0 0 0 100vmax rgba(18, 31, 38, 0.35); max-height: calc(100vh - 120px); overflow-y: auto;
    }
    .entete__navigation .menu-principal > li:last-of-type { border-bottom: 0; }
    .entete__navigation .menu-principal a { justify-content: flex-start; font-size: 18px; }
    .entete__navigation .menu-principal > li > a::after {
        content: ""; margin-left: auto; width: 8px; height: 8px; border-top: 2px solid currentColor; border-right: 2px solid currentColor;
        transform: rotate(45deg); opacity: 0.45;
    }
    .entete__navigation .menu-principal__bouton { font-size: 18px; }
    .menu-principal > li.menu-principal__mobile { border-bottom: 0; padding-top: 14px; }
    .menu-principal__mobile .bouton { min-height: 52px; font-size: 17px; }
    .barre-territoire__liens a[href$="/contact"] { display: none; }

    /* --hauteur-barre-debug : barre de debug Symfony en développement (front/layout/base_front.html.twig) */
    /* place de la barre d'onglets, quand la page en a une (pas sur le portail en mode présentation) */
    body:has(.barre-mobile) { padding-bottom: calc(76px + env(safe-area-inset-bottom) + var(--hauteur-barre-debug, 0px)); }
    .barre-mobile {
        position: fixed; left: 0; right: 0; bottom: var(--hauteur-barre-debug, 0px); z-index: 60;
        display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: end;
        padding: 6px 6px calc(8px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--bordure);
    }
    .barre-mobile a {
        position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
        min-height: 54px; font-size: 12px; font-weight: 700; color: var(--texte-discret); text-decoration: none;
    }
    .barre-mobile a[aria-current="page"] { color: var(--principale-fonce); }
    .barre-mobile__plus {
        width: 56px; height: 56px; margin-top: -30px; margin-bottom: 2px; border-radius: 20px; display: grid; place-items: center;
        background: var(--couleur-principale); color: #fff; border: 2px solid var(--anthracite); box-shadow: var(--ombre-etiquette);
    }
    .barre-mobile__donner { color: var(--texte) !important; }
    .barre-mobile__compteur {
        position: absolute; top: 2px; left: 54%; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 999px;
        background: var(--couleur-principale); color: #fff; font-size: 11px; display: grid; place-items: center; border: 2px solid #fff;
    }
}

/* Encart bandeau avant le pied de page */
.bandeau-encart { padding-block: 24px 72px; }

/* Pied de page */
.pied { background: var(--couleur-secondaire); color: #fff; padding: 64px 0 28px; }
.pied a { color: #fff; text-decoration: none; }
.pied a:hover { text-decoration: underline; color: #fff; }
.pied__colonnes { display: flex; flex-wrap: wrap; gap: 40px 64px; padding-bottom: 40px; border-bottom: 1px solid rgba(255, 255, 255, 0.16); }
.pied__presentation { flex: 1 1 300px; min-width: 0; }
.pied__presentation .logo { font-size: 40px; }
.pied__presentation p { margin: 16px 0 0; color: var(--texte-sur-fonce); max-width: 24em; }
.pied__colonne { flex: 0 1 200px; }
.pied__colonne h2 { margin: 0 0 14px; font-size: 16px; letter-spacing: 0.02em; }
.pied__colonne ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pied__colonne address { font-style: normal; color: var(--texte-sur-fonce); }
.pied__reseaux { display: flex; gap: 8px; margin-top: 14px; }
.pied__reseaux a { width: 44px; height: 44px; border-radius: 999px; display: inline-grid; place-items: center; background: rgba(255, 255, 255, 0.1); }
.pied__reseaux a:hover { background: rgba(255, 255, 255, 0.2); }
.pied__bas { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px; padding-top: 24px; font-size: 14px; color: var(--texte-sur-fonce); }
.pied__bas ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 22px; }
.pied__bas a { color: var(--texte-sur-fonce); text-decoration: underline; }
.pied__bas a.pied__soutien { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; text-decoration: none; opacity: 0.85; }
.pied__bas a.pied__soutien:hover, .pied__bas a.pied__soutien:focus-visible { opacity: 1; text-decoration: none; }
.pied__soutien img { display: block; height: 32px; width: auto; }

/* Messages flash */
.messages-flash { padding-top: 24px; display: flex; flex-direction: column; gap: 10px; }
