.site-header {
    position: relative;
    z-index: 30;
    border-bottom: 1px solid rgba(223, 230, 239, .92);
    background: rgba(255, 255, 255, .98);
}

.site-header__inner {
    display: grid;
    grid-template-columns: minmax(225px, 270px) 1fr auto;
    gap: clamp(.9rem, 1.8vw, 1.7rem);
    align-items: center;
    min-height: 88px;
}

.brand {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.brand__logo {
    display: block;
    width: min(255px, 100%);
    max-height: 74px;
    object-fit: contain;
    object-position: left center;
}

.brand__mark {
    display: none;
}

.site-header__brand {
    display: flex;
    align-items: center;
    min-width: 0;
}

.site-header__brand .brand {
    flex: 0 1 auto;
    min-width: 0;
}

/* Pastille de l'espace, à gauche de la loupe ; pour l'administrateur, elle bascule entre l'espace enseignant et l'espace parents. */
.space-switch {
    flex: none;
    padding: 5px 12px;
    border-radius: 999px;
    background: var(--bbb-teal-100);
    color: var(--bbb-teal-700);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: background var(--bbb-transition), color var(--bbb-transition);
}

.space-switch--children {
    background: #fff1e3;
    color: #b45708;
}

a.space-switch:hover,
a.space-switch:focus-visible {
    background: var(--bbb-teal-700);
    color: #fff;
}

/* Écran étroit : seul le symbole reste, le nom est dans l'infobulle et pour les lecteurs d'écran ; la pastille sans lien disparaît. */
@media (max-width: 900px) {
    .space-switch {
        padding: 3px 9px;
    }

    .space-switch__label,
    .space-switch--static {
        display: none;
    }
}

/* Menus déroulants de l'en-tête (accueil du site, espace parents) : mêmes liens que le menu des enseignants, sans script. */
.nav-menu {
    position: relative;
}

.nav-menu > summary {
    cursor: pointer;
    list-style: none;
}

.nav-menu > summary::-webkit-details-marker {
    display: none;
}

.nav-menu[open] > summary::after {
    margin-top: 3px;
    transform: rotate(-135deg);
}

.nav-menu__panel {
    position: absolute;
    top: calc(100% + 6px);
    left: -12px;
    z-index: 40;
    min-width: 230px;
    margin: 0;
    padding: 8px;
    list-style: none;
    background: #fff;
    border: 1px solid var(--bbb-border);
    border-radius: 10px;
    box-shadow: var(--bbb-shadow-md);
}

.nav-menu__panel a,
.nav-menu__panel span {
    display: block;
    padding: 9px 12px;
    border-radius: 7px;
    color: var(--bbb-navy-900);
    font-size: .82rem;
    text-decoration: none;
    white-space: nowrap;
}

.nav-menu__panel a:hover,
.nav-menu__panel a:focus-visible {
    background: var(--bbb-surface-teal);
    color: var(--bbb-teal-700);
}

.nav-menu__panel span {
    color: var(--bbb-muted);
}

.nav-menu__panel em {
    margin-left: 4px;
    color: var(--bbb-teal-700);
    font-size: .74rem;
    font-style: normal;
}

/* Le menu défile horizontalement sur écran étroit : le panneau se place alors sous l'en-tête, sans être coupé. */
@media (max-width: 900px) {
    .nav-menu {
        position: static;
    }

    .nav-menu__panel {
        top: 100%;
        left: 1rem;
        right: 1rem;
        min-width: 0;
    }

    .site-header__inner {
        position: relative;
    }
}

.main-nav {
    justify-self: center;
    min-width: 0;

    /* BBB NAVBAR ALIGNEMENT MAQUETTE 20260815 */
    transform: translateX(-2rem);
}

.main-nav__list {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(.65rem, 1.3vw, 1.25rem);
    margin: 0;
    padding: 0;
    list-style: none;
}

.main-nav__link,
.main-nav__future {
    position: relative;
    display: inline-flex;
    gap: .32rem;
    align-items: center;
    min-height: 38px;
    color: var(--bbb-navy-900);
    font-size: .8rem;
    font-weight: 680;
    text-decoration: none;
    white-space: nowrap;
}

.main-nav__future {
    opacity: .72;
    cursor: default;
}

.main-nav__link--chevron::after,
.main-nav__future--chevron::after {
    content: "";
    width: 6px;
    height: 6px;
    margin-top: -3px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg);
}

.main-nav__link:hover {
    color: var(--bbb-teal-700);
}

.main-nav__link[aria-current="page"] {
    color: var(--bbb-teal-700);
}

.main-nav__link[aria-current="page"]::before {
    content: "";
    position: absolute;
    left: .05rem;
    right: .05rem;
    bottom: 0;
    height: 2px;
    border-radius: 99px;
    background: var(--bbb-teal-500);
}

.header-tools {
    display: flex;
    gap: .8rem;
    align-items: center;
}

.header-search {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    color: var(--bbb-navy-900);
    text-decoration: none;
}

.header-search:hover {
    color: var(--bbb-teal-700);
}

.header-search svg {
    width: 23px;
    height: 23px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: .55rem;
}

.header-actions .bbb-button {
    min-height: 39px;
    padding-inline: .85rem;
    font-size: .76rem;
}

.site-main {
    min-height: 60vh;
}

.site-footer {
    margin-top: 3rem;
    color: #fff;
    background: linear-gradient(135deg, var(--bbb-navy-950), var(--bbb-navy-800));
}

.site-footer__inner {
    display: flex;
    justify-content: space-between;
    gap: .6rem 1.25rem;
    align-items: center;
    min-height: 44px;
    padding-block: .6rem;
}

.site-footer__copyright {
    margin: 0;
    color: rgba(255, 255, 255, .76);
    font-size: .72rem;
    white-space: nowrap;
}

.site-footer__legal {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: .35rem 0;
}

.site-footer__legal a {
    color: rgba(255, 255, 255, .84);
    font-size: .72rem;
    text-decoration: none;
}

.site-footer__legal a + a {
    margin-left: .8rem;
    padding-left: .8rem;
    border-left: 1px solid rgba(255, 255, 255, .24);
}

.site-footer__legal a:hover,
.site-footer__legal a:focus-visible {
    color: #fff;
    text-decoration: underline;
    text-underline-offset: 3px;
}

@media (max-width: 1180px) {
    .main-nav {
        transform: translateX(-1rem);
    }
    .site-header__inner {
        grid-template-columns: 210px 1fr auto;
    }

    .brand__logo {
        width: 205px;
    }

    .main-nav__list {
        gap: .75rem;
    }

    .main-nav__future--chevron:last-child {
        display: none;
    }

    .header-actions .bbb-button:first-child {
        display: none;
    }
}

@media (max-width: 900px) {
    .main-nav {
        transform: none;
    }
    .site-header__inner {
        grid-template-columns: 70px 1fr auto;
        min-height: 78px;
    }

    .brand__logo {
        display: none;
    }

    .brand__mark {
        display: block;
        width: 62px;
        height: 58px;
        object-fit: cover;
        object-position: left center;
    }

    .main-nav {
        justify-self: start;
        width: 100%;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .main-nav::-webkit-scrollbar {
        display: none;
    }

    .main-nav__list {
        justify-content: flex-start;
    }

    .main-nav__future {
        display: none;
    }

    .header-actions {
        display: none;
    }

    /* Espace enfants : « Quitter » reste visible. */
    .header-actions--always {
        display: flex;
    }

}

@media (max-width: 560px) {
    .site-header__inner {
        grid-template-columns: 56px 1fr auto;
        gap: .6rem;
    }

    .brand__mark {
        width: 52px;
        height: 50px;
    }

    .main-nav__link--chevron::after {
        display: none;
    }

    .header-search {
        width: 34px;
        height: 34px;
    }

    .site-footer__inner {
        flex-direction: column;
        justify-content: center;
        gap: .45rem;
        padding-block: .72rem;
        text-align: center;
    }

    .site-footer__legal {
        justify-content: center;
    }
}

/* BBB NAVBAR ALIGNEMENT DEBUT COLONNE 20260815 V2
 * La navigation n'est plus centree dans toute la colonne centrale :
 * elle commence directement apres la zone logo, comme sur la maquette.
 */
@media (min-width: 901px) {
    .main-nav {
        justify-self: start;
        transform: none;
    }
}
