/*
 * omniblack Sphinx theme.
 *
 * Loaded after basic.css. Layout: a sticky header, then a three column grid
 * (left sidebar, content, right sidebar). The sidebar state attributes on
 * <html> are set by layout.html and omniblack-sphinx.js.
 */

/* ---------------------------------------------------------------- tokens */

:root {
    /* Each color is light-dark(light, dark). The browser picks one from
       color-scheme: the reader's preference by default, or the choice made
       with the theme toggle (data-ob-theme on <html>). */
    color-scheme: light dark;

    --ob-bg: light-dark(#ffffff, #16171b);
    --ob-bg-soft: light-dark(#f6f7f9, #1d1f24);
    --ob-bg-code: light-dark(#f3f4f6, #23252b);
    --ob-fg: light-dark(#1c1e21, #e3e5e8);
    --ob-fg-muted: light-dark(#5c6370, #9aa0aa);
    --ob-border: light-dark(#e1e4e8, #2e3138);
    --ob-accent: light-dark(#5b3fd6, #a794ff);
    --ob-accent-visited: light-dark(#8a3fb8, #cf9cf7);
    --ob-accent-soft: light-dark(#eeeafc, #2a2544);
    --ob-shadow: 0 8px 24px light-dark(rgb(0 0 0 / 0.15), rgb(0 0 0 / 0.5));
    --ob-backdrop: light-dark(rgb(0 0 0 / 0.35), rgb(0 0 0 / 0.55));

    --ob-note: light-dark(#2f6fdb, #6ea2ff);
    --ob-tip: light-dark(#1f8a4c, #4cc47f);
    --ob-warning: light-dark(#c27c0e, #e0a33b);
    --ob-danger: light-dark(#cf2d3a, #ff6b76);

    --ob-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
        Arial, sans-serif;
    --ob-font-mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", Menlo,
        Consolas, monospace;

    --ob-header-h: 3.25rem;
    --ob-left-width: 17rem;
    --ob-right-width: 15rem;
    --ob-content-width: 50rem;
    --ob-speed: 200ms;
    --ob-radius: 6px;
}

:root[data-ob-theme="light"] {
    color-scheme: light;
}

:root[data-ob-theme="dark"] {
    color-scheme: dark;
}

/* ---------------------------------------------------------------- base */

html {
    scroll-padding-top: calc(var(--ob-header-h) + 1rem);
}

body {
    margin: 0;
    padding: 0;
    background: var(--ob-bg);
    color: var(--ob-fg);
    font-family: var(--ob-font);
    font-size: 1rem;
    line-height: 1.6;
}

a {
    color: var(--ob-accent);
    text-decoration: none;
}

/* basic.css sets a fixed dark purple, unreadable on the dark background. */
a:visited {
    color: var(--ob-accent-visited);
}

a:hover {
    text-decoration: underline;
}

:focus-visible {
    outline: 2px solid var(--ob-accent);
    outline-offset: 2px;
}

.ob-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

/* ---------------------------------------------------------------- header */

.ob-header {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    height: var(--ob-header-h);
    padding: 0 0.75rem;
    box-sizing: border-box;
    background: var(--ob-bg);
    border-bottom: 1px solid var(--ob-border);
}

.ob-brand,
.ob-brand:visited {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    color: var(--ob-fg);
    font-weight: 600;
    white-space: nowrap;
}

.ob-brand span {
    overflow: hidden;
    text-overflow: ellipsis;
}

.ob-brand:hover {
    text-decoration: none;
}

.ob-logo {
    max-height: calc(var(--ob-header-h) - 1rem);
    width: auto;
}

.ob-search {
    position: relative;
    margin-left: auto;
}

.ob-search input {
    width: 14rem;
    max-width: 40vw;
    padding: 0.35rem 2rem 0.35rem 0.6rem;
    border: 1px solid var(--ob-border);
    border-radius: var(--ob-radius);
    background: var(--ob-bg-soft);
    color: var(--ob-fg);
    font: inherit;
    font-size: 0.9rem;
}

/* Shortcut hints: "/" to focus the box, "Esc" to leave it. */
.ob-search-keys {
    position: absolute;
    top: 50%;
    right: 0.5rem;
    transform: translateY(-50%);
    color: var(--ob-fg-muted);
    line-height: 1.2;
    pointer-events: none;
}

.ob-search-key-close,
.ob-search input:focus + .ob-search-keys .ob-search-key-open,
.ob-search input:not(:focus):not(:placeholder-shown) + .ob-search-keys,
html:not(.ob-js) .ob-search-keys {
    display: none;
}

.ob-search input:focus + .ob-search-keys .ob-search-key-close {
    display: inline;
}

/* The browser's clear button would sit under the hint. */
.ob-search input::-webkit-search-cancel-button {
    display: none;
}

.ob-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: 1px solid transparent;
    border-radius: var(--ob-radius);
    background: transparent;
    color: var(--ob-fg-muted);
    cursor: pointer;
}

.ob-toggle:hover {
    background: var(--ob-bg-soft);
    color: var(--ob-fg);
}

.ob-toggle[aria-expanded="true"] {
    color: var(--ob-accent);
}

/* The theme and right toggles sit at the far end even when there is no
   search box. */
.ob-theme-toggle,
.ob-toggle-right {
    margin-left: auto;
}

.ob-search ~ .ob-theme-toggle,
.ob-search ~ .ob-toggle-right,
.ob-theme-toggle ~ .ob-toggle-right {
    margin-left: 0;
}

/* The button shows the icon of the current choice. */
.ob-theme-toggle svg {
    display: none;
}

html:not([data-ob-theme]) .ob-theme-icon-auto,
html[data-ob-theme="light"] .ob-theme-icon-light,
html[data-ob-theme="dark"] .ob-theme-icon-dark {
    display: block;
}

/* Without JavaScript the toggles can't work, so the sidebars stay open. */
html:not(.ob-js) .ob-toggle {
    display: none;
}

/* ---------------------------------------------------------------- layout */

.ob-layout {
    --ob-left-col: var(--ob-left-width);
    --ob-right-col: var(--ob-right-width);

    display: grid;
    grid-template-columns:
        var(--ob-left-col) minmax(0, 1fr) var(--ob-right-col);
    transition: grid-template-columns var(--ob-speed) ease;
}

html[data-ob-left="closed"] .ob-layout,
.ob-layout.ob-no-left {
    --ob-left-col: 0rem;
}

html[data-ob-right="closed"] .ob-layout,
.ob-layout.ob-no-right {
    --ob-right-col: 0rem;
}

.ob-sidebar-left {
    grid-column: 1;
    grid-row: 1;
}

.ob-main {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    padding: 2rem 2.5rem 3rem;
}

.ob-sidebar-right {
    grid-column: 3;
    grid-row: 1;
}

.ob-sidebar {
    position: sticky;
    top: var(--ob-header-h);
    align-self: start;
    height: calc(100vh - var(--ob-header-h));
    overflow: hidden auto;
    overscroll-behavior: contain;
    box-sizing: border-box;
    background: var(--ob-bg);
    font-size: 0.9rem;
    visibility: visible;
    transition: visibility 0s linear 0s;
}

.ob-sidebar:focus {
    outline: none;
}

.ob-sidebar-left {
    border-right: 1px solid var(--ob-border);
}

.ob-sidebar-right {
    border-left: 1px solid var(--ob-border);
}

/* Fixed width so the contents don't reflow while the column animates. */
.ob-sidebar-inner {
    box-sizing: border-box;
    padding: 1.25rem 1rem 2rem;
}

.ob-sidebar-left .ob-sidebar-inner {
    width: var(--ob-left-width);
}

.ob-sidebar-right .ob-sidebar-inner {
    width: var(--ob-right-width);
}

/* Hide a closed sidebar once its column has finished collapsing. */
html[data-ob-left="closed"] .ob-sidebar-left,
html[data-ob-right="closed"] .ob-sidebar-right {
    visibility: hidden;
    transition-delay: var(--ob-speed);
}

.ob-backdrop {
    display: none;
}

/* Narrow screens: sidebars become overlay drawers. */
@media (max-width: 899.98px) {
    .ob-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .ob-main {
        grid-column: 1;
        padding: 1.5rem 1rem 2.5rem;
    }

    html.ob-js .ob-sidebar {
        position: fixed;
        top: var(--ob-header-h);
        bottom: 0;
        z-index: 30;
        align-self: stretch;
        width: min(20rem, 85vw);
        height: auto;
        box-shadow: var(--ob-shadow);
        visibility: hidden;
        transition:
            transform var(--ob-speed) ease,
            visibility 0s linear var(--ob-speed);
    }

    html.ob-js .ob-sidebar-left {
        left: 0;
        transform: translateX(-100%);
    }

    html.ob-js .ob-sidebar-right {
        right: 0;
        transform: translateX(100%);
    }

    html.ob-js[data-ob-drawer="left"] .ob-sidebar-left,
    html.ob-js[data-ob-drawer="right"] .ob-sidebar-right {
        transform: none;
        visibility: visible;
        transition:
            transform var(--ob-speed) ease,
            visibility 0s linear 0s;
    }

    .ob-sidebar .ob-sidebar-inner {
        width: auto;
    }

    .ob-backdrop {
        display: block;
        position: fixed;
        inset: var(--ob-header-h) 0 0 0;
        z-index: 20;
        background: var(--ob-backdrop);
    }

    .ob-backdrop[hidden] {
        display: none;
    }

    /* Without JavaScript, show the sidebars below the content. */
    html:not(.ob-js) .ob-sidebar {
        position: static;
        grid-column: 1;
        height: auto;
        border: 0;
        border-top: 1px solid var(--ob-border);
    }

    html:not(.ob-js) .ob-sidebar-left {
        grid-row: 2;
    }

    html:not(.ob-js) .ob-sidebar-right {
        grid-row: 3;
    }

    .ob-search input {
        width: 9rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    :root {
        --ob-speed: 0ms;
    }
}

/* ---------------------------------------------------------------- sidebars */

.ob-sidebar-title {
    margin: 0 0 0.5rem;
    color: var(--ob-fg-muted);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.ob-sidebar-title a {
    color: inherit;
}

.ob-sidebar ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.ob-sidebar ul ul {
    padding-left: 0.85rem;
}

.ob-sidebar li {
    margin: 0;
}

.ob-sidebar a {
    display: block;
    padding: 0.2rem 0.5rem;
    border-radius: var(--ob-radius);
    color: var(--ob-fg);
    line-height: 1.4;
}

.ob-sidebar a:hover {
    background: var(--ob-bg-soft);
    text-decoration: none;
}

.ob-sidebar code.literal {
    padding: 0;
    background: none;
}

.ob-globaltoc p.caption {
    margin: 1rem 0 0.25rem;
    color: var(--ob-fg-muted);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.ob-globaltoc li.current > a {
    font-weight: 600;
}

.ob-globaltoc a.current {
    background: var(--ob-accent-soft);
    color: var(--ob-accent);
}

/* The local TOC's top entry is the page title; show only its sections. */
.ob-localtoc > ul > li > a {
    display: none;
}

.ob-localtoc > ul > li > ul {
    padding-left: 0;
}

.ob-localtoc a {
    color: var(--ob-fg-muted);
}

.ob-localtoc a:hover {
    color: var(--ob-fg);
}

/* ---------------------------------------------------------------- content */

div.body {
    max-width: var(--ob-content-width);
    min-width: 0;
    margin: 0 auto;
    background: transparent;
    color: var(--ob-fg);
}

div.body h1,
div.body h2,
div.body h3,
div.body h4,
div.body h5,
div.body h6 {
    margin: 2rem 0 0.75rem;
    font-weight: 650;
    line-height: 1.25;
}

div.body h1 {
    margin-top: 0;
    font-size: 2.1rem;
}

div.body h2 {
    padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--ob-border);
    font-size: 1.55rem;
}

div.body h3 {
    font-size: 1.25rem;
}

div.body h4 {
    font-size: 1.05rem;
}

a.headerlink {
    margin-left: 0.3rem;
    color: var(--ob-fg-muted);
    font-weight: 400;
}

a.headerlink:hover {
    color: var(--ob-accent);
    background: none;
    text-decoration: none;
}

div.body img {
    max-width: 100%;
    height: auto;
}

hr {
    border: 0;
    border-top: 1px solid var(--ob-border);
}

blockquote {
    margin-left: 0;
    padding-left: 1rem;
    border-left: 3px solid var(--ob-border);
    color: var(--ob-fg-muted);
}

kbd {
    padding: 0.1rem 0.35rem;
    border: 1px solid var(--ob-border);
    border-bottom-width: 2px;
    border-radius: 4px;
    background: var(--ob-bg-soft);
    font-family: var(--ob-font-mono);
    font-size: 0.85em;
}

/* Inline code. */
code,
tt {
    font-family: var(--ob-font-mono);
    font-size: 0.875em;
}

code.literal {
    padding: 0.1em 0.3em;
    border-radius: 4px;
    background: var(--ob-bg-code);
}

a code.literal {
    color: inherit;
}

/* Code blocks. */
div.highlight {
    border-radius: var(--ob-radius);
}

pre {
    margin: 0;
    padding: 0.85rem 1rem;
    overflow-x: auto;
    border: 1px solid var(--ob-border);
    border-radius: var(--ob-radius);
    font-family: var(--ob-font-mono);
    font-size: 0.85rem;
    line-height: 1.5;
}

div[class^="highlight-"] {
    margin: 1rem 0;
}

div.code-block-caption {
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--ob-border);
    border-bottom: 0;
    border-radius: var(--ob-radius) var(--ob-radius) 0 0;
    background: var(--ob-bg-soft);
    color: var(--ob-fg-muted);
    font-size: 0.85rem;
}

div.code-block-caption + div pre {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

table.highlighttable pre {
    border: 0;
}

span.linenos,
td.linenos pre {
    color: var(--ob-fg-muted);
}

/* Admonitions. */
div.admonition,
div.topic,
aside.topic {
    --ob-admonition: var(--ob-note);

    margin: 1.25rem 0;
    padding: 0.75rem 1rem;
    border: 1px solid var(--ob-border);
    border-left: 4px solid var(--ob-admonition);
    border-radius: var(--ob-radius);
    background: var(--ob-bg-soft);
}

div.admonition p.admonition-title,
p.topic-title {
    margin: 0 0 0.35rem;
    color: var(--ob-admonition);
    font-weight: 650;
}

div.admonition > :last-child {
    margin-bottom: 0;
}

div.admonition.tip,
div.admonition.hint,
div.admonition.important,
div.admonition.seealso {
    --ob-admonition: var(--ob-tip);
}

div.admonition.attention,
div.admonition.caution,
div.admonition.warning {
    --ob-admonition: var(--ob-warning);
}

div.admonition.danger,
div.admonition.error {
    --ob-admonition: var(--ob-danger);
}

div.topic,
aside.topic {
    --ob-admonition: var(--ob-fg-muted);
}

aside.sidebar,
div.sidebar {
    margin: 0 0 1rem 1.5rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--ob-border);
    border-radius: var(--ob-radius);
    background: var(--ob-bg-soft);
}

@media (max-width: 599.98px) {
    aside.sidebar,
    div.sidebar {
        float: none;
        width: auto;
        margin-left: 0;
    }
}

/* Version notes. */
div.versionadded,
div.versionchanged,
div.deprecated,
div.versionremoved {
    margin: 1rem 0;
    padding-left: 0.85rem;
    border-left: 3px solid var(--ob-tip);
}

div.versionchanged {
    border-left-color: var(--ob-warning);
}

div.deprecated,
div.versionremoved {
    border-left-color: var(--ob-danger);
}

span.versionmodified {
    font-style: normal;
    font-weight: 600;
}

/* Tables. */
table.docutils {
    margin: 1rem 0;
    border: 1px solid var(--ob-border);
    border-collapse: collapse;
}

/* Scroll wide tables instead of widening the page. */
div.body table.docutils {
    display: block;
    width: fit-content;
    max-width: 100%;
    overflow-x: auto;
}

table.docutils th,
table.docutils td {
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--ob-border);
    text-align: left;
    vertical-align: top;
}

table.docutils th {
    background: var(--ob-bg-soft);
}

table.docutils td > p:first-child,
table.docutils th > p:first-child {
    margin-top: 0;
}

table.docutils td > p:last-child,
table.docutils th > p:last-child {
    margin-bottom: 0;
}

table caption {
    padding-bottom: 0.35rem;
    color: var(--ob-fg-muted);
    font-size: 0.9rem;
}

/* Field lists. */
dl.field-list > dt {
    padding-left: 0;
    background: none;
    font-weight: 600;
}

/* API signatures (autodoc and the domains). */
dl.py,
dl.c,
dl.cpp,
dl.js,
dl.rst,
dl.std {
    margin: 1.5rem 0;
}

dt.sig {
    padding: 0.4rem 0.6rem;
    border-left: 3px solid var(--ob-accent);
    border-radius: 0 var(--ob-radius) var(--ob-radius) 0;
    background: var(--ob-bg-soft);
    font-family: var(--ob-font-mono);
    font-size: 0.9rem;
}

dl dl > dt.sig {
    border-left-color: var(--ob-border);
}

dt.sig .sig-name {
    color: var(--ob-accent);
    font-weight: 600;
}

dt.sig .sig-prename,
dt.sig em.property {
    color: var(--ob-fg-muted);
}

dt.sig em.sig-param {
    font-style: normal;
}

dd {
    margin-left: 1.5rem;
}

/* Footnotes and citations. */
aside.footnote,
div.citation {
    font-size: 0.9rem;
}

aside.footnote > span.label,
div.citation > span.label {
    color: var(--ob-fg-muted);
}

/* Misc directives. */
p.rubric {
    margin-top: 1.5rem;
    font-weight: 650;
}

div.toctree-wrapper p.caption {
    color: var(--ob-fg-muted);
    font-weight: 600;
}

figure {
    margin: 1.5rem 0;
}

figcaption,
div.figure p.caption {
    color: var(--ob-fg-muted);
    font-size: 0.9rem;
}

/* Search results and genindex. */
span.highlighted {
    border-radius: 2px;
    background: var(--ob-accent-soft);
}

div.body form.search-form,
div.body form[action=""] {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

div.body form input[type="text"],
div.body form input[type="submit"] {
    padding: 0.35rem 0.6rem;
    border: 1px solid var(--ob-border);
    border-radius: var(--ob-radius);
    background: var(--ob-bg-soft);
    color: var(--ob-fg);
    font: inherit;
}

div.body form input[type="text"] {
    flex: 1;
    max-width: 24rem;
}

div.body form input[type="submit"] {
    cursor: pointer;
}

ul.search li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--ob-border);
    background-image: none;
}

ul.search li p.context {
    color: var(--ob-fg-muted);
    font-size: 0.9rem;
}

table.indextable td {
    vertical-align: top;
}

table.indextable tr.cap {
    background: var(--ob-bg-soft);
}

/* ---------------------------------------------------------------- prev/next */

.ob-prevnext {
    display: flex;
    gap: 1rem;
    max-width: var(--ob-content-width);
    margin: 3rem auto 0;
    padding-top: 1.5rem;
    border-top: 1px solid var(--ob-border);
}

.ob-prevnext a {
    display: flex;
    flex: 1;
    flex-direction: column;
    padding: 0.6rem 0.85rem;
    border: 1px solid var(--ob-border);
    border-radius: var(--ob-radius);
    color: var(--ob-fg);
}

.ob-prevnext a:hover {
    border-color: var(--ob-accent);
    text-decoration: none;
}

.ob-next {
    margin-left: auto;
    text-align: right;
}

.ob-prevnext-label {
    color: var(--ob-fg-muted);
    font-size: 0.8rem;
}

.ob-prevnext-title {
    font-weight: 600;
}

/* ---------------------------------------------------------------- footer */

div.footer {
    padding: 1.5rem 1rem;
    border-top: 1px solid var(--ob-border);
    color: var(--ob-fg-muted);
    font-size: 0.85rem;
    text-align: center;
}

div.footer a {
    color: inherit;
    text-decoration: underline;
}
