/*
 * En-tête sur téléphone et tablette (moins de 992 px) : thèmes Chaleureux, Sobre et Verger (barre #nav-menu-links).
 *
 * Une seule barre de 64 px, fixée en haut de l'écran : logo et nom de la Maison à gauche, Contact et Menu à droite.
 * Repères suivis : barre fixe de 56 à 72 px, logo de 36 à 44 px de haut, zones tactiles d'au moins 44 × 44 px espacées
 * de 8 px, marges latérales de 16 px (12 px sous 360 px), nom lisible (15 px, deux lignes au plus).
 * Le grand en-tête de l'ordinateur (logo, devise, liens, Qualiopi) est masqué : les liens utiles restent dans le menu
 * ouvert, Qualiopi descend en haut du pied de page sous 992 px (voir admin_area/image-marque/bloc.html.twig).
 * Ordinateur (992 px et plus) : rien ne change, la marque mobile est masquée.
 */
.wm-marque-mobile {
    display: none;
}

@media (max-width: 991.98px) {
    body .navbar-custom {
        display: none !important;
    }

    body #nav-menu-links {
        min-height: 64px;
        padding: 0 !important;
        border-bottom: 1px solid rgba(0, 0, 0, .08);
        box-shadow: 0 2px 12px rgba(0, 0, 0, .06) !important;
    }

    body #nav-menu-links > .container {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        column-gap: 8px;
        max-width: none;
        min-height: 64px;
        padding: 10px 16px !important;
    }

    /* Logo et nom */
    body #nav-menu-links .wm-marque-mobile {
        display: flex;
        align-items: center;
        gap: 10px;
        flex: 1 1 0;
        min-width: 0;
        min-height: 44px;
        padding: 0 !important;
        background: none !important;
        color: var(--warm-text, #1f2421) !important;
        text-decoration: none !important;
    }

    body #nav-menu-links .wm-marque-mobile__logo {
        display: block;
        flex: none;
        width: auto;
        height: 40px;
        max-width: 112px;
        margin: 0 !important;
        object-fit: contain;
        object-position: left center;
        border-radius: 0 !important;
        box-shadow: none !important;
    }

    body #nav-menu-links .wm-marque-mobile__nom {
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        overflow: hidden;
        min-width: 0;
        padding-left: 10px;
        border-left: 1px solid rgba(0, 0, 0, .18);
        font: 700 15px/1.2 "Roboto Slab", Georgia, serif;
        letter-spacing: 0;
        text-transform: none;
        color: inherit;
    }

    /* L'icône MFR qui apparaissait au défilement fait doublon avec le logo */
    body #nav-menu-links img.responsive-menu.logo-hidden {
        display: none !important;
    }

    /* Contact et Menu */
    body #nav-menu-links > .container > .d-flex {
        flex: none;
        align-items: center;
        gap: 8px;
        margin: 0;
    }

    body #nav-menu-links .contact-header.responsive-menu {
        align-items: center;
        gap: 8px;
        max-width: none;
        margin: 0 !important;
        padding: 0 !important;
    }

    body #nav-menu-links .contact-header.responsive-menu .nav-item {
        display: flex;
    }

    /* Contact : bouton rond de 44 px, l'enveloppe seule ; le mot « Contact » reste le nom du lien pour les lecteurs d'écran */
    body #nav-menu-links #contact-btn-header {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        width: 44px;
        min-width: 0 !important;
        height: 44px;
        margin: 0 !important;
        padding: 0 !important;
        border-radius: 50% !important;
        font-size: 0 !important;
        line-height: 0 !important;
        letter-spacing: 0 !important;
    }

    body #nav-menu-links #contact-btn-header {
        box-shadow: none !important;
    }

    /* L'enveloppe prend la couleur du texte du bouton, réglée par chaque thème pour être lisible sur son fond */
    body #nav-menu-links #contact-btn-header img {
        display: none !important;
    }

    body #nav-menu-links #contact-btn-header::before {
        content: "";
        width: 20px;
        height: 20px;
        background: currentColor;
        -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 5h18a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1zm.8 2.2v.4l8.2 5.6 8.2-5.6v-.4zm0 2.8V17h16.4v-7L12 15.6z'/%3E%3C/svg%3E") center / contain no-repeat;
        mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 5h18a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1zm.8 2.2v.4l8.2 5.6 8.2-5.6v-.4zm0 2.8V17h16.4v-7L12 15.6z'/%3E%3C/svg%3E") center / contain no-repeat;
    }

    /* Chaleureux : l'enveloppe prend la couleur calculée par le thème pour être lisible sur la couleur secondaire
       (encre ou blanc selon le contraste, --theme-secondary-on) ; le blanc imposé tombait à 2,2:1 sur un or clair. */
    body.theme-chaleureux:not(.theme-verger) #nav-menu-links #contact-btn-header {
        color: var(--theme-secondary-on, #fff) !important;
    }

    body #nav-menu-links .navbar-toggler .navbar-toggler-bar {
        height: 2px;
        background: var(--warm-text, #2b2f2c);
    }

    body #nav-menu-links #search-btn-header {
        min-height: 44px;
        display: inline-flex !important;
        align-items: center;
        margin: 0 !important;
        padding: 0 14px !important;
        font-size: 13px !important;
    }

    body #nav-menu-links .navbar-toggler {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        margin: 0 !important;
        padding: 0 !important;
        border: 0;
        border-radius: 50%;
    }

    body #nav-menu-links .navbar-toggler .navbar-toggler-icon {
        margin: 0 !important;
    }

    /* Menu ouvert : sous la barre, sur toute la largeur ; il défile s'il dépasse l'écran */
    body #nav-menu-links #navigation {
        flex-basis: 100%;
    }

    /* Liens utiles (téléphone, courriel, plan, portes ouvertes) en bas du menu ouvert : chaleureux.css les masquait dans la barre,
       ordinateur compris, si bien que le téléphone n'avait aucun lien d'appel. Contact est déjà dans la barre. */
    body.theme-chaleureux #nav-menu-links .responsive-links {
        display: flex !important;
        flex-direction: column;
        align-items: center;
        gap: 8px;
        margin: 8px 0 4px;
        padding: 14px 16px 6px;
        border-top: 1px solid rgba(0, 0, 0, .1);
    }

    body #nav-menu-links .responsive-links .contact-btn-desktop {
        display: none !important;
    }

    body #nav-menu-links .responsive-links .header-link-list {
        display: flex !important;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        gap: 8px;
        margin: 0;
        padding: 0;
    }

    body #nav-menu-links .responsive-links .header-link-list a {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 44px;
        min-height: 44px;
    }

    body #nav-menu-links.is-fixed #navigation.show {
        max-height: calc(100vh - 64px);
        max-height: calc(100dvh - 64px);
        overflow-y: auto;
        overscroll-behavior: contain;
    }
}

@media (max-width: 359.98px) {
    body #nav-menu-links > .container {
        padding: 10px 12px !important;
    }

    body #nav-menu-links .wm-marque-mobile__logo {
        height: 36px;
        max-width: 92px;
    }

    body #nav-menu-links .wm-marque-mobile__nom {
        font-size: 14px;
    }
}
