/**
 * topnav.css
 * BEM namespace: .topnav
 *
 * Sticky pill-shaped top nav bar. Mounts at the top of the page via the
 * TopNav component class. Owns brand wordmark, search, action icons,
 * the hamburger drawer toggle, the avatar, and the slot the ThemeToggle
 * mounts into.
 */

.topnav-wrap {
    position: sticky;
    top: 0;
    z-index: 50;
    padding: 14px 24px 0;
    display: flex;
    justify-content: center;
    pointer-events: none;
}

.topnav {
    pointer-events: auto;
    width: 100%;
    max-width: 1480px;
    height: 60px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 24px;
    padding: 0 18px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--surface) 78%, transparent);
    -webkit-backdrop-filter: saturate(160%) blur(16px);
    backdrop-filter: saturate(160%) blur(16px);
    border: 1px solid var(--hairline);
    box-shadow: var(--shadow-soft);
}

.topnav__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 8px 0 6px;
    text-decoration: none;
    color: var(--text);
}

.topnav__brand-logo {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
}

.topnav__brand-name {
    font-family: 'Inter Tight', sans-serif;
    font-weight: 700;
    font-size: 16px;
    letter-spacing: -0.02em;
}

.topnav__search {
    position: relative;
    max-width: 480px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    align-items: center;
    height: 40px;
    padding: 0 14px 0 38px;
    background: var(--surface-2);
    border: 1px solid var(--hairline);
    border-radius: 999px;
    transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}
.topnav__search:focus-within {
    border-color: color-mix(in srgb, var(--iris) 50%, transparent);
    box-shadow: 0 0 0 4px var(--iris-tint);
    background: var(--surface);
}
.topnav__search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-3);
}
.topnav__search-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font: 500 14px 'Inter', sans-serif;
    color: var(--text);
    min-width: 0;
}
.topnav__search-input::placeholder { color: var(--text-3); }

.topnav__search-kbd {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 6px;
    background: var(--surface);
    border: 1px solid var(--hairline-2);
    color: var(--text-2);
    font-feature-settings: "tnum";
}

.topnav__actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.topnav__icon-btn {
    position: relative;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border: none;
    background: transparent;
    border-radius: 999px;
    color: var(--text-2);
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
}
.topnav__icon-btn:hover {
    background: var(--surface-2);
    color: var(--text);
}
.topnav__icon-btn:focus-visible {
    outline: 2px solid var(--iris);
    outline-offset: 2px;
}

.topnav__icon-btn--menu {
    display: none;
}

.topnav__dot-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--iris);
    box-shadow: 0 0 0 2px var(--surface), 0 0 8px var(--iris);
}

.topnav__avatar-btn {
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 999px;
}
.topnav__avatar-btn:focus-visible {
    outline: 2px solid var(--iris);
    outline-offset: 2px;
}

.topnav__avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-family: 'Inter Tight', sans-serif;
    font-weight: 600;
    font-size: 14px;
    color: white;
    letter-spacing: -0.02em;
    user-select: none;
    background: linear-gradient(135deg, #6366f1, #22d3ee);
}

@media (max-width: 768px) {
    .topnav__icon-btn--menu { display: grid; }
    .topnav { padding: 0 12px; gap: 12px; }
    .topnav__search { display: none; }
    .topnav-wrap { padding: 10px 12px 0; }
}
