/* Common colours */
:root {
    --good-color: rgb(41 100 51);
    --good-border: rgb(79 196 100);
    --middle-color: rgb(133 72 38);
    --middle-border: rgb(244, 227, 76);
    --bad-color: rgb(159 49 51);
    --bad-border: rgb(244, 76, 78);
}

/* unset some styles from the classic stylesheet */
div.document,
div.body,
div.related,
div.body h1,
div.body h2,
div.body h3,
div.body h4,
div.body h5,
div.body h6,
div.sphinxsidebar a,
div.sphinxsidebar p,
div.sphinxsidebar ul,
div.sphinxsidebar h3,
div.sphinxsidebar h3 a,
div.sphinxsidebar h4,
.menu a,
.menu p,
.menu ul,
.menu h3,
.menu h3 a,
.menu h4,
table.docutils td,
table.indextable tr.cap,
pre {
    background-color: inherit;
    color: inherit;
}

/* Add underlines to links */
a[href] {
    text-decoration: underline 1px;
}

/* Increase the underline offset for code to avoid obscuring underscores */
a[href]:has(> code) {
    text-underline-offset: 0.25em;
}

/* No underline for navigation */
a.headerlink,
div.genindex-jumpbox a,
div.modindex-jumpbox a,
div#search-results a,
div.sphinxsidebar a,
div.toctree-wrapper a,
div[role=navigation] a,
table.contentstable a,
table.indextable a {
    text-decoration: none;
}

/* Except when hovered */
div.genindex-jumpbox a:hover,
div.modindex-jumpbox a:hover,
div#search-results a:hover,
div.sphinxsidebar a:hover,
div.toctree-wrapper a:hover,
div[role=navigation] a:hover,
table.contentstable a:hover,
table.indextable a:hover {
    text-decoration: underline;
    text-underline-offset: auto;
}

body {
    margin-left: 1em;
    margin-right: 1em;
}

.mobile-nav,
.menu-wrapper {
    display: none;
}

div.related {
    margin-top: 0.5em;
    margin-bottom: 1.2em;
    padding: 0.5em 0;
    border-width: 1px;
    border-color: #ccc;
}

.mobile-nav + div.related {
    border-bottom-style: solid;
}

.document + div.related {
    border-top-style: solid;
}

div.related a:hover {
    color: #0095c4;
}

.related .switchers {
    display: inline-flex;
}

.switchers > div {
    margin-right: 5px;
}

div.related ul::after {
    content: '';
    clear: both;
    display: block;
}

.inline-search,
form.inline-search input {
    display: inline;
}

form.inline-search input[type='submit'] {
    /* In some languages, more than 40px is required */
    width: auto;
    min-width: 40px;
}

div.document {
    display: flex;
    /* Don't let long code literals extend beyond the right side of the screen */
    overflow-wrap: break-word;
}

/* Don't let long code literals extend beyond the right side of the screen */
span.pre {
    white-space: unset;
}

div.sphinxsidebar {
    display: flex;
    width: min(25vw, 350px);
    float: none;
    position: sticky;
    top: 0;
    max-height: 100vh;
    color: #444;
    background-color: #eee;
    border-radius: 5px;
    line-height: 130%;
    font-size: smaller;
}

div.sphinxsidebar h3,
div.sphinxsidebar h4 {
    margin-top: 1.5em;
}

div.bodywrapper {
    margin-left: min(25vw, 350px);
}

div.sphinxsidebarwrapper {
    box-sizing: border-box;
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    float: none;
    flex-grow: 1;
}

div.sphinxsidebarwrapper > h3:first-child {
    margin-top: 0.2em;
}

div.sphinxsidebarwrapper > ul > li > ul > li {
    margin-bottom: 0.4em;
}

div.sphinxsidebar a:hover {
    color: #0095c4;
}

form.inline-search input,
div.sphinxsidebar input,
div.related input {
    font-family: -apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, helvetica, Cantarell, Ubuntu, roboto, noto, arial, sans-serif;
    border: 1px solid #999999;
    font-size: smaller;
    border-radius: 3px;
}

div.sphinxsidebar input[type='text'] {
    max-width: 150px;
}

#sidebarbutton {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 12px;
    min-width: 12px;
    border-radius: 0 5px 5px 0;
    border-left: none;
}

#sidebarbutton:hover {
    background-color: #AAAAAA;
}

div.body {
    padding: 0 0 0 1.2em;
}

div.body p, div.body dd, div.body li, div.body blockquote {
    text-align: left;
    line-height: 1.6;
}
div.body h1, div.body h2, div.body h3, div.body h4, div.body h5, div.body h6 {
    margin: 0;
    border: 0;
    padding: 0.3em 0;
}
div.body dl.field-list > dt {
    line-height: 1.6;
}

div.body hr {
    border: 0;
    background-color: #ccc;
    height: 1px;
}

div.body pre {
    border-radius: 3px;
    border: 1px solid #ac9;
}

div.body {
    .good pre {
        border-left: 3px solid var(--good-border);
    }
    .bad pre {
        border-left: 3px solid var(--bad-border);
    }
    .maybe pre {
        border-left: 3px solid var(--middle-border);
    }
}

div.code-block-caption {
    background-color: #eee;
    border: 1px solid #ac9;
    border-bottom: none;
    border-radius: 3px 3px 0 0;
    padding: 0.3em 0.6em;
    font-size: 90%;
    color: #333;

    & + div pre {
        border-top-left-radius: 0 !important;
        border-top-right-radius: 0 !important;
    }

    & + div .copybutton {
        border-top-right-radius: 0 !important;
    }
}

/* Admonitions */
:root {
    --admonition-background: #eee;
    --admonition-border: #ccc;
    --admonition-color: black;
    --attention-background: #bbddff5c;
    --attention-border: #0000ff36;
    --caution-background: #ffc;
    --caution-border: #dd6;
    --danger-background: #ffe4e4;
    --danger-border: red;
    --error-background: #ffe4e4;
    --error-border: red;
    --hint-background: #dfd;
    --hint-border: green;
    --seealso-background: #ffc;
    --seealso-border: #dd6;
    --tip-background: #dfd;
    --tip-border: green;
    --warning-background: #ffe4e4;
    --warning-border: red;
}

div.body div.admonition {
    background-color: var(--admonition-background);
    border: 1px solid var(--admonition-border);
    border-radius: 3px;
    color: var(--admonition-color);
}

div.body div.admonition.attention {
    background-color: var(--attention-background);
    border-color: var(--attention-border);
}

div.body div.admonition.caution {
    background-color: var(--caution-background);
    border-color: var(--caution-border);
}

div.body div.admonition.danger {
    background-color: var(--danger-background);
    border-color: var(--danger-border);
}

div.body div.admonition.error {
    background-color: var(--error-background);
    border-color: var(--error-border);
}

div.body div.admonition.hint {
    background-color: var(--hint-background);
    border-color: var(--hint-border);
}

div.body div.admonition.seealso {
    background-color: var(--seealso-background);
    border-color: var(--seealso-border);
}

div.body div.admonition.tip {
    background-color: var(--tip-background);
    border-color: var(--tip-border);
}

div.body div.admonition.warning {
    background-color: var(--warning-background);
    border-color: var(--warning-border);
}

div.body div.impl-detail {
    border-radius: 3px;
}

div.body div.impl-detail > p {
    margin: 0;
}

div.body a {
    color: #0072aa;
}

div.body a:visited {
    color: #6363bb;
}

div.body a:hover {
    color: #00b0e4;
}

tt, code, pre {
    font-family: Menlo, Consolas, Monaco, Liberation Mono, Lucida Console, monospace;
    font-size: 96.5%;
}

div.body pre {
    line-height: 120%;
}

div.body tt,
div.body code {
    border-radius: 3px;
}

div.body tt.descname,
div.body code.descname {
    font-size: 120%;
}

div.body tt.xref,
div.body a tt,
div.body code.xref,
div.body a code {
    font-weight: normal;
}

table.docutils {
    border: 1px solid #ddd;
    min-width: 20%;
    border-radius: 3px;
    margin-top: 10px;
    margin-bottom: 10px;
}

table.docutils td,
table.docutils th {
    border: 1px solid #ddd !important;
    border-radius: 3px;
    padding: 0.3em 0.5em;
}

table p,
table li {
    text-align: left !important;
}

table.docutils th {
    background-color: #eee;
}

table.footnote,
table.footnote td {
    border: 0 !important;
}

div.footer {
    line-height: 150%;
    text-align: right;
    width: auto;
    margin-right: 10px;
}

div.footer a {
    text-underline-offset: auto;
}

div.footer a:hover {
    color: #0095c4;
}

/* C API return value annotations */
:root {
    --refcount: var(--good-color);
    --refcount-return-borrowed-ref: var(--middle-color);
}

.refcount {
    color: var(--refcount);
}

.refcount.return_borrowed_ref {
    color: var(--refcount-return-borrowed-ref)
}

.stableabi {
    color: #229;
}

/* C API thread safety annotations */
:root {
    --threadsafety-incompatible: var(--bad-color);
    --threadsafety-compatible: var(--middle-color);
    --threadsafety-distinct: var(--middle-color);
    --threadsafety-shared: var(--good-color);
    --threadsafety-atomic: var(--good-color);
}

.threadsafety.threadsafety-incompatible {
    color: var(--threadsafety-incompatible);
}

.threadsafety.threadsafety-compatible {
    color: var(--threadsafety-compatible);
}

.threadsafety.threadsafety-distinct {
    color: var(--threadsafety-distinct);
}

.threadsafety.threadsafety-shared {
    color: var(--threadsafety-shared);
}

.threadsafety.threadsafety-atomic {
    color: var(--threadsafety-atomic);
}


dl > dt span ~ em,
.sig {
    font-family: Menlo, Consolas, Monaco, Liberation Mono, Lucida Console, monospace;
}

.toctree-wrapper ul {
    padding-left: 20px;
}

.theme-selector {
    margin-left: .5em;
}

div.genindex-jumpbox,
div.genindex-jumpbox > p {
    display: inline-flex;
    flex-wrap: wrap;
}

div.genindex-jumpbox a {
    margin: 0 5px;
    min-width: 30px;
    text-align: center;
}

.copybutton {
    cursor: pointer;
    position: absolute;
    top: 0;
    right: 0;
    font-family: Menlo, Consolas, Monaco, Liberation Mono, Lucida Console, monospace;
    font-size: 80%;
    padding-left: .5em;
    padding-right: .5em;
    height: 100%;
    max-height: min(100%, 2.4em);
    border-radius: 0 3px 0 0;
    color: #000;
    background-color: #fff;
    border: 1px solid #ac9; /* follows div.body pre */
    display: none;
}

.copybutton:hover {
    background-color: #eee;
}

.copybutton:active {
    background-color: #ddd;
}

.highlight:active .copybutton {
    display: block;
}

.highlight:hover .copybutton {
    display: block;
}

@media (max-width: 1023px) {
    /* Body layout */
    div.body {
        min-width: 100%;
        padding: 0;
        font-size: 0.875rem;
    }
    div.bodywrapper {
        margin: 0;
    }
    /* Typography */
    div.body h1 {
        font-size: 1.625rem;
    }
    div.body h2 {
        font-size: 1.25rem;
    }
    div.body h3, div.body h4, div.body h5 {
        font-size: 1rem;
    }
    /* Override default styles to make more readable */
    div.body ul {
        padding-inline-start: 1rem;
    }
    div.body blockquote {
        margin-inline-start: 1rem;
        margin-inline-end: 0;
    }
    /* Remove sidebar and top related bar */
    div.related, div.sphinxsidebar {
        display: none;
    }
    /* Anchorlinks are not hidden by fixed-positioned navbar when scrolled to */
    html {
        scroll-padding-top: 40px;
    }
    body {
        margin-top: 40px;
    }

    /* Top navigation bar */
    .mobile-nav {
        display: block;
        height: 40px;
        width: 100%;
        position: fixed;
        top: 0;
        left: 0;
        box-shadow: rgba(0, 0, 0, 0.25) 0 0 2px 0;
        z-index: 1;
    }
    .mobile-nav * {
        box-sizing: border-box;
    }
    .nav-content {
        position: absolute;
        z-index: 1;
        height: 40px;
        width: 100%;
        display: flex;
        background-color: white;
    }
    .nav-items-wrapper {
        display: flex;
        flex: auto;
        padding: .25rem;
        align-items: stretch;
    }
    .nav-logo {
        margin-right: 1rem;
        flex-shrink: 0;
        align-self: center;
    }
    .nav-content img {
        display: block;
        width: 20px;
    }
    .version_switcher_placeholder {
        margin-right: 1rem;
    }
    .version_switcher_placeholder > select {
        height: 100%;
    }
    .nav-content .search {
        display: flex;
        flex: auto;
        border: 1px solid #a9a9a9;
        align-items: stretch;
    }
    .nav-content .search input[type=search] {
        border: 0;
        padding-left: 24px;
        width: 100%;
        flex: 1;
    }
    .nav-content .search input[type=submit] {
        height: 100%;
        box-shadow: none;
        border: 0;
        border-left: 1px solid #a9a9a9;
        cursor: pointer;
        margin-right: 0;
    }
    .nav-content .search svg {
        position: absolute;
        align-self: center;
        padding-left: 4px;
    }
    .toggler__input {
        display: none;
    }
    .toggler__label {
        width: 40px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 8px;
        flex-shrink: 0;
    }
    .toggler__label:hover, .toggler__label:focus {
        background-color: rgba(127 127 127 / 50%);
    }
    .toggler__label > span {
        position: relative;
        flex: none;
        height: 2px;
        width: 100%;
        background: currentColor;
        transition: all 400ms ease;
    }
    .toggler__label > span::before,
    .toggler__label > span::after {
        content: '';
        height: 2px;
        width: 100%;
        background: inherit;
        position: absolute;
        left: 0;
        top: -8px;
    }
    .toggler__label > span::after {
        top: 8px;
    }
    .toggler__input:checked ~ nav > .toggler__label span {
        transform: rotate(135deg);
    }
    .toggler__input:checked ~ nav > .toggler__label span::before {
        transform: rotate(90deg);
    }
    .toggler__input:checked ~ nav > .toggler__label span::before,
    .toggler__input:checked ~ nav > .toggler__label span::after {
        top: 0;
    }
    .toggler__input:checked:hover ~ nav > .toggler__label span {
        transform: rotate(315deg);
    }
    .toggler__input:checked ~ .menu-wrapper {
        visibility: visible;
        left: 0;
    }

    /* Sliding side menu */
    .menu-wrapper {
        display: block;
        position: fixed;
        top: 0;
        transition: left 400ms ease;
        left: -310px;
        width: 300px;
        height: 100%;
        background-color: #eee;
        color: #444444;
        box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
        overflow-y: auto;
    }
    .menu-wrapper.open {
        visibility: visible;
        left: 0;
    }
    .menu {
        padding: 40px 10px 30px 20px;
    }
    .menu-wrapper h3,
    .menu-wrapper h4 {
        margin-bottom: 0;
        font-weight: normal;
    }
    .menu-wrapper h4 {
        font-size: 1.3em;
    }
    .menu-wrapper h3 {
        font-size: 1.4em;
    }
    .menu-wrapper h3 + p,
    .menu-wrapper h4 + p {
        margin-top: 0.5rem;
    }
    .menu a {
        font-size: smaller;
        text-decoration: none;
    }
    .menu ul {
        list-style: none;
        line-height: 1.4;
        overflow-wrap: break-word;
        padding-left: 0;
    }
    .menu ul ul {
        margin-left: 20px;
        list-style: square;
    }
    .menu ul li {
        margin-bottom: 0.5rem;
    }
    .language_switcher_placeholder {
        margin-top: 2rem;
    }
    .language_switcher_placeholder select {
        width: 100%;
    }
    .document {
        position: relative;
        z-index: 0;
    }
    /*Responsive tables*/
    .responsive-table__container {
        width: 100%;
        overflow-x: auto;
    }

    .menu .theme-selector-label {
        margin-top: .5em;
        display: flex;
        width: 100%;
    }

    .menu .theme-selector {
        flex: auto;
    }
}

@media (min-width: 1024px) {
    div.footer {
        margin-top: -2em;
    }
}

/* Version change directives */
:root {
    --versionadded: var(--good-color);
    --versionchanged: var(--middle-color);
    --deprecated: var(--bad-color);
    --soft-deprecated: rgb(175, 0, 255);

    --versionadded-border: var(--good-border);
    --versionchanged-border: var(--middle-border);
    --deprecated-border: var(--bad-border);
    --soft-deprecated-border: rgb(175, 0, 255);
}

div.versionadded,
div.versionchanged,
div.deprecated,
div.deprecated-removed {
    border-left: 3px solid;
    padding: 0 1rem;
}

div.versionadded {
    border-left-color: var(--versionadded-border);
}

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

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

div.soft-deprecated {
    border-left-color: var(--soft-deprecated-border);
}

div.versionadded .versionmodified {
    color: var(--versionadded);
}

div.versionchanged .versionmodified {
    color: var(--versionchanged);
}

div.deprecated .versionmodified,
div.deprecated-removed .versionmodified,
div.versionremoved .versionmodified {
    color: var(--deprecated);
}

div.soft-deprecated .versionmodified {
    color: var(--soft-deprecated);
}

/* Hide header when printing */
@media print {
    div.mobile-nav {
        display: none;
    }
}
