:root {
    --topbar-height: 50px;
}

.topbar {
    box-sizing: border-box;
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
    height: var(--topbar-height);
    border-bottom: 1px solid #404040;
    background-color: #0d0d0d;
    color: #f0f6fc;
    font-size: 16px;
    line-height: 24px;
    font-family:
        'Cloud Fonts', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial,
        sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji';
}

.topbar-inner {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 16px;
    height: 100%;
    padding: 0 20px;
}

.topbar a {
    color: inherit;
    text-decoration: none;
}

.topbar a:hover {
    opacity: 0.7;
}

.topbar-brand {
    font-weight: bold;
}

.topbar-github {
    display: flex;
}

.topbar-space {
    flex: 1;
}

.topbar-lang {
    position: relative;
}

.topbar-lang summary {
    display: flex;
    align-items: center;
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.topbar-lang summary::-webkit-details-marker {
    display: none;
}

.topbar-lang summary::after {
    content: '';
    display: inline-block;
    margin-left: 6px;
    margin-top: 4px;
    border: 4px solid transparent;
    border-top-color: currentColor;
}

.topbar-lang[open] summary::after {
    margin-top: -4px;
    transform: rotate(180deg);
}

.topbar-lang-menu {
    position: absolute;
    top: calc(100% + 12px);
    right: -8px;
    min-width: 110px;
    padding: 6px;
    border: 1px solid #404040;
    background-color: #1a1a1a;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.topbar-lang-menu a,
.topbar-lang-menu span {
    display: block;
    padding: 6px 10px;
    white-space: nowrap;
}

.topbar-lang-menu a:hover {
    opacity: 1;
    background-color: #262626;
}

.topbar-lang-current {
    font-weight: bold;
}

/* pages that follow the os theme (tool pages) */
@media (prefers-color-scheme: light) {
    .topbar.topbar-auto {
        border-bottom-color: #e0e0e6;
        background-color: #ffffff;
        color: #1f2225;
    }

    .topbar-auto .topbar-lang-menu {
        border-color: #e0e0e6;
        background-color: #ffffff;
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
    }

    .topbar-auto .topbar-lang-menu a:hover {
        background-color: #f0f0f4;
    }
}
