/* =========================================================
   NAVIGATION PUBLIQUE BST
   Header persistant, navigation desktop et menu mobile
   ========================================================= */

:root {
    --nav-blue: #173247;
    --nav-blue-dark: #0b2435;
    --nav-green: #31533f;
    --nav-gold: #f3cf67;
    --nav-cream: #fffaf0;
    --nav-text: #173042;
    --nav-line: rgba(49, 83, 63, 0.16);
}

.public-header {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 1200;

    width: 100%;

    border-bottom: 1px solid var(--nav-line);

    background: rgba(255, 250, 240, 0.96);

    box-shadow:
        0 8px 24px
        rgba(28, 48, 38, 0.10);

    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/*
 * Un header fixed sort du flux normal.
 * Cette compensation évite qu’il masque le début de la page.
 */
body {
    padding-top: 76px;
}

.public-header__inner {
    position: relative;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;

    width: min(calc(100% - 32px), 1280px);
    min-height: 76px;

    margin: 0 auto;
    padding: 10px 0;
}

.public-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;

    min-width: 0;

    color: var(--nav-blue-dark);

    font-weight: 850;
    line-height: 1.25;
    text-decoration: none;
}

.public-brand .logo {
    flex: 0 0 auto;

    width: 48px;
    height: 48px;

    object-fit: contain;
}

.public-brand span {
    overflow-wrap: anywhere;
}

.public-brand:hover {
    color: var(--nav-green);
}

.public-brand:focus-visible,
.public-nav a:focus-visible,
.public-nav-toggle:focus-visible {
    outline: 3px solid var(--nav-gold);
    outline-offset: 3px;
}

.public-nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
}

.public-nav a {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 42px;
    padding: 9px 13px;

    border-radius: 999px;

    color: var(--nav-text);

    font-size: 0.94rem;
    font-weight: 750;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;

    transition:
        color 160ms ease,
        background-color 160ms ease,
        transform 160ms ease;
}

.public-nav a:hover {
    color: var(--nav-blue-dark);
    background: rgba(49, 83, 63, 0.09);
    transform: translateY(-1px);
}

.public-nav a.active,
.public-nav a[aria-current="page"] {
    color: var(--nav-blue-dark);
    background: var(--nav-gold);
}

.public-nav-toggle {
    display: none;
}

/* Les ancres restent visibles sous le header persistant. */
[id] {
    scroll-margin-top: 100px;
}

@media (max-width: 980px) {
    .public-header__inner {
        gap: 16px;
    }

    .public-brand span {
        max-width: 260px;
    }

    .public-nav a {
        padding-inline: 10px;
        font-size: 0.9rem;
    }
}

@media (max-width: 850px) {
    body {
        padding-top: 68px;
    }

    .public-header__inner {
        min-height: 68px;
    }

    .public-brand .logo {
        width: 42px;
        height: 42px;
    }

    .public-brand span {
        max-width: min(54vw, 360px);
        font-size: 0.92rem;
    }

    .public-nav-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        flex: 0 0 auto;

        min-height: 44px;
        padding: 9px 13px;

        border: 1px solid rgba(49, 83, 63, 0.25);
        border-radius: 999px;

        color: #163b26;
        background: #edf3df;

        font: inherit;
        font-weight: 800;
        cursor: pointer;
    }

    .public-nav {
        display: none;

        position: absolute;
        top: 100%;
        right: 0;
        left: 0;
        z-index: 1210;

        flex-direction: column;
        align-items: stretch;
        gap: 6px;

        max-height: calc(100vh - 86px);
        padding: 12px;
        overflow-y: auto;

        border: 1px solid rgba(49, 83, 63, 0.16);
        border-top: 0;
        border-radius: 0 0 16px 16px;

        background: rgba(255, 250, 240, 0.99);

        box-shadow:
            0 18px 34px
            rgba(0, 0, 0, 0.18);

        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
    }

    .public-nav.open,
    .public-nav.is-open {
        display: flex;
    }

    .public-nav a {
        justify-content: flex-start;

        width: 100%;
        min-height: 46px;
        padding: 12px 14px;

        border-radius: 10px;

        white-space: normal;
    }

    .public-nav a:hover {
        transform: none;
    }

    [id] {
        scroll-margin-top: 88px;
    }
}

@media (max-width: 480px) {
    .public-header__inner {
        width: min(calc(100% - 20px), 1280px);
    }

    .public-brand {
        gap: 8px;
    }

    .public-brand span {
        max-width: 44vw;
        font-size: 0.82rem;
    }

    .public-nav-toggle__label {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .public-nav a {
        transition: none;
    }
}
/* =========================================================
   DATE ET HEURE DU HEADER
   ========================================================= */

.public-header__clock {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;

    margin-left: auto;
    padding: 7px 11px;

    border: 1px solid rgba(49, 83, 63, 0.16);
    border-radius: 999px;

    color: #52645d;
    background: rgba(237, 243, 223, 0.7);

    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}

.public-header__clock #time {
    color: #173229;
    font-variant-numeric: tabular-nums;
}

.public-header__clock-separator {
    color: #c4a45c;
    font-weight: 900;
}

@media (min-width: 851px) {
    .public-header__inner {
        gap: 18px;
    }

    .public-header__clock {
        order: 2;
    }

    .public-nav {
        order: 3;
    }

    .public-nav-toggle {
        order: 4;
    }
}

@media (max-width: 850px) {
    .public-header__clock {
        margin-left: auto;
        padding: 6px 10px;
        font-size: 0.75rem;
    }

    .public-header__clock #today,
    .public-header__clock-separator {
        display: none;
    }
}

@media (max-width: 430px) {
    .public-header__clock {
        display: none;
    }
}

/* =========================================================
   MODE TABLETTE DU HEADER
   ========================================================= */

@media (max-width: 1100px) {
    /*
     * Hauteur stable du header fixe.
     */
    body {
        padding-top: 72px;
    }

    .public-header__inner {
        width: min(
            calc(100% - 28px),
            1280px
        );

        min-height: 72px;
        padding: 8px 0;
        gap: 12px;
    }

    /*
     * Empêche le nom de la BST de former
     * une colonne très étroite.
     */
    .public-brand {
        flex: 1 1 auto;
        min-width: 0;
        max-width: 430px;
    }

    .public-brand .logo {
        width: 44px;
        height: 44px;
    }

    .public-brand span {
        max-width: none;

        font-size: 0.9rem;
        line-height: 1.2;

        white-space: normal;
        overflow-wrap: normal;
    }

    /*
     * En tablette, seule l’heure reste affichée.
     */
    .public-header__clock {
        flex: 0 0 auto;
        margin-left: auto;
        padding: 6px 10px;
    }

    .public-header__clock #today,
    .public-header__clock-separator {
        display: none;
    }

    /*
     * Le bouton du menu apparaît dès 1100 px.
     */
    .public-nav-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        flex: 0 0 auto;

        min-height: 44px;
        padding: 9px 13px;

        border:
            1px solid
            rgba(49, 83, 63, 0.25);

        border-radius: 999px;

        color: #163b26;
        background: #edf3df;

        font: inherit;
        font-weight: 800;
        cursor: pointer;
    }

    /*
     * Navigation déroulante.
     */
    .public-nav {
        display: none;

        position: absolute;
        top: 100%;
        right: 0;
        left: 0;
        z-index: 1210;

        flex-direction: column;
        align-items: stretch;
        gap: 6px;

        max-height:
            calc(100vh - 82px);

        padding: 12px;
        overflow-y: auto;

        border:
            1px solid
            rgba(49, 83, 63, 0.16);

        border-top: 0;

        border-radius:
            0 0 16px 16px;

        background:
            rgba(255, 250, 240, 0.99);

        box-shadow:
            0 18px 34px
            rgba(0, 0, 0, 0.18);

        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
    }

    .public-nav.open,
    .public-nav.is-open {
        display: flex;
    }

    .public-nav a {
        justify-content: flex-start;

        width: 100%;
        min-height: 46px;
        padding: 12px 14px;

        border-radius: 10px;

        white-space: normal;
    }

    .public-nav a:hover {
        transform: none;
    }

    /*
     * Compensation des ancres sous le header fixe.
     */
    [id] {
        scroll-margin-top: 90px;
    }
}