/* =============================================
   Global Header — taubenloft/site-header
   Pixel-perfect from Figma navbar (node I81:7524;593:522, desktop 1920)
   ─────────────────────────────────────────────
   Bar:        height 67, bg #333A42, padding 16 top, 16 bottom (content centered)
   Bottom:     0.5px divider line (#585D63, matches footer family)
   Inner:      max-width 1200, centered, HORIZONTAL space-between, align center
   Logo:       logo_full 198×35, glyph color #B9BEC5
   Nav items:  Nunito Sans 500, 16px / 21.824 line-height, color #B9BEC5,
               gap 64 (Figma itemSpacing), UPPERCASE
   CTA:        optional pill (renders only if header_cta_text option set)
   ============================================= */

/* Defensive */
.tl-header img { max-width: 100%; height: auto; display: block; }
.tl-header svg { max-width: 100%; }

.tl-header {
    background: #333a42;                  /* Figma bar fill */
    border-bottom: 0.5px solid #585d63;   /* Figma bottom Line */
    font-family: 'Nunito Sans', 'Nunito Sans Fallback', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.tl-header__inner {
    max-width: 1320px;                    /* Figma navbar spreads wider than the 1200 content */
    margin: 0 auto;
    min-height: 67px;                     /* Figma bar height */
    padding: 16px 24px;                   /* Figma 16 top/bottom; 24 side gutter */
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;       /* logo left | nav right */
    gap: 40px;
    box-sizing: border-box;
}

/* ── Logo ─────────────────────────────────────────── */
.tl-header__logo-link {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    line-height: 0;
    text-decoration: none;
}

.tl-header__logo {
    width: 198px;                         /* Figma logo_full 198×35 */
    height: 35px;
    max-width: 100%;
}

/* ── Nav ──────────────────────────────────────────── */
.tl-header__nav {
    display: flex;
    align-items: center;
    flex: 1 1 auto;
    justify-content: flex-end;            /* Figma text frame hugs right (MAX) */
    min-width: 0;
}

.tl-header__menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;                    /* single row like Figma */
    align-items: center;
    justify-content: flex-end;
    gap: 48px;                            /* tightened so all 6 items fit one row */
}

.tl-header__menu li { margin: 0; }

.tl-header__menu a {
    display: inline-block;
    font-family: 'Nunito Sans', 'Nunito Sans Fallback', sans-serif;
    font-weight: 500;                     /* Figma Medium */
    font-size: 16px;                      /* Figma fontSize */
    line-height: 21.824px;                /* Figma lineHeightPx 21.823999... */
    letter-spacing: 0;
    text-transform: uppercase;            /* Figma render shows UPPER */
    color: #b9bec5;                       /* Figma text fill */
    text-decoration: none;
    white-space: nowrap;
    transition: opacity 0.2s, color 0.2s;
}
.tl-header__menu a:hover,
.tl-header__menu a:focus,
.tl-header__menu .current-menu-item > a {
    color: #ffffff;
    opacity: 1;
    text-decoration: none;
}

/* ── CTA (optional pill) ──────────────────────────── */
.tl-header__cta {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: 'Nunito Sans', 'Nunito Sans Fallback', sans-serif;
    font-weight: 700;
    font-size: 16px;
    line-height: 1;
    letter-spacing: 0;
    color: #333a42;
    background: #b9bec5;
    padding: 12px 24px;
    border-radius: 999px;                 /* pill */
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.2s, color 0.2s;
}
.tl-header__cta:hover,
.tl-header__cta:focus {
    background: #ffffff;
    color: #333a42;
    text-decoration: none;
}

/* ── Mobile "menu" toggle pill (hidden on desktop, shown ≤767 — Figma mobile) ── */
.tl-header__toggle {
    display: none;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: 1px solid #b9bec5;            /* Figma outlined pill */
    border-radius: 999px;
    color: #b9bec5;
    font-family: 'Nunito Sans', 'Nunito Sans Fallback', sans-serif;
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    padding: 7px 16px;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
}
.tl-header__toggle:hover,
.tl-header__toggle:focus { color: #ffffff; border-color: #ffffff; }

/* ── Compact nav ≤1200 — the full nav needs ~1157px to sit beside the logo, so
   below that it would overlap the logo. Switch to the Figma hamburger overlay
   (node 81:7861): "menu" pill (left) + logo (right); tap opens a FULL-SCREEN
   centered menu and the pill swaps to a ✕. ───────────────────────────────── */
@media (max-width: 1200px) {
    .tl-header { position: relative; }
    .tl-header__inner {
        flex-wrap: wrap;                  /* row 1: pill + logo · overlay is fixed */
        justify-content: center;          /* logo centered (Figma); pill is pinned left */
        align-items: center;
        align-content: center;            /* center the bar row vertically (collapsed nav line sits below) */
        min-height: 0;
        padding: 12px 16px;
        row-gap: 0;
        gap: 12px;
    }
    .tl-header__toggle   {
        display: inline-flex;
        order: 1;
        min-width: 64px;
        justify-content: center;
        position: absolute;               /* pinned left so the logo can center */
        left: 16px;
        top: 50%;
        transform: translateY( -50% );
    }
    .tl-header__logo-link { order: 2; flex: 0 0 auto; transform: translateX( 30px ); }  /* centered, nudged ~30px right */
    .tl-header__logo     { width: 198px; height: 35px; }       /* full logo down to tablet */
    .tl-header__cta      { display: none; }                    /* no CTA in mobile bar */

    /* Pill swaps "menu" → ✕ while the overlay is open (Figma) */
    .tl-header--open .tl-header__toggle-label { display: none; }
    .tl-header--open .tl-header__toggle::before {
        content: "\2715";                 /* ✕ */
        font-size: 16px;
        line-height: 1;
    }

    /* Open = the WHOLE header becomes a full-screen overlay, so the bar
       (✕ left + logo right) stays at the top of the menu, exactly like Figma. */
    .tl-header--open {
        position: fixed;
        inset: 0;
        z-index: 1001;
        background: #333a42;                       /* Figma overlay fill */
        overflow-y: auto;
    }
    .tl-header--open .tl-header__inner {
        min-height: 100%;
        align-content: flex-start;                 /* bar on top, menu below */
        justify-content: space-between;            /* open: ✕ left + logo right */
    }
    .tl-header--open .tl-header__toggle {
        position: static;                          /* back in flow at the overlay's top-left */
        transform: none;
    }
    .tl-header--open .tl-header__logo-link { transform: none; }   /* open: logo at right edge, no nudge */
    /* Logged-in admins: WP admin bar is fixed at top:0 — drop the overlay below it
       so the ✕ + logo bar isn't hidden behind it (no effect for real visitors). */
    .admin-bar .tl-header--open { top: 46px; }

    /* Nav = its own row; collapsed until the menu is open.
       Closed → taken out of flow so the bar is a single centered row
       (otherwise the collapsed line throws off the logo's vertical centering). */
    .tl-header__nav {
        order: 3;
        flex: 1 1 100%;
        position: absolute;
        left: 0;
        right: 0;
        top: 100%;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }
    .tl-header--open .tl-header__nav {
        position: static;
        max-height: none;
        padding-top: 32px;
    }
    .tl-header__menu {
        flex-direction: column;
        flex-wrap: nowrap;
        align-items: center;              /* Figma: centered list */
        justify-content: flex-start;
        gap: 0;
        width: 100%;
    }
    .tl-header__menu li { width: 100%; text-align: center; }
    .tl-header__menu a {
        display: block;
        font-size: 16px;                  /* Figma item: Nunito Sans 500 / 16 */
        text-align: center;
        padding: 20px 2px;                /* generous even spacing, NO dividers */
        border: 0;
    }

    /* Lock background scroll while the overlay is open (set by header.js) */
    html.tl-menu-open, html.tl-menu-open body { overflow: hidden; }
}

/* ── Narrow phones: smaller Figma mobile logo ─────────────────────────────── */
@media (max-width: 600px) {
    .tl-header__logo { width: 152px; height: 28px; }   /* Figma mobile logo 152×28 */
}
