/* ===================================
   Tax Radar - Site navigation
   Evidence Pack register: light ground, flat links, teal CTA.

   Loaded by every page after css/footer.css. Values come from
   css/tokens.css; each var() carries the tokens.css hex as a fallback so
   the bar still renders correctly if tokens.css fails to load.

   Motion: this component has no transitions, transforms or animations of
   any kind, so there is nothing for a prefers-reduced-motion block to
   guard. The open/closed state is a plain display swap.
   ================================ */

:root {
    /* Rendered height of the bar: 20px padding + 42px content row
       (the CTA governs: 12px + 18px line-height + 12px) + 20px padding
       + 1px bottom border. Consumed by 404.html and by navigation.js. */
    --nav-height: 83px;

    /* Desktop row demand measured from DM Sans metrics is 1082.64px;
       plus 24px slack, rounded up to the nearest 20px. The media queries
       below must be kept in step with this value; JS reads it from here
       rather than repeating the number. */
    --nav-breakpoint: 1120px;
}

.nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--paper, #F8F9FA);
    border-bottom: 1px solid var(--rule, #D6DAE1);
}

.nav-container {
    max-width: 1160px;
    margin: 0 auto;
    padding: 20px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

/* Logo -------------------------------------------------------------- */

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--navy, #1B2A4A);
    flex-shrink: 0;
}

.logo img {
    display: block;
    height: 34px;
    width: auto;
}

.nav-wordmark {
    font-family: var(--font-body, 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.14em;
    line-height: 18px;
    color: var(--navy, #1B2A4A);
    white-space: nowrap;
}

/* Menu -------------------------------------------------------------- */

.nav-menu {
    display: flex;
    align-items: center;
    gap: 32px;
}

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

.nav-links a {
    font-family: var(--font-body, 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
    font-size: 15px;
    font-weight: 500;
    line-height: 18px;
    color: var(--ink-soft, #4A5568);
    text-decoration: none;
    white-space: nowrap;
}

.nav-links a:hover,
.nav-links a:focus-visible {
    color: var(--navy, #1B2A4A);
}

.nav-cta {
    display: inline-block;
    font-family: var(--font-body, 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
    font-size: 15px;
    font-weight: 500;
    line-height: 18px;
    padding: 12px 24px;
    border-radius: 3px;
    background: var(--teal, #2A9D8F);
    color: #fff;
    text-decoration: none;
    white-space: nowrap;
}

.nav-cta:hover,
.nav-cta:focus-visible {
    background: #238A7E;
    color: #fff;
}

/* Focus rings ------------------------------------------------------- */

.logo:focus-visible,
.nav-links a:focus-visible,
.nav-cta:focus-visible,
.nav-toggle:focus-visible {
    outline: 2px solid var(--navy, #1B2A4A);
    outline-offset: 3px;
    border-radius: 3px;
}

/* Toggle: desktop hides it; the mobile block below reveals it -------- */

.nav-toggle {
    display: none;
    align-items: center;
    gap: 10px;
    font-family: var(--font-body, 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
    font-size: 15px;
    font-weight: 500;
    line-height: 18px;
    color: var(--navy, #1B2A4A);
    background: transparent;
    border: 1px solid var(--rule, #D6DAE1);
    border-radius: 3px;
    padding: 11px 16px;
    cursor: pointer;
}

/* Three-line icon, drawn from the bar element and its two pseudo-elements. */
.nav-toggle-bars {
    position: relative;
    display: block;
    width: 18px;
    height: 2px;
    background: var(--navy, #1B2A4A);
}

.nav-toggle-bars::before,
.nav-toggle-bars::after {
    content: "";
    position: absolute;
    left: 0;
    width: 18px;
    height: 2px;
    background: var(--navy, #1B2A4A);
}

.nav-toggle-bars::before { top: -6px; }
.nav-toggle-bars::after  { top: 6px; }

/* Below the breakpoint ---------------------------------------------- */

@media (max-width: 1119.98px) {
    .nav-container {
        flex-wrap: wrap;
    }

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

    .nav-menu {
        display: none;
    }

    /* Open state: the panel takes the full container width on its own
       row beneath the bar, and scrolls if it is taller than the space
       left below the bar. */
    .nav.nav-open .nav-menu {
        display: block;
        flex-basis: 100%;
        width: 100%;
        margin-top: 20px;
        border-top: 1px solid var(--rule, #D6DAE1);
        max-height: calc(100vh - var(--nav-height));
        overflow-y: auto;
    }

    .nav.nav-open .nav-links {
        display: block;
    }

    .nav.nav-open .nav-links li {
        border-bottom: 1px solid var(--rule, #D6DAE1);
    }

    .nav.nav-open .nav-links a {
        display: block;
        padding: 16px 0;
    }

    .nav.nav-open .nav-cta {
        display: block;
        margin-top: 16px;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .nav-wordmark {
        display: none;
    }
}
