/* =========================================================
   HEADER MDES V2 — reprise complète propre
   ========================================================= */

:root {
    --mdes-h2-black: #050505;
    --mdes-h2-black-soft: #111111;
    --mdes-h2-white: #ffffff;
    --mdes-h2-muted: rgba(255, 255, 255, 0.74);
    --mdes-h2-red: #e20d17;
    --mdes-h2-red-dark: #a90f15;
    --mdes-h2-yellow: #f3c300;
    --mdes-h2-border: rgba(255, 255, 255, 0.13);
}

.mdes-header-v2,
.mdes-header-v2 * {
    box-sizing: border-box;
}

.mdes-skip-link-v2 {
    position: absolute;
    left: -999px;
    top: 10px;
    z-index: 99999;
    background: var(--mdes-h2-red);
    color: #ffffff;
    padding: 10px 14px;
    text-decoration: none;
    font-weight: 900;
}

.mdes-skip-link-v2:focus {
    left: 10px;
}

/* Header */

.mdes-header-v2 {
    width: 100%;
    background: var(--mdes-h2-black);
    color: var(--mdes-h2-white);
    border-bottom: 4px solid var(--mdes-h2-red);
    position: sticky;
    top: 0;
    z-index: 9999;
}

.admin-bar .mdes-header-v2 {
    top: 32px;
}

.mdes-header-v2__inner {
    width: calc(100% - 48px);
    max-width: 1880px;
    min-height: 82px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 185px minmax(0, 1fr) auto;
    align-items: center;
    gap: 20px;
}

/* Marque */

.mdes-header-v2__brand {
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 185px;
    max-width: 185px;
    min-width: 0;
    color: var(--mdes-h2-white);
    text-decoration: none;
    overflow: hidden;
}

.mdes-header-v2__brand:hover,
.mdes-header-v2__brand:focus {
    color: var(--mdes-h2-white);
    text-decoration: none;
}

.mdes-header-v2__brand .custom-logo,
.mdes-header-v2__brand img {
    display: block;
    max-height: 54px;
    width: auto;
}

.mdes-header-v2__brand-main {
    display: block;
    color: var(--mdes-h2-white);
    font-size: 1.75rem;
    font-weight: 950;
    line-height: 1;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    white-space: nowrap;
}

.mdes-header-v2__brand-sub {
    display: block;
    margin-top: 7px;
    color: var(--mdes-h2-yellow);
    font-size: 0.49rem;
    font-weight: 900;
    line-height: 1.2;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    white-space: nowrap;
}

/* Navigation */

.mdes-header-v2__nav {
    min-width: 0;
    width: 100%;
}

.mdes-header-v2__menu,
.mdes-header-v2__submenu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mdes-header-v2__menu {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0;
    width: 100%;
    min-width: 0;
}

.mdes-header-v2__menu > li {
    position: relative;
    display: flex;
    align-items: center;
    min-width: 0;
}

.mdes-header-v2__menu > li > a {
    display: flex;
    align-items: center;
    min-height: 82px;
    padding: 0 6px;
    color: var(--mdes-h2-white);
    text-decoration: none;
    font-size: 0.66rem;
    font-weight: 950;
    line-height: 1;
    letter-spacing: 0.01em;
    text-transform: uppercase;
    white-space: nowrap;
    transition: background-color 0.18s ease, color 0.18s ease;
}

.mdes-header-v2__menu > li > a:hover,
.mdes-header-v2__menu > li > a:focus {
    background: rgba(255, 255, 255, 0.08);
    color: var(--mdes-h2-white);
    text-decoration: none;
}

/* Bouton flèche */

.mdes-header-v2__subtoggle {
    width: 18px;
    height: 82px;
    border: 0;
    padding: 0;
    margin: 0 4px 0 -1px;
    background: transparent;
    color: var(--mdes-h2-white);
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
}

.mdes-header-v2__subtoggle::before {
    content: "";
    position: absolute;
    left: 4px;
    top: 50%;
    width: 7px;
    height: 7px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translateY(-55%) rotate(45deg);
}

.mdes-header-v2__has-sub:hover > .mdes-header-v2__subtoggle,
.mdes-header-v2__has-sub:focus-within > .mdes-header-v2__subtoggle {
    color: var(--mdes-h2-yellow);
}

/* Sous-menus desktop */

.mdes-header-v2__submenu {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 10000;
    min-width: 235px;
    padding: 8px 0;
    background: var(--mdes-h2-black-soft);
    border: 1px solid var(--mdes-h2-border);
    border-top: 4px solid var(--mdes-h2-red);
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.45);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    pointer-events: none;
    transition: opacity 0.18s ease, visibility 0.18s ease, transform 0.18s ease;
}

.mdes-header-v2__has-sub:hover > .mdes-header-v2__submenu,
.mdes-header-v2__has-sub:focus-within > .mdes-header-v2__submenu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.mdes-header-v2__menu > li:nth-last-child(-n+3) > .mdes-header-v2__submenu {
    left: auto;
    right: 0;
}

.mdes-header-v2__submenu li {
    display: block;
    width: 100%;
}

.mdes-header-v2__submenu a {
    display: block;
    width: 100%;
    padding: 12px 16px;
    color: var(--mdes-h2-white);
    text-decoration: none;
    font-size: 0.84rem;
    font-weight: 750;
    line-height: 1.25;
    white-space: nowrap;
    text-transform: none;
}

.mdes-header-v2__submenu a:hover,
.mdes-header-v2__submenu a:focus {
    background: var(--mdes-h2-red);
    color: var(--mdes-h2-white);
    text-decoration: none;
}

/* CTA */

.mdes-header-v2__cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 18px;
    border-radius: 999px;
    background: var(--mdes-h2-red);
    color: var(--mdes-h2-white);
    text-decoration: none;
    font-size: 0.74rem;
    font-weight: 950;
    line-height: 1;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    white-space: nowrap;
    transition: background-color 0.18s ease, transform 0.18s ease;
}

.mdes-header-v2__cta:hover,
.mdes-header-v2__cta:focus {
    background: var(--mdes-h2-red-dark);
    color: var(--mdes-h2-white);
    text-decoration: none;
    transform: translateY(-1px);
}

/* Toggle mobile */

.mdes-header-v2__toggle {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 42px;
    padding: 0 12px;
    border: 1px solid var(--mdes-h2-border);
    border-radius: 6px;
    background: transparent;
    color: var(--mdes-h2-white);
    font-size: 0.78rem;
    font-weight: 900;
    text-transform: uppercase;
    cursor: pointer;
}

.mdes-header-v2__burger {
    position: relative;
    display: block;
    width: 22px;
    height: 2px;
    background: var(--mdes-h2-white);
}

.mdes-header-v2__burger::before,
.mdes-header-v2__burger::after {
    content: "";
    position: absolute;
    left: 0;
    width: 22px;
    height: 2px;
    background: var(--mdes-h2-white);
}

.mdes-header-v2__burger::before {
    top: -7px;
}

.mdes-header-v2__burger::after {
    top: 7px;
}

/* Écrans moyens */

@media (max-width: 1500px) {
    .mdes-header-v2__inner {
        width: calc(100% - 32px);
        grid-template-columns: 170px minmax(0, 1fr) auto;
        gap: 14px;
    }

    .mdes-header-v2__brand {
        width: 170px;
        max-width: 170px;
    }

    .mdes-header-v2__brand-main {
        font-size: 1.45rem;
    }

    .mdes-header-v2__brand-sub {
        font-size: 0.42rem;
        letter-spacing: 0.11em;
    }

    .mdes-header-v2__menu > li > a {
        padding: 0 4px;
        font-size: 0.56rem;
    }

    .mdes-header-v2__subtoggle {
        width: 15px;
        margin-right: 2px;
    }

    .mdes-header-v2__cta {
        min-height: 36px;
        padding: 0 14px;
        font-size: 0.64rem;
    }
}

@media (max-width: 1280px) {
    .mdes-header-v2__nav {
        display: none;
    }

    .mdes-header-v2__toggle {
        display: inline-flex;
        grid-column: 2;
        justify-self: end;
    }

    .mdes-header-v2__inner {
        grid-template-columns: 190px 1fr auto;
        min-height: 76px;
    }

    .mdes-header-v2__brand {
        width: 190px;
        max-width: 190px;
    }

    .mdes-header-v2__cta {
        grid-column: 3;
    }

    .mdes-header-v2__nav.is-open {
        display: block;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--mdes-h2-black);
        border-top: 1px solid var(--mdes-h2-border);
        border-bottom: 4px solid var(--mdes-h2-red);
    }

    .mdes-header-v2__nav.is-open .mdes-header-v2__menu {
        width: calc(100% - 32px);
        margin: 0 auto;
        padding: 12px 0 18px;
        display: flex;
        flex-direction: column;
        align-items: stretch;
    }

    .mdes-header-v2__menu > li {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 42px;
        align-items: center;
    }

    .mdes-header-v2__menu > li > a {
        min-height: auto;
        padding: 15px 0;
        font-size: 0.92rem;
        border-bottom: 1px solid var(--mdes-h2-border);
        white-space: normal;
    }

    .mdes-header-v2__subtoggle {
        width: 42px;
        height: 48px;
        margin: 0;
        border-bottom: 1px solid var(--mdes-h2-border);
    }

    .mdes-header-v2__submenu {
        grid-column: 1 / -1;
        position: static;
        min-width: 100%;
        display: none;
        opacity: 1;
        visibility: visible;
        transform: none;
        pointer-events: auto;
        box-shadow: none;
        border: 0;
        border-left: 3px solid var(--mdes-h2-red);
        background: rgba(255, 255, 255, 0.04);
        padding: 0;
        margin: 0 0 8px;
    }

    .mdes-header-v2__has-sub.is-open > .mdes-header-v2__submenu {
        display: block;
    }

    .mdes-header-v2__submenu a {
        padding: 12px 0 12px 18px;
        font-size: 0.86rem;
        color: var(--mdes-h2-muted);
        border-bottom: 1px solid var(--mdes-h2-border);
        white-space: normal;
    }

    .mdes-header-v2__submenu a:hover,
    .mdes-header-v2__submenu a:focus {
        background: transparent;
        color: var(--mdes-h2-white);
    }
}

@media (max-width: 640px) {
    .mdes-header-v2__inner {
        width: calc(100% - 24px);
        grid-template-columns: 1fr auto;
        gap: 10px;
    }

    .mdes-header-v2__brand {
        width: auto;
        max-width: 210px;
    }

    .mdes-header-v2__brand-main {
        font-size: 1.32rem;
    }

    .mdes-header-v2__brand-sub {
        font-size: 0.38rem;
    }

    .mdes-header-v2__cta {
        display: none;
    }

    .mdes-header-v2__toggle {
        grid-column: 2;
    }

    .mdes-header-v2__toggle-label {
        display: none;
    }
}

/* =========================================================
   PATCH HEADER V2 — desktop visible + suppression bande beige
   ========================================================= */

/* Supprimer la bande beige avant le header */
body {
    margin: 0 !important;
    padding: 0 !important;
}

.mdes-header-v2 {
    margin-top: 0 !important;
}

/* Empêcher un espace parasite entre la barre admin et le header */
#page,
.site,
.site-content,
main {
    margin-top: 0 !important;
}

/* Le menu desktop doit rester visible plus longtemps */
@media (min-width: 1181px) {
    .mdes-header-v2__nav {
        display: block !important;
    }

    .mdes-header-v2__toggle {
        display: none !important;
    }

    .mdes-header-v2__inner {
        grid-template-columns: 190px minmax(0, 1fr) auto;
        min-height: 82px;
    }

    .mdes-header-v2__menu {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: flex-end !important;
    }

    .mdes-header-v2__menu > li {
        width: auto !important;
        display: flex !important;
        grid-template-columns: none !important;
    }

    .mdes-header-v2__menu > li > a {
        min-height: 82px !important;
        padding: 0 5px !important;
        font-size: 0.58rem !important;
        border-bottom: 0 !important;
        white-space: nowrap !important;
    }

    .mdes-header-v2__subtoggle {
        width: 16px !important;
        height: 82px !important;
        border-bottom: 0 !important;
        margin: 0 2px 0 -2px !important;
    }

    .mdes-header-v2__submenu {
        position: absolute !important;
        display: block !important;
        opacity: 0 !important;
        visibility: hidden !important;
        transform: translateY(10px) !important;
        pointer-events: none !important;
    }

    .mdes-header-v2__has-sub:hover > .mdes-header-v2__submenu,
    .mdes-header-v2__has-sub:focus-within > .mdes-header-v2__submenu {
        opacity: 1 !important;
        visibility: visible !important;
        transform: translateY(0) !important;
        pointer-events: auto !important;
    }
}

/* Passage en menu mobile seulement sous 1180px */
@media (max-width: 1180px) {
    .mdes-header-v2__nav {
        display: none;
    }

    .mdes-header-v2__toggle {
        display: inline-flex;
    }
}

/* =========================================================
   PATCH FINAL — header aéré + logo non coupé
   ========================================================= */

.mdes-header-v2__inner {
    min-height: 78px;
    grid-template-columns: 330px minmax(0, 1fr) auto;
    gap: 24px;
}

.mdes-header-v2__brand {
    width: 330px;
    max-width: 330px;
    overflow: visible;
}

.mdes-header-v2__brand-main {
    font-size: 1.75rem;
}

.mdes-header-v2__brand-sub {
    font-size: 0.52rem;
    letter-spacing: 0.12em;
    white-space: nowrap;
}

/* Menu un peu plus lisible maintenant qu’il y a moins d’entrées */
.mdes-header-v2__menu {
    justify-content: flex-end;
}

.mdes-header-v2__menu > li > a {
    min-height: 78px;
    padding: 0 10px;
    font-size: 0.74rem;
}

/* Flèche des sous-menus */
.mdes-header-v2__subtoggle {
    height: 78px;
    width: 18px;
    margin: 0 6px 0 -4px;
}

/* Bouton adhérer plus équilibré */
.mdes-header-v2__cta {
    min-height: 42px;
    padding: 0 22px;
    font-size: 0.76rem;
}

/* Ligne rouge sous header */
.mdes-header-v2 {
    border-bottom: 4px solid #e20d17;
}

/* Responsive intermédiaire */
@media (max-width: 1500px) {
    .mdes-header-v2__inner {
        grid-template-columns: 300px minmax(0, 1fr) auto;
        gap: 18px;
    }

    .mdes-header-v2__brand {
        width: 300px;
        max-width: 300px;
    }

    .mdes-header-v2__brand-main {
        font-size: 1.55rem;
    }

    .mdes-header-v2__brand-sub {
        font-size: 0.46rem;
    }

    .mdes-header-v2__menu > li > a {
        padding: 0 7px;
        font-size: 0.68rem;
    }
}
/* =========================================================
   PATCH SOUS-MENUS HEADER V2 — propre, large, sans ligne rouge verticale
   ========================================================= */

/* Sous-menu desktop propre */
@media (min-width: 1181px) {

    .mdes-header-v2__submenu {
        position: absolute !important;
        top: 100% !important;
        left: 0 !important;
        z-index: 10050 !important;

        min-width: 310px !important;
        max-width: 360px !important;

        margin: 0 !important;
        padding: 10px 0 !important;

        background: #111111 !important;
        border: 1px solid rgba(255, 255, 255, 0.12) !important;
        border-top: 4px solid #e20d17 !important;
        border-left: 1px solid rgba(255, 255, 255, 0.12) !important;

        box-shadow: 0 18px 42px rgba(0, 0, 0, 0.45) !important;

        opacity: 0 !important;
        visibility: hidden !important;
        transform: translateY(8px) !important;
        pointer-events: none !important;

        display: block !important;
    }

    .mdes-header-v2__has-sub:hover > .mdes-header-v2__submenu,
    .mdes-header-v2__has-sub:focus-within > .mdes-header-v2__submenu {
        opacity: 1 !important;
        visibility: visible !important;
        transform: translateY(0) !important;
        pointer-events: auto !important;
    }

    /* Évite le débordement à droite */
    .mdes-header-v2__menu > li:nth-last-child(-n+3) > .mdes-header-v2__submenu {
        left: auto !important;
        right: 0 !important;
    }

    .mdes-header-v2__submenu li {
        display: block !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .mdes-header-v2__submenu a {
        display: block !important;
        width: 100% !important;

        padding: 12px 18px !important;

        color: rgba(255, 255, 255, 0.86) !important;
        background: transparent !important;

        font-size: 0.88rem !important;
        font-weight: 750 !important;
        line-height: 1.25 !important;

        text-decoration: none !important;
        text-transform: none !important;
        white-space: normal !important;

        border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
        box-shadow: none !important;
    }

    .mdes-header-v2__submenu li:last-child a {
        border-bottom: 0 !important;
    }

    .mdes-header-v2__submenu a:hover,
    .mdes-header-v2__submenu a:focus {
        background: #e20d17 !important;
        color: #ffffff !important;
    }
}

/* =========================================================
   PATCH — suppression espace beige sur accueil
   ========================================================= */

/* Supprime les marges parasites générales */
html,
body {
    margin: 0 !important;
    padding: 0 !important;
}

/* Évite que l’accueil affiche du beige au-dessus du header */
body.home,
body.front-page {
    background: #050505 !important;
}

/* Le header ne doit jamais laisser d’espace au-dessus */
.mdes-header-v2 {
    margin-top: 0 !important;
}

/* En mode connecté WordPress, évite le double décalage admin bar + sticky */
body.admin-bar .mdes-header-v2 {
    top: 0 !important;
}

/* La page d’accueil doit commencer immédiatement après le header */
body.home .home-mdes,
body.front-page .home-mdes,
body.home .home-hero,
body.front-page .home-hero {
    margin-top: 0 !important;
    padding-top: 0 !important;
}