/* Include the 44px navigation row and 1px border when sizing the sticky header. */
:root { --site-header-width: 1100px; --site-header-padding: 24px; --site-header-height: calc(2 * var(--site-header-padding) + 45px); }
.site-header { box-sizing: border-box; width: min(100%, var(--site-header-width)); margin: auto; padding: var(--site-header-padding) 0; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid #394337; }
.site-header .brand-home { display: flex; align-items: center; gap: 12px; color: #d5dfd1; text-decoration: none; font: 600 14px/1.5 system-ui, sans-serif; }
.site-header .socials { display: flex; align-items: center; gap: 24px; }
.site-header .socials a { display: flex; align-items: center; gap: 8px; min-height: 44px; color: #c4cdc1; font: 500 13px/1.5 system-ui, sans-serif; text-decoration: none; }
.site-header .socials svg { width: 18px; height: 18px; fill: currentColor; }
.site-header .socials a:hover, .site-header .socials a[aria-current="page"] { color: #fff; }
.site-header .socials a[aria-current="page"] { box-shadow: inset 0 -2px var(--cinnabar-red); }
.site-header a:focus-visible { outline: 2px solid #f8c1af; outline-offset: 4px; }

@media (max-width: 700px) {
    :root { --site-header-padding: 12px; }
    .site-header { gap: 16px; }
    .site-header .brand-home span { display: none; }
    .site-header .socials { gap: 16px; }
}

@media (max-width: 380px) {
    .site-header .github span, .site-header .discord span { display: none; }
}
/* Override every built-in theme so a saved mdBook preference stays dark too. */
:root, .navy, .light, .rust, .coal, .ayu {
    --main-font: system-ui, sans-serif;
    --mono-font: ui-monospace, monospace;
    --cinnabar-red: #B8281E;
    --color-scheme: dark;
    --content-max-width: 70ch;
    --bg: #141815;
    --fg: #edf2eb;
    --sidebar-bg: #1c231d;
    --sidebar-fg: #c4cdc1;
    --sidebar-active: #fff;
    --sidebar-non-existant: #acb7a9;
    --sidebar-spacer: #505b4c;
    --sidebar-header-border-color: var(--cinnabar-red);
    --scrollbar: #63725c;
    --icons: #acb7a9;
    --icons-hover: #fff;
    --links: #f8c1af;
    --inline-code-color: #e6d7a8;
    --theme-popup-bg: #1c231d;
    --theme-popup-border: #505b4c;
    --theme-hover: #303b30;
    --quote-bg: #1c231d;
    --quote-border: #63725c;
    --table-border-color: #505b4c;
    --table-header-bg: #303b30;
    --table-alternate-bg: #1c231d;
    --searchbar-border-color: #505b4c;
    --searchbar-bg: #101511;
    --searchbar-fg: #fff;
    --searchresults-header-fg: #c4cdc1;
    --searchresults-border-color: #505b4c;
    --searchresults-li-bg: #1c231d;
    --search-mark-bg: #451510;
}

html, body { font-family: var(--main-font); }
body { font-size: 16px; }

/* Place the native sidebar and search controls in the shared header's row. */
.page { display: grid; grid-template-columns: minmax(0, 1fr); margin-block-start: 0; }
.site-header { grid-area: 1 / 1; position: sticky; top: 0; z-index: 101; background: var(--bg); }
html .page #mdbook-menu-bar { grid-area: 1 / 1; align-self: center; justify-self: start; position: sticky; top: var(--site-header-padding) !important; z-index: 102; width: 88px; height: 44px; margin: 0 0 0 calc(max(0px, (100% - var(--site-header-width)) / 2) + 120px); border: 0; background: transparent; }
#mdbook-menu-bar .left-buttons { display: flex; }
#mdbook-menu-bar .icon-button { box-sizing: border-box; width: 44px; height: 44px; line-height: 44px; }
#mdbook-menu-bar-hover-placeholder, #mdbook-menu-bar .menu-title,
#mdbook-theme-toggle, #mdbook-theme-list, #mdbook-menu-bar .right-buttons { display: none; }

.content { line-height: 1.7; }
/* Leave the heading visible when fragments or search results scroll to it. */
:target { scroll-margin-top: calc(var(--site-header-height) + 16px); }
.content h1, .content h2, .content h3 { line-height: 1.3; }
.content pre, .content code { background: #101511; }
.content pre { border: 1px solid #394337; }
.content pre code { color: #e1e8de; }
.content pre, .content code, .mobile-nav-chapters, #mdbook-searchbar { border-radius: 0; }
.sidebar { border-right: 1px solid #505b4c; }
.chapter li a { display: block; flex: 1; padding: 5px 8px; border-left: 3px solid transparent; }
.chapter a:hover { background: #303b30; }
.chapter a.active { border-left-color: var(--cinnabar-red); background: #303b30; }
.chapter li.chapter-item { line-height: 1.5; }

.content .hljs-comment, .content .hljs-quote { color: #acb7a9; }
.content .hljs-keyword, .content .hljs-selector-tag, .content .hljs-literal,
.content .hljs-variable, .content .hljs-template-variable, .content .hljs-deletion { color: #f27a63; }
.content .hljs-string, .content .hljs-regexp, .content .hljs-addition { color: #a1ce8f; }
.content .hljs-number, .content .hljs-symbol, .content .hljs-bullet,
.content .hljs-params, .content .hljs-meta, .content .hljs-link { color: #e6d7a8; }
.content .hljs-title, .content .hljs-section, .content .hljs-attribute, .content .hljs-built_in { color: #f8c1af; }
.content .hljs-type, .content .hljs-name, .content .hljs-attr,
.content .hljs-selector-id, .content .hljs-selector-class { color: #c4cdc1; }

@media (max-width: 700px) {
    html .page #mdbook-menu-bar { margin-left: 40px; }
    /* Keep the close toggle at the drawer edge after mdBook shifts the page. */
    html.sidebar-visible .page #mdbook-menu-bar { margin-left: calc(-1 * var(--page-padding)); }
    .sidebar-visible .site-header .brand-home,
    .sidebar-visible #mdbook-search-toggle { visibility: hidden; }
}

@media print {
    .site-header, #mdbook-menu-bar { display: none; }
}
