/*
 * Header — the shared partial (@default/_site_head), restyled. Cream, no
 * rule; the name in bold with the brand's star (an uploaded logo keeps its
 * own); links in capitals with a gradient line under the current page and
 * the one under the pointer. Sticky and overlay (theme.json → header):
 * it slides away while reading down, and sits on a hero's film in cream.
 */
.site-head {
    view-transition-name: site-head;
    border-bottom: 0;
    background: transparent;
}

/* Scrolled, the header's paper is a floating pill with room around it: a
   bar across the page would cut the gradient shapes in a straight line.
   It comes the moment the page slides under the header (kit.js sets
   data-header-scrolled then), and over a hero once past the header's
   height; at the top the header stays bare, over the shapes or the hero. */
.site-head::before {
    content: "";
    position: absolute;
    inset: var(--space-2) calc(var(--gutter) - var(--space-4));
    z-index: -1;
    border-radius: 999px;
    background: color-mix(in srgb, var(--bg) 90%, transparent);
    box-shadow: 0 10px 30px -14px rgb(17 17 17 / .35), 0 0 0 1px rgb(17 17 17 / .06);
    backdrop-filter: blur(14px) saturate(1.4);
    opacity: 0;
    scale: .97;
    transition: opacity var(--duration) var(--ease), scale var(--duration) var(--ease);
    pointer-events: none;
}

.site-head[data-header-scrolled]:not([data-nav-open])::before {
    opacity: 1;
    scale: 1;
}

.mark {
    gap: .2em;
    font-size: var(--text-lg);
    font-weight: var(--weight-black);
    letter-spacing: var(--tracking-display);
    text-transform: uppercase;
    color: var(--ink);
}

.mark:not(:has(.mark-logo))::after {
    content: "";
    width: .7em;
    aspect-ratio: 1;
    margin-top: -.6em;
    background: var(--brand-gradient);
    mask: url("logo-star.svg") center / contain no-repeat;
    transition: transform var(--duration) var(--ease-spring);
}

.mark:hover::after {
    transform: rotate(144deg) scale(1.3);
}

.nav,
.langs > summary {
    font-size: var(--text-sm);
    font-weight: var(--weight-strong);
    letter-spacing: var(--tracking-caps);
    text-transform: uppercase;
}

.nav a,
.langs > summary {
    color: var(--ink);
}

.nav a {
    display: inline-flex;
    align-items: center;
    min-height: var(--tap);
    /* The line sits just under the capitals, not at the foot of the target. */
    background: var(--brand-gradient) left 0 bottom var(--space-2) / 0 2px no-repeat;
    transition: background-size var(--duration) var(--ease), font-weight var(--duration-fast) var(--ease);
}

.nav a:hover,
.nav a[aria-current="page"] {
    background-size: 100% 2px;
}

.nav a:hover {
    font-weight: var(--weight-black);
}

.langs > summary {
    display: flex;
    align-items: center;
    min-height: var(--tap);
}

.nav-sub {
    font-size: var(--text-xs);
}

.langs-menu {
    border: 0;
    box-shadow: var(--shadow);
}

.langs-menu a {
    color: var(--ink);
    font-weight: var(--weight-strong);
}

.nav-toggle {
    border: 0;
    background: transparent;
    color: var(--ink);
}

/* Over a hero's film or picture: cream on the media, until scrolled past. */
.opens-with-media .site-head.is-overlay:not([data-header-scrolled], [data-nav-open]) .mark,
.opens-with-media .site-head.is-overlay:not([data-header-scrolled], [data-nav-open]) .nav a,
.opens-with-media .site-head.is-overlay:not([data-header-scrolled], [data-nav-open]) .langs > summary,
.opens-with-media .site-head.is-overlay:not([data-header-scrolled], [data-nav-open]) .nav-toggle {
    color: var(--on-night);
}

/* Over the home's poster it floats, so the poster starts at the very top
   of the screen. */
/* Below an editor's preview note while it is on screen (kit.css → Header
   modes). */
.opens-with-poster .site-head.is-overlay {
    position: fixed;
    inset: var(--preview-note-offset, 0px) 0 auto;
}

.opens-with-poster .site-head.is-overlay:not(.is-sticky) {
    position: absolute;
    top: var(--preview-note-h, 0px);
}

/* And the page starts at the very top: no room kept for a header that is
   not in the flow (the kit does the same for a page opening on a film). */
.opens-with-poster main {
    padding-top: 0;
}

/* On a phone the open menu is a gradient panel with the brand's stack:
   big, black capitals, coming in line by line (motion.css). */
@media (max-width: 760px) {
    /* On a phone the pill is plain paper, not frosted: the work scrolls
       right under a narrow header, and none of it should read through. */
    .site-head::before {
        background: var(--bg);
        backdrop-filter: none;
    }

    .site-head[data-nav-open] {
        min-height: calc(100dvh - var(--preview-note-offset, 0px));
        align-content: start;
        /* Warm only: the small links and the languages are ink on it. */
        background: var(--brand-gradient-under-ink);
        backdrop-filter: none;
    }

    .site-head[data-nav-open] .mark::after {
        background: var(--ink);
    }

    .site-head[data-nav-open] .site-head-panel {
        gap: var(--space-6);
        margin-block: var(--space-7) var(--space-4);
    }

    .site-head[data-nav-open] .nav {
        gap: 0;
    }

    .site-head[data-nav-open] .nav > .nav-item > a {
        font-size: clamp(2.6rem, 13vw, 4rem);
        font-weight: var(--weight-black);
        line-height: 1;
        letter-spacing: var(--tracking-monster);
        background: none;
    }

    .site-head[data-nav-open] .nav > .nav-item > a[aria-current="page"]::after {
        content: "";
        width: .45em;
        aspect-ratio: 1;
        margin-left: .15em;
        align-self: start;
        background: var(--ink);
        mask: url("logo-star.svg") center / contain no-repeat;
    }

    .site-head[data-nav-open] .nav-sub a {
        font-size: var(--text-sm);
    }
}

@media (prefers-reduced-motion: reduce) {
    .nav a,
    .mark::after {
        transition: none;
    }
}
