/* SiteHeader — a floating surface that hides on the way down and returns on
 * the way up. Fixed, so it is out of flow and affects nothing else on the page.
 */

.site-header {
    position: fixed;
    top: var(--header-float-inset);

    /* Sized to its contents, then centred.
       The insets define the box the bar may occupy; `fit-content` shrinks it to
       just what the brand and nav need (and no wider than that box, so it still
       behaves on narrow screens); `margin-inline: auto` splits the leftover
       space evenly. All three are required — with the insets alone the element
       would stretch to fill, and with `margin: auto` alone it would not move.
       Deliberately not `left: 50%` + translate: `translate` belongs to the hide
       animation below. */
    left: var(--header-float-inset);
    right: var(--header-float-inset);
    width: fit-content;
    margin-inline: auto;

    z-index: 20;
    /* Only transform animates, so hiding never triggers layout. */
    transition: translate 260ms cubic-bezier(0.4, 0, 0.2, 1), opacity 200ms ease;
}

/* Set by SiteHeader.js once the page has scrolled past the header's own height. */
.site-header[data-hidden="true"] {
    /* -140% of its own height clears the top inset as well as the bar. */
    translate: 0 -140%;
    pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
    .site-header { transition: none; }
}

.site-header__inner {
    /* The surface itself is the inner element so the fixed wrapper can stay a
       plain positioning box.

       `center` groups the brand and the nav together in the middle of the bar.
       Swap for `space-between` to push them to opposite ends instead — that is
       the only line that decides it. */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 32px;
    min-height: var(--header-height);
    padding: 0 var(--header-padding-h);
}

.site-header__brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--text-primary);
    text-decoration: none;
}

.site-header__mark {
    width: 32px;
    height: 32px;
    flex: none;
    display: block;
}

.site-header__nav {
    display: flex;
    align-items: center;
    gap: var(--nav-gap);
}

.site-header__link {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 140ms ease;
}
.site-header__link:hover,
.site-header__link[aria-current="true"] {
    color: var(--text-primary);
}

/* --- Language menu ------------------------------------------------------- */
.language-menu {
    position: relative;
}

.language-menu__button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border: 1px solid var(--outline-subtle);
    border-radius: var(--pill-radius);
    color: var(--text-muted);
    background: transparent;
    cursor: pointer;
    transition: color 140ms ease, border-color 140ms ease;
}
.language-menu__button:hover,
.language-menu__button[aria-expanded="true"] {
    color: var(--text-primary);
    border-color: var(--chip-selected-outline);
}
.language-menu__button .glyph {
    transition: rotate 180ms ease;
}
.language-menu__button[aria-expanded="true"] .glyph {
    rotate: 180deg;
}

.language-menu__list {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 116px;
    margin: 0;
    padding: 6px;
    list-style: none;
    /* Its own small surface, matching the header it drops out of. */
    border-radius: 14px;
    display: none;
}
.language-menu__list[data-open="true"] {
    display: block;
}

.language-menu__option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    padding: 9px 12px;
    border: 0;
    border-radius: 9px;
    color: var(--text-muted);
    background: transparent;
    cursor: pointer;
    text-align: left;
    transition: color 140ms ease, background-color 140ms ease;
}
.language-menu__option:hover {
    color: var(--text-primary);
    background: rgb(233 234 238 / 0.07);
}
.language-menu__option[aria-selected="true"] {
    color: var(--text-primary);
}
.language-menu__option[aria-selected="true"]::after {
    content: "";
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent);
}

/* --- Compact ------------------------------------------------------------- */
.site-header__nav-toggle { display: none; }

@media (max-width: 900px) {
    .site-header__nav { display: none; }
    .site-header__nav-toggle {
        display: inline-flex;
        align-items: center;
        gap: 8px;
    }
}

.site-header__overlay {
    position: fixed;
    top: calc(var(--header-float-inset) + var(--header-height) + 8px);
    /* Same shrink-and-centre as the bar it drops out of, with a floor so a
       two-word menu does not end up narrower than it is tappable. */
    left: var(--header-float-inset);
    right: var(--header-float-inset);
    width: fit-content;
    min-width: min(260px, 100%);
    margin-inline: auto;
    z-index: 19;
    display: none;
}
.site-header__overlay[data-open="true"] { display: block; }

.site-header__overlay-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px var(--header-padding-h);
    margin: 0;
    list-style: none;
}
.site-header__overlay-list a {
    display: block;
    padding: 12px 0;
    color: var(--text-muted);
    text-decoration: none;
}
.site-header__overlay-list a:hover { color: var(--text-primary); }
