/* En-tête du site (composant Header) : bandeau d'informations (34 px, ordinateur) et barre principale (72 px), collants.
   Sous 960 px, la navigation devient un panneau ouvert par le bouton « Menu » (contrôleur mobile-menu).
   Produits et Sur mesure ont un sous-menu (contrôleur submenu) : liste déroulante sur ordinateur,
   dépliée sur place dans le panneau sur mobile. */

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--surface-page);
    box-shadow: var(--shadow-sm);
}

.site-header__topbar {
    display: none;
    background: var(--surface-inverse-deep);
    color: var(--steel-300);
    font-size: var(--text-sm);
}

@media (min-width: 960px) {
    .site-header__topbar {
        display: block;
    }
}

.site-header__topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-6);
    min-height: 34px;
}

.site-header__tagline {
    font-weight: var(--weight-semibold);
    color: var(--text-inverse);
}

.site-header__facts {
    display: flex;
    gap: var(--space-6);
}

.site-header__fact {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    white-space: nowrap;
}

/* Compte connecté (Mon espace, Back-office, Se déconnecter) : sous 1280 px, ses liens prennent la place
   des mentions génériques, pour que le bandeau tienne sur une ligne */
@media (max-width: 1279px) {
    .site-header__facts--signed-in .site-header__fact--claim {
        display: none;
    }
}

.site-header__fact svg {
    width: 14px;
    height: 14px;
    color: var(--red-500);
}

.site-header__fact a {
    color: var(--text-inverse);
    text-decoration: none;
}

.site-header__fact a:hover {
    color: var(--text-inverse);
    text-decoration: underline;
}

.site-header__main {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-height: 72px;
}

.site-header__brand {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    margin-right: auto;
    color: var(--text-primary);
    text-decoration: none;
}

.site-header__brand:hover {
    color: var(--text-primary);
}

.site-header__logo {
    width: 48px;
    height: 48px;
    border: var(--border-width) solid var(--border-default);
    border-radius: var(--radius-sm);
}

.site-header__name {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.site-header__wordmark {
    font: var(--weight-bold) var(--text-lg) / 1 var(--font-display);
    letter-spacing: 0.04em;
}

.site-header__baseline {
    font: var(--type-overline);
    letter-spacing: var(--tracking-wide);
    text-transform: uppercase;
    color: var(--text-secondary);
}

.site-header__nav a {
    font-weight: var(--weight-medium);
    color: var(--text-primary);
    text-decoration: none;
}

.site-header__nav a:hover {
    color: var(--text-link-hover);
}

/* Rubrique de la page courante : soulignée en rouge, comme dans le back-office */
.site-header__nav a[aria-current] {
    text-decoration: underline;
    text-decoration-color: var(--red-500);
    text-decoration-thickness: 2px;
    text-underline-offset: 8px;
}

/* Rubrique à sous-menu (contrôleur submenu) : son lien, le bouton qui ouvre la liste de ses pages */
.site-header__section-head {
    display: flex;
    align-items: center;
}

.site-header__submenu-button {
    display: inline-grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: var(--radius-sm);
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
}

.site-header__submenu-button:hover {
    color: var(--text-link-hover);
}

.site-header__submenu-button svg {
    transition: transform var(--duration-fast) var(--ease-out);
}

.site-header__section[data-submenu-open] .site-header__submenu-button svg {
    transform: rotate(180deg);
}

.site-header__submenu {
    display: none;
    margin: 0;
    padding: 0;
    list-style: none;
}

.site-header__section[data-submenu-open] .site-header__submenu {
    display: grid;
}

.site-header__menu-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: var(--control-h-sm);
    min-width: var(--control-h-sm);
    padding: 0 var(--space-3);
    border: var(--border-width) solid var(--border-strong);
    border-radius: var(--radius-md);
    background: var(--surface-page);
    font: var(--weight-semibold) var(--text-sm) / 1 var(--font-body);
    color: var(--text-primary);
    cursor: pointer;
}

.site-header__menu-icon {
    width: 18px;
    height: 18px;
}

.site-header__menu-icon--close,
.site-header[data-menu-open] .site-header__menu-icon--open {
    display: none;
}

.site-header[data-menu-open] .site-header__menu-icon--close {
    display: inline;
}

/* Ordinateur : navigation en ligne, pas de bouton Menu */
@media (min-width: 960px) {
    .site-header__main {
        gap: var(--space-8);
    }

    .site-header__nav > ul {
        display: flex;
        align-items: center;
        gap: var(--space-8);
    }

    .site-header__nav a {
        white-space: nowrap;
    }

    /* Sous-menu : liste déroulante sous la rubrique */
    .site-header__section {
        position: relative;
    }

    .site-header__section-head {
        gap: 2px;
    }

    .site-header__submenu-button {
        width: 24px;
        height: 24px;
    }

    .site-header__submenu-button svg {
        width: 16px;
        height: 16px;
    }

    .site-header__submenu {
        position: absolute;
        top: calc(100% + var(--space-5));
        left: calc(-1 * var(--space-4));
        z-index: 1;
        min-width: 15rem;
        padding: var(--space-2) 0;
        border: var(--border-width) solid var(--border-default);
        border-radius: var(--radius-md);
        background: var(--surface-card);
        box-shadow: var(--shadow-md);
    }

    /* Passerelle invisible entre la rubrique et la liste : le survol ne se perd pas en chemin */
    .site-header__submenu::before {
        content: '';
        position: absolute;
        bottom: 100%;
        left: 0;
        right: 0;
        height: var(--space-5);
    }

    .site-header__submenu a {
        display: block;
        padding: var(--space-2) var(--space-4);
    }

    .site-header__submenu a[aria-current] {
        text-underline-offset: 4px;
    }

    .site-header__nav-phone,
    .site-header__menu-button {
        display: none;
    }
}

/* Mobile et tablette : panneau sous la barre, ouvert par le bouton Menu */
@media (max-width: 959px) {
    .site-header__nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--surface-page);
        border-top: var(--border-width) solid var(--border-default);
        box-shadow: var(--shadow-md);
    }

    .site-header[data-menu-open] .site-header__nav {
        display: block;
    }

    .site-header__nav > ul {
        display: grid;
        padding: var(--space-2) var(--container-pad) var(--space-4);
    }

    .site-header__nav a {
        display: flex;
        align-items: center;
        gap: var(--space-2);
        min-height: 52px;
        border-bottom: var(--border-width) solid var(--border-default);
        font-size: var(--text-md);
    }

    .site-header__nav-phone a {
        border-bottom: 0;
    }

    /* Sous-menu : dépliée sur place, sous le lien de la rubrique */
    .site-header__section-head {
        border-bottom: var(--border-width) solid var(--border-default);
    }

    .site-header__section-head a {
        flex: 1;
        border-bottom: 0;
    }

    .site-header__submenu-button {
        width: 48px;
        height: 48px;
    }

    .site-header__submenu-button svg {
        width: 20px;
        height: 20px;
    }

    .site-header__submenu {
        padding: var(--space-1) 0 var(--space-2) var(--space-4);
        border-bottom: var(--border-width) solid var(--border-default);
    }

    .site-header__submenu a {
        min-height: 44px;
        border-bottom: 0;
        font-size: var(--text-base);
        color: var(--text-secondary);
    }

    .site-header__submenu a[aria-current] {
        color: var(--text-primary);
        text-underline-offset: 6px;
    }

    .site-header__nav-phone svg {
        width: 18px;
        height: 18px;
        color: var(--red-500);
    }
}

/* Petits écrans : le logo seul (il porte « P.B.A.B »), le libellé du bouton Menu reste lu par les lecteurs d'écran */
@media (max-width: 599px) {
    .site-header__baseline {
        display: none;
    }
}

@media (max-width: 479px) {
    .site-header__name {
        display: none;
    }

    .site-header__menu-button span {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }
}

/* « Mon projet » : icône, libellé (masqué sur petit écran) et nombre de lots choisis */
.site-header__project {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    min-height: var(--control-h-sm);
    padding: 0 var(--space-2);
    font-weight: var(--weight-medium);
    color: var(--text-primary);
    text-decoration: none;
    white-space: nowrap;
}

.site-header__project:hover {
    color: var(--text-link-hover);
}

.site-header__project[aria-current] .site-header__project-label {
    text-decoration: underline;
    text-decoration-color: var(--red-500);
    text-decoration-thickness: 2px;
    text-underline-offset: 8px;
}

.site-header__project svg {
    width: 20px;
    height: 20px;
}

.site-header__project-count {
    display: inline-grid;
    place-items: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: var(--action-primary);
    font: var(--weight-bold) var(--text-xs) / 1 var(--font-body);
    color: var(--text-inverse);
}

.site-header__project-count:empty {
    display: none;
}

/* Entre 960 et 1199 px, six rubriques tiennent sur une ligne en resserrant l'écart */
@media (min-width: 960px) and (max-width: 1199px) {
    .site-header__main,
    .site-header__nav > ul {
        gap: var(--space-5);
    }
}

@media (max-width: 1199px) {
    .site-header__project-label {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }
}
