/* ════════════════════════════════
   Shared site navigation (Aperitiu)
   • Base = overlay over the home hero (transparent, white text, absolute)
   • .hp-nav--solid = solid header for every other page (sticky, dark text)
   Variables (--hp-*) are provided by .home-page on the home; fallbacks below
   keep the bar correct on pages that don't load home.css.
════════════════════════════════ */

.hp-nav {
    position: absolute;
    top: 34px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: var(--hp-max, 1440px);
    padding: 0 var(--hp-pad, 100px);
    box-sizing: border-box;
    z-index: 50;
    /* Grid 3 colonnes : ul gauche | logo | ul droite — le logo occupe sa propre
       colonne (auto) donc les uls ne peuvent jamais l'overlap, peu importe leur
       contenu. */
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 30px;
    color: #fff;
}

/* White separator line under the overlay nav */
.hp-nav::after {
    content: '';
    position: absolute;
    bottom: -34px;
    left: var(--hp-pad, 100px);
    right: var(--hp-pad, 100px);
    height: 1px;
    background: rgba(255, 255, 255, .35);
}

.hp-nav-logo {
    position: relative;
    width: 240px;
    margin-top: -24px;
    z-index: 11;
    /* Le logo dépasse légèrement au-dessus de la barre nav. */
}

.hp-nav-logo img { width: 100%; height: auto; display: block; }

.hp-nav-links {
    display: flex;
    gap: 44px;
    font-family: var(--hp-font-script, 'Darumadrop One', 'Caveat', cursive);
    font-size: 20px;
    color: #fff;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
}

/* L'ul de droite : items poussés vers le bord droit de la grille */
.hp-nav-links--right {
    justify-content: flex-end;
}

.hp-nav-links a {
    color: #fff;
    text-decoration: none;
    transition: opacity .15s ease;
    white-space: nowrap;
}

.hp-nav-links a:hover { opacity: .75; }
.hp-nav-links a.active { text-decoration: underline; text-underline-offset: 6px; }

.hp-nav-icon-wrap {
    display: flex;
    gap: 18px;
    align-items: center;
    margin-left: 22px;
}

.hp-nav-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    color: inherit;
}

.hp-nav-icon svg { width: 24px; height: 24px; }

/* Icon used as a button (account toggle) — strip native button chrome */
button.hp-nav-icon {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}
.hp-nav-user:hover { opacity: .75; }

/* Account dropdown wrapper sits in the icon row — align like a plain icon */
.hp-nav-icon-wrap .nav-dropdown-wrap {
    display: inline-flex;
    align-items: center;
}

/* The dropdown lives inside .hp-nav-links, whose `a` rules (white on the hero
   overlay, dark on the solid header) would otherwise override the menu links and
   make them invisible. Re-assert the brand colours with higher specificity. */
.hp-nav-links .nav-dropdown .nav-dropdown-item {
    color: #3d3833;
    opacity: 1;
}
.hp-nav-links .nav-dropdown .nav-dropdown-item:hover {
    color: #e85a28;
    opacity: 1;
}
.hp-nav-links .nav-dropdown .nav-dropdown-item--admin { color: #e85a28; }
.hp-nav-links .nav-dropdown .nav-dropdown-item--admin:hover { color: #b22222; }
.hp-nav-links .nav-dropdown .nav-dropdown-item--logout { color: #b34a3a; }
.hp-nav-links .nav-dropdown .nav-dropdown-item--logout:hover { color: #b22222; }

/* Cart count badge */
.hp-nav-cart-count {
    position: absolute;
    top: -7px;
    right: -9px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    box-sizing: border-box;
    border-radius: 999px;
    background: var(--hp-orange-2, #f3a63c);
    color: var(--hp-dark, #242323);
    font-family: var(--hp-font-ui, 'Poppins', system-ui, sans-serif);
    font-size: 10px;
    font-weight: 600;
    line-height: 16px;
    text-align: center;
}

/* Auth: logged-out links + logged-in avatar reuse the global dropdown
   (.nav-dropdown* lives in style.css and is driven by app.js). */
.hp-nav-auth-link {
    font-family: var(--hp-font-script, 'Darumadrop One', cursive);
    font-size: 18px;
    color: inherit;
    text-decoration: none;
    opacity: .9;
}
.hp-nav-auth-link:hover { opacity: .65; }

.hp-nav-cta {
    font-family: var(--hp-font-ui, 'Poppins', system-ui, sans-serif);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    color: #fff;
    background: var(--hp-red, #e85a28);
    padding: 8px 18px;
    border-radius: 999px;
    transition: filter .15s ease;
}
.hp-nav-cta:hover { filter: brightness(1.07); }

/* ── Solid variant - every page except the home hero ──────────────────────
   Fixed top bar, like the legacy navbar, so the existing `main{padding-top:64px}`
   in style.css clears it (no double gap). Height is bounded to ~64px. */
.hp-nav--solid {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    transform: none;
    width: 100%;
    max-width: none;
    height: 64px;
    padding: 0 var(--hp-pad, 40px);
    background: var(--hp-cream-2, #fbf4e9);
    border-bottom: 1px solid rgba(36, 35, 35, .12);
    color: var(--hp-dark, #242323);
    z-index: 100;
}

.hp-nav--solid::after { display: none; }

.hp-nav--solid .hp-nav-links,
.hp-nav--solid .hp-nav-links a,
.hp-nav--solid .hp-nav-icon,
.hp-nav--solid .hp-nav-auth-link { color: var(--hp-dark, #242323); }

/* Logo flows inline (centered flex item) instead of overhanging the hero */
.hp-nav--solid .hp-nav-logo {
    position: static;
    left: auto;
    top: auto;
    transform: none;
    width: auto;
    height: 38px;
}

.hp-nav--solid .hp-nav-logo img { width: auto; height: 100%; }

/* Keep the fixed bar below the admin maintenance banner when present */
body:has(.maintenance-banner) .hp-nav--solid { top: 31px; }

/* ── Orange variant - espace client (et autres pages dans le brand orange) ──
   Mimétisme complet de la nav home (max-width 1440px, grid 3 colonnes, logo
   overhang) mais en position fixed et avec une bande orange+texture full-width
   en arrière via un ::before (sinon la couleur s'arrêterait au max-width).

   - .hp-nav (base) : position absolute, top 34px, max-width 1440px, grid centré
                      via left:50% + translateX(-50%). On hérite presque tout.
   - .hp-nav--orange : on override juste position (fixed) et le centrage
                       (left/right:0 + margin auto) pour éviter le containing
                       block créé par transform qui casserait le ::before fixed.
*/
.hp-nav--orange {
    position: fixed;
    /* Réinitialise le centrage par translate de .hp-nav : transform sur le
       parent crée un containing block qui ferait que le ::before fixed se
       positionnerait par rapport à la nav et non au viewport (cf. specs). */
    left: 0;
    right: 0;
    transform: none;
    margin-inline: auto;
    z-index: 100;
}

/* Bande orange + texture papier froissé, full-width, derrière la nav.
   Hauteur ~110px : couvre la barre nav (~64px à partir de top:34px) + 24px
   d'overhang du logo + un peu de marge en bas. */
.hp-nav--orange::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 110px;
    background-color: var(--hp-red, #e85a28);
    background-image: url('/images/home/union3.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: -1;
    pointer-events: none;
}

/* Pas de filet blanc sous la nav espace client. */
.hp-nav--orange::after { display: none; }

body:has(.maintenance-banner) .hp-nav--orange { top: 65px; }
body:has(.maintenance-banner) .hp-nav--orange::before { top: 31px; }

/* ════════════════════════════════
   Burger + menu mobile
════════════════════════════════ */
.hp-nav-burger {
    display: none;            /* visible uniquement en mobile (voir media query) */
    flex-direction: column;
    align-items: center;      /* barres centrées (comme la maquette) */
    justify-content: center;
    gap: 7px;
    width: 46px;
    height: 46px;
    padding: 10px;
    background: none;
    border: 0;
    cursor: pointer;
    color: inherit;          /* blanc sur l'overlay, foncé sur le solid */
    position: relative;
    z-index: 60;
}
.hp-nav-burger span {
    display: block;
    height: 4px;
    border-radius: 999px;
    background: currentColor;
}
/* Largeurs décroissantes/variées, comme la photo (barre du milieu la plus longue) */
.hp-nav-burger span:nth-child(1) { width: 80%; }
.hp-nav-burger span:nth-child(2) { width: 100%; }
.hp-nav-burger span:nth-child(3) { width: 60%; }

/* Menu mobile PLEIN ÉCRAN (fond orange texturé, liens centrés) */
.hp-nav-mobile {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100dvh;
    box-sizing: border-box;
    padding: 86px 24px 36px;
    background-color: var(--hp-red, #e85a28);
    background-image: url('/images/home/union3.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 26px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transition: opacity .28s ease, visibility .28s ease;
}
.hp-nav-mobile.open { opacity: 1; visibility: visible; }

/* Bouton fermer (X) en haut à droite */
.hp-nav-mobile-close {
    position: absolute;
    top: 22px;
    right: 22px;
    width: 46px;
    height: 46px;
    padding: 9px;
    background: none;
    border: 0;
    cursor: pointer;
    color: #fff;
}
.hp-nav-mobile-close svg {
    width: 100%; height: 100%;
    fill: none; stroke: currentColor;
    stroke-width: 2.4; stroke-linecap: round;
}

/* Liens principaux : gros, centrés, police script */
.hp-nav-mobile-links {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.hp-nav-mobile-links a {
    font-family: var(--hp-font-script, 'Darumadrop One', 'Caveat', cursive);
    font-size: clamp(30px, 8.5vw, 46px);
    line-height: 1.12;
    color: #fff;
    text-decoration: none;
    padding: 6px 0;
    transition: opacity .15s ease;
}
.hp-nav-mobile-links a:hover { opacity: .8; }
.hp-nav-mobile-links a.active { text-decoration: underline; text-underline-offset: 8px; text-decoration-thickness: 3px; }

/* Actions secondaires : sous une ligne, plus petites, avec icône */
.hp-nav-mobile-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    width: min(92%, 360px);
    margin-top: 6px;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, .35);
}
.hp-nav-mobile-action {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: var(--hp-font-body, 'DM Sans', sans-serif);
    font-size: 17px;
    font-weight: 600;
    color: #fff;
    text-decoration: none;
    background: none;
    border: 0;
    cursor: pointer;
    transition: opacity .15s ease;
}
.hp-nav-mobile-action:hover { opacity: .8; }
.hp-nav-mobile-action svg {
    width: 19px; height: 19px;
    fill: none; stroke: currentColor; stroke-width: 2;
}

/* ════════════════════════════════
   Palier intermédiaire (1101-1400px) : on compacte la nav desktop pour
   qu'elle tienne sans déborder avant la bascule burger.
════════════════════════════════ */
@media (min-width: 1101px) and (max-width: 1430px) {
    .hp-nav { gap: 16px; }
    .hp-nav-links { gap: 18px; font-size: 16px; }
    .hp-nav-icon-wrap { gap: 12px; margin-left: 10px; }
    .hp-nav-logo { width: 170px; }
}

/* ════════════════════════════════
   Bascule mobile (≤ 1100px) : logo gauche + burger droite.
   Seuil relevé (la nav desktop, très chargée, ne tient pas sous ~1280px).
════════════════════════════════ */
@media (max-width: 1100px) {
    .hp-nav {
        left: 0;
        transform: none;
        width: 100%;
        max-width: none;
        padding: 0 20px;
        gap: 12px;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    .hp-nav::after { left: 20px; right: 20px; }

    .hp-nav-links { display: none; }
    .hp-nav-burger { display: inline-flex; }

    .hp-nav-logo { width: 150px; margin-top: 0; }
    .hp-nav--solid .hp-nav-logo,
    .hp-nav--orange .hp-nav-logo { height: 38px; width: auto; }
}
