/* Dark look inspired by the Unreal Editor, on top of the built-in MkDocs theme. */

/* Any theme value: another site on the same domain may have saved "light" in this browser. */
html[data-bs-theme] {
    --ed-recessed: #0f0f0f;
    --ed-window: #151515;
    --ed-panel: #242424;
    --ed-header: #333333;
    --ed-hover: #3d3d3d;
    --ed-text: #d9d9d9;
    --ed-muted: #ababab;
    --ed-bright: #ffffff;
    --ed-select: #0069d1;
    --ed-link: #62b5ff;
    --ed-pad: 24px;

    color-scheme: dark;
    scrollbar-color: #575757 var(--ed-window);

    --bs-body-font-family: Roboto, "Segoe UI", system-ui, sans-serif;
    --bs-body-bg: var(--ed-window);
    --bs-body-bg-rgb: 21, 21, 21;
    --bs-body-color: var(--ed-text);
    --bs-body-color-rgb: 217, 217, 217;
    --bs-tertiary-bg: var(--ed-panel);
    --bs-tertiary-bg-rgb: 36, 36, 36;
    --bs-border-color: var(--ed-header);
    --bs-link-color: var(--ed-link);
    --bs-link-color-rgb: 98, 181, 255;
    --bs-link-hover-color: var(--ed-bright);
    --bs-link-hover-color-rgb: 255, 255, 255;
}

body {
    line-height: 1.6;
}

body::before {
    background: var(--ed-window);
}

/* Specific enough to beat Bootstrap, which hides the outline on navigation links. */
html[data-bs-theme] :focus-visible {
    outline: 2px solid var(--ed-bright);
    outline-offset: 2px;
}

/* Inside the link, because the outline panel cuts off anything outside it. */
html[data-bs-theme] .bs-sidebar :focus-visible {
    outline-offset: -2px;
}

/* Layout: an outline panel next to a main panel */
.container {
    max-width: 1160px;
    padding-inline: 16px;
}

.row:has(> [role="main"]) {
    display: grid;
    gap: 8px;
    margin: 0;
}

.row > .col-md-3,
.row > .col-md-9 {
    width: auto;
    padding: 0;
}

.row > [role="main"] {
    min-width: 0;
    padding: var(--ed-pad);
    border-top: 2px solid var(--ed-select);
    border-radius: 4px;
    background: var(--ed-panel);
}

@media (min-width: 768px) {
    .row:has(> [role="main"]) {
        grid-template-columns: 220px minmax(0, 1fr);
    }
}

@media (max-width: 767.98px) {
    html[data-bs-theme] {
        --ed-pad: 16px;
    }
}

/* Top bar */
.nav-link,
.navbar-brand {
    text-shadow: none;
}

.navbar.fixed-top {
    border: 0;
    background: var(--ed-recessed) !important;
    box-shadow: none;
}

.navbar .navbar-brand,
.navbar .nav-link {
    color: var(--ed-text);
}

.navbar .navbar-brand {
    color: var(--ed-bright);
    font-weight: 600;
}

.navbar .nav-link:hover,
.navbar .nav-link.active {
    color: var(--ed-bright);
}

.navbar .nav-link.disabled {
    color: var(--ed-muted);
}

/* Outline */
.bs-sidebar.affix {
    z-index: 1;
}

.bs-sidebar .card {
    border: 0;
    border-radius: 4px;
}

.bs-sidebar .navbar-toggler {
    width: 100%;
    min-height: 44px;
    border: 0;
    background: var(--ed-panel);
    color: var(--ed-text);
}

.bs-sidebar .nav > li > a {
    border: 0;
    color: var(--ed-text);
    font-weight: 400;
    overflow-wrap: anywhere;
}

.bs-sidebar .nav > li > a:hover,
.bs-sidebar .nav > li > a:focus {
    border: 0;
    background: var(--ed-hover);
    color: var(--ed-bright);
}

.bs-sidebar .nav > li > a.active,
.bs-sidebar .nav > li > a.active:hover,
.bs-sidebar .nav > li > a.active:focus {
    border: 0;
    background: var(--ed-select);
    color: var(--ed-bright);
    font-weight: 400;
}

/* Text. Sections look like the category bars of a details panel. */
h1, h2, h3, h4, h5, h6 {
    color: var(--ed-bright);
    font-weight: 600;
    text-shadow: none;
}

[role="main"] h1 {
    margin-bottom: 12px;
    font-size: 32px;
}

[role="main"] h2 {
    margin: 32px calc(-1 * var(--ed-pad)) 16px;
    padding: 8px var(--ed-pad);
    background: var(--ed-header);
    font-size: 18px;
    line-height: 1.4;
}

[role="main"] h3 {
    margin-top: 24px;
    font-size: 17px;
}

[role="main"] h4, [role="main"] h5, [role="main"] h6 {
    font-size: 16px;
}

[role="main"] > p,
[role="main"] > ul,
[role="main"] > ol {
    max-width: 75ch;
}

[role="main"] > :last-child {
    margin-bottom: 0;
}

[role="main"] li + li {
    margin-top: 4px;
}

[role="main"] img {
    padding: 0;
    border: 0;
    background: none;
}

blockquote {
    border-color: var(--ed-select);
}

/* Tables look like property rows */
.table {
    --bs-table-bg: var(--ed-panel);
    --bs-table-color: var(--ed-text);
    --bs-table-striped-bg: #2a2a2a;
    --bs-table-striped-color: var(--ed-text);
    --bs-table-hover-bg: var(--ed-hover);
    --bs-table-hover-color: var(--ed-bright);
    --bs-table-border-color: var(--ed-window);
    margin: 20px 0;
}

.table > thead > tr > th {
    background: var(--ed-window);
    color: var(--ed-text);
    font-weight: 600;
}

.table > :not(caption) > * > * {
    padding: 8px 12px;
}

.table td:first-child {
    color: var(--ed-bright);
}

/* Wide tables scroll on their own instead of widening the page. */
@media (max-width: 767.98px) {
    [role="main"] .table {
        display: block;
        overflow-x: auto;
    }

    [role="main"] td:last-child {
        min-width: 150px;
    }
}

/* Code */
pre,
code,
.hljs {
    border-color: var(--ed-header);
    background: var(--ed-recessed);
    color: var(--ed-text);
}

code {
    border-radius: 3px;
}

pre {
    border-radius: 4px;
}

pre code {
    font-size: 14px;
}

kbd {
    background: var(--ed-header);
    color: var(--ed-bright);
    box-shadow: none;
}

/* Search, shortcuts and menus */
.modal-content,
.dropdown-menu {
    border: 1px solid #4a4a4a;
    border-radius: 4px;
    background: var(--ed-panel);
    color: var(--ed-text);
}

.modal-header {
    background: var(--ed-header);
}

#mkdocs_search_modal .modal-footer {
    display: none;
}

#mkdocs-search-results {
    margin-top: 20px;
}

#mkdocs-search-results h3 {
    font-size: 18px;
}

.form-control,
.form-control:focus {
    border-color: #808080;
    border-radius: 4px;
    background: var(--ed-recessed);
    color: var(--ed-bright);
}

.form-control:focus {
    border-color: var(--ed-link);
    box-shadow: none;
}

.form-control::placeholder {
    color: var(--ed-muted);
}

.btn-close {
    filter: invert(1);
}

.dropdown-item {
    color: var(--ed-text);
}

.dropdown-item:hover,
.dropdown-item:focus {
    background: var(--ed-hover);
    color: var(--ed-bright);
}

.dropdown-item.active,
.dropdown-item:active {
    background: var(--ed-select);
    color: var(--ed-bright);
}

footer {
    color: var(--ed-muted);
    font-size: 14px;
    font-weight: 400;
}

footer hr {
    display: none;
}
