@import url('https://fonts.googleapis.com/css2?family=Elms+Sans:ital,wght@0,100..900;1,100..900&display=swap');

* {
    font-family: "Elms Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

:root {
    --border-radius: 0;
    --color-brand-primary: #1a1a1a;
    --color-brand-content: #2d2d2d;
    --color-foreground-primary: #1a1a1a;
    --color-background-primary: #ffffff;
    --color-background-secondary: #f8f8f8;
    --color-admonition-background: #f4f4f4;
    --color-table-border: #d0d0d0;
    --color-background-border: #d0d0d0;
    --color-guilabel-background: #f4f4f4;
    --color-guilabel-border: #d0d0d0;
    --color-admonition-title--note: #1a1a1a;
    --color-admonition-title-background--note: #ebebeb;
    --color-admonition-title--seealso: #1a1a1a;
    --color-admonition-title-background--seealso: #ebebeb;
    --color-admonition-title: #1a1a1a;
    --color-admonition-title-background: #ebebeb;
    --color-border: #d0d0d0;
    --color-button: #f4f4f4;
    --color-background-highlight: #f4f4f4;
    --color-title: #000000;
    --color-link: #1a1a1a;
    --color-link-hover: #666666;
    --color-strong: #000000;
    font-size: 16px;
    line-height: 1.7;
}

@media (prefers-color-scheme: dark) {
    body:not([data-theme=light]) {
        --color-brand-primary: #cccccc;
        --color-brand-content: #999999;
        --color-foreground-primary: #cccccc;
        --color-background-primary: #0d0d0d;
        --color-background-secondary: #141414;
        --color-admonition-background: #181818;
        --color-table-border: #333333;
        --color-guilabel-background: #181818;
        --color-guilabel-border: #333333;
        --color-admonition-title--note: #cccccc;
        --color-admonition-title-background--note: #1a1a1a;
        --color-admonition-title--seealso: #cccccc;
        --color-admonition-title-background--seealso: #1a1a1a;
        --color-admonition-title: #cccccc;
        --color-admonition-title-background: #1a1a1a;
        --color-border: #333333;
        --color-button: #1a1a1a;
        --color-background-highlight: #181818;
        --color-title: #e0e0e0;
        --color-link: #cccccc;
        --color-link-hover: #999999;
        --color-strong: #e0e0e0;
    }
}

/* --- Layout --- */

body {
    margin: 0;
    font-family: "Elms Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-color: var(--color-background-primary);
    min-height: 100vh;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

body::-webkit-scrollbar {
    display: none;
}

.page {
    display: flex;
}

.main {
    display: flex;
    flex: 1;
    min-width: 0;
    justify-content: center;
    background-color: var(--color-background-primary);
}

.content {
    flex: 0 1 56em;
    max-width: 56em;
    padding: 3rem 3rem 4rem;
    overflow-wrap: break-word;
    word-wrap: break-word;
    min-width: 0;
}

@media (max-width: 82em) {
    .main {
        justify-content: flex-start;
    }
}

@media (min-width: 82em) {
    .main {
        justify-content: space-between;
    }
    .main::before {
        content: '';
    }
}

@media (max-width: 67em) {
    .content {
        padding: 2rem 1.5rem 3rem;
    }
}

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

.mobile-header {
    background-color: var(--color-background-primary);
    border-bottom: 1px solid var(--color-border);
    z-index: 60;
}

.mobile-header .brand {
    font-family: "Elms Sans", sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
}

/* --- Sidebar --- */

.sidebar-drawer {
    background-color: var(--color-background-secondary);
    border-right: 1px solid var(--color-border);
}

@media (min-width: 63em) {
    .sidebar-drawer {
        width: auto;
        justify-content: initial;
        flex: 0 0 18em;
    }
}

.sidebar-container {
    width: 18em;
    background-color: var(--color-background-secondary);
    padding: 1.5rem 0;
    position: sticky;
    top: 0;
    align-self: start;
    max-height: 100vh;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.sidebar-container::-webkit-scrollbar {
    display: none;
}

.sidebar-brand {
    padding: 0.5rem 1.5rem 1rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.sidebar-logo-container {
    margin: 0;
    flex-shrink: 0;
}

.sidebar-logo {
    width: 36px;
    height: auto;
    display: block;
}

.sidebar-brand-text {
    font-family: "Elms Sans", sans-serif;
    font-weight: 700;
    font-size: 2.8rem;
    letter-spacing: -0.03em;
    display: inline-flex;
    gap: 0.04em;
    line-height: 1;
}

.sidebar-brand-text a {
    display: inline-flex;
    gap: 0.02em;
}

.brand-char {
    display: inline-block;
    transition: transform 0.2s ease, color 0.2s ease;
}

.brand-char:hover {
    transform: translateY(-4px);
    color: var(--color-link-hover);
}

@keyframes letterPop {
    0% { transform: translateY(0); opacity: 0.6; }
    50% { transform: translateY(-6px); opacity: 1; }
    100% { transform: translateY(0); opacity: 1; }
}

.brand-char {
    animation: letterPop 0.4s ease backwards;
}

.brand-char:nth-child(1) { animation-delay: 0.00s; }
.brand-char:nth-child(2) { animation-delay: 0.05s; }
.brand-char:nth-child(3) { animation-delay: 0.10s; }
.brand-char:nth-child(4) { animation-delay: 0.15s; }
.brand-char:nth-child(5) { animation-delay: 0.20s; }
.brand-char:nth-child(6) { animation-delay: 0.25s; }

.sidebar-tree {
    padding: 0 1rem;
}

.sidebar-tree li {
    margin: 0.15rem 0;
}

.sidebar-tree .reference {
    font-family: "Elms Sans", sans-serif;
    font-size: 0.875rem;
    font-weight: 400;
    padding: 0.3rem 0.5rem;
    display: block;
    border-left: 2px solid transparent;
    transition: border-color 0.15s ease, color 0.15s ease;
}

.sidebar-tree .current > .reference {
    border-left: 2px solid var(--color-title);
    font-weight: 600;
}

.sidebar-tree .toctree-l1 > .reference:hover {
    border-left: 2px solid var(--color-border);
}

.sidebar-tree li.toctree-l1 > .reference,
.sidebar-tree li.toctree-l2 > .reference {
    padding: 0.3rem 0.5rem 0.3rem 1rem;
}

/* --- TOC drawer --- */

.toc-drawer {
    flex: 0 0 auto;
    width: 15em;
    border-left: 1px solid var(--color-border);
    background-color: var(--color-background-secondary);
    padding: 1.5rem 0 0 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

@media (min-width: 82em) {
    .toc-drawer {
        position: sticky;
        top: 0;
        align-self: start;
        max-height: 100vh;
        overflow-y: auto;
    }
}

.toc-drawer::-webkit-scrollbar {
    display: none;
}

@media (max-width: 63em) {
    .toc-drawer {
        position: fixed;
        right: -15em;
        top: 0;
        width: 15em;
        height: 100vh;
        z-index: 65;
        background-color: var(--color-background-secondary);
        border-left: 1px solid var(--color-border);
        display: block;
        transition: right 0.2s ease;
    }
}

@media (min-width: 82em) {
    .no-toc {
        display: block;
    }
}

.toc-tree {
    padding: 0 1rem;
}

.toc-tree .reference {
    font-family: "Elms Sans", sans-serif;
    font-size: 0.8125rem;
    font-weight: 400;
    color: var(--color-foreground-primary);
    padding: 0.2rem 0.5rem;
    display: block;
    border-left: 2px solid transparent;
    transition: border-left-color 0.15s ease;
}

.toc-tree .reference:hover {
    border-left-color: var(--color-border);
}

.toc-tree li.scroll-current > .reference {
    border-left-color: var(--color-title);
    font-weight: 600;
}

/* --- Headings --- */

h1, h2, h3, h4, h5, h6 {
    font-family: "Elms Sans", sans-serif;
    font-weight: 650;
    color: var(--color-title);
    letter-spacing: -0.02em;
    line-height: 1.3;
    padding-bottom: 0.3rem;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
}

h1:first-child, h2:first-child, h3:first-child {
    margin-top: 0;
}

h1 {
    font-size: 2rem;
    font-weight: 700;
    border-bottom: 2px solid var(--color-border);
    padding-bottom: 0.4rem;
    letter-spacing: -0.03em;
}

h2 {
    font-size: 1.5rem;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 0.3rem;
}

h3 {
    font-size: 1.2rem;
}

h4 {
    font-size: 1.05rem;
}

h5, h6 {
    font-size: 1rem;
}

/* --- Paragraphs & text --- */

p {
    margin: 0 0 1.2rem;
    line-height: 1.7;
}


article[role="main"] {
    overflow-wrap: break-word;
    word-wrap: break-word;
}

article[role="main"] img {
    max-width: 100%;
    height: auto;
}

article p code.literal,
li p code.literal {
    font-family: "Elms Sans", sans-serif;
    background-color: var(--color-background-highlight);
    border: 1px solid var(--color-border);
    border-radius: 2px;
    padding: 0.1em 0.4em;
    font-size: 0.875em;
    font-weight: 500;
}

article[role=main] .highlight pre {
    font-family: "Elms Sans", sans-serif;
    font-size: 0.875rem;
    line-height: 1.5;
    border: 1px solid var(--color-border);
    border-radius: 0;
    background-color: var(--color-background-highlight);
    padding: 1.2rem;
}

div[class*="highlight-"] {
    margin: 1.5rem 0;
    overflow-x: auto;
    max-width: 100%;
}
.highlight pre {
    overflow-x: auto;
    max-width: 100%;
}

/* --- Links --- */

a {
    text-decoration: none;
    color: var(--color-link);
    transition: color 0.15s ease;
}

a:hover {
    color: var(--color-link-hover);
    text-decoration: underline;
}

a.sidebar-brand:hover,
a.sidebar-brand:focus {
    text-decoration: none;
}

a.reference {
    border-bottom: 1px solid transparent;
}

a.reference:hover {
    border-bottom-color: var(--color-link-hover);
}

/* --- Admonitions --- */

.admonition {
    border-radius: 0;
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--color-title);
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
}

p.admonition-title {
    font-family: "Elms Sans", sans-serif;
    font-weight: 650;
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}

/* --- Tables --- */

table.docutils {
    border: 1px solid var(--color-table-border);
    border-radius: 0;
    border-collapse: collapse;
    margin: 1.5rem 0;
    width: 100%;
    max-width: 100%;
}

table.docutils th {
    background-color: var(--color-background-highlight);
    border: 1px solid var(--color-table-border);
    padding: 0.6rem 0.8rem;
    font-family: "Elms Sans", sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
}

table.docutils td {
    border: 1px solid var(--color-table-border);
    padding: 0.5rem 0.8rem;
    font-size: 0.9rem;
    line-height: 1.5;
}

table.docutils:not(.field-list) tr:nth-child(2n-1) td {
    background-color: var(--color-background-highlight);
}

.table-wrapper {
    overflow-x: auto;
    max-width: 100%;
}

/* --- Code signatures (function defs, class defs) --- */

dl.py {
    margin: 1rem 0;
}

dl.py dt {
    box-sizing: border-box !important;
    font-family: "Elms Sans", sans-serif !important;
    background-color: var(--color-background-highlight) !important;
    border-radius: 0 !important;
    border-left: 3px solid var(--color-title) !important;
    padding: 0.5rem 1rem !important;
    margin: 0.75rem 0 !important;
    font-size: 0.9rem;
    width: 100%;
    word-break: break-word;
    text-indent: 0 !important;
}

dl.py dd {
    margin: 0.5rem 0 0.75rem 1.5rem;
}

.sig-prename,
.sig-name,
.sig-param,
.sig-paren,
.sig-return,
.sig-return-typehint,
.sig-param .pre,
.property .pre,
em.property {
    white-space: normal !important;
    overflow-wrap: break-word !important;
    word-break: break-word !important;
}

.sig-prename,
.sig-name {
    font-family: "Elms Sans", sans-serif;
    color: var(--color-foreground-primary);
}

/* --- Lists --- */

article[role=main] ul,
article[role=main] ol {
    margin: 0 0 1.2rem;
    padding-left: 1.5rem;
    line-height: 1.7;
}

article[role=main] li {
    margin-bottom: 0.3rem;
}

/* --- Navigation buttons --- */

.related-pages {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border);
}

.related-pages a {
    background-color: var(--color-button);
    border: 1px solid var(--color-border);
    border-radius: 0;
    padding: 0.6rem 1rem;
    font-family: "Elms Sans", sans-serif;
    font-size: 0.9rem;
    transition: background-color 0.15s ease;
}

.related-pages a:hover {
    background-color: var(--color-background-highlight);
}

/* --- Bottom of page --- */

.bottom-of-page {
    border-top: 1px solid var(--color-border);
    padding: 1.5rem 0;
    margin-top: 3rem;
    font-size: 0.85rem;
    color: var(--color-foreground-primary);
}

/* --- Blockquotes --- */

blockquote {
    border-left: 3px solid var(--color-border);
    border-radius: 0;
    padding: 0.5rem 1rem;
    margin: 1.5rem 0;
    color: var(--color-foreground-primary);
}

/* --- Usable-by badges --- */

.usable-by-container {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid var(--color-border);
    padding: 0.35rem 0.75rem;
    margin: 0.75rem 0;
    font-size: 0.85rem;
    background-color: var(--color-background-secondary);
}

.usable-by-label {
    font-weight: 600;
    color: var(--color-foreground-primary);
    margin-right: 0.25rem;
}

.usable-by-badge {
    display: inline-block;
    padding: 0.1em 0.5em;
    font-weight: 600;
    font-size: 0.85em;
}

.usable-by-badge.badge-yes {
    color: #0a0;
}

.usable-by-badge.badge-no {
    color: #c33;
}

@media (prefers-color-scheme: dark) {
    body:not([data-theme=light]) .usable-by-badge.badge-yes {
        color: #4c4;
    }
    body:not([data-theme=light]) .usable-by-badge.badge-no {
        color: #c66;
    }
}

/* --- Misc --- */

.content-icon-container {
    margin-top: 1.5rem;
    margin-bottom: 0;
}

.highlight button.copybtn svg {
    color: var(--color-foreground-primary);
    transition: color 0.15s ease;
}

.highlight button.copybtn:hover svg {
    color: var(--color-title);
}

.field-list {
    margin: 1.5rem 0;
}

.field-list dt {
    border-left: none !important;
    background: none !important;
    padding: 0 !important;
    font-weight: 600;
}

.field-list dd {
    margin: 0 0 0.5rem 1.5rem;
}

dl.py dd > dl.simple > dt,
dl.py dd dl:not([class]) > dt,
dl.py dd .field-list.simple > dt,
dl.py dd .field-list > dt {
    border: 1px solid var(--color-border) !important;
    background: var(--color-background-highlight) !important;
    padding: 0.35rem 0.75rem !important;
    font-weight: 650;
    font-size: 0.9rem;
    white-space: nowrap;
}

/* --- Buttons and inline elements --- */

kbd, .guilabel {
    font-family: "Elms Sans", sans-serif;
    background-color: var(--color-guilabel-background);
    border: 1px solid var(--color-guilabel-border);
    border-radius: 2px;
    padding: 0.1em 0.4em;
    font-size: 0.875em;
}

/* --- Version and toctree captions --- */

.toctree-wrapper {
    margin: 1.5rem 0;
}

.toctree-wrapper .caption-text {
    font-family: "Elms Sans", sans-serif;
    font-weight: 650;
    font-size: 1rem;
}

/* --- Homepage specific --- */

article[role=main] .code-block-caption {
    font-family: "Elms Sans", sans-serif;
    font-size: 0.85rem;
    padding: 0.4rem 1.2rem;
    border: 1px solid var(--color-border);
    border-bottom: none;
    background-color: var(--color-background-highlight);
}
