/* [npca_match_dashboard_header] -- design-token driven, same convention as dashboard.css/
   platform-shell.css/registration.css: no hardcoded brand colors/fonts/spacing. Kept in its own
   file (not appended to dashboard.css) so this new, independently-placeable component never
   depends on dashboard.css's own load order/specificity history -- see docs/KNOWN_RISKS.md's
   "active theme/page-builder cascade" lessons from the C-PACE Academy pass; every rule below is
   self-contained flex/grid layout, not text-align, for the same reason. Breakpoint (720px) matches
   the rest of this plugin's dashboard-adjacent CSS for visual consistency. */

.npca-v2-dash-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 12px;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--match-border, #E2E8EE);
    overflow-x: hidden;
    max-width: 100%;
    box-sizing: border-box;
}

.npca-v2-dash-header * {
    box-sizing: border-box;
}

.npca-v2-dash-header__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.npca-v2-dash-header__heading {
    min-width: 0;
}

.npca-v2-dash-header__title {
    margin: 0;
    font-family: var(--font-heading, system-ui, sans-serif);
    color: var(--match-ink, #272F3D);
}

.npca-v2-dash-header__subtitle {
    margin: 4px 0 0;
    color: var(--match-ink, #272F3D);
    opacity: 0.75;
}

.npca-v2-dash-header__actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    flex: 0 0 auto;
}

.npca-v2-dash-header__landing-link,
.npca-v2-dash-header__logout {
    color: var(--brand-secondary, #76BC21);
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.npca-v2-dash-header__landing-link:hover,
.npca-v2-dash-header__logout:hover {
    text-decoration: underline;
}

/* Mobile nav toggle -- hidden entirely at desktop widths (see the @media block below); the
   toggle-button + [hidden]-on-<nav> pattern deliberately mirrors templates/components/portal-nav.php's
   existing Documents/C-PACE Academy expand-collapse pattern (assets/js/portal-nav.js) rather than
   introducing a second, inconsistent JS interaction style. Server-rendered markup never adds
   [hidden] itself (see templates/components/dashboard-header.php) -- only assets/js/dashboard-
   header.js does, on load, so a JS-disabled visitor always sees the full nav, never a link hidden
   behind a toggle that cannot function. */
.npca-v2-dash-header__toggle {
    display: none;
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    align-items: center;
    justify-content: center;
    background: none;
    border: 2px solid var(--match-border, #E2E8EE);
    border-radius: calc(var(--radius-card, 14px) / 2);
    cursor: pointer;
    padding: 0;
}

.npca-v2-dash-header__toggle span,
.npca-v2-dash-header__toggle span::before,
.npca-v2-dash-header__toggle span::after {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--npca-v2-role-color, var(--brand-primary, #2E7D32));
    border-radius: 1px;
}

.npca-v2-dash-header__toggle span {
    position: relative;
}

.npca-v2-dash-header__toggle span::before,
.npca-v2-dash-header__toggle span::after {
    content: "";
    position: absolute;
    left: 0;
}

.npca-v2-dash-header__toggle span::before {
    top: -6px;
}

.npca-v2-dash-header__toggle span::after {
    top: 6px;
}

.npca-v2-dash-header__nav {
    width: 100%;
}

.npca-v2-dash-header__nav[hidden] {
    /* Same 2026-07-05 lesson already documented on .npca-v2-portal-nav__children[hidden]: an
       author `display` rule on the base selector would otherwise beat the UA [hidden] default
       depending on rule order, so this is explicit rather than assumed. */
    display: none;
}

.npca-v2-dash-header__nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
}

.npca-v2-dash-header__nav-item a,
.npca-v2-dash-header__nav-label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: calc(var(--radius-card, 14px) / 2);
    text-decoration: none;
    color: var(--match-ink, #272F3D);
    font-weight: 600;
    font-size: 0.95em;
}

.npca-v2-dash-header__nav-item a:hover {
    background: var(--match-surface-tint, #F3F9F5);
}

.npca-v2-dash-header__nav-item.is-active a {
    background: var(--npca-v2-role-color, var(--brand-primary, #2E7D32));
    color: #fff;
}

.npca-v2-dash-header__nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: rgba(39, 47, 61, 0.12);
    color: var(--match-ink, #272F3D);
    font-size: 0.8em;
    font-weight: 700;
}

.npca-v2-dash-header__nav-item.is-active .npca-v2-dash-header__nav-badge {
    background: rgba(255, 255, 255, 0.3);
    color: #fff;
}

/* Locked/unavailable item (onboarding not yet complete) -- deliberately not an <a>, so there is
   nothing here for a screen reader or keyboard user to activate; the dimmed style plus the small
   lock glyph is a purely visual reinforcement of that already-real non-interactivity, not the
   mechanism creating it. */
.npca-v2-dash-header__nav-label--locked {
    color: var(--match-ink, #272F3D);
    opacity: 0.45;
    cursor: not-allowed;
}

.npca-v2-dash-header__nav-lock {
    display: inline-block;
    width: 10px;
    height: 10px;
    border: 2px solid currentColor;
    border-radius: 2px;
}

.npca-v2-dash-header__nav-item--logout {
    margin-left: auto;
}

.npca-v2-dash-header__nav-item--logout a {
    color: #8A1F17;
}

/* Standard screen-reader-only utility -- scoped to this component so it does not depend on a
   theme/core stylesheet having already printed a .screen-reader-text rule by this point. */
.npca-v2-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Keyboard focus visibility -- explicit rather than relying on the (frequently reset-to-none-by-
   themes) browser default, per this component's own accessibility requirement. */
.npca-v2-dash-header a:focus-visible,
.npca-v2-dash-header button:focus-visible {
    outline: 3px solid var(--npca-v2-role-color, var(--brand-primary, #2E7D32));
    outline-offset: 2px;
}

@media (max-width: 720px) {
    .npca-v2-dash-header__toggle {
        display: flex;
    }

    .npca-v2-dash-header__nav-list {
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
        padding-top: 8px;
        border-top: 1px solid var(--match-border, #E2E8EE);
    }

    .npca-v2-dash-header__nav-item a,
    .npca-v2-dash-header__nav-label {
        width: 100%;
    }

    .npca-v2-dash-header__nav-item--logout {
        margin-left: 0;
        margin-top: 8px;
        padding-top: 8px;
        border-top: 1px solid var(--match-border, #E2E8EE);
    }
}

@media (min-width: 721px) {
    /* Desktop always shows the full nav regardless of the [hidden] attribute JS may have added for
       the mobile collapse -- the toggle button is already display:none above this width, so there
       is no control that could re-hide it here. */
    .npca-v2-dash-header__nav[hidden] {
        display: block;
    }
}
