/* ==========================================================================
   Site header and mobile menu
   ==========================================================================
   The header sits over the top of the page (not fixed). It uses the same
   two-column grid as the content: the logo in the first column, the menu
   spread across the second.

   State classes toggled by assets/js/scripts.js:
     .site-header.header-dark   the section behind asked for light navigation
     .site-nav-overlay.is-open  the mobile menu is open
   ========================================================================== */
.site-header {
    position: absolute;
    inset-block-start: 0;
    inset-inline: 0;
    z-index: 100;
    color: var(--color-ink);
}

.site-header.header-dark { color: var(--color-paper); }

.site-header-inner {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: var(--gutter);
    align-items: start;
    width: 100%;
    max-width: var(--container-max);
    margin-inline: auto;
    padding-inline: var(--container-pad);
    padding-top: var(--space-32);
}

/* ---------- Logo ----------
   Three versions are printed: dark and light for the full header (CSS shows
   the one that suits the background) and the small monogram, shown only in
   the compact bar. */
.site-logo {
    display: inline-flex;
    justify-self: start;
}

.site-logo-img {
    display: block;
    width: var(--logo-width);
    height: auto;
}

.site-logo-img--light,
.site-logo-img--small,
.site-header.header-dark .site-logo-img--dark { display: none; }

.site-header.header-dark .site-logo-img--light,
.site-nav-overlay .site-logo-img--light { display: block; }

/* ---------- Inline menu ---------- */
.site-nav-list {
    display: flex;
    justify-content: space-between;
    gap: var(--space-32);
    list-style: none;
    margin: 0;
    margin-top: var(--space-16);
    padding: 0;
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.4;
}

.site-nav-list a { transition: opacity 0.3s var(--ease); }
.site-nav-list a:hover { opacity: 0.6; }

.site-nav-toggle {
    display: none;
    justify-self: end;
    padding: 0;
    background: none;
    border: 0;
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.4;
    color: inherit;
    cursor: pointer;
}

/* ---------- Mobile menu ---------- */
.site-nav-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    overflow-y: auto;
    background: var(--color-dark);
    color: var(--color-paper);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s var(--ease), visibility 0.4s var(--ease);
}

.site-nav-overlay.is-open { opacity: 1; visibility: visible; }

.site-nav-overlay-inner {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    padding: var(--space-32) var(--container-pad-mobile) var(--space-64);
}

.site-nav-overlay-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.site-nav-overlay-close {
    padding: 0;
    background: none;
    border: 0;
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.4;
    color: inherit;
    cursor: pointer;
}

.site-nav-overlay-nav { margin-top: var(--space-64); }

.site-nav-overlay-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.site-nav-overlay-list a {
    display: block;
    padding-block: var(--space-16);
    border-bottom: 1px solid var(--color-line-dark);
    font-family: var(--font-sans);
    font-weight: 300;
    font-size: 1.375rem;
    line-height: 1.3;
}

.site-nav-overlay-contact {
    display: flex;
    flex-direction: column;
    margin-top: auto;
    padding-top: var(--space-64);
    font-family: var(--font-sans);
    font-weight: 300;
    font-size: 1rem;
    line-height: 1.35;
}

/* ---------- Compact bar ----------
   Once the page has scrolled past the full header, scripts.js fixes the
   header to the top as a slim bar (.is-condensed). It stays out of view
   while scrolling down and slides in when scrolling up (.is-revealed).
   .is-animated is added one frame later, so the switch itself never
   animates. At the very top of the page the full header returns. */
.site-header.is-condensed {
    position: fixed;
    color: var(--color-ink);
    background: var(--color-bg);
    border-bottom: 1px solid rgb(26 26 26 / 0.08);
    transform: translateY(-100%);
}

.site-header.is-condensed.is-animated { transition: transform 0.4s var(--ease); }
.site-header.is-condensed.is-revealed { transform: none; }

.site-header.is-condensed .site-header-inner {
    align-items: center;
    padding-block: var(--space-16);
}

/* The bar has its own logo: the small monogram (Site Settings → Logo). */
.site-header.is-condensed :is(.site-logo-img--dark, .site-logo-img--light) { display: none; }

.site-header.is-condensed .site-logo-img--small {
    display: block;
    width: 44px;
}
.site-header.is-condensed .site-nav-list { margin-top: 0; }

/* ---------- Focus ---------- */
:is(.site-header, .site-nav-overlay) :is(a, button):focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 4px;
}

@media (max-width: 767px) {
    .site-header-inner {
        grid-template-columns: minmax(0, 1fr) auto;
        padding-inline: var(--container-pad-mobile);
    }

    .site-nav { display: none; }
    .site-nav-toggle { display: block; }
}
