/* nav.css — Two-tier navbar styles (extracted from home.js injectNewNav)
 * Covers: navbar-wrapper, nav-top, nav-categories, mega-menu,
 *         cmd-palette, mobile-drawer, and responsive breakpoints.
 * Load order: after tokens.css and style.css, on homepage + all landing pages.
 */

/* ── CSS custom properties ── */
:root {
    --nav-bg: rgba(10, 14, 26, 0.88); /* no token equivalent — opacity variant of --calc-bg-page-alt */
    --nav-bg-elevated: var(--calc-bg-card);
    --nav-border-subtle: rgba(255, 255, 255, 0.07); /* no token equivalent */
    --nav-border-medium: rgba(255, 255, 255, 0.12); /* no token equivalent */
    --nav-text-primary: #fff; /* no token equivalent — #F8FAFC (--calc-text-primary) is close but not identical */
    --nav-text-secondary: rgba(255, 255, 255, 0.6); /* no token equivalent */
    --nav-text-tertiary: #a8b8cc; /* no token equivalent */
    --nav-shadow-dropdown:
        0 24px 64px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.06); /* no token equivalent */
    --nav-transition-fast: 150ms ease;
    --nav-transition-med: 250ms ease;
    --nav-transition-smooth: 350ms cubic-bezier(0.4, 0, 0.2, 1);
    /* --calc-radius-sm/md/lg, --calc-gold, --calc-gold-dim removed — identical values already defined in tokens.css */
}

[data-theme='light'] {
    --nav-bg: rgba(255, 255, 255, 0.92);
    --nav-bg-elevated: #f1f3f5;
    --nav-border-subtle: rgba(0, 0, 0, 0.06);
    --nav-border-medium: rgba(0, 0, 0, 0.1);
    --nav-text-primary: #0f172a;
    --nav-text-secondary: rgba(15, 23, 42, 0.6);
    /* Slate 600 keeps the placeholder and keyboard hint above 4.5:1 on light backgrounds. */
    --nav-text-tertiary: #475569;
    --nav-shadow-dropdown: 0 24px 64px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.06);
    /* --calc-gold, --calc-gold-dim removed — identical values already defined in tokens.css [data-theme="light"] */
}

/* ── Navbar wrapper ── */
.navbar-wrapper {
    position: sticky;
    top: 0;
    z-index: 1000;
}

/* Legacy fallback nav used before NavInject replaces .glass-navbar.
 * Keep this external so production CSP does not leave raw links exposed.
 */
.glass-navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 64px;
    padding: 0 32px;
    background: var(--nav-bg);
    border-bottom: 1px solid var(--nav-border-subtle);
    box-shadow: 0 1px 24px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(24px) saturate(1.4);
    -webkit-backdrop-filter: blur(24px) saturate(1.4);
}

.glass-navbar .nav-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--nav-text-primary);
    text-decoration: none;
    flex-shrink: 0;
}

.glass-navbar .nav-logo {
    width: 34px;
    height: auto;
    filter: drop-shadow(0 0 8px rgba(168, 85, 247, 0.4));
}

.glass-navbar .brand-text {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: var(--calc-gold, #fbbf24);
}

.glass-navbar .nav-links-container {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-left: 24px;
    flex: 1;
}

.glass-navbar .nav-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 4px;
    color: var(--nav-text-secondary);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-decoration: none;
    text-transform: uppercase;
    transition: color var(--nav-transition-fast);
}

.glass-navbar .nav-link:hover,
.glass-navbar .nav-link.active {
    color: var(--nav-text-primary);
}

.glass-navbar .nav-dropdown {
    position: relative;
}

.glass-navbar .nav-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    z-index: 1001;
    display: none;
    min-width: 190px;
    padding: 10px;
    background: var(--nav-bg-elevated);
    border: 1px solid var(--nav-border-medium);
    border-radius: var(--calc-radius-md);
    box-shadow: var(--nav-shadow-dropdown);
    transform: translateX(-50%);
}

.glass-navbar .nav-dropdown:hover .nav-dropdown-menu,
.glass-navbar .nav-dropdown:focus-within .nav-dropdown-menu {
    display: grid;
    gap: 4px;
}

.glass-navbar .nav-dropdown-menu a {
    display: block;
    padding: 8px 10px;
    color: var(--nav-text-secondary);
    font-size: 0.9rem;
    font-weight: 650;
    text-decoration: none;
    border-radius: var(--calc-radius-xs);
}

.glass-navbar .nav-dropdown-menu a:hover,
.glass-navbar .nav-dropdown-menu a:focus {
    color: var(--nav-text-primary);
    background: rgba(255, 255, 255, 0.06);
}

.glass-navbar .nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    padding: 8px 10px;
    margin-left: auto;
    color: var(--nav-text-primary);
    background: transparent;
    border: 1px solid var(--nav-border-medium);
    border-radius: 10px;
    cursor: pointer;
}

.glass-navbar .hamburger-bar {
    display: block;
    width: 20px;
    height: 2px;
    background: currentcolor;
    border-radius: 2px;
}

[data-theme='light'] .glass-navbar .nav-dropdown-menu a:hover,
[data-theme='light'] .glass-navbar .nav-dropdown-menu a:focus {
    background: rgba(0, 0, 0, 0.04);
}

@media (max-width: 1200px) {
    .glass-navbar .nav-toggle {
        display: flex;
    }
    .glass-navbar .nav-links-container {
        display: none;
    }
    .glass-navbar .nav-links-container.open {
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        margin-left: 0;
        padding: 12px 0;
        background: var(--nav-bg);
        border-bottom: 1px solid var(--nav-border-subtle);
        backdrop-filter: blur(18px);
        -webkit-backdrop-filter: blur(18px);
    }
    .glass-navbar .nav-link {
        width: 100%;
        padding: 12px 28px;
    }
    .glass-navbar .nav-dropdown {
        width: 100%;
    }
    .glass-navbar .nav-dropdown-menu {
        position: static;
        min-width: 0;
        margin: 0 24px 8px;
        transform: none;
        box-shadow: none;
    }
}

.navbar-wrapper.compact .nav-categories {
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
}

.navbar-wrapper.compact .nav-top {
    border-radius: 0 0 var(--calc-radius-md) var(--calc-radius-md);
}

/* ── Top bar ── */
.nav-top {
    display: flex;
    align-items: center;
    height: 64px;
    padding: 0 32px;
    background: var(--nav-bg);
    border-bottom: 1px solid var(--nav-border-subtle);
    backdrop-filter: blur(24px) saturate(1.4);
    -webkit-backdrop-filter: blur(24px) saturate(1.4);
    position: relative;
    z-index: 2;
}

[data-theme='light'] .nav-top {
    background: rgba(252, 253, 255, 0.85);
    backdrop-filter: blur(16px) saturate(1.4);
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.06);
}

/* ── Brand ── */
.navbar-wrapper .nav-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    flex-shrink: 0;
}

.navbar-wrapper .nav-logo {
    width: 34px;
    height: auto;
    filter: drop-shadow(0 0 8px rgba(168, 85, 247, 0.4));
    transition: filter var(--nav-transition-med);
}

.navbar-wrapper .nav-brand:hover .nav-logo {
    filter: drop-shadow(0 0 14px rgba(168, 85, 247, 0.6));
}

.navbar-wrapper .brand-text {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: var(--calc-gold, #fbbf24);
}

/* ── Search trigger button ── */
.search-trigger {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 46px;
    padding: 0 20px;
    background: var(--nav-bg-elevated);
    border: 1px solid var(--nav-border-medium);
    border-radius: var(--calc-radius-md);
    cursor: pointer;
    transition:
        transform var(--nav-transition-med),
        box-shadow var(--nav-transition-med),
        color var(--nav-transition-med),
        opacity var(--nav-transition-med),
        background-color var(--nav-transition-med);
    flex: 1;
    max-width: 560px;
    margin: 0 32px;
    color: var(--nav-text-tertiary);
    font-size: 15px;
    font-family: inherit;
    position: relative;
}

.search-trigger:hover {
    border-color: rgba(251, 191, 36, 0.3);
    background: rgba(255, 255, 255, 0.06);
    box-shadow:
        0 0 0 1px rgba(251, 191, 36, 0.2),
        0 0 20px rgba(168, 85, 247, 0.06),
        0 0 40px rgba(251, 191, 36, 0.04);
}

[data-theme='light'] .search-trigger {
    background: #ffffff;
    border-color: rgba(15, 23, 42, 0.12);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

[data-theme='light'] .search-trigger:hover {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(180, 83, 9, 0.3);
    box-shadow:
        0 0 0 1px rgba(180, 83, 9, 0.2),
        0 0 20px rgba(124, 58, 237, 0.06);
}

.search-trigger svg {
    opacity: 0.45;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

.search-trigger:hover svg {
    opacity: 0.7;
}

.search-trigger:focus-visible {
    outline: none;
    border-color: rgba(251, 191, 36, 0.5);
    box-shadow:
        0 0 0 2px rgba(251, 191, 36, 0.25),
        0 0 20px rgba(168, 85, 247, 0.08);
}

[data-theme='light'] .search-trigger:focus-visible {
    border-color: rgba(180, 83, 9, 0.5);
    box-shadow: 0 0 0 2px rgba(180, 83, 9, 0.2);
}

.search-trigger .search-text {
    flex: 1;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-trigger .search-hint {
    font-size: 13px;
    color: var(--nav-text-tertiary);
    opacity: 0.6;
    margin-left: auto;
    white-space: nowrap;
}

.search-kbd {
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: 12px;
    font-weight: 600;
    color: var(--nav-text-tertiary);
    background: rgba(255, 255, 255, 0.06);
    padding: 4px 9px;
    border-radius: 6px;
    border: 1px solid var(--nav-border-subtle);
    font-family: inherit;
    line-height: 1;
    flex-shrink: 0;
}

[data-theme='light'] .search-kbd {
    background: rgba(0, 0, 0, 0.04);
}

/* ── Nav utils (theme toggle) ── */
.nav-utils {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    flex-shrink: 0;
}

.nav-utils .theme-toggle {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    color: var(--nav-text-secondary);
    transition:
        transform var(--nav-transition-fast),
        box-shadow var(--nav-transition-fast),
        color var(--nav-transition-fast),
        opacity var(--nav-transition-fast),
        background-color var(--nav-transition-fast);
}

.nav-utils .theme-toggle svg {
    transition: transform var(--nav-transition-med);
}

.nav-utils .theme-toggle:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--nav-border-subtle);
    color: var(--nav-text-primary);
}

.nav-utils .theme-toggle:hover svg {
    transform: rotate(15deg) scale(1.08);
}

[data-theme='light'] .nav-utils .theme-toggle:hover {
    background: rgba(0, 0, 0, 0.04);
}

/* ── Mobile toggle ── */
.mobile-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: none;
    border: 1px solid transparent;
    border-radius: var(--calc-radius-sm);
    cursor: pointer;
    color: var(--nav-text-secondary);
    transition:
        transform var(--nav-transition-fast),
        box-shadow var(--nav-transition-fast),
        color var(--nav-transition-fast),
        opacity var(--nav-transition-fast),
        background-color var(--nav-transition-fast);
}

.mobile-toggle:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--nav-border-subtle);
}

[data-theme='light'] .mobile-toggle:hover {
    background: rgba(0, 0, 0, 0.04);
}

/* ── Category bar ── */
.nav-categories {
    display: flex;
    align-items: center;
    height: 48px;
    padding: 0 32px;
    gap: 0;
    background: var(--nav-bg);
    border-bottom: 1px solid var(--nav-border-subtle);
    backdrop-filter: blur(24px);
    position: relative;
    z-index: 1000;
    transition:
        transform var(--nav-transition-smooth),
        opacity var(--nav-transition-smooth);
    overflow-x: auto;
    scrollbar-width: none;
}

.nav-categories::-webkit-scrollbar {
    display: none;
}

/* Spectrum strip (2026-06 elevation pass): a hairline gradient through all
   11 category colors at the nav's bottom edge — the site's structure as a
   quiet brand signature. Lives on .nav-categories so it hides automatically
   with the row in .navbar-wrapper.compact mode (pseudo inherits the
   element's transform + opacity). Mirrored at the footer top edge in
   components/28-footer-new.css. */
.nav-categories::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 1px;
    background: var(--calc-spectrum);
    opacity: 0.35;
    pointer-events: none;
}

/* Light-native premium 2026-06: light AA category colors are dark enough to
   carry a stronger spectrum strip — 2px and more present than dark's hairline. */
[data-theme='light'] .nav-categories::before {
    opacity: 0.55;
    height: 2px;
    bottom: -2px;
}

.nav-categories::after {
    content: '';
    position: sticky;
    right: 0;
    top: 0;
    flex-shrink: 0;
    width: 36px;
    height: 100%;
    background: linear-gradient(to right, transparent, var(--nav-bg));
    pointer-events: none;
}

[data-theme='light'] .nav-categories::after {
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.88));
}

[data-theme='light'] .nav-categories {
    background: rgba(255, 255, 255, 0.88);
}

.nav-indicator {
    position: absolute;
    bottom: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--calc-gold, #fbbf24), var(--calc-purple, #a855f7));
    border-radius: 2px 2px 0 0;
    transition:
        left var(--nav-transition-smooth),
        width var(--nav-transition-smooth);
    pointer-events: none;
}

.cat-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 10px;
    height: 100%;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    color: var(--nav-text-secondary);
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    background: none;
    border: none;
    font-family: inherit;
    transition: color var(--nav-transition-fast);
}

.cat-link:hover,
.cat-link.active {
    color: var(--nav-text-primary);
}

.cat-link .chevron {
    width: 10px;
    height: 10px;
    opacity: 0.4;
    transition:
        transform var(--nav-transition-fast),
        opacity var(--nav-transition-fast);
}

.cat-link:hover .chevron,
.cat-link.active .chevron {
    opacity: 0.8;
    transform: rotate(180deg);
}

/* ── Category-aware nav tint (2026-06 elevation pass) ──
   On pages that resolve --page-accent (calculator pages via
   <html data-calc-cat>, hubs via <body data-hub> — see
   components/35-category-accent.css), the active category link and
   the indicator pick up the page's category color, so the nav
   quietly reflects where you are. Pages without the hook (homepage,
   resources) keep the default white link + gold→purple indicator. */
[data-calc-cat] .cat-link.active,
body[data-hub] .cat-link.active {
    color: var(--page-accent, var(--nav-text-primary));
}

[data-calc-cat] .nav-indicator,
body[data-hub] .nav-indicator {
    background: var(--page-accent, linear-gradient(90deg, var(--calc-gold, #fbbf24), var(--calc-purple, #a855f7)));
}

/* ── Mega menu backdrop ── */
.mega-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 998;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--nav-transition-med);
}

.mega-backdrop.visible {
    opacity: 1;
    pointer-events: auto;
}

/* ── Mega menu (two-pane panel) ── */
/* Each .mega-menu carries inline --mm-acc / --mm-acc-rgb custom props
   (set in nav/dom.js from the --calc-color-<category> tokens), giving every
   dropdown its category's accent identity. Tokens auto-flip in light mode.
   Layout: a centered, content-sized panel — accent-tinted category intro
   pane on the left, dense subcategory list on the right. */
/* .navbar-wrapper prefix: outranks the legacy .mega-menu duplicate in
   components.css (left/right 32px, padding 28px), which loads after nav.css
   on pages with a static nav.css <link>. */
.navbar-wrapper .mega-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    width: max-content;
    max-width: min(920px, calc(100vw - 64px));
    margin: 0 auto;
    background: var(--nav-bg);
    backdrop-filter: blur(24px) saturate(1.4);
    -webkit-backdrop-filter: blur(24px) saturate(1.4);
    border: 1px solid var(--nav-border-medium);
    border-top: 2px solid rgba(var(--mm-acc-rgb, 251, 191, 36), 0.55);
    border-radius: 0 0 var(--calc-radius-lg) var(--calc-radius-lg);
    box-shadow: var(--nav-shadow-dropdown);
    padding: 0;
    overflow: hidden;
    display: none;
    z-index: 999;
}

.mega-menu::before {
    content: '';
    position: absolute;
    top: -16px;
    left: 0;
    right: 0;
    height: 16px;
}

.mega-menu.open {
    display: block;
}

.mega-menu.mega-enter {
    animation: megaSlideIn 200ms ease forwards;
}

@keyframes megaSlideIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mega-panes {
    display: flex;
    align-items: stretch;
}

/* Left pane: accent-tinted category intro */
.mega-pane-left {
    width: 248px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
    padding: 22px 22px 20px;
    background: linear-gradient(
        160deg,
        rgba(var(--mm-acc-rgb, 251, 191, 36), 0.12),
        rgba(var(--mm-acc-rgb, 251, 191, 36), 0.03)
    );
    border-right: 1px solid var(--nav-border-subtle);
}

[data-theme='light'] .mega-pane-left {
    background: linear-gradient(
        160deg,
        rgba(var(--mm-acc-rgb, 180, 83, 9), 0.08),
        rgba(var(--mm-acc-rgb, 180, 83, 9), 0.02)
    );
}

.mega-eyebrow {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.6px;
    color: var(--mm-acc, var(--calc-gold, #fbbf24));
}

.mega-menu .mega-title {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 20px;
    font-weight: 800;
    line-height: 1.2;
    color: var(--nav-text-primary);
}

.mega-tagline {
    font-size: 12px;
    color: var(--nav-text-tertiary);
}

.mega-popular {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    margin-top: 12px;
    margin-bottom: 14px; /* keeps the View-all CTA (margin-top:auto) from hugging when the pane is short */
}

.mega-popular-badge {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--mm-acc, var(--calc-purple, #a855f7));
    background: rgba(var(--mm-acc-rgb, 168, 85, 247), 0.14);
    padding: 2px 7px;
    border-radius: 4px;
}

.mega-popular-name {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--nav-text-secondary);
}

.mega-menu .mega-viewall {
    margin-top: auto;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    color: var(--mm-acc, var(--calc-gold, #fbbf24));
    background: rgba(var(--mm-acc-rgb, 251, 191, 36), 0.14);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: background var(--nav-transition-fast);
}

.mega-menu .mega-viewall:hover {
    background: rgba(var(--mm-acc-rgb, 251, 191, 36), 0.24);
}

/* Right pane: dense subcategory list */
.mega-pane-right {
    min-width: 0;
    padding: 14px 16px;
}

/* .mega-pane-right prefix: outranks the legacy .mega-grid/.mega-item
   duplicates in components.css, which loads AFTER nav.css on pages with a
   static nav.css <link> (hubs, homepage). */
.mega-pane-right .mega-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(250px, 290px));
    gap: 2px 6px;
    align-content: start;
    height: 100%;
}

/* 5 or fewer subs: single dense column */
.mega-pane-right .mega-grid[data-count='1'],
.mega-pane-right .mega-grid[data-count='2'],
.mega-pane-right .mega-grid[data-count='3'],
.mega-pane-right .mega-grid[data-count='4'],
.mega-pane-right .mega-grid[data-count='5'] {
    grid-template-columns: minmax(270px, 310px);
}

.mega-panes .mega-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-radius: var(--calc-radius-sm);
    text-decoration: none;
    color: var(--nav-text-primary);
    transition: background var(--nav-transition-fast);
}

.mega-panes .mega-item:hover,
.mega-panes .mega-item:focus-visible {
    background: rgba(var(--mm-acc-rgb, 251, 191, 36), 0.08);
}

.mega-panes .mega-item:hover h4,
.mega-panes .mega-item:focus-visible h4 {
    color: var(--mm-acc, var(--nav-text-primary));
}

.mega-panes .mega-icon {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    background: rgba(var(--mm-acc-rgb, 251, 191, 36), 0.1);
    color: var(--mm-acc, var(--calc-gold, #fbbf24));
    flex-shrink: 0;
    font-size: 13px;
}

[data-theme='light'] .mega-panes .mega-icon {
    background: rgba(var(--mm-acc-rgb, 180, 83, 9), 0.08);
}

.mega-item-text {
    min-width: 0;
    transition: transform var(--nav-transition-fast);
}

.mega-item:hover .mega-item-text {
    transform: translateX(2px);
}

.mega-panes .mega-item-text h4 {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 1px;
    transition: color var(--nav-transition-fast);
}

.mega-panes .mega-item-text p {
    font-size: 11.5px;
    color: var(--nav-text-tertiary);
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Staggered entrance for items when the panel first opens */
@media (prefers-reduced-motion: no-preference) {
    .mega-menu.mega-enter .mega-item {
        opacity: 0;
        animation: megaItemIn 240ms ease forwards;
        animation-delay: calc(var(--i, 0) * 18ms + 40ms);
    }
}

@keyframes megaItemIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

[data-theme='light'] .navbar-wrapper .mega-menu {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(16px);
}

/* ── Command palette ── */
.cmd-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: min(20vh, 160px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
}

.cmd-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

[data-theme='light'] .cmd-overlay {
    background: rgba(0, 0, 0, 0.25);
}

.cmd-palette {
    width: min(640px, 92vw);
    background: var(--nav-bg);
    border: 1px solid var(--nav-border-medium);
    border-radius: var(--calc-radius-lg);
    box-shadow:
        0 32px 80px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.04);
    overflow: hidden;
    transform: scale(0.96) translateY(-10px);
    transition: transform 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

.cmd-overlay.open .cmd-palette {
    transform: scale(1) translateY(0);
}

[data-theme='light'] .cmd-palette {
    background: #fff;
    box-shadow:
        0 32px 80px rgba(0, 0, 0, 0.12),
        0 0 0 1px rgba(0, 0, 0, 0.06);
}

.cmd-input-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--nav-border-subtle);
}

.cmd-input-wrap svg {
    color: var(--nav-text-tertiary);
    flex-shrink: 0;
}

.cmd-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    font-size: 17px;
    font-family: inherit;
    color: var(--nav-text-primary);
}

.cmd-input::placeholder {
    color: var(--nav-text-tertiary);
}

[data-theme='light'] .cmd-input {
    color: #0f172a;
}

[data-theme='light'] .cmd-input::placeholder {
    color: rgba(15, 23, 42, 0.4);
}

.cmd-close {
    font-size: 11px;
    color: var(--nav-text-tertiary);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--nav-border-subtle);
    border-radius: 5px;
    padding: 3px 8px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
}

[data-theme='light'] .cmd-close {
    background: rgba(0, 0, 0, 0.05);
    color: rgba(15, 23, 42, 0.5);
}

.cmd-results {
    max-height: 400px;
    overflow-y: auto;
    padding: 8px;
}

.cmd-results::-webkit-scrollbar {
    width: 4px;
}

.cmd-results::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

[data-theme='light'] .cmd-results::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.12);
}

.cmd-group-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--nav-text-tertiary);
    padding: 12px 12px 6px;
}

.cmd-result {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--calc-radius-sm);
    cursor: pointer;
    text-decoration: none;
    color: var(--nav-text-primary);
    transition: background var(--nav-transition-fast);
}

.cmd-result:hover,
.cmd-result.selected {
    background: rgba(255, 255, 255, 0.06);
}

[data-theme='light'] .cmd-result:hover,
[data-theme='light'] .cmd-result.selected {
    background: rgba(0, 0, 0, 0.04);
}

.cmd-result-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--calc-radius-xs);
    background: rgba(255, 255, 255, 0.04);
    color: var(--nav-text-secondary);
    font-size: 14px;
    flex-shrink: 0;
}

[data-theme='light'] .cmd-result-icon {
    background: rgba(0, 0, 0, 0.04);
}

.cmd-result-text {
    flex: 1;
}

.cmd-result-text .cmd-name {
    font-size: 14px;
    font-weight: 500;
}

.cmd-result-text .cmd-path {
    font-size: 12px;
    color: var(--nav-text-tertiary);
}

.cmd-result-text .cmd-name mark {
    background: none;
    color: var(--calc-gold, #fbbf24);
    font-weight: 700;
}

[data-theme='light'] .cmd-result-text .cmd-name mark {
    color: #0e7490;
}

.cmd-result-arrow {
    color: var(--nav-text-tertiary);
    opacity: 0;
    transition: opacity var(--nav-transition-fast);
}

.cmd-result:hover .cmd-result-arrow {
    opacity: 1;
}

.cmd-footer {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 20px;
    border-top: 1px solid var(--nav-border-subtle);
    font-size: 12px;
    color: var(--nav-text-tertiary);
}

.cmd-footer kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--nav-border-subtle);
    border-radius: 4px;
    font-size: 11px;
    font-family: inherit;
    font-weight: 600;
    color: var(--nav-text-tertiary);
}

[data-theme='light'] .cmd-footer kbd {
    background: rgba(0, 0, 0, 0.05);
}

/* ── Inline preview side panel (P17) ── */
/* Reuses .search-preview-* visual language defined in nav-search.css so the
   palette and the legacy nav-search-panel share one DOM contract. */
.cmd-preview-panel {
    display: none;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 18px 20px 20px;
    border-left: 1px solid var(--nav-border-subtle);
}

.cmd-preview-panel::-webkit-scrollbar {
    width: 4px;
}
.cmd-preview-panel::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 4px;
}
[data-theme='light'] .cmd-preview-panel::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.12);
}

@media (min-width: 900px) {
    .cmd-palette.has-preview {
        width: min(980px, 95vw);
        display: grid;
        grid-template-columns: 40% 60%;
        grid-template-areas:
            'input   input'
            'results preview'
            'footer  footer';
        max-height: 70vh;
    }
    .cmd-palette.has-preview .cmd-input-wrap {
        grid-area: input;
    }
    .cmd-palette.has-preview .cmd-results {
        grid-area: results;
        max-height: 480px;
        border-right: 1px solid var(--nav-border-subtle);
    }
    .cmd-palette.has-preview .cmd-preview-panel {
        display: block;
        grid-area: preview;
        max-height: 480px;
    }
    .cmd-palette.has-preview .cmd-footer {
        grid-area: footer;
    }
}

/* ── Mobile drawer overlay ── */
.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--nav-transition-med);
}

.drawer-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

/* ── Mobile drawer panel ── */
.mobile-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 300px;
    max-width: 85vw;
    height: 100vh;
    background: var(--nav-bg);
    border-left: 1px solid var(--nav-border-subtle);
    z-index: 2001;
    transform: translateX(100%);
    /* iOS Safari fix (2026-04-25): position:fixed + translateX(100%) still
     * contributes to document.scrollWidth on iOS, causing 300px horizontal
     * scroll on every page. visibility:hidden removes the element from iOS's
     * scroll-boundary calculation while the drawer is offscreen. The visibility
     * transition delay matches the slide-out duration so the element stays
     * visible during the close animation, then hides after it finishes. */
    visibility: hidden;
    transition:
        transform var(--nav-transition-smooth),
        visibility 0s linear var(--nav-transition-smooth);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.mobile-drawer.open {
    transform: translateX(0);
    visibility: visible;
    transition:
        transform var(--nav-transition-smooth),
        visibility 0s linear 0s;
}

[data-theme='light'] .mobile-drawer {
    background: #fff;
}

.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--nav-border-subtle);
    flex-shrink: 0;
}

.drawer-header h3 {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: var(--calc-gold, #fbbf24);
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.drawer-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: var(--calc-radius-sm);
    cursor: pointer;
    color: var(--nav-text-secondary);
    transition:
        transform var(--nav-transition-fast),
        box-shadow var(--nav-transition-fast),
        color var(--nav-transition-fast),
        opacity var(--nav-transition-fast),
        background-color var(--nav-transition-fast);
}

.drawer-close:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--nav-text-primary);
}

[data-theme='light'] .drawer-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #0f172a;
}

.drawer-search {
    margin: 12px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--nav-bg-elevated);
    border: 1px solid var(--nav-border-subtle);
    border-radius: var(--calc-radius-sm);
    flex-shrink: 0;
}

.drawer-search input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    font-size: 14px;
    color: var(--nav-text-primary);
    font-family: inherit;
}

.drawer-search input::placeholder {
    color: var(--nav-text-tertiary);
}

.drawer-search svg {
    color: var(--nav-text-tertiary);
    flex-shrink: 0;
}

[data-theme='light'] .drawer-search input {
    color: #0f172a;
}

.drawer-nav {
    padding: 8px 0;
    flex: 1;
    overflow-y: auto;
}

.drawer-tools {
    flex-shrink: 0;
    padding: 10px 20px calc(10px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--nav-border-subtle);
}
.drawer-lang-switch {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 8px 12px;
    border-radius: var(--calc-radius-sm);
    color: var(--nav-text-secondary);
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    transition:
        color var(--nav-transition-fast),
        background var(--nav-transition-fast);
}
.drawer-lang-switch:hover {
    color: var(--nav-text-primary);
    background: rgba(255, 255, 255, 0.06);
}
.drawer-lang-switch:focus-visible {
    outline: 2px solid var(--calc-gold, #fbbf24);
    outline-offset: 2px;
}
[data-theme='light'] .drawer-lang-switch {
    color: rgba(15, 23, 42, 0.65);
}
[data-theme='light'] .drawer-lang-switch:hover {
    color: #0f172a;
    background: rgba(0, 0, 0, 0.04);
}

.drawer-category {
    border-bottom: 1px solid var(--nav-border-subtle);
}

.drawer-cat-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--nav-text-secondary);
    font-family: inherit;
    text-align: left;
    transition:
        color var(--nav-transition-fast),
        background var(--nav-transition-fast);
}

.drawer-cat-btn:hover {
    color: var(--nav-text-primary);
    background: rgba(255, 255, 255, 0.02);
}

[data-theme='light'] .drawer-cat-btn {
    color: rgba(15, 23, 42, 0.6);
}

[data-theme='light'] .drawer-cat-btn:hover {
    color: #0f172a;
    background: rgba(0, 0, 0, 0.02);
}

.drawer-cat-btn .drawer-arrow {
    transition: transform var(--nav-transition-med);
    opacity: 0.4;
}

/* .mobile-drawer prefix needed: components.css ships duplicate drawer rules
   that load after nav.css and would otherwise win the cascade. */
.mobile-drawer .drawer-category.expanded .drawer-cat-btn,
[data-theme='light'] .mobile-drawer .drawer-category.expanded .drawer-cat-btn {
    color: var(--mm-acc, var(--nav-text-primary));
    background: rgba(var(--mm-acc-rgb, 251, 191, 36), 0.06);
}

.drawer-category.expanded .drawer-cat-btn .drawer-arrow {
    transform: rotate(180deg);
    opacity: 0.8;
}

.drawer-sub {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--nav-transition-smooth);
}

.drawer-category.expanded .drawer-sub {
    max-height: 600px;
}

.drawer-sub a {
    display: block;
    padding: 10px 20px 10px 40px;
    font-size: 13px;
    color: var(--nav-text-tertiary);
    text-decoration: none;
    transition:
        color var(--nav-transition-fast),
        background var(--nav-transition-fast);
}

/* .mobile-drawer prefix: outranks the duplicate rules in components.css */
.mobile-drawer .drawer-sub a:hover,
[data-theme='light'] .mobile-drawer .drawer-sub a:hover {
    color: var(--nav-text-primary);
    background: rgba(var(--mm-acc-rgb, 255, 255, 255), 0.06);
}

[data-theme='light'] .drawer-sub a {
    color: rgba(15, 23, 42, 0.5);
}

[data-theme='light'] .drawer-sub a:hover {
    color: #0f172a;
    background: rgba(0, 0, 0, 0.03);
}

/* ── Responsive ── */
/* Medium-desktop band: the 14 category links don't fit between 961-1400px,
   so the row would overflow into a hidden (scrollbar-width:none) scroll and
   clip the last links ("RESOURCES"/"ABOUT") with no affordance to reach them.
   Tighten the row + per-item padding so all 14 fit. Above 1400px the default
   spacing applies; at/below 960px the row is replaced by the hamburger. */
@media (min-width: 961px) and (max-width: 1400px) {
    .nav-categories {
        padding: 0 16px;
    }
    .cat-link {
        padding: 0 8px;
    }
}

@media (max-width: 960px) {
    .nav-categories {
        display: none;
    }
    .mobile-toggle {
        display: flex;
    }
    .search-trigger {
        max-width: none;
        flex: 0 0 auto;
        margin: 0 12px;
        width: 46px;
        height: 46px;
        padding: 0;
        justify-content: center;
        border-radius: var(--calc-radius-sm);
    }
    .search-trigger .search-text,
    .search-trigger .search-kbd,
    .search-trigger .search-hint {
        display: none;
    }
    .search-trigger svg {
        opacity: 0.6;
    }
}

/* Phones: language switching sits in the drawer's pinned footer (full-width
   select), so the sticky header stays a single row. Mounted by nav/api.js. */
@media (max-width: 600px) {
    .language-menu.is-drawer .language-menu-select {
        display: block;
        width: 100%;
        max-width: none;
        padding: 0 12px;
        font-size: 1rem;
        font-weight: 600;
        letter-spacing: normal;
    }
}

@media (max-width: 480px) {
    .nav-top {
        padding: 0 16px;
        height: 56px;
    }
    .navbar-wrapper .brand-text {
        font-size: 16px;
        letter-spacing: 1.5px;
    }
    .navbar-wrapper .nav-logo {
        width: 26px;
    }
    .search-trigger {
        width: 44px;
        height: 44px;
        margin: 0 8px;
    }
    .nav-utils .theme-toggle {
        width: 44px;
        height: 44px;
    }
    .nav-utils > .lang-switch {
        display: none !important;
    }
    .nav-utils > .theme-toggle,
    .nav-utils > .mobile-toggle {
        flex: 0 0 44px;
        min-width: 44px;
        min-height: 44px;
    }
}

/* Keep the full 44px controls inside the narrowest supported phone widths. */
@media (max-width: 360px) {
    .nav-top {
        padding-left: 7px;
        padding-right: 7px;
    }
    .search-trigger {
        margin-left: 0;
        margin-right: 0;
    }
}

/* ── Mobile portrait: full-viewport cmd-palette so keyboard can't clip results ── */
@media (max-width: 600px) and (min-height: 481px) {
    .cmd-overlay {
        padding-top: 0;
        align-items: stretch;
        /* dvh tracks keyboard on iOS 15.4+; JS visualViewport handles older */
        height: 100dvh;
    }
    .cmd-overlay.open .cmd-palette {
        /* Cancel the scale/translate entry animation on mobile */
        transform: none;
    }
    .cmd-palette {
        width: 100%;
        max-width: none;
        border-radius: 0;
        flex: 1 1 auto;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
    .cmd-input-wrap { flex: 0 0 auto; }
    .cmd-results    { flex: 1 1 auto; max-height: none; }
    .cmd-footer     { flex: 0 0 auto; }
    /* 44×44 minimum touch target on the ESC/close button */
    .cmd-close {
        min-width: 44px;
        min-height: 44px;
        padding: 0 12px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

/* ── Mobile landscape (height ≤ 480px): keep a top margin for the URL bar ── */
@media (max-width: 600px) and (max-height: 480px) {
    .cmd-overlay {
        padding-top: 8px;
        align-items: flex-start;
    }
    .cmd-palette {
        width: 100%;
        max-width: none;
        border-radius: 0;
    }
    .cmd-results {
        /* Leave room for nav bar without going full-screen */
        max-height: calc(100dvh - 120px);
        max-height: calc(100vh - 120px);
    }
    .cmd-close {
        min-width: 44px;
        min-height: 44px;
        padding: 0 12px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

/* ===== Facet chips (type filter row above cmd-palette results — P14) ===== */
.cmd-facets {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 14px 10px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
}
.cmd-facets::-webkit-scrollbar {
    height: 4px;
}
.cmd-facets::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 4px;
}
.cmd-facet-chip {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.82);
    font-family: inherit;
    font-size: 0.78rem;
    line-height: 1.2;
    cursor: pointer;
    transition:
        background 0.15s,
        border-color 0.15s,
        color 0.15s;
}
.cmd-facet-chip:hover {
    background: color-mix(in srgb, var(--calc-cyan, #22d3ee) 12%, rgba(255, 255, 255, 0.05));
    border-color: color-mix(in srgb, var(--calc-cyan, #22d3ee) 32%, transparent);
    color: #fff;
}
.cmd-facet-chip[aria-selected='true'] {
    background: color-mix(in srgb, var(--calc-cyan, #22d3ee) 18%, rgba(255, 255, 255, 0.05));
    border-color: color-mix(in srgb, var(--calc-cyan, #22d3ee) 45%, transparent);
    color: var(--calc-cyan, #22d3ee);
    /* Non-color affordance so the active chip reads without color vision. */
    font-weight: 700;
    box-shadow: inset 0 -2px 0 currentcolor;
}
.cmd-facet-chip.is-empty {
    opacity: 0.45;
}
.cmd-facet-chip__count {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.55);
}
.cmd-facet-chip[aria-selected='true'] .cmd-facet-chip__count {
    color: inherit;
}
.cmd-facet-chip:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--calc-cyan, #22d3ee) 55%, transparent);
    outline-offset: 2px;
}

[data-theme='light'] .cmd-facet-chip {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.12);
    color: rgba(0, 0, 0, 0.72);
}
[data-theme='light'] .cmd-facet-chip:hover {
    background: rgba(8, 145, 178, 0.08);
    border-color: rgba(8, 145, 178, 0.32);
    color: #0f172a;
}
[data-theme='light'] .cmd-facet-chip[aria-selected='true'] {
    background: rgba(8, 145, 178, 0.12);
    border-color: rgba(8, 145, 178, 0.45);
    color: #0891b2;
}
[data-theme='light'] .cmd-facet-chip__count {
    color: rgba(0, 0, 0, 0.5);
}

/* ===== Recent searches row inside the cmd palette ===== */
.cmd-recent-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 4px 14px 12px;
}
.cmd-recent-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 4px 5px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.78rem;
    cursor: pointer;
    transition:
        background 0.15s,
        border-color 0.15s,
        color 0.15s;
}
.cmd-recent-chip:hover {
    background: color-mix(in srgb, var(--calc-cyan, #22d3ee) 12%, rgba(255, 255, 255, 0.05));
    border-color: color-mix(in srgb, var(--calc-cyan, #22d3ee) 32%, transparent);
    color: #fff;
}
.cmd-recent-chip__label {
    pointer-events: none;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cmd-recent-chip__x {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-left: 2px;
    border: 0;
    background: transparent;
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
    line-height: 1;
    border-radius: 50%;
    cursor: pointer;
    transition:
        background 0.15s,
        color 0.15s;
}
.cmd-recent-chip__x:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}
.cmd-recent-clear {
    margin-left: auto;
    padding: 4px 10px;
    border: 0;
    background: transparent;
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.72rem;
    cursor: pointer;
    border-radius: 6px;
    transition:
        background 0.15s,
        color 0.15s;
}
.cmd-recent-clear:hover {
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.9);
}

/* ── Browse by topic (zero-query palette) ──
   Subcategory jump chips shown when the palette opens with no query, so a
   first-time visitor has a way to explore 1,611 calculators without typing.
   Shares .cmd-recent-row's layout; anchors rather than buttons because each
   one navigates. */
.cmd-browse-row {
    padding-bottom: 14px;
}
.cmd-browse-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.78rem;
    text-decoration: none;
    text-transform: capitalize;
    transition:
        background 0.15s,
        border-color 0.15s,
        color 0.15s;
}
.cmd-browse-chip:hover,
.cmd-browse-chip:focus-visible {
    background: color-mix(in srgb, var(--calc-cyan, #22d3ee) 12%, rgba(255, 255, 255, 0.05));
    border-color: color-mix(in srgb, var(--calc-cyan, #22d3ee) 32%, transparent);
    color: #fff;
    outline: none;
}
.cmd-browse-chip__label {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cmd-browse-chip__n {
    font-family: var(--calc-font-mono);
    font-size: 0.68rem;
    color: rgba(255, 255, 255, 0.45);
}
[data-theme='light'] .cmd-browse-chip {
    background: #f0f4f9;
    border-color: rgba(0, 0, 0, 0.08);
    color: #1f2937;
}
[data-theme='light'] .cmd-browse-chip:hover,
[data-theme='light'] .cmd-browse-chip:focus-visible {
    background: rgba(14, 116, 144, 0.08);
    color: #0f172a;
}
[data-theme='light'] .cmd-browse-chip__n {
    color: #64748b;
}

[data-theme='light'] .cmd-recent-chip {
    background: #f0f4f9;
    border-color: rgba(0, 0, 0, 0.08);
    color: #1f2937;
}
[data-theme='light'] .cmd-recent-chip:hover {
    background: rgba(14, 116, 144, 0.08);
    border-color: rgba(14, 116, 144, 0.32);
    color: #0e7490;
}
[data-theme='light'] .cmd-recent-chip__x {
    color: rgba(0, 0, 0, 0.4);
}
[data-theme='light'] .cmd-recent-chip__x:hover {
    background: rgba(0, 0, 0, 0.06);
    color: #0f172a;
}
[data-theme='light'] .cmd-recent-clear {
    color: rgba(0, 0, 0, 0.45);
}
[data-theme='light'] .cmd-recent-clear:hover {
    background: rgba(0, 0, 0, 0.04);
    color: #0f172a;
}

/* ===== "View all results" CTA footer inside the cmd palette ===== */
.cmd-view-all {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 10px 14px 14px;
    padding: 11px 16px;
    border-radius: 10px;
    border: 1px solid color-mix(in srgb, var(--calc-cyan, #22d3ee) 28%, transparent);
    background: color-mix(in srgb, var(--calc-cyan, #22d3ee) 6%, transparent);
    color: color-mix(in srgb, var(--calc-cyan, #22d3ee) 92%, #fff);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition:
        background 0.15s,
        border-color 0.15s,
        transform 0.15s;
}
.cmd-view-all:hover {
    background: color-mix(in srgb, var(--calc-cyan, #22d3ee) 14%, transparent);
    border-color: color-mix(in srgb, var(--calc-cyan, #22d3ee) 50%, transparent);
    transform: translateY(-1px);
}
.cmd-view-all__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}
.cmd-view-all__label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

[data-theme='light'] .cmd-view-all {
    border-color: rgba(14, 116, 144, 0.32);
    background: rgba(14, 116, 144, 0.06);
    color: #0e7490;
}
[data-theme='light'] .cmd-view-all:hover {
    background: rgba(14, 116, 144, 0.12);
    border-color: rgba(14, 116, 144, 0.5);
}


/* ── Recently-added NEW pill (shared with nav-search.css overlay) ── */
.ns-new-pill {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.12);
    padding: 2px 6px;
    border-radius: 4px;
    flex-shrink: 0;
    margin-left: auto;
}
[data-theme='light'] .ns-new-pill {
    color: #b45309;
    background: rgba(180, 83, 9, 0.1);
}
