/**
 * Alternate Sphinx design
 * Originally created by Armin Ronacher for Werkzeug, adapted by Georg Brandl.
 */

:root {
    --topoly-bg: #edf7ff;
    --topoly-surface: #ffffff;
    --topoly-surface-soft: #f5faff;
    --topoly-text: #1a2b3c;
    --topoly-muted: #4a6580;
    --topoly-primary: #0078c0;
    --topoly-primary-dark: #005e96;
    --topoly-primary-light: #4699ec;
    --topoly-border: #c4e3f3;
    --topoly-shadow: 0 16px 40px rgba(0, 120, 192, 0.10);

    /* Bump pydata-sphinx-theme's rem-anchored sizing (sidebar, TOC, milli text) */
    --pst-sidebar-font-size: 1rem;
    --pst-sidebar-header-font-size: 1.3rem;
    --pst-font-size-milli: 1rem;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: Inter, 'Segoe UI', 'Lucida Grande', 'Lucida Sans Unicode', 'Geneva', 'Verdana', sans-serif;
    font-size: 17px;
    letter-spacing: -0.01em;
    line-height: 1.65;
    text-align: center;
    background:
        url("topo-bg.svg") center top / cover no-repeat,
        radial-gradient(circle at top left, rgba(0, 120, 192, 0.07), transparent 35%),
        linear-gradient(180deg, #f5faff 0%, var(--topoly-bg) 100%);
    color: var(--topoly-text);
    padding: 0;
    border: 0;
    margin: 0;
    min-width: 0;
}

body, div.document, div.related ul, div.footer {
    box-sizing: border-box;
}

a {
    color: var(--topoly-primary);
    text-decoration: none;
}

a:hover {
    color: var(--topoly-primary-dark);
}

div.document {
    background-color: var(--topoly-surface);
    text-align: left;
    background-image: none;
    max-width: 1180px;
    margin: 24px auto;
    border: 1px solid var(--topoly-border);
    border-radius: 22px;
    box-shadow: var(--topoly-shadow);
    overflow: hidden;
}

div.body {
    margin: 0;
    padding: 1.1rem 2rem 2rem 2rem;
}

div.bodywrapper {
    margin: 0 290px 0 0;
    border-right: 1px solid var(--topoly-border);
}

div.related ul {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    height: auto;
    min-height: 3rem;
    list-style: none;
    border-top: 1px solid var(--topoly-border);
    border-bottom: 1px solid var(--topoly-border);
    margin: 0;
    padding: 0.5rem 1.25rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    align-items: center;
}

div.related ul li {
    margin: 0;
    padding: 0;
    height: auto;
    float: none;
}

div.related ul li.right {
    float: none;
    margin-left: auto;
}

div.related ul li a {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin: 0;
    padding: 0.35rem 0.75rem;
    line-height: 1.2;
    color: var(--topoly-text);
    border-radius: 999px;
    background: #e8f4fc;
    transition: background-color 120ms ease, color 120ms ease, transform 120ms ease;
}

div.related ul li a:hover {
    color: #fff;
    background: var(--topoly-primary);
    transform: translateY(-1px);
}

.topoly-navbar {
    background: linear-gradient(90deg, #00456e 0%, #0078c0 60%, #4699ec 100%);
    box-shadow: 0 4px 18px rgba(0, 69, 110, 0.22);
}

.topoly-navbar__logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    flex: 0 0 auto;
}

.topoly-navbar .navbar-brand,
.topoly-navbar .nav-link {
    color: #fff !important;
}

.topoly-navbar .navbar-brand {
    font-size: 1.4rem;
    font-weight: 600;
}

.topoly-navbar .nav-link {
    padding: 0.5rem 0.8rem;
    border-radius: 999px;
    font-size: 1.1rem;
}

.topoly-navbar .nav-link:hover,
.topoly-navbar .nav-link:focus {
    background: rgba(255, 255, 255, 0.14);
}

.topoly-hero {
    color: #fff;
    background:
        url("topo-bg-hero.svg") center center / cover no-repeat,
        radial-gradient(circle at 80% 50%, rgba(70, 153, 236, 0.30), transparent 30%),
        linear-gradient(120deg, #00456e 0%, #006aad 50%, #0078c0 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.10);
}

.topoly-cta {
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.94);
}

.topoly-cta .btn {
    border-radius: 12px;
}

.topoly-hero__brand {
    display: flex;
    gap: 1rem;
    align-items: center;
    min-width: 0;
}

.topoly-kicker {
    margin: 0 0 0.15rem 0;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.9rem;
    opacity: 0.82;
}

.topoly-title {
    margin: 0;
    padding: 0;
    font-size: clamp(1.5rem, 2.8vw, 2.4rem);
    line-height: 1.1;
    color: #fff;
}

.topoly-subtitle {
    margin: 0.35rem 0 0 0;
    max-width: 90ch;
    color: rgba(255, 255, 255, 0.88);
}

a {
    color: var(--topoly-primary);
    text-decoration: none;
}

a:hover {
    color: var(--topoly-primary-dark);
}

pre {
    font-family: 'Consolas', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
    font-size: 0.95em;
    letter-spacing: 0.015em;
    padding: 0.5em;
    border: 1px solid #ccc;
    background-color: #f8f8f8;
}

td.linenos pre {
    padding: 0.5em 0;
    border: 0;
    background-color: transparent;
    color: #aaa;
}

table.highlighttable {
    margin-left: 0.5em;
}

table.highlighttable td {
    padding: 0 0.5em 0 0.5em;
}

cite, code, tt {
    font-family: 'Consolas', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
    font-size: 0.95em;
    letter-spacing: 0.01em;
}

hr {
    border: 1px solid #abc;
    margin: 2em;
}

tt {
    background-color: #f2f2f2;
    border-bottom: 1px solid #ddd;
    color: #333;
}

tt.descname {
    background-color: transparent;
    font-weight: bold;
    font-size: 1.2em;
    border: 0;
}

tt.descclassname {
    background-color: transparent;
    border: 0;
}

tt.xref {
    background-color: transparent;
    font-weight: bold;
    border: 0;
}

a tt {
    background-color: transparent;
    font-weight: bold;
    border: 0;
    color: #CA7900;
}

a tt:hover {
    color: #2491CF;
}

dl {
    margin-bottom: 15px;
}

dd p {
    margin-top: 0px;
}

dd ul, dd table {
    margin-bottom: 10px;
}

dd {
    margin-top: 3px;
    margin-bottom: 10px;
    margin-left: 30px;
}

.refcount {
    color: #060;
}

dt:target,
.highlight {
    background-color: #fbe54e;
}

dl.class, dl.function {
    border-top: 2px solid #888;
}

dl.method, dl.attribute {
    border-top: 1px solid #aaa;
}

dl.glossary dt {
    font-weight: bold;
    font-size: 1.1em;
}

pre {
    line-height: 120%;
}

pre a {
    color: inherit;
    text-decoration: underline;
}

.first {
    margin-top: 0 !important;
}

div.document {
    background-color: white;
    text-align: left;
    background-image: url(contents.png);
    background-repeat: repeat-x;
}

/*
div.documentwrapper {
    width: 100%;
}
*/

div.clearer {
    clear: both;
}

div.related h3 {
    display: none;
}

div.related ul {
    background-image: url(navigation.png);
    height: 2em;
    list-style: none;
    border-top: 1px solid #ddd;
    border-bottom: 1px solid #ddd;
    margin: 0;
    padding-left: 10px;
}

div.related ul li {
    margin: 0;
    padding: 0;
    height: 2em;
    float: left;
}

div.related ul li.right {
    float: right;
    margin-right: 5px;
}

div.related ul li a {
    margin: 0;
    padding: 0 5px 0 5px;
    line-height: 1.75em;
    color: #EE9816;
}

div.related ul li a:hover {
    color: #3CA8E7;
}

div.body {
    margin: 0;
    padding: 0.5em 20px 20px 20px;
}

div.bodywrapper {
    margin: 0 240px 0 0;
    border-right: 1px solid #ccc;
}

div.body a {
    text-decoration: underline;
}

div.sphinxsidebar {
    margin: 0;
    padding: 1.1rem 1rem 1.5rem 0;
    width: 260px;
    float: right;
    text-align: left;
/*    margin-left: -100%; */
}

div.sphinxsidebar h4, div.sphinxsidebar h3 {
    margin: 1em 0 0.5em 0;
    font-size: 0.9em;
    padding: 0.55rem 0.75rem;
    color: var(--topoly-text);
    border: 1px solid var(--topoly-border);
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 12px;
}

div.sphinxsidebar ul {
    padding-left: 1.5em;
    margin-top: 7px;
    list-style: none;
    padding: 0;
    line-height: 130%;
}

div.sphinxsidebar ul ul {
    list-style: square;
    margin-left: 20px;
}

p {
    margin: 0.8em 0 0.5em 0;
}

p.rubric {
    font-weight: bold;
}

h1 {
    margin: 0;
    padding: 0.7em 0 0.3em 0;
    font-size: 1.5em;
    color: var(--topoly-primary-dark);
}

h2 {
    margin: 1.3em 0 0.2em 0;
    font-size: 1.35em;
    padding: 0;
}

h2::after {
    content: '';
    display: block;
    width: 72px;
    height: 4px;
    margin-top: 0.35rem;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--topoly-primary), var(--topoly-primary-light));
}

h3 {
    margin: 1em 0 -0.3em 0;
    font-size: 1.2em;
}

h1 a, h2 a, h3 a, h4 a, h5 a, h6 a {
    color: black!important;
}

h1 a.anchor, h2 a.anchor, h3 a.anchor, h4 a.anchor, h5 a.anchor, h6 a.anchor {
    display: none;
    margin: 0 0 0 0.3em;
    padding: 0 0.2em 0 0.2em;
    color: #aaa!important;
}

h1:hover a.anchor, h2:hover a.anchor, h3:hover a.anchor, h4:hover a.anchor,
h5:hover a.anchor, h6:hover a.anchor {
    display: inline;
}

h1 a.anchor:hover, h2 a.anchor:hover, h3 a.anchor:hover, h4 a.anchor:hover,
h5 a.anchor:hover, h6 a.anchor:hover {
    color: #777;
    background-color: #eee;
}

table {
    border-collapse: collapse;
    margin: 0 -0.5em 0 -0.5em;
}

table td, table th {
    padding: 0.2em 0.5em 0.2em 0.5em;
}

div.footer {
    background-color: var(--topoly-surface-soft);
    color: var(--topoly-muted);
    padding: 0.75rem 1rem;
    clear: both;
    font-size: 0.85em;
    text-align: right;
    border-top: 1px solid var(--topoly-border);
}

div.footer a {
    color: #86989B;
    text-decoration: underline;
}

div.pagination {
    margin-top: 2em;
    padding-top: 0.5em;
    border-top: 1px solid black;
    text-align: center;
}

div.sphinxsidebar ul.toc {
    margin: 1em 0 1em 0;
    padding: 0 0 0 0.5em;
    list-style: none;
}

div.sphinxsidebar ul.toc li {
    margin: 0.5em 0 0.5em 0;
    font-size: 0.9em;
    line-height: 130%;
}

div.sphinxsidebar ul.toc li p {
    margin: 0;
    padding: 0;
}

div.sphinxsidebar ul.toc ul {
    margin: 0.2em 0 0.2em 0;
    padding: 0 0 0 1.8em;
}

div.sphinxsidebar ul.toc ul li {
    padding: 0;
}

div.admonition, div.warning {
    font-size: 0.95em;
    margin: 1em 0 0 0;
    border: 1px solid var(--topoly-border);
    background-color: var(--topoly-surface-soft);
    border-radius: 14px;
    overflow: hidden;
}

div.admonition p, div.warning p {
    margin: 0.5em 1em 0.5em 1em;
    padding: 0;
}

div.admonition pre, div.warning pre {
    margin: 0.4em 1em 0.4em 1em;
}

div.admonition p.admonition-title,
div.warning p.admonition-title {
    margin: 0;
    padding: 0.55rem 0.75rem;
    color: #fff;
    border-bottom: 1px solid var(--topoly-border);
    font-weight: 700;
    background: linear-gradient(90deg, #005e96 0%, #0078c0 100%);
}

div.warning {
    border: 1px solid #ef4444;
}

div.warning p.admonition-title {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border-bottom-color: #ef4444;
}

div.admonition ul, div.admonition ol,
div.warning ul, div.warning ol {
    margin: 0.1em 0.5em 0.5em 3em;
    padding: 0;
}

div.versioninfo {
    margin: 1em 0 0 0;
    border: 1px solid var(--topoly-border);
    background: #e8f4fc;
    padding: 0.85rem 1rem;
    line-height: 1.5em;
    font-size: 0.92em;
    border-radius: 12px;
}


a.headerlink {
    color: #c60f0f!important;
    font-size: 1em;
    margin-left: 6px;
    padding: 0 4px 0 4px;
    text-decoration: none!important;
    visibility: hidden;
}

h1:hover > a.headerlink,
h2:hover > a.headerlink,
h3:hover > a.headerlink,
h4:hover > a.headerlink,
h5:hover > a.headerlink,
h6:hover > a.headerlink,
dt:hover > a.headerlink {
    visibility: visible;
}

a.headerlink:hover {
    background-color: #ccc;
    color: white!important;
}

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

table.indextable dl, table.indextable dd {
    margin-top: 0;
    margin-bottom: 0;
}

table.indextable tr.pcap {
    height: 10px;
}

table.indextable tr.cap {
    margin-top: 10px;
    background-color: #f2f2f2;
}

img.toggler {
    margin-right: 3px;
    margin-top: 3px;
    cursor: pointer;
}

img.inheritance {
    border: 0px
}

form.pfform {
    margin: 10px 0 20px 0;
}

table.contentstable {
    width: 90%;
}

table.contentstable p.biglink {
    line-height: 150%;
}

a.biglink {
    font-size: 1.3em;
}

span.linkdescr {
    font-style: italic;
    padding-top: 5px;
    font-size: 90%;
}

ul.search {
    margin: 10px 0 0 20px;
    padding: 0;
}

ul.search li {
    padding: 5px 0 5px 20px;
    background-image: url(file.png);
    background-repeat: no-repeat;
    background-position: 0 7px;
}

ul.search li a {
    font-weight: bold;
}

ul.search li div.context {
    color: #888;
    margin: 2px 0 0 30px;
    text-align: left;
}

@media (max-width: 1100px) {
    div.document {
        margin: 12px;
        border-radius: 16px;
    }

    div.bodywrapper {
        margin-right: 0;
        border-right: 0;
    }

    div.sphinxsidebar {
        float: none;
        width: auto;
        padding: 1rem 1.25rem 0 1.25rem;
        border-top: 1px solid var(--topoly-border);
        background: #f0f8ff;
    }

    .topoly-hero .row {
        gap: 1.5rem;
    }
}

@media (max-width: 720px) {
    div.body {
        padding: 1rem;
    }

    .topoly-hero {
        padding: 1rem 0;
    }

    .topoly-hero__brand {
        align-items: flex-start;
    }

    .topoly-navbar__logo {
        width: 28px;
        height: 28px;
    }

    .topoly-cta {
        margin-top: 0.25rem;
    }
}

ul.keywordmatches li.goodmatch a {
    font-weight: bold;
}

/* ── Version switcher ─────────────────────────────────────── */

.version-switcher__btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    border: 1.5px solid rgba(255, 255, 255, 0.45);
    border-radius: 999px;
    padding: 0.35rem 0.85rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 120ms, border-color 120ms;
    white-space: nowrap;
}

.version-switcher__btn:hover,
.version-switcher__btn:focus {
    background: rgba(255, 255, 255, 0.24);
    border-color: rgba(255, 255, 255, 0.7);
    outline: none;
}

.version-switcher__menu {
    min-width: 180px;
    border: 1px solid var(--topoly-border);
    border-radius: 14px;
    box-shadow: 0 8px 28px rgba(0, 69, 110, 0.16);
    padding: 0.4rem 0.3rem;
    overflow: hidden;
    font-size: 1rem;
}

.version-switcher__menu .dropdown-header {
    font-size: 0.73rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--topoly-muted);
    padding: 0.3rem 0.85rem 0.2rem;
}

.version-switcher__menu .dropdown-item {
    border-radius: 9px;
    padding: 0.42rem 0.85rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--topoly-text);
    transition: background 100ms;
}

.version-switcher__menu .dropdown-item:hover {
    background: var(--topoly-surface-soft);
    color: var(--topoly-primary-dark);
}

.version-switcher__menu .dropdown-item.active {
    background: #e0f2fe;
    color: var(--topoly-primary-dark);
    font-weight: 600;
}

.version-switcher__menu .dropdown-item.active::after {
    content: '✓';
    font-size: 0.78rem;
    color: var(--topoly-primary);
}

.vs-stable-badge {
    background: #dcfce7;
    color: #166534;
    border-radius: 999px;
    padding: 0.1rem 0.55rem;
    font-size: 0.72rem;
    font-weight: 600;
    margin-left: 0.4rem;
}

.version-switcher__menu .dropdown-divider {
    border-color: var(--topoly-border);
    margin: 0.3rem 0.5rem;
}

@media (max-width: 991px) {
    .version-switcher__btn {
        margin-top: 0.5rem;
        width: fit-content;
    }
    .version-switcher__menu {
        min-width: 160px;
    }
}

/* ── pydata-sphinx-theme header navbar (page nav links, search) ──────── */

.bd-header .navbar-brand {
    font-size: 1.3rem;
}

.bd-header .navbar-nav .nav-link,
.bd-navbar-elements .nav-link,
.search-button__default-text {
    font-size: 1.12rem;
}

/* ── Wider content pane ────────────────────────────────────────────── */

.bd-article-container {
    max-width: 76em;
}

.bd-page-width {
    max-width: 96rem;
}
