/* ==========================================================================
   Workmen Studio — shared HEADER (sticky bar, nav, mobile menu, contact icon)
   Loaded by every page: home, services, about. Behaviour lives in js/site.js.

   Per-page tuning (set on :root in the page's own <style>):
     --site-max   width of the header content   (default 72rem)
     --site-pad   left/right padding of it      (default 1.5rem; 1rem on phones)
   Set them to match the page's own content container so the logo lines up.
   ========================================================================== */

:root {
    /* Real heights are measured and written by js/site.js; these are fallbacks. */
    --header-h: 4.5rem;
    --era-nav-h: 3rem;
}

html {
    /* anchored sections land below the sticky header */
    scroll-padding-top: var(--header-h);
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 45; /* above the about page era-nav (40) */
    width: 100%;
    background-color: rgba(249, 248, 246, 0.96);
    border-bottom: 1px solid #E2E0D8;
    transition: box-shadow .25s ease;
}

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
    .site-header {
        background-color: rgba(249, 248, 246, 0.82);
        -webkit-backdrop-filter: saturate(180%) blur(12px);
        backdrop-filter: saturate(180%) blur(12px);
    }
}

.site-header.is-scrolled {
    box-shadow: 0 8px 24px -14px rgba(0, 0, 0, 0.22);
}

.site-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: var(--site-max, 72rem);
    margin-inline: auto;
    padding: 1rem var(--site-pad, 1.5rem);
}

.brand-logo {
    display: inline-flex;
}

.brand-logo img {
    display: block;
    height: auto;
    width: clamp(120px, 16vw, 200px);
    max-width: 100%;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
    align-items: center;
}

.nav-links a {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
    font-size: .75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #444;
    text-decoration: none;
    transition: color .2s ease;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
    color: #111;
}

.nav-links a[aria-current="page"] {
    font-weight: 700;
    border-bottom: 1px solid #B9975B;
    padding-bottom: .125rem;
}

/* Mobile menu toggle (hidden on larger screens) */
.menu-toggle {
    display: none;
    width: 2.75rem;
    height: 2.75rem;
    margin-right: -0.5rem;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 0;
    border-radius: 9999px;
    color: #161616;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.menu-toggle-bars {
    position: relative;
    display: block;
    width: 20px;
    height: 14px;
}

.menu-toggle-bars span {
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    transition: transform .25s ease, top .25s ease, opacity .2s ease;
}

.menu-toggle-bars span:nth-child(1) { top: 0; }
.menu-toggle-bars span:nth-child(2) { top: 6px; }
.menu-toggle-bars span:nth-child(3) { top: 12px; }

.menu-toggle[aria-expanded="true"] .menu-toggle-bars span:nth-child(1) { top: 6px; transform: rotate(45deg); }
.menu-toggle[aria-expanded="true"] .menu-toggle-bars span:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] .menu-toggle-bars span:nth-child(3) { top: 6px; transform: rotate(-45deg); }

.contact-label {
    display: none;
}

/* Contact button styling in header */
.btn-contact-icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 9999px;
    background-color: #161616;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, background-color 0.2s ease;
}
.btn-contact-icon:hover {
    transform: scale(1.05);
    background-color: #B9975B;
}

/* keep the envelope icon white against the dark circle (beats .nav-links a / .footer-links a) */
.nav-links a.btn-contact-icon,
.nav-links a.btn-contact-icon:hover,
.footer-links a.btn-contact-icon,
.footer-links a.btn-contact-icon:hover {
    color: #fff;
}

/* Mobile: compact sticky bar + dropdown menu */
@media (max-width: 639px) {
    .site-nav {
        padding: 0.5rem var(--site-pad, 1rem);
        min-height: 3.5rem;
    }

    .brand-logo img {
        width: 130px;
    }

    .menu-toggle {
        display: inline-flex;
    }

    .nav-links {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 0.25rem var(--site-pad, 1rem) 1.25rem;
        background-color: #F9F8F6;
        border-bottom: 1px solid #E2E0D8;
        box-shadow: 0 18px 30px -18px rgba(0, 0, 0, 0.25);
        opacity: 0;
        visibility: hidden;
        transform: translateY(-8px);
        transition: opacity .2s ease, transform .2s ease, visibility 0s linear .2s;
    }

    .nav-links.is-open {
        opacity: 1;
        visibility: visible;
        transform: none;
        transition-delay: 0s;
    }

    .nav-links li {
        border-bottom: 1px solid rgba(226, 224, 216, 0.7);
    }

    .nav-links li:last-child {
        border-bottom: 0;
        padding-top: 1rem;
    }

    .nav-links a:not(.btn-contact-icon) {
        display: flex;
        align-items: center;
        min-height: 3rem;
        font-size: 0.8rem;
        letter-spacing: 0.1em;
    }

    .nav-links a[aria-current="page"] {
        border-bottom: 0;
        padding-bottom: 0;
    }

    .nav-links a[aria-current="page"]::after {
        content: "";
        width: 6px;
        height: 6px;
        margin-left: 0.6rem;
        border-radius: 9999px;
        background: #B9975B;
    }

    .nav-links a.btn-contact-icon {
        width: 100%;
        height: auto;
        min-height: 3rem;
        gap: 0.6rem;
    }

    .contact-label {
        display: inline;
        font-family: 'JetBrains Mono', monospace;
        font-size: 0.75rem;
        font-weight: 600;
        letter-spacing: 0.1em;
        text-transform: uppercase;
    }
}
