/* =========================================================
   UPB — HEADER GLOBAL (voir upb-header.php et upb-header.js)
   Conforme à l'artefact validé « Header UPB — Desktop & Mobile ».
   Palette officielle UPB : blanc #FFFFFF · beige doux #FBF6EE ·
   beige soutenu #F3E7DF · rose accent #D98FA0 · chocolat #704B3E.
   Point de rupture desktop / mobile : 1280px (à modifier ici ET dans
   upb-header.js si besoin).
   Le header natif d'Astra (#masthead) n'est masqué que si ce header
   est présent juste avant lui.
   ========================================================= */

.upb-hdr ~ #masthead {
    display: none !important;
}

.upb-hdr,
.upb-hdr *,
.upb-hdr *::before,
.upb-hdr *::after {
    box-sizing: border-box;
}

.upb-hdr {
    position: relative;
    z-index: 1000;
    background: #FFFFFF;
    border-bottom: 1px solid #F3E7DF;
    font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
    color: #704B3E;
    line-height: 1.2;
}

.upb-hdr ul,
.upb-hdr li {
    list-style: none;
    margin: 0;
    padding: 0;
}

.upb-hdr a {
    text-decoration: none;
    box-shadow: none;
    border: 0;
}

.upb-hdr a:focus-visible,
.upb-hdr button:focus-visible {
    outline: 2px solid #704B3E;
    outline-offset: 3px;
    border-radius: 6px;
}

/* ---- Logo ---- */
.upb-hdr .upb-hdr-logo {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
    color: #704B3E;
}

.upb-hdr .upb-hdr-logo-img {
    display: block;
    width: auto;
    height: 52px;
    max-width: 100%;
}

.upb-hdr .upb-hdr-logo-ring {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
}

.upb-hdr .upb-hdr-logo-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.upb-hdr .upb-hdr-logo-name {
    font-family: "Playfair Display", serif;
    font-size: 22px;
    line-height: 1;
    color: #704B3E;
    white-space: nowrap;
}

.upb-hdr .upb-hdr-logo-sub {
    font-family: "Playfair Display", serif;
    font-size: 19px;
    line-height: 1;
    color: #D98FA0;
}

/* ---- Boutons (chevron, burger) : neutralise les styles de boutons du thème ---- */
.upb-hdr button.upb-hdr-chev,
.upb-hdr button.upb-hdr-burger {
    all: unset;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 50%;
    color: #704B3E;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.upb-hdr button.upb-hdr-chev:focus-visible,
.upb-hdr button.upb-hdr-burger:focus-visible {
    outline: 2px solid #704B3E;
    outline-offset: 3px;
}

.upb-hdr .upb-hdr-chev svg {
    transition: transform .15s;
}

.upb-hdr .is-open > .upb-hdr-chev svg {
    transform: rotate(180deg);
}

.upb-hdr .upb-hdr-burger-close {
    display: none;
}

.upb-hdr.is-open .upb-hdr-burger-open {
    display: none;
}

.upb-hdr.is-open .upb-hdr-burger-close {
    display: block;
}

/* =========================================================
   DESKTOP (≥ 1280px) : header horizontal, sous-menus en panneau
   ========================================================= */
@media (min-width: 1280px) {

    .upb-hdr .upb-hdr-box {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 24px;
        height: 95px;
        max-width: 1280px;
        margin: 0 auto;
        padding: 0 40px;
    }

    .upb-hdr button.upb-hdr-burger,
    .upb-hdr .upb-hdr-band {
        display: none;
    }

    .upb-hdr .upb-hdr-list {
        display: flex;
        align-items: center;
        gap: 18px;
    }

    .upb-hdr .upb-hdr-item {
        position: relative;
        display: flex;
        align-items: center;
        gap: 2px;
        flex-shrink: 0;
    }

    .upb-hdr .upb-hdr-link {
        display: inline-flex;
        align-items: center;
        padding: 6px 0;
        color: #704B3E;
        white-space: nowrap;
        text-transform: uppercase;
        letter-spacing: .05em;
        font-size: 12.5px;
        font-weight: 500;
        line-height: 1.2;
    }

    .upb-hdr .upb-hdr-link:hover {
        color: #704B3E;
        box-shadow: inset 0 -1px 0 #D98FA0;
    }

    .upb-hdr .is-active > .upb-hdr-link,
    .upb-hdr .is-active > .upb-hdr-link:hover {
        font-weight: 600;
        box-shadow: inset 0 -2px 0 #D98FA0;
    }

    .upb-hdr .upb-hdr-ext {
        margin-left: 6px;
        flex-shrink: 0;
    }

    .upb-hdr button.upb-hdr-chev {
        width: 32px;
        height: 32px;
        transition: background .15s;
    }

    .upb-hdr button.upb-hdr-chev:hover,
    .upb-hdr .is-open > button.upb-hdr-chev {
        background: #F3E7DF;
    }

    /* Panneau de sous-menu : accroché sous sa rubrique, pointe vers sa flèche */
    .upb-hdr .upb-hdr-sub {
        display: none;
        position: absolute;
        top: calc(100% + 38px);
        left: -12px;
        min-width: 250px;
        padding: 6px;
        background: #FFFFFF;
        border: 1px solid #F3E7DF;
        border-radius: 12px;
        box-shadow: 0 12px 28px rgba(112, 75, 62, .10);
        z-index: 5;
    }

    .upb-hdr .upb-hdr-sub::before {
        content: "";
        position: absolute;
        top: -7px;
        left: 26px;
        width: 12px;
        height: 12px;
        background: #FFFFFF;
        border-top: 1px solid #F3E7DF;
        border-left: 1px solid #F3E7DF;
        transform: rotate(45deg);
    }

    .upb-hdr .is-open > .upb-hdr-sub {
        display: block;
    }

    .upb-hdr .upb-hdr-sublink {
        display: block;
        padding: 7px 12px;
        border-radius: 8px;
        font-size: 14px;
        line-height: 1.3;
        font-weight: 400;
        color: #704B3E;
        white-space: nowrap;
    }

    .upb-hdr .upb-hdr-sublink:hover {
        background: #FBF6EE;
        color: #704B3E;
    }
}

/* =========================================================
   MOBILE / TABLETTE (< 1280px) : barre + menu vertical en accordéon
   ========================================================= */
@media (max-width: 1279px) {

    .upb-hdr {
        min-height: 77px;
    }

    .upb-hdr .upb-hdr-box {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        padding: 0 20px;
        background: #FFFFFF;
    }

    .upb-hdr .upb-hdr-logo {
        min-height: 76px;
        gap: 10px;
        max-width: calc(100% - 64px);
    }

    .upb-hdr .upb-hdr-logo-img {
        height: 40px;
    }

    .upb-hdr .upb-hdr-logo-ring {
        width: 40px;
        height: 40px;
    }

    .upb-hdr .upb-hdr-logo-text {
        gap: 2px;
    }

    .upb-hdr .upb-hdr-logo-name {
        font-size: 18px;
    }

    .upb-hdr .upb-hdr-logo-sub {
        font-size: 15px;
    }

    .upb-hdr button.upb-hdr-burger {
        width: 44px;
        height: 44px;
        background: #F3E7DF;
    }

    /* Menu ouvert : le panneau recouvre la page, la barre reste en haut */
    .upb-hdr.is-open .upb-hdr-box {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        height: 100vh;
        height: 100dvh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        align-content: flex-start;
        border-bottom: 0;
    }

    body.admin-bar .upb-hdr.is-open .upb-hdr-box {
        top: 46px;
        height: calc(100vh - 46px);
        height: calc(100dvh - 46px);
    }

    body.upb-hdr-open {
        overflow: hidden;
    }

    .upb-hdr .upb-hdr-nav {
        display: none;
        flex: 0 0 100%;
        border-top: 1px solid #F3E7DF;
        padding: 8px 0 40px;
    }

    .upb-hdr.is-open .upb-hdr-nav {
        display: block;
    }

    .upb-hdr .upb-hdr-item {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        border-bottom: 1px solid #F3E7DF;
    }

    .upb-hdr .upb-hdr-item:last-child {
        border-bottom: 0;
    }

    .upb-hdr .upb-hdr-link {
        display: inline-flex;
        align-items: center;
        min-height: 60px;
        padding: 6px 0;
        color: #704B3E;
        text-transform: uppercase;
        letter-spacing: .07em;
        font-size: 15px;
        font-weight: 500;
        line-height: 1.3;
    }

    .upb-hdr .is-active > .upb-hdr-link {
        font-weight: 600;
        text-decoration: underline;
        text-decoration-color: #D98FA0;
        text-decoration-thickness: 2px;
        text-underline-offset: 7px;
    }

    .upb-hdr .upb-hdr-ext {
        width: 13px;
        height: 13px;
        margin-left: 8px;
    }

    .upb-hdr button.upb-hdr-chev {
        width: 44px;
        height: 44px;
        margin-right: -10px;
        transition: background .15s;
    }

    .upb-hdr .is-open > button.upb-hdr-chev {
        background: #F3E7DF;
    }

    /* Sous-rubriques : secondaires, retrait, groupe compact, air avant la rubrique suivante */
    .upb-hdr .upb-hdr-sub {
        display: none;
        flex: 0 0 100%;
        padding: 0 0 30px 22px;
        margin-top: -6px;
    }

    .upb-hdr .is-open > .upb-hdr-sub {
        display: block;
    }

    .upb-hdr .upb-hdr-sublink {
        display: block;
        padding: 4px 0;
        font-size: 14px;
        line-height: 1.3;
        font-weight: 400;
        color: #704B3E;
    }
    /* Bandeau du menu mobile : fond beige UPB, étoile rose, texte chocolat */
    .upb-hdr .upb-hdr-band {
        display: none;
        flex: 0 0 auto;
        width: calc(100% + 40px);
        margin: 0 -20px;
        padding: 28px 24px 32px;
        background: #F3E7DF;
        text-align: center;
    }

    .upb-hdr.is-open .upb-hdr-band {
        display: block;
        position: relative;
    }

    /* Cookie détective : posé sur le bord haut du bandeau, à droite (mobile uniquement) */
    .upb-hdr .upb-hdr-band-cookie {
        position: absolute;
        right: 74px;
        bottom: calc(100% - 1px);
        width: 74px;
        height: auto;
        margin: 0;
        pointer-events: none;
    }

    .upb-hdr .upb-hdr-band-star {
        display: block;
        margin: 0 auto 14px;
        color: #D98FA0;
    }

    .upb-hdr .upb-hdr-band-text {
        margin: 0;
        font-family: "Playfair Display", serif;
        font-style: italic;
        font-weight: 400;
        font-size: 18px;
        line-height: 1.4;
        color: #704B3E;
    }
}
