/* ============================================
   SITE HEADER - Navigation principale
   ============================================ */

.site-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: var(--color-blanc);
    z-index: 1000;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

/* HOMEPAGE : header BLANC comme les autres pages */
/* Pas de règle spéciale pour la homepage, elle garde le fond blanc par défaut */

/* Mode Sticky - Header réduit au scroll */
.site-header.is-sticky {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.site-header.is-sticky .site-header__container {
    height: 80px;
}

.site-header.is-sticky .site-branding img {
    height: 40px;
}

/* Retirer le filtre blanc en mode sticky */
.site-header.is-sticky .site-branding img,
.page-sans-hero .site-branding img {
    filter: none !important;
}

.site-header__container {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding-left: max(var(--marge-laterale), env(safe-area-inset-left));
    padding-right: max(var(--marge-laterale), env(safe-area-inset-right));
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100px;
    gap: var(--space-xl);
}

/* ============================================
   LOGO / BRANDING
   ============================================ */

.site-branding {
    flex-shrink: 0;
}

/* Masquer le logo avant sticky sur TOUTES les pages */
.site-header:not(.is-sticky) .site-branding {
    opacity: 0;
    visibility: hidden;
    pointer-events: none; /* Évite que l'élément invisible intercepte les clics sur le CTA */
}

/* Afficher le logo en mode sticky, et dès le chargement sur les pages sans hero (classe de body page-sans-hero :
   pages Comprendre, Mentions légales), au rendu de l'état sticky */
.site-header.is-sticky .site-branding,
.page-sans-hero .site-header .site-branding {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.site-branding a {
    display: block;
    text-decoration: none;
}

/* Masquer le texte du site si pas de logo */
.site-branding a:not(:has(img)) {
    font-size: 0;
    opacity: 0;
}

.site-branding img {
    height: 50px;
    width: auto;
    display: block;
    transition: var(--transition-normal);
}

/* ============================================
   NAVIGATION MENU
   ============================================ */

.site-nav {
    flex: 1;
    display: flex;
    justify-content: center;
}

.site-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    /* écart des liens : 60 px à partir de 1336 px, jusqu'à 20 px à 1216 px, pour que le menu tienne sur une ligne avec la marge de 110 px */
    column-gap: clamp(20px, calc((100vw - 1156px) / 3), 60px);
}

.site-nav li {
    margin: 0;
    padding: 0;
}

/* Force PP Neue Machina sur tous les liens du menu */
.site-nav,
.site-nav *,
.site-nav ul,
.site-nav li,
.site-nav a,
.site-nav .menu,
.site-nav .menu-item,
.site-nav .menu-item a {
    font-family: var(--font-heading) !important;
}

.site-nav a {
    font-family: var(--font-heading) !important;
    font-size: var(--fs-small);
    font-weight: var(--fw-regular) !important;
    text-transform: uppercase !important;
    letter-spacing: var(--ls-wide) !important;
    color: var(--color-noir) !important;
    text-decoration: none !important;
    transition: var(--transition-normal);
    display: block;
    padding: 10px 0;
    position: relative;
    white-space: nowrap;
}

/* Hover effect - Underline */
.site-nav a::after {
    content: '';
    position: absolute;
    bottom: 5px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--color-noir);
    transition: width 0.3s ease;
}

.site-nav a:hover::after,
.site-nav .current-menu-item > a::after,
.site-nav .current-menu-parent > a::after,
.site-nav .current-menu-ancestor > a::after {
    width: 100%;
}

.site-nav a:hover {
    opacity: 0.7;
}

/* ============================================
   CTA BUTTON (Contactez nous)
   ============================================ */

.site-header__cta {
    flex-shrink: 0;
}

.site-header__cta .btn {
    font-family: var(--font-heading) !important;
    font-size: var(--fs-small);
    font-weight: var(--fw-regular);
    text-transform: none;
    letter-spacing: normal;
    color: var(--color-noir);
    background: transparent;
    border: 2px solid var(--color-noir);
    padding: 12px 30px;
    text-align: center;
    transition: var(--transition-normal);
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    white-space: nowrap;
}

.site-header__cta .btn:hover {
    background-color: var(--color-noir);
    color: var(--color-blanc);
}

/* ============================================
   BURGER + OVERLAY MOBILE — Defaults desktop
   ============================================ */

/* Caché par défaut sur desktop (>768px) */
.burger-btn {
    display: none;
}

.mobile-nav-overlay {
    display: none;
}

/* ============================================
   RESPONSIVE
   ============================================ */

/* Tablet (< 1024px) */
@media (max-width: 1024px), (hover: none) and (pointer: coarse) and (orientation: portrait) and (max-width: 1032px) {
    .site-header__container {
        height: 80px;
    }

    .site-branding img {
        height: 40px;
    }

    .site-nav ul {
        gap: var(--space-lg);
    }

    .site-nav a {
        font-size: var(--fs-tiny);
    }

    .site-header__cta .btn {
        padding: 10px 20px;
        font-size: var(--fs-tiny);
    }
}

/* Ordinateur de 769 à 1215 px : en-tête réduit, il tient sur une ligne avec la marge de 80 px */
@media (min-width: 769px) and (max-width: 1215px) and (hover: hover), (min-width: 769px) and (max-width: 1215px) and (pointer: fine), (min-width: 769px) and (max-width: 1215px) and (pointer: none) {
    .site-branding img {
        height: 40px;
    }

    .site-nav ul {
        column-gap: clamp(20px, calc((100vw - 965px) / 3), 30px);
    }

    .site-nav a {
        font-size: var(--fs-tiny);
    }

    .site-header__cta .btn {
        padding: 10px 20px;
        font-size: var(--fs-tiny);
    }
}

/* Mobile (< 768px) */
@media (max-width: 768px), (hover: none) and (pointer: coarse) and (orientation: portrait) and (max-width: 1032px) {
    .site-header__container {
        height: 70px;
        padding-right: max(calc(var(--marge-laterale) - 8px), env(safe-area-inset-right)); /* les traits du burger (28 px dans 44 px) finissent sur la marge */
        padding-left: max(var(--marge-laterale), env(safe-area-inset-left));
        align-items: center;
        padding-top: 30px; /* Espace haut burger égal à l'espace droit */
    }

    /* Sticky mobile : reset padding-top pour centrer burger et logo */
    .site-header.is-sticky .site-header__container {
        padding-top: 0;
    }

    .site-branding {
        overflow: hidden;
        flex-shrink: 1; /* Permettre au logo de rétrécir sur mobile */
    }

    .site-branding img {
        height: 42px;
        max-width: 100%; /* Ne pas dépasser la largeur disponible */
    }

    /* Pages sans hero : logo à la taille de l'état sticky, il tient dans l'en-tête */
    .page-sans-hero .site-branding img {
        height: 40px;
    }

    .site-nav {
        display: none; /* Remplacé par le burger menu mobile */
    }

    /* ============================================
       MOBILE — Pas de padding-top sur le body
       Le header flotte sur le hero : le body ne
       doit pas avoir le padding de compensation.
       Toutes les pages ont un hero qui gère son
       propre espacement via margin + padding.
       ============================================ */

    body {
        padding-top: 0 !important;
    }

    /* ============================================
       HEADER TRANSPARENT AVANT STICKY — Mobile
       Le header "flotte" au-dessus du hero sans fond blanc.
       Au scroll (is-sticky), le fond blanc apparaît.
       ============================================ */

    .site-header:not(.is-sticky) {
        background-color: transparent;
        border-bottom: none;
        box-shadow: none;
    }

    /* Barres burger : noir par défaut (pages intérieures, heroes clairs) */
    /* Blanc sur pages avec hero sombre : homepage, Particuliers (90), Entreprises (91) */
    body.home .site-header:not(.is-sticky) .burger-btn__line,
    body.page-id-90 .site-header:not(.is-sticky) .burger-btn__line,
    body.page-id-91 .site-header:not(.is-sticky) .burger-btn__line {
        background-color: var(--color-blanc);
        box-shadow: 0 0 6px 2px rgba(0, 0, 0, 0.6);
    }

    .site-header__cta {
        display: none; /* Intégré dans le menu mobile */
    }

    /* ============================================
       BURGER BUTTON
       ============================================ */

    .burger-btn {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 6px;
        width: 44px;
        height: 44px;
        background: transparent;
        border: none;
        cursor: pointer;
        padding: 0;
        flex-shrink: 0;
        position: relative;
        z-index: 1100;
    }

    .burger-btn__line {
        display: block;
        width: 28px;
        height: 2px;
        background-color: var(--color-noir);
        transition: transform 0.3s ease, opacity 0.3s ease;
        transform-origin: center;
    }

    /* État ouvert : transformer en X */
    .burger-btn.is-open .burger-btn__line:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }

    .burger-btn.is-open .burger-btn__line:nth-child(2) {
        opacity: 0;
    }

    .burger-btn.is-open .burger-btn__line:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }

    /* ============================================
       BOUTON FERMER OVERLAY MOBILE
       ============================================ */

    .mobile-nav__close {
        position: absolute;
        top: 13px; /* Aligné verticalement avec le burger (header 70px → centre ~35px, bouton 44px → top = 35 - 22 = 13px) */
        right: calc(var(--marge-laterale) - 8px); /* Même marge horizontale que le burger */
        width: 44px;
        height: 44px;
        background: transparent;
        border: none;
        cursor: pointer;
        padding: 0;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 0;
        z-index: 1100;
    }

    .mobile-nav__close-line {
        display: block;
        width: 28px;
        height: 2px;
        background-color: var(--color-noir);
        transition: transform 0.3s ease;
        transform-origin: center;
    }

    .mobile-nav__close-line:nth-child(1) {
        transform: translateY(1px) rotate(45deg);
    }

    .mobile-nav__close-line:nth-child(2) {
        transform: translateY(-1px) rotate(-45deg);
    }

    /* ============================================
       LOGO DANS L'OVERLAY MOBILE
       ============================================ */

    .mobile-nav__logo {
        margin-bottom: 40px;
        text-align: left; /* Aligné à gauche comme les liens du menu */
    }

    .mobile-nav__logo img {
        height: 50px;
        width: auto;
        display: inline-block;
    }

    /* ============================================
       MOBILE NAV OVERLAY
       ============================================ */

    .mobile-nav-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: var(--color-blanc);
        z-index: 1050;
        transform: translateX(100%);
        transition: transform 0.35s ease;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .mobile-nav-overlay.is-open {
        transform: translateX(0);
    }

    .mobile-nav {
        width: 100%;
        padding: 80px 40px 40px;
    }

    /* Réutilise wp_nav_menu — styles pour les liens mobiles */
    .mobile-nav .mobile-nav__menu {
        list-style: none;
        margin: 0;
        padding: 0;
        display: flex;
        flex-direction: column;
        gap: 0;
    }

    .mobile-nav .mobile-nav__menu li {
        margin: 0;
        padding: 0;
        border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    }

    .mobile-nav .mobile-nav__menu li:first-child {
        border-top: 1px solid rgba(0, 0, 0, 0.08);
    }

    .mobile-nav .mobile-nav__menu a {
        display: block;
        font-family: var(--font-heading) !important;
        font-size: 22px !important;
        font-weight: var(--fw-regular) !important;
        text-transform: uppercase !important;
        letter-spacing: var(--ls-wide) !important;
        color: var(--color-noir) !important;
        text-decoration: none !important;
        padding: 20px 0 !important;
        transition: opacity 0.2s ease;
    }

    .mobile-nav .mobile-nav__menu a:hover {
        opacity: 0.6;
    }

    /* Lien contact en bas */
    .mobile-nav__contact {
        margin-top: 40px;
    }

    .mobile-nav__contact .btn {
        display: block;
        font-family: var(--font-heading) !important;
        font-size: 16px;
        font-weight: var(--fw-regular);
        text-transform: uppercase;
        color: var(--color-noir);
        background: transparent;
        border: 2px solid var(--color-noir);
        padding: 16px 30px;
        text-align: center;
        text-decoration: none;
        transition: var(--transition-normal);
    }

    .mobile-nav__contact .btn:hover {
        background-color: var(--color-noir);
        color: var(--color-blanc);
    }
}

/* ============================================
   PAYSAGE TACTILE - Tablette et téléphone en paysage
   Menu sur une ligne, bouton dans l'écran
   ============================================ */

@media (hover: none) and (pointer: coarse) and (orientation: landscape) and (min-width: 769px) and (max-width: 1376px) {
    .site-header__container {
        gap: 20px;
    }

    .site-nav ul {
        gap: 30px;
    }

    .site-nav a {
        font-size: min(14px, 1.3672vw) !important;
        white-space: nowrap;
    }

    .site-header__cta .btn {
        padding: 10px 20px;
        font-size: min(14px, 1.3672vw);
    }
}

/* ============================================
   TABLETTE PORTRAIT - Burger posé dans le cadre blanc des héros (5.5556vw, 4.1667vw à l'accueil), ombre réduite (barres de 2 px)
   ============================================ */

@media (hover: none) and (pointer: coarse) and (orientation: portrait) and (min-width: 769px) and (max-width: 1032px) {
    .site-header:not(.is-sticky) .site-header__container {
        height: calc(5.5556vw + 46px);
        padding-top: calc(5.5556vw + 6px);
        padding-right: calc(5.5556vw + 12px);
        padding-left: calc(5.5556vw + 12px);
    }

    body.home .site-header:not(.is-sticky) .site-header__container {
        height: calc(4.1667vw + 46px);
        padding-top: calc(4.1667vw + 6px);
        padding-right: calc(4.1667vw + 12px);
        padding-left: calc(4.1667vw + 12px);
    }

    body.home .site-header:not(.is-sticky) .burger-btn__line,
    body.page-id-90 .site-header:not(.is-sticky) .burger-btn__line,
    body.page-id-91 .site-header:not(.is-sticky) .burger-btn__line {
        box-shadow: 0 0 3px 1px rgba(0, 0, 0, 0.8);
    }
}
