/* =========================
   Global Docs Topbar
========================= */

.site-topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    margin: -24px clamp(-72px, -5vw, -20px) 24px;
    border-bottom: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
    background: linear-gradient(
        180deg,
        color-mix(in srgb, var(--panel) 94%, transparent),
        color-mix(in srgb, var(--panel) 84%, transparent)
    );
    backdrop-filter: blur(16px);
}

.site-topbar-inner {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 22px;
    min-height: 64px;
    padding: 0 clamp(20px, 5vw, 72px);
}

.site-topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.topbar-brand {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
    color: var(--ink);
    font-weight: 900;
}

.topbar-logo-mark {
    display: inline-grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    font-size: 14px;
    line-height: 1;
    box-shadow: 0 8px 18px color-mix(in srgb, var(--accent) 26%, transparent);
}

.topbar-brand strong {
    overflow: hidden;
    font-size: 15px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

.topbar-nav a {
    position: relative;
    display: inline-flex;
    align-items: center;
    min-height: 64px;
    color: var(--muted);
    padding: 0 12px;
    font-size: 13px;
    font-weight: 800;
}

.topbar-nav a:hover,
.topbar-nav a.active {
    color: var(--ink);
}

.topbar-nav a.active::after {
    content: '';
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: -1px;
    height: 2px;
    border-radius: 999px;
    background: var(--accent);
}

.topbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 9px;
    min-width: 0;
}

.topbar-search {
    display: grid;
    grid-template-columns: auto minmax(130px, 220px) auto;
    align-items: center;
    gap: 8px;
    height: 38px;
    border: 1px solid color-mix(in srgb, var(--line) 84%, transparent);
    border-radius: 10px;
    background: color-mix(in srgb, var(--panel) 88%, transparent);
    padding: 0 8px 0 11px;
}

.topbar-search span {
    color: var(--muted);
    font-size: 14px;
}

.topbar-search input {
    width: 100%;
    min-width: 0;
    border: 0;
    background: transparent;
    color: var(--ink);
    outline: none;
    font-size: 13px;
}

.topbar-search input::placeholder {
    color: color-mix(in srgb, var(--muted) 72%, transparent);
}

.topbar-search kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 20px;
    border: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
    border-radius: 6px;
    background: color-mix(in srgb, var(--bg) 76%, var(--panel));
    color: var(--muted);
    padding: 0 6px;
    font-size: 10px;
    font-family: inherit;
    font-weight: 800;
}

.topbar-github,
.topbar-start {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 38px;
    border-radius: 10px;
    padding: 0 13px;
    font-size: 13px;
    font-weight: 850;
    white-space: nowrap;
}

.topbar-github {
    border: 1px solid color-mix(in srgb, var(--line) 84%, transparent);
    background: var(--panel);
    color: var(--ink);
}

.topbar-github::before {
    content: '●';
    margin-right: 7px;
    color: var(--ink);
    font-size: 9px;
}

.topbar-github:hover {
    border-color: var(--accent);
}

.topbar-start {
    border: 1px solid var(--accent);
    background: var(--accent);
    color: #fff;
    box-shadow: 0 10px 20px color-mix(in srgb, var(--accent) 22%, transparent);
}

.topbar-start:hover {
    background: var(--accent-dark);
}

.topbar-theme {
    display: inline-flex;
    align-items: center;
    height: 38px;
    border: 1px solid color-mix(in srgb, var(--line) 84%, transparent);
    border-radius: 10px;
    background: var(--panel);
    padding: 3px;
}

.topbar-theme .theme-button {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}

.topbar-theme .theme-button:hover,
.topbar-theme .theme-button.active {
    background: color-mix(in srgb, var(--accent) 10%, var(--panel));
    color: var(--accent-dark);
}

@media (max-width: 1180px) {
    .site-topbar-inner {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .topbar-nav {
        display: none;
    }

    .topbar-actions {
        min-width: 0;
    }

    .topbar-search {
        grid-template-columns: auto minmax(100px, 1fr);
    }

    .topbar-search kbd {
        display: none;
    }
}

@media (max-width: 760px) {
    .site-topbar {
        margin-bottom: 18px;
    }

    .site-topbar-inner {
        min-height: 58px;
        gap: 10px;
    }

    .topbar-brand strong {
        max-width: 130px;
    }

    .topbar-search {
        display: none;
    }

    .topbar-github {
        display: none;
    }

    .topbar-start {
        height: 34px;
        padding: 0 11px;
        font-size: 12px;
    }

    .topbar-theme {
        height: 34px;
    }

    .topbar-theme .theme-button {
        width: 27px;
        height: 27px;
    }
}
