/* Copyright 2024 Remy Blank <remy@c-space.org> */
/* SPDX-License-Identifier: MIT */

/* As a convention, :not(#¶) is used to add to the ID specificity weight and
   :not(.¶) to add to the CLASS specificity weight. !important is only used to
   overide styles set on elements directly. */

/* Set global variables. */
html:not(#¶) {
    /* Remove "Cascadia Code", it has programming ligatures. */
    --pst-font-family-monospace-system: ui-monospace, "Source Code Pro",
        "Menlo", "Consolas", "DejaVu Sans Mono", monospace;
    /* Revert font attributes to pre pydata-sphinx-theme 0.16.0. */
    --pst-font-size-h1: 2.5rem;
    --pst-font-size-h2: 2rem;
    --pst-font-size-h6: 1.1rem;
    --pst-font-weight-heading: 400;
    /* Use the same color for "high-contrast" links as for normal ones. */
    --pst-color-link-higher-contrast: var(--pst-color-link);
}

/* Utility classes */
.hidden:not(#¶) {
    display: none;
}
section.hidden-heading:not(#¶) > :is(h1, h2, h3, h4, h5, h6):first-child {
    display: none;
}
.line-height-normal:not(#¶) .highlight pre {
    line-height: normal;
}
@media print {
    .no-print {
        display: none !important;
    }
}

/* Set the maximum width of sidebars instead of a fixed width. */
:is(div, aside).sidebar {
    max-width: 40%;
    width: inherit;
}

/* Make rulers darker. */
hr {
    opacity: 1;
}

/* BUG(pydata-sphinx-theme): The first paragraph in list items has a smaller
   bottom margin. We want that only if it's the only child, or if it's followed
   by a sub-list as a last child. */
:is(ol, ul) li
        > p:first-child:not(:last-child, :has(+ :is(ol, ul):last-child)) {
    margin-bottom: 1.15rem;
}
:is(ol, ul) li > :is(ol, ul) {
    margin-bottom: 1rem;
}

/* Invert the even and odd row colors in tables, so that the first row below the
   header has a different color than the header. */
.table > tbody > tr:nth-child(even) {
    background-color: var(--pst-color-table-row-zebra-low-bg);
}
.table > tbody > tr:nth-child(odd) {
    background-color: var(--pst-color-table-row-zebra-high-bg);
}
.table > tbody.inv > tr:nth-child(even) {
    background-color: var(--pst-color-table-row-zebra-high-bg);
}
.table > tbody.inv > tr:nth-child(odd) {
    background-color: var(--pst-color-table-row-zebra-low-bg);
}
.table > tbody > tr:hover:not(.¶) {
    background-color: var(--pst-color-table-row-hover-bg);
}

/* Give more specificity to table-related rules in basic.css. */
:is(th, td):not(.¶) > :first-child {
    margin-top: 0;
}
:is(th, td):not(.¶) > :last-child {
    margin-bottom: 0;
}

/* Classes to revert table styles from pydata-sphinx-theme. */
.table.reset {
    border: 0 solid var(--pst-color-table-inner-border);
    background-color: initial;
}
.table.reset > :is(thead, tbody, tfoot),
.table.reset > :is(thead, tbody, tfoot) > tr,
.table.reset > :is(thead, tbody, tfoot) > tr:hover,
.table.reset > :is(thead, tbody, tfoot) > tr > :is(th, td) {
    border: 0 solid;
    border-color: inherit;
    background-color: initial;
}
.table.reset > :is(thead, tbody, tfoot) > tr > :is(th, td) {
    box-shadow: initial;
    padding: initial;
}
@media print {
    .table.reset-print {
        border: 0 solid black;
        background-color: initial;
    }
    .table.reset-print > :is(thead, tbody, tfoot),
    .table.reset-print > :is(thead, tbody, tfoot) > tr,
    .table.reset-print > :is(thead, tbody, tfoot) > tr:hover,
    .table.reset-print > :is(thead, tbody, tfoot) > tr > :is(th, td) {
        border: 0 solid;
        border-color: inherit;
        background-color: initial;
    }
    .table.reset-print > :is(thead, tbody, tfoot) > tr > :is(th, td) {
        box-shadow: initial;
        padding: initial;
    }
}

/* Make quotation attributions a bit more compact. */
blockquote div > p:has(+ p.attribution) {
    margin-bottom: 0;
}

/* Build status */
.article-header-buttons > button.btn-build-status {
    display: none;
}
html[data-tdoc-build-status=building]
        .article-header-buttons > button.btn-build-status {
    display: flex;
    --fa: '\f2f1';  /* rotate */
    color: var(--pst-color-warning);
    animation: spin 4s linear infinite;
}
html[data-tdoc-build-status=failure]
        .article-header-buttons > button.btn-build-status {
    display: flex;
    --fa: '\f071';  /* triangle-exclamation */
    color: var(--pst-color-danger);
}

/* TOC */
.bd-sidebar-primary li:is(.toctree-l1, .toctree-l2, .toctree-l3) > a {
    padding-left: 1.25rem;  /* The original padding is 0.65rem */
    text-indent: -0.6rem;
}
.page-toc li:is(.toc-h2, .toc-h3, .toc-h4, .toc-h5, .toc-h6) > a {
    padding-left: 1.5rem;  /* The original padding is 1rem */
    text-indent: -0.5rem;
}
.bd-toc .nav .toc-entry a.nav-link {
    /* Revert increased padding introduced in pydata-sphinx-theme 0.16.0. */
    padding-top: 0.125rem;
    padding-bottom: 0.125rem;
}
@media (min-width: 1200px) {
    .bd-sidebar-secondary {
        /* Remove undesired padding introduced in sphinx-book-theme 1.2.0. */
        padding-left: 0;
        padding-right: 0;
    }
}

/* Layout */
.page-break {
    break-before: page;
}
.column-break {
    break-before: column;
}
.allow-break-inside:not(#¶) {
    break-inside: auto;
}
.avoid-break-inside:not(#¶) {
    break-inside: avoid;
}
.columns-2 {
    column-count: 2;
}
.columns-3 {
    column-count: 3;
}
.columns-4 {
    column-count: 4;
}
.columns-5 {
    column-count: 5;
}
.columns-6 {
    column-count: 6;
}
.columns-7 {
    column-count: 7;
}
.columns-8 {
    column-count: 8;
}
.grid-1 {
    display: grid;
    grid-template-columns: 1fr;
}
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
}
.grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
}
.grid-4 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
}
.grid-5 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
}
.grid-6 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr;
}
.grid-7 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr 1fr;
}
.grid-8 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr;
}
.tdoc-hspace {
    display: inline-block;
}
.tdoc-vspace {
    display: block;
}

/* Hidden elements */
html:is([data-tdoc-hide~=navigation], [data-tdoc-hide~=navbar])
        .bd-header-article,
html:is([data-tdoc-hide~=navigation], [data-tdoc-hide~=primary-sidebar])
        .bd-sidebar-primary,
html:is([data-tdoc-hide~=navigation], [data-tdoc-hide~=primary-sidebar])
        .header-article-item:has(> button.primary-toggle),
html:is([data-tdoc-hide~=navigation], [data-tdoc-hide~=secondary-sidebar])
        :is(.bd-sidebar-secondary, #print-main-content),
html:is([data-tdoc-hide~=navigation], [data-tdoc-hide~=prev-next])
        .prev-next-footer,
html:is([data-tdoc-hide~=navigation], [data-tdoc-hide~=footer])
        .bd-footer-content {
    display: none;
}

/* Keep some space between the title and the article when the TOC is removed. */
@media print {
    html:is([data-tdoc-hide~=navigation], [data-tdoc-hide~=primary-sidebar])
            .bd-main .bd-content .bd-article {
        padding-top: 1.5rem;
    }
}

/* Leaders. The EOL leaders are heavily inspired from
   https://markentier.tech/posts/2021/03/responsive-toc-leader-lines-with-css/ */
.tdoc-leader.eol {
    position: relative;
    overflow: hidden;
}
.tdoc-leader.eol::after {
    position: absolute;
    bottom: 0;
    margin-left: 0.5rem;
}
.tdoc-leader:not(.eol) {
    display: inline-block;
    overflow: hidden;
    vertical-align: bottom;
}
.tdoc-leader::after {
    white-space: nowrap;
}
.tdoc-leader.c\.::after {
    content: "................................................................"
             "................................................................"
             "................................................................"
             "................................................................"
             "................................................................"
             "................................................................";
}
.tdoc-leader.cdot::after {
    content: "․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․"
             "․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․"
             "․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․"
             "․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․";
}
.tdoc-leader.c\_::after {
    content: "________________________________________________________________"
             "________________________________________________________________"
             "________________________________________________________________"
             "________________________________________________________________";
}

/* Grids */
.tdoc-grid {
    margin: 1rem 0;
    display: grid;
    gap: 1rem;
}
.tdoc-grid > div > :first-child {
    margin-top: 0;
}
.tdoc-grid > div > :last-child {
    margin-bottom: 0;
}

/* List styling */
:is(ol, ul) {
    column-gap: 2rem;
}
:is(ol, ul).none {
    list-style-type: none;
    padding-left: 0;
    column-gap: normal;
}
:is(ol, ul).disc {
    list-style-type: disc;
}
:is(ol, ul).circle {
    list-style-type: circle;
}
:is(ol, ul).square {
    list-style-type: square;
}
:is(ol, ul).decimal {
    list-style-type: decimal;
}
:is(ol, ul).decimal-leading-zero {
    list-style-type: decimal-leading-zero;
}
:is(ol, ul).lower-alpha {
    list-style-type: lower-alpha;
}
:is(ol, ul).upper-alpha {
    list-style-type: upper-alpha;
}
:is(ol, ul).lower-greek {
    list-style-type: lower-greek;
}
:is(ol, ul).lower-roman {
    list-style-type: lower-roman;
}
:is(ol, ul).upper-roman {
    list-style-type: upper-roman;
}
@counter-style decimal-paren {
    system: extends decimal;
    suffix: ') ';
}
@counter-style decimal-leading-zero-paren {
    system: extends decimal-leading-zero;
    suffix: ') ';
}
@counter-style lower-alpha-paren {
    system: extends lower-alpha;
    suffix: ') ';
}
@counter-style upper-alpha-paren {
    system: extends upper-alpha;
    suffix: ') ';
}
@counter-style lower-greek-paren {
    system: extends lower-greek;
    suffix: ') ';
}
@counter-style lower-roman-paren {
    system: extends lower-roman;
    suffix: ') ';
}
@counter-style upper-roman-paren {
    system: extends upper-roman;
    suffix: ') ';
}
:is(ol, ul).decimal-paren {
    list-style-type: decimal-paren;
}
:is(ol, ul).decimal-leading-zero-paren {
    list-style-type: decimal-leading-zero-paren;
}
:is(ol, ul).lower-alpha-paren {
    list-style-type: lower-alpha-paren;
}
:is(ol, ul).upper-alpha-paren {
    list-style-type: upper-alpha-paren;
}
:is(ol, ul).lower-greek-paren {
    list-style-type: lower-greek-paren;
}
:is(ol, ul).lower-roman-paren {
    list-style-type: lower-roman-paren;
}
:is(ol, ul).upper-roman-paren {
    list-style-type: upper-roman-paren;
}
:is(ol, ul).decimal-paren > li,
:is(ol, ul).decimal-leading-zero-paren > li,
:is(ol, ul).lower-alpha-paren > li,
:is(ol, ul).lower-greek-paren > li,
:is(ol, ul).lower-roman-paren > li,
:is(ol, ul).upper-roman-paren > li {
    padding-left: 0.5rem;
}
:is(ol, ul).hsep-0 > li {
    padding-left: 0;
}
:is(ol, ul).hsep-1 > li {
    padding-left: 0.5rem;
}
:is(ol, ul).hsep-2 > li {
    padding-left: 1rem;
}
:is(ol, ul).hsep-3 > li {
    padding-left: 1.5rem;
}
:is(ol, ul).hsep-4 > li {
    padding-left: 2rem;
}
:is(ol, ul).vsep-1 > li:not(:first-child) {
    margin-top: 0.5rem;
}
:is(ol, ul).vsep-2 > li:not(:first-child) {
    margin-top: 1rem;
}
:is(ol, ul).vsep-3 > li:not(:first-child) {
    margin-top: 1.5rem;
}
:is(ol, ul).vsep-4 > li:not(:first-child) {
    margin-top: 2rem;
}
:is(ol, ul).avoid-break-items > li {
    break-inside: avoid;
}
ul.contains-task-list {
    padding-left: 0.8rem;
}
ul.contains-task-list > li.task-list-item {
    list-style-type: none;
}
ul.contains-task-list > li.task-list-item input.task-list-item-checkbox {
    margin-right: 0.8rem;
}
ul.contains-task-list > li.task-list-item
        input.task-list-item-checkbox:disabled {
    appearance: none;
}
ul.contains-task-list > li.task-list-item
        input.task-list-item-checkbox:disabled::before {
    --tdoc-fa-font: var(--fa-font-regular);
    --fa: "\f0c8";  /* square */
}
ul.contains-task-list > li.task-list-item
        input.task-list-item-checkbox:disabled:checked::before {
    --tdoc-fa-font: var(--fa-font-solid);
    --fa: "\f14a";  /* square-check */
}

/* Grid tables */
table.grid {
    margin: 1rem auto;
    text-align: center;
}
table.grid > :is(thead, tbody) > tr > :is(th, td) {
    border: 1px solid var(--pst-color-text-base);
    padding: 0.1rem 0.5rem;
}
table.grid > :is(thead, tbody) > tr > :is(th, td).l {
    text-align: left;
}
table.grid > :is(thead, tbody) > tr > :is(th, td).r {
    text-align: right;
}

/* Function tables */
table.function-table {
    margin: 1rem 0;
    text-align: center;
}
table.function-table > :is(thead, tbody) > tr:not(:last-child) {
    border-bottom: 1px solid var(--pst-color-text-base);
}
table.function-table > :is(thead, tbody) > tr > :is(th, td) {
    border-right: 1px solid var(--pst-color-text-base);
    padding: 0.1rem 0.5rem;
}
table.function-table > :is(thead, tbody) > tr > :is(th, td).l {
    text-align: left;
}
table.function-table > :is(thead, tbody) > tr > :is(th, td).r {
    text-align: right;
}
table.function-table > :is(thead, tbody) > tr > :is(th, td).g {
    background-color: var(--pst-color-border);
}
table.function-table > :is(thead, tbody) > tr > :is(th, td).w {
    min-width: 5rem;
}
table.function-table > :is(thead, tbody) > tr
        > :is(th, td):is(:first-child, :last-child) {
    border-right: 3px double var(--pst-color-text-base);
}

/* Table alignment */
table.align-left {
    margin-left: 0;
    margin-right: auto;
}
table.align-center {
    margin-left: auto;
    margin-right: auto;
}
table.align-right {
    margin-left: auto;
    margin-right: 0;
}

/* Framed blocks */
div.frame.docutils.container {
    margin-bottom: 1rem;
    border: 1px solid var(--pst-color-border);
    border-radius: 0.25rem;
    padding: 1rem;
}
div.frame.docutils.container > p.rubric {
    margin-bottom: 0.5rem;
    border-bottom: none;
}
div.frame.docutils.container > :first-child:not(#¶) {
    margin-top: 0;
}
div.frame.docutils.container > :last-child:not(#¶) {
    margin-bottom: 0;
}

/* BUG(pydata-sphinx-theme): Rubric headings have "display: flex" for no
   apparent reason. This causes issues when the headings contain formatted
   text. */
p.rubric {
    display: block;
}

/* Fix the layout of admonition content. pydata-sphinx-theme sets left and right
   margins on all direct descendants, which breaks horizontal alignment classes.
   Use padding on the container instead, and remove the margins through
   patching. Also, set a bottom margin on the title. */
.admonition,
div.admonition {
    padding-left: 2rem;
    padding-right: 2rem;
}
.admonition > .admonition-title,
div.admonition > .admonition-title {
    margin-left: -2rem;
    margin-right: -2rem;
    margin-bottom: 0.4em;
}

/* Admonitions */
.admonition.dropdown .admonition-title {
    cursor: pointer;
}
.admonition.dropdown .admonition-title:hover {
    box-shadow: inset 0 0 0px 20px rgb(0 0 0 / 1%);
}
.admonition.dropdown .admonition-title:active {
    box-shadow: inset 0 0 0px 20px rgb(0 0 0 / 3%);
}
.admonition.dropdown .admonition-title button {
    position: absolute;
    right: 0;
    outline: none;
    border: none;
    padding: 0;
    background: none;
}
.admonition.dropdown .admonition-title ~ * {
    transition: opacity 0.3s;
}
.admonition.dropdown:not(.expand) {
    padding-bottom: 0;
}
.admonition.dropdown:not(.expand) .admonition-title {
    margin-bottom: 0;
}
.admonition.dropdown:not(.expand) .admonition-title ~ * {
    display: block !important;
    margin: 0 !important;
    border: none !important;
    padding: 0 !important;
    height: 0 !important;
    visibility: hidden !important;
    overflow: hidden !important;
    opacity: 0 !important;
}
@media print {
    .admonition.dropdown:not(.expand) {
        display: none;
    }
}

/* Iframes */
iframe.tdoc {
    display: block;
    width: 100%;
    aspect-ratio: 16/9;
    margin: 1rem auto;
}

/* Solutions */
html[data-tdoc-solutions]:not([data-tdoc-solutions-ctrl],
                              [data-tdoc-solutions-state=show])
        .admonition.solution:not(.always-show) {
    display: none;
}
html[data-tdoc-solutions-ctrl]:not([data-tdoc-solutions-state=show])
        .admonition.solution:not(.always-show) > .admonition-title {
    background-image: linear-gradient(-45deg,
        #00000020 5%, #00000000 5% 50%, #00000020 50% 55%, #00000000 55%);
    background-size: 28.28px 28.28px;
}
html[data-theme=dark][data-tdoc-solutions-ctrl]:not([data-tdoc-solutions-state=show])
        .admonition.solution:not(.always-show) > .admonition-title {
    background-image: linear-gradient(-45deg,
        #ffffff30 5%, #00000000 5% 50%, #ffffff30 50% 55%, #00000000 55%);
    background-size: 28.28px 28.28px;
}
html:is([data-tdoc-solutions-state=show]) .article-header-buttons
        > button.btn-toggle-solutions .fa-eye {
    --fa: '\f070';  /* eye-slash */
}
html:not([data-tdoc-solutions-ctrl], [data-tdoc-solutions=hide])
        .article-header-buttons > button.btn-toggle-solutions {
    display: none;
}
html[data-tdoc-solutions-ctrl] .bd-header-article {
    /* Don't hide the navbar when dynamic solutions can be controlled. */
    display: flex;
}

/* Inline code */
a code {
    color: inherit;
}
code.xref,
a code {
    font-weight: inherit;
}

/* Code blocks */
div.literal-block-wrapper {
    overflow: hidden;
}
div.literal-block-wrapper div.code-block-caption {
    padding: 0.3rem;
}
div.literal-block-wrapper div.highlight {
    border-radius: 0;
}
div.literal-block-wrapper div.highlight pre {
    border: none;
    border-radius: 0;
}
div.highlight {
    position: relative;
}
div.highlight pre {
    padding: 0.5rem;
}
div.highlight pre > .linenos {
    margin-right: 8px;
    border-right: 1px solid var(--pst-color-border);
}
div.highlight pre > .linenos::before {
    content: attr(data-n);
}

/* Icons */
.tfa::before,
.tfar::before,
:is(.tdoc, [class^=tdoc-], [class*=" tdoc-"]):is([class^=fa-],
                                                 [class*=" fa-"])::before,
:is(.tdoc, [class^=tdoc-], [class*=" tdoc-"]) :is([class^=fa-],
                                                  [class*=" fa-"])::before,
ul.contains-task-list > li.task-list-item
        input.task-list-item-checkbox:disabled::before {
    display: inline-block;
    font: var(--tdoc-fa-font, var(--fa-font-solid));
    text-rendering: auto;
    -webkit-font-smoothing: antialiased;
    content: var(--fa) / "";
}
.tfar {
    --tdoc-fa-font: var(--fa-font-regular);
}

/* Buttons */
button:is(.tdoc, [class^=tdoc-], [class*=" tdoc-"]) {
    border: 1px solid var(--pst-color-border);
    border-radius: 0.25rem;
    background-color: var(--pst-color-surface);
    transition: background-color 0.3s;
}
button:is(.tdoc, [class^=tdoc-], [class*=" tdoc-"]):not([disabled]) {
    color: var(--pst-color-text-muted);
}
button:is(.tdoc, [class^=tdoc-], [class*=" tdoc-"]):not([disabled]):hover {
    background-color: var(--pst-color-border);
}
button:is(.tdoc, [class^=tdoc-], [class*=" tdoc-"]):is([class^=fa-],
                                                       [class*=" fa-"]) {
    width: 1.8rem;
    height: 1.8rem;
    display: inline-flex;
    justify-content: center;
    align-items: center;
}

/* Input fields */
input[type=text]:is(.tdoc, [class^=tdoc-], [class*=" tdoc-"]) {
    border: 1px solid var(--pst-color-border);
    border-radius: 0.25rem;
    padding-block: 1px;
    padding-inline: 2px;
}
select:is(.tdoc, [class^=tdoc-], [class*=" tdoc-"]) {
    background-color: field;
    border: 1px solid var(--pst-color-border);
    border-radius: 0.25rem;
    padding: 2px;
}

/* Drawing */
.bd-header-article .header-article-items__start {
    display: flex;
    align-items: start;
    gap: 0.5rem;
}
html[data-tdoc-draw] .article-header-buttons > button.btn-draw {
    background-color: var(--pst-color-border);
}
html:not([data-tdoc-draw]) .tdoc-draw-toolbar {
    display: none;
}
.tdoc-draw-toolbar input[type=checkbox] {
    appearance: none;
}
.tdoc-draw-toolbar input[type=checkbox]:checked {
    background-color: var(--pst-color-border);
}
.tdoc-draw-toolbar .tdoc-size {
    margin-left: 0.5rem;
    margin-right: 0.5rem;
    width: 4rem;
}
.tdoc-draw-toolbar .tdoc-size:focus-visible {
    outline: none;
}
.tdoc-draw-toolbar :is(.tdoc-tool, .tdoc-color) button {
    width: 2.5rem;
    justify-content: center;
}
.tdoc-draw-toolbar :is(.tdoc-tool, .tdoc-color) .dropdown-menu {
    min-width: 0;
}
.tdoc-draw-toolbar :is(.tdoc-tool, .tdoc-color) .dropdown-item {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    font-size: 1.3rem;
    justify-content: center;
}
.bd-content {
    position: relative;
}
svg#tdoc-drawing {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    pointer-events: none;
}
html[data-tdoc-draw] svg#tdoc-drawing {
    pointer-events: auto;
    touch-action: none;
}
@media print {
    svg#tdoc-drawing {
        display: none;
    }
}

/* Quizzes */
tdoc-quiz {
    display: flex;
    width: 100%;
    flex-direction: row;
    column-gap: 0.3rem;
}
tdoc-quiz > .content {
    position: relative;
    flex-basis: 100%;
}
tdoc-quiz > .controls {
    display: flex;
    flex-direction: column;
    row-gap: 0.3rem;
}
tdoc-quiz button.tdoc-check:disabled {
    color: var(--pst-color-success);
    border: none;
    background-color: var(--pst-color-success-bg);
}
tdoc-quiz .tdoc-quiz-hint {
    display: inline-block;
    position: absolute;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    border-left: 0.2rem solid var(--pst-color-success);
    background-color: var(--pst-color-success-bg);
    box-shadow: 0 0.2rem 0.5rem var(--pst-color-shadow),
                0 0 0.0625rem var(--pst-color-shadow);
    z-index: 100;
    visibility: hidden;
    opacity: 0;
    transition: 0.3s visibility, 0.3s opacity;
}
tdoc-quiz .tdoc-quiz-hint.show {
    visibility: visible;
    opacity: unset;
}
tdoc-quiz .tdoc-quiz-hint.invalid {
    border-left: 0.2rem solid var(--pst-color-warning);
    background-color: var(--pst-color-warning-bg);
}
tdoc-quiz .tdoc-quiz-field.right,
tdoc-quiz ul.tdoc-quiz-group.right {
    float: right;
    clear: right;
    margin-left: 1rem;
}
tdoc-quiz .tdoc-quiz-field.right + .tdoc-quiz-field.right {
    margin-top: 0.25rem;
}
tdoc-quiz ul.tdoc-quiz-group.right + p {
    margin-top: 0.25rem;
}
tdoc-quiz ul.tdoc-quiz-group.right + p:last-child {
    margin-bottom: 0.25rem;
}
tdoc-quiz :has(> :is(.tdoc-quiz-field, ul.tdoc-quiz-group).right)::after {
    content: ".";
    visibility: hidden;
    display: block;
    height: 0;
    clear: both;
}
tdoc-quiz ul.tdoc-quiz-group {
    margin-bottom: 0;
    padding-inline-start: 0;
    list-style: none;
    column-gap: 1rem;
    text-align: left;
}
tdoc-quiz ul.tdoc-quiz-group li {
    display: flex;
    align-items: baseline;
    column-gap: 0.6rem;
}
tdoc-quiz ul.tdoc-quiz-group li > input {
    margin-left: 0.3rem;
}
tdoc-quiz ul.tdoc-quiz-group li > label {
    flex-grow: 1;
}
tdoc-quiz ul.tdoc-quiz-group li > label > p:first-child {
    margin-top: 0;
}
tdoc-quiz ul.tdoc-quiz-group li > label > p:last-child {
    margin-bottom: 0;
}
tdoc-quiz .tdoc-quiz-field.bad,
tdoc-quiz ul.tdoc-quiz-group:has(.tdoc-quiz-field.bad) {
    background-color: var(--pst-color-danger-bg);
}
tdoc-quiz .tdoc-quiz-entry > tr > td:has(.tdoc-quiz-field, .tdoc-check) {
    vertical-align: baseline;
}
tdoc-quiz .tdoc-quiz-entry > tr > td:last-child {
    width: 0;
}

/* Polls */
tdoc-poll {
    display: block;
    margin: 1rem auto;
    border: 1px solid var(--pst-color-border);
    border-left: 0.3rem solid var(--pst-color-border);
    border-radius: 0.25rem;
    box-shadow: 0 0.2rem 0.5rem var(--pst-color-shadow),
                0 0 0.0625rem var(--pst-color-shadow);
    background-color: var(--pst-color-on-background);
    padding: 1rem;
    counter-reset: answerNum;
}
tdoc-poll.open {
    border-left-color: var(--pst-color-warning);
}
tdoc-poll .tdoc-poll-header > div {
    display: flex;
    white-space: nowrap;
    justify-content: space-between;
}
tdoc-poll .tdoc-poll-header .stats {
    display: flex;
    column-gap: 1.3rem;
}
tdoc-poll .tdoc-poll-header :is(.voters, .votes) > :last-child {
    margin-left: 0.4rem;
}
tdoc-poll[mode=single] .tdoc-poll-header .votes {
    display: none;
}
tdoc-poll.open .tdoc-poll-header .closed {
    display: none;
}
tdoc-poll .tdoc-poll-header .controls {
    display: none;
    column-gap: 0.3rem;
}
@media not print {
    html[data-tdoc-poll-control] tdoc-poll .tdoc-poll-header .controls {
        display: flex;
    }
}
tdoc-poll .tdoc-poll-answers:not(:has(.tdoc-poll-sel.s)) .tdoc-poll-header
        .controls > .tdoc-solutions {
    display: none;
}
tdoc-poll .tdoc-poll-header .controls > .tdoc-clear {
    margin-left: 0.5rem;
}
tdoc-poll .tdoc-poll-num {
    counter-increment: answerNum;
}
tdoc-poll.num-decimal .tdoc-poll-num::before {
    content: counter(answerNum, decimal);
}
tdoc-poll.num-lower-alpha .tdoc-poll-num::before {
    content: counter(answerNum, lower-alpha);
}
tdoc-poll.num-upper-alpha .tdoc-poll-num::before {
    content: counter(answerNum, upper-alpha);
}
tdoc-poll.solutions .tdoc-poll-sel.s {
    background-color: var(--pst-color-success-bg);
}
tdoc-poll .tdoc-poll-sel > span {
    visibility: hidden;
}
tdoc-poll .tdoc-poll-answers {
    margin-bottom: 0;
}
tdoc-poll .tdoc-poll-answers.table > tbody > tr {
    background-color: var(--pst-color-table-row-zebra-high-bg);
}
tdoc-poll .tdoc-poll-answers.table > tbody > tr > td {
    border-bottom-color: var(--pst-color-table-inner-border);
}
tdoc-poll .tdoc-poll-answers > tbody > tr.selected > td.tdoc-poll-sel > span {
    visibility: visible;
}
tdoc-poll .tdoc-poll-ans {
    width: 100%;
}
tdoc-poll tr[style*="--tdoc-value:"] > td.tdoc-poll-ans {
    background: linear-gradient(to right,
        var(--pst-color-attention-bg) var(--tdoc-value),
        var(--bs-table-bg) var(--tdoc-value));
}
tdoc-poll :is(.tdoc-poll-cnt, .tdoc-poll-pct) {
    text-align: right;
    white-space: nowrap;
}
tdoc-poll .tdoc-poll-answers:not(:has(.tdoc-poll-cnt:not(:empty)))
        .tdoc-poll-cnt,
tdoc-poll .tdoc-poll-answers:not(:has(.tdoc-poll-pct:not(:empty)))
        .tdoc-poll-pct {
    display: none;
}

/* Auto-sizing text area */
.tdoc-autosize {
    display: grid;
}
.tdoc-autosize > textarea {
    resize: none;
    overflow: hidden;
}
.tdoc-autosize::after {
    content: attr(data-text) " ";
    white-space: pre-wrap;
    visibility: hidden;
}
.tdoc-autosize > textarea,
.tdoc-autosize::after {
    border: 1px solid var(--pst-color-border);
    border-radius: 0.25rem;
    padding-block: 1px;
    padding-inline: 2px;
    font: inherit;
    grid-area: 1 / 1 / 2 / 2;
    word-break: break-word;
}

/* Editors */
div.cm-editor.cm-focused {
    outline: none;
}
div.cm-editor div.cm-scroller {
    font-family: var(--pst-font-family-monospace);
    font-size: 0.875em;
}
html[data-theme=dark] div.cm-editor {
    background-color: var(--pst-color-surface);
}
.tdoc-editor-status {
    height: 1.8rem;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    color: var(--pst-color-text-muted);
}
.tdoc-editor-status.local {
    --tdoc-fa-font: var(--fa-font-regular);
    --fa: '\f0c7';  /* floppy-disk */
}
.tdoc-editor-status.init {
    --fa: '\f0ed';  /* cloud-arrow-down */
}
.tdoc-editor-status.push {
    --fa: '\f2f1';  /* rotate */
    animation: spin 4s linear infinite;
}
.tdoc-editor-status.saved {
    --tdoc-fa-font: var(--fa-font-regular);
    --fa: '\f0c2';  /* cloud */
}
.tdoc-editor-status.error {
    --fa: '\f071';  /* triangle-exclamation */
    color: var(--pst-color-danger);
}
@keyframes spin {
    100% { transform: rotate(360deg); }
}

/* Exec blocks */
tdoc-exec {
    margin: 1rem 0;
    border-radius: 0.25rem;
    display: flex;
    flex-direction: row;
    column-gap: 0.3rem;
    clear: none;  /* From sphinx-book-theme.css */
    break-inside: avoid;  /* From pydata-sphinx-theme.css */
}
tdoc-exec div.highlight {
    flex-basis: 100%;
    overflow: auto;
}
tdoc-exec > div.tdoc-exec-controls {
    display: flex;
    flex-direction: column;
    row-gap: 0.3rem;
}
div.literal-block-wrapper > tdoc-exec {
    margin: 0;
}
div.literal-block-wrapper > tdoc-exec:has(.tdoc-exec-controls) pre {
    border-right: 1px solid var(--pst-color-border);
}
div.literal-block-wrapper > tdoc-exec > div.tdoc-exec-controls {
    margin-top: 0.3rem;
    margin-bottom: 0.3rem;
    margin-right: 0.3rem;
}
tdoc-exec[editor] div.highlight:has(> .cm-editor) :is(pre, button.copybtn) {
    display: none;
}
tdoc-exec[editor] div.cm-editor {
    height: 100%;
    max-height: 80vh;
    border: 1px solid var(--pst-color-border);
    border-radius: 0.25rem;
    overflow: hidden;
}
div.literal-block-wrapper > tdoc-exec[editor] div.cm-editor {
    border-top: none;
    border-bottom: none;
    border-left: none;
    border-radius: 0;
}
.tdoc-exec-coords {
    position: absolute;
    z-index: 100;
    pointer-events: none;
}
.tdoc-exec-coords > svg {
    position: absolute;
    left: -5px;
    top: -5px;
}
.tdoc-exec-coords > div {
    margin-left: 15px;
    margin-top: 15px;
    border: 1px solid var(--pst-color-info);
    border-radius: 0.25rem;
    padding: 0.1rem 0.2rem;
    text-wrap: nowrap;
    line-height: normal;
    background-color: var(--pst-color-info-bg);
    pointer-events: auto;
}

/* Exec outputs */
div.tdoc-exec-output {
    position: relative;
    margin: 1rem 0;
}
div.tdoc-exec-output :has(> button.tdoc-remove) {
    timeline-scope: --scroll-y;
    animation: --scroll-y forwards;
    animation-timeline: --scroll-y;
    container-name: --scroll;
}
@keyframes --scroll-x {
    0%,to { --scroll-x: 1; }
}
@keyframes --scroll-y {
    0%,to { --scroll-y: 1; }
}
div.tdoc-exec-output button.tdoc-remove {
    position: absolute;
    top: 0.3rem;
    right: 0.3rem;
    user-select: none;
    opacity: 0;
    transition: background-color 0.3s, opacity 0.3s;
}
@container --scroll style(--scroll-y: 1) {
    div.tdoc-exec-output button.tdoc-remove {
        right: 1.3rem;
    }
}
div.tdoc-exec-output:hover button.tdoc-remove {
    opacity: 1;
}
div.tdoc-exec-output.tdoc-sectioned {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    border: 1px solid var(--pst-color-border);
    border-top: 0.25rem solid var(--pst-color-border);
    border-radius: 0.25rem;
    overflow: hidden;
}
div.tdoc-exec-output.tdoc-sectioned:empty {
    display: none;
}
div.tdoc-exec-output.tdoc-sectioned > :not(:last-child) {
    border-bottom: 1px solid var(--pst-color-border);
}
div.tdoc-exec-output.tdoc-sectioned > div.highlight {
    border-radius: 0;
}
div.tdoc-exec-output.tdoc-sectioned > div.highlight > pre {
    border: none;
    border-radius: 0;
}
div.tdoc-exec-output.tdoc-sectioned > .canvas > canvas {
    display: block;
    margin: 0 auto;
}
div.tdoc-exec-output > div.tdoc-console > pre {
    max-height: 20rem;
    scroll-timeline: --scroll-y y;
}
div.tdoc-exec-output > div.tdoc-console > pre span.err {
    color: var(--pst-color-danger);
}
div.tdoc-exec-output > div.tdoc-console > pre span.warn {
    color: var(--pst-color-warning);
}
div.tdoc-exec-output > div.tdoc-console > pre span.info {
    color: var(--pst-color-info);
}
div.tdoc-exec-output > div.tdoc-console > pre span.debug {
    color: var(--pst-color-text-muted);
}
div.tdoc-exec-output.tdoc-sectioned > div.tdoc-input {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    margin: 0;
    padding: 0.3rem;
    column-gap: 0.3rem;
}
div.tdoc-exec-output.tdoc-sectioned > div.tdoc-input > .prompt {
    white-space: pre;
    padding-left: 0.2rem;
    padding-right: 0.2rem;
}
div.tdoc-exec-output.tdoc-sectioned > div.tdoc-input > .input {
    width: 100%;
}
div.tdoc-exec-output.tdoc-sectioned > div.tdoc-input > input[type=text] {
    border: 1px solid var(--pst-color-border);
    border-radius: 0.25rem;
    padding-block: 1px;
    padding-inline: 2px;
}
div.tdoc-exec-output > .tdoc-navbar {
    padding: 0.3rem;
    display: flex;
    flex-direction: row;
    column-gap: 0.3rem;
    background-color: var(--pst-color-background);
}
div.tdoc-exec-output > .tdoc-navbar > .tdoc-title {
    flex-basis: 100%;
    padding: 0 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
div.tdoc-exec-output > iframe {
    display: block;
    width: 100%;
    aspect-ratio: 16/9;
    background: white;
}
html.tdoc-fullscreen {
    overflow: hidden;
}
div.tdoc-exec-output.tdoc-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 2000;
    margin: 0;
    border: none;
}
div.tdoc-exec-output:not(.tdoc-fullscreen) > .tdoc-navbar .tdoc-restore {
    display: none;
}
div.tdoc-exec-output.tdoc-fullscreen > .tdoc-navbar .tdoc-maximize {
    display: none;
}
div.tdoc-exec-output.tdoc-fullscreen > iframe {
    height: 100% !important;  /* Override element style */
    aspect-ratio: auto;
}
div.tdoc-exec-output.tdoc-error {
    margin-bottom: 1rem;
    border: 1px solid var(--pst-color-danger);
    border-radius: 0.25rem;
    padding: 0.5rem;
    background-image: linear-gradient(-45deg,
        var(--pst-color-table-row-zebra-low-bg) 5%,
        var(--pst-color-table-row-zebra-high-bg) 5% 50%,
        var(--pst-color-table-row-zebra-low-bg) 50% 55%,
        var(--pst-color-table-row-zebra-high-bg) 55%);
    background-size: 28.28px 28.28px;
}
div.tdoc-exec-output .table > tbody > tr:nth-child(odd).tdoc-no-results {
    background-image: linear-gradient(-45deg,
        var(--pst-color-table-row-zebra-low-bg) 5%,
        var(--pst-color-table-row-zebra-high-bg) 5% 50%,
        var(--pst-color-table-row-zebra-low-bg) 50% 55%,
        var(--pst-color-table-row-zebra-high-bg) 55%);
    background-size: 28.28px 28.28px;
}

/* Exec blocks within quizzes */
tdoc-quiz ul.tdoc-quiz-group li > label tdoc-exec:first-child {
    margin-top: 0;
}
tdoc-quiz ul.tdoc-quiz-group li > label
        tdoc-exec.hidden:first-child + div.tdoc-exec-output {
    margin-top: 0;
}

/* Dynamically-rendered blocks */
tdoc-dyn:not(.¶) {
    display: block;
    margin: 1rem auto;
    border-radius: 0.25rem;
    text-align: center;
}
tdoc-dyn.frame {
    border: 1px solid var(--pst-color-border);
}
tdoc-dyn.align-left {
    margin-left: 0;
    text-align: left;
}
tdoc-dyn.align-right {
    margin-right: 0;
    text-align: right;
}
tdoc-dyn:not(.rendered) {
    padding: 0.5rem;
    text-align: left;
    color: var(--pst-color-text-base);
}
tdoc-dyn:not(.rendered):empty::after {
    content: "Rendering...";
}
html[data-tdoc-local] tdoc-dyn:not(.rendered) {
    /* Override border attributes set on the element. */
    border: 1px solid var(--pst-color-danger) !important;
}

/* JSXGraph boards */
tdoc-dyn[type=jsxgraph] {
    /* The magic value is used to detect the default in jsxgraph.js. */
    aspect-ratio: 142857 / 142857;
    border-color: var(--pst-color-border);
    border-radius: 0.25rem;
    background-color: var(--pst-color-background);
}
html[data-theme=dark] tdoc-dyn[type=jsxgraph]
        > :is(svg, div[class^=JXG]) {
    filter: invert(1) hue-rotate(180deg);
}
:fullscreen > tdoc-dyn[type=jsxgraph] {
    border: none;
    border-radius: 0;
}
.JXG_navigation > .JXG_navigation_button {
    padding-top: 0.2rem;
    padding-bottom: 0.2rem;
}
.JXG_navigation > .JXG_navigation_button > svg {
    top: unset;
}
@media print {
    tdoc-dyn[type=jsxgraph] .JXG_navigation {
        display: none;
    }
}

/* Chart.js charts */
tdoc-dyn[type=chartjs] {
    position: relative;
    aspect-ratio: 2;
    overflow: hidden;
}
tdoc-dyn[type=chartjs] > canvas {
    /* BUG(chart.js): Responsive resizing doesn't work properly when the canvas
       grows, because it keeps the container's previous height. Let the
       container adjust its height to the canvas so that the latter can grow.
       This also solves issues with printing, where the canvas would extend
       horizontally beyond the container.

       https://github.com/chartjs/Chart.js/issues/12177
       https://github.com/chartjs/Chart.js/issues/11005
       https://github.com/chartjs/Chart.js/issues/7006
    */
    width: 100% !important;
    height: auto !important;
}
html[data-theme=dark] tdoc-dyn[type=chartjs] > canvas {
    filter: invert(1) hue-rotate(180deg);
}

/* Mermaid diagrams */
tdoc-dyn[type=mermaid]:not([data-processed]) {
    color: #0000;
}
html[data-theme=dark] tdoc-dyn[type=mermaid] > svg {
    filter: invert(1) hue-rotate(180deg);
}
.mermaidTooltip {
    position: absolute;
    max-width: 30%;
    border: 1px solid var(--pst-color-border);
    border-radius: 0.25rem;
    padding: 2px 4px;
    background-color: var(--pst-color-surface);
    font-size: var(--pst-font-size-milli);
    pointer-events: none;
    z-index: 100;
}

/* Graphviz diagrams */
div.graphviz {
    text-align: center;
}
div.graphviz.align-left {
    text-align: left;
}
div.graphviz.align-right {
    text-align: right;
}
div.graphviz > svg {
    max-width: 100%;
    height: auto;
}
div.graphviz > img.graphviz:not(#¶) {
    background-color: transparent;
}
html[data-theme=dark] div.graphviz > :is(img.graphviz, object.graphviz, svg) {
    filter: invert(1) hue-rotate(180deg);
}

/* Drop-down menus */
.dropdown-menu {
    --bs-dropdown-link-color: var(--pst-color-text-muted);
    --bs-dropdown-link-hover-color: var(--pst-color-text-muted);
    --bs-dropdown-link-active-color: var(--pst-color-text-muted);
    --bs-dropdown-padding-y: 0.2rem;
    box-shadow: 0 0.2rem 0.5rem var(--pst-color-shadow),
                0 0 0.0625rem var(--pst-color-shadow) !important;
    border-color: var(--pst-color-border);
    background-color: var(--pst-color-background);
    color: var(--pst-color-text-muted);
}
.dropdown-menu .dropdown-item {
    display: inline-flex;
    align-items: center;
    padding-left: 0.5rem;
    padding-right: var(--bs-dropdown-item-padding-x);
    cursor: pointer;
}
.dropdown-menu .btn__icon-container.tdoc:is([class^=fa-], [class*=" fa-"]) {
    display: inline-flex;
    width: 1.7rem;
    align-items: center;
    justify-content: center;
}

/* Content footer */
.bd-footer-content .bd-footer-content__inner {
    padding-right: 0;
}
.bd-footer-content .tdoc-version {
    float: right;
    margin-left: 2rem;
}

/* Create a hanging indent for signatures. */
.sig {
    padding-left: 3rem;
    text-indent: -3rem;
}

/* Login functionality */
html:not([data-tdoc-user-tags]) .article-header-buttons > .dropdown-user
        .fa-user {
    --tdoc-fa-font: var(--fa-font-regular);
}
html[data-tdoc-user-tags] .article-header-buttons > .dropdown-user
        .dropdown-item.btn-login,
html:not([data-tdoc-user-tags]) .article-header-buttons > .dropdown-user
        .dropdown-item.btn-settings {
    display: none;
}
.tdoc-domain-storage {
    position: absolute;
    width: 0px;
    height: 0px;
}

/* Permission-based visibility */
html:not([data-tdoc-user-perms~="*"],
         [data-tdoc-user-perms~="instructor:view"]):not(#¶) .instructor {
    display: none;
}
html[data-theme=light] {
    --tdoc-color-instructor: #8045e5;
    --tdoc-color-instructor-bg: #e0c7ff;
    --tdoc-color-instructor-highlight: #651ee0;
}
html[data-theme=dark] {
    --tdoc-color-instructor: #9c5ffd;
    --tdoc-color-instructor-bg: #341a61;
    --tdoc-color-instructor-highlight: #7c2bfc;
}
.frame.docutils.container.instructor {
    border-color: var(--tdoc-color-instructor);
}
.admonition.instructor, div.admonition.instructor {
    border-color: var(--tdoc-color-instructor);
}
.admonition.instructor > .admonition-title,
div.admonition.instructor >.admonition-title {
    background-color: var(--tdoc-color-instructor-bg);
}
.admonition.instructor > .admonition-title:after,
div.admonition.instructor > .admonition-title:after {
    color: var(--tdoc-color-instructor);
}

/* Revert table style changes from pydata-sphinx-theme in Bootstrap modals. */
.modal .table {
    --bs-table-bg: var(--bs-body-bg);
    --bs-table-color: var(--bs-emphasis-color);
    border-color: var(--bs-table-border-color);
    border-style: initial;
    border-width: initial;
    color: var(--bs-table-color);
}
.modal .table :is(th, td) ~ :is(th, td) {
    border-left-color: initial;
    border-left-style: initial;
    border-left-width: initial;
}
.modal .table thead tr {
    background-color: initial;
    border-bottom-color: initial;
    border-bottom-style: initial;
    border-bottom-width: initial;
}
.modal .table tbody tr,
.modal .table tbody tr:hover {
    background-color: initial;
}

/* Badges in the primary sidebar */
.sidebar-primary-items__start .sidebar-primary-item:has(.tdoc-badge) {
    display: flex;
    flex-flow: row wrap;
    gap: 0.5rem;
}
.sidebar-primary-items__start .sidebar-primary-item .tdoc-badge img {
    display: block;
}
html:not([data-tdoc-user-tags~=repo-access], [data-tdoc-local])
        .sidebar-primary-items__start .sidebar-primary-item:has(.tdoc-badge) {
    display: none;
}

/* Repository status */
.sidebar-primary-item:has(.tdoc-repo-status):not(#¶) {
    border: 2px solid var(--pst-color-danger);
    border-radius: 0.25rem;
    padding: 0.3rem 0.5rem;
}
.sidebar-primary-item:has(.tdoc-repo-status tbody:empty) {
    display: none;
}
.tdoc-repo-status {
    width: 100%;
    color: var(--pst-color-text-muted);
    line-height: 1.3;
}
.tdoc-repo-status :is(th, td) {
    padding: 0;
    /*border: 1px solid black;*/
}
.tdoc-repo-status thead th {
    padding-bottom: 0.2rem;
}
.tdoc-repo-status thead th:not(:first-child) {
    padding-left: 0.3rem;
    text-align: right;
}
.tdoc-repo-status tbody td:first-child {
    padding-left: 0.5rem;
    padding-right: 0.3rem;
    font-family: var(--pst-font-family-monospace);
}
.tdoc-repo-status tbody td:not(:first-child) {
    padding-left: 0.3rem;
    text-align: right;
}
.tdoc-repo-status:not(:has(td:nth-child(2):not(:empty)))
        :is(th, td):nth-child(2),
.tdoc-repo-status:not(:has(td:nth-child(3):not(:empty)))
        :is(th, td):nth-child(3) {
    display: none;
}

/* Remove some unnecessary whitespace in the primary sidebar. */
.bd-sidebar-primary
        :is(.sidebar-primary-items__start, .sidebar-primary-items__end) {
    display: flex;
    flex-direction: column;
    row-gap: 1rem;
}
.bd-sidebar-primary
        :is(.sidebar-primary-items__start, .sidebar-primary-items__end)
        .sidebar-primary-item {
    padding-top: 0;
    padding-bottom: 0;
}
.bd-sidebar-primary .sidebar-primary-items__end {
    margin-bottom: 0;
}
.bd-sidebar-primary .sidebar-primary-item:empty,
.bd-sidebar-primary .sidebar-primary-item:has(#ethical-ad-placement) {
    display: none;
}

/* Make the modal created by pydata-sphinx-theme when opening the left sidebar
   full-height, and remove the ugly dialog border. */
.bd-sidebar-primary[open] {
    position: fixed;
    height: 100vh;
    border-top: none;
    border-left: none;
    border-bottom: none;
}

/* Remove the underline on hover on navbar buttons. */
.pst-navbar-icon.pst-navbar-icon:hover::before {
    border-bottom: none;
}

/* Fix the alignment of navbar icons. */
.article-header-buttons {
    align-items: center;
}
.article-header-buttons > button,
.article-header-buttons > .dropdown > button {
    justify-content: center;
    height: 2.15rem;
}
.article-header-buttons > .btn > .btn__icon-container {
    display: inline-flex;
    align-items: center;
}

/* Don't open dropdown menus on hover. */
.bd-header-article .btn:hover + .dropdown-menu:not(.show) {
    display: none;
}
.bd-header-article .dropdown-menu:hover:not(.show) {
    display: none;
}

/* Add a slight background shading on hover to menu items. */
.bd-header-article .dropdown-menu .dropdown-item:hover {
    background-color: var(--bs-dropdown-link-hover-bg);
}

/* Render alerts in the header. */
.bd-header-article {
    height: unset;
    flex-direction: column;
    align-items: stretch;
}
.bd-header-article .header-article-items {
    height: unset;
}
.bd-header-article:has(.tdoc-alerts:not(:empty)) {
    padding-bottom: 0.3rem;
}
.tdoc-alerts {
    display: flex;
    flex-direction: column;
    max-height: 40vh;
    overflow-y: auto;
    row-gap: 0.3rem;
    align-items: stretch;
}
.tdoc-alerts:empty {
    display: none;
}
.tdoc-alerts > .alert {
    --bs-alert-margin-bottom: 0;
    --bs-alert-padding-x: 0.5rem;
    --bs-alert-padding-y: 0.5rem;
}
.tdoc-alerts .alert-dismissible {
    padding-right: 2.3rem;
}
.tdoc-alerts .alert-dismissible .btn-close {
    top: 0.2rem;
    right: 0.2rem;
    width: 0.8rem;
    height: 0.8rem;
    padding: 0.5rem;
}

/* Prevent the wrapper background set by pygments from being visible if the
   wrapper is larger than its content (visible in dark mode). */
div.highlight.highlight.highlight {
    background: none;
}

/* Prevent the wrapper background set by pygments from overriding code literal
   styles. */
code.literal.literal.literal {
    background-color: var(--pst-color-surface);
}

/* Fix the gap left by pydata-sphinx-theme between the table and the
   scrollbar. */
.pst-scrollable-table-container {
    margin-bottom: 1rem;
    scroll-timeline: --scroll-y y;
}
.pst-scrollable-table-container > .table {
    margin-bottom: 0;
}

/* Reduce the bottom margin of directive definition list options. */
dl[class]:not(.option-list, .field-list, .footnote, .glossary,
              .simple):not(#¶) {
    margin-bottom: 1.5rem;
}

/* Make field lists more compact. */
dl[class]:not(.option-list, .field-list, .footnote, .glossary, .simple)
        dl.field-list {
    grid-template-columns: fit-content(30%) auto;
}
dl[class]:not(.option-list, .field-list, .footnote, .glossary, .simple) dd {
    margin-left: 1rem;
}

/* Hide the search shortcut, which is disabled. */
.search-button-field .search-button__kbd-shortcut,
.bd-search .search-button__kbd-shortcut {
    display: none;
}

/* Make align-* classes work on math blocks. */
div.math.align-left:not(#¶) > mjx-container {
    text-align: left;
}
div.math.align-center:not(#¶) > mjx-container {
    text-align: center;
}
div.math.align-right:not(#¶) > mjx-container {
    text-align: right;
}

/* Avoid that math blocks sometimes get cut off at the top. */
:is(div, span).math {
    overflow: visible;
}
div.math mjx-container {
    padding-top: 0.2rem;
}

/* Fix margin collapse with math blocks. */
div.math {
    margin: 1em 0;
}
mjx-container[display="true"]:not(#¶) {
    margin: 0;
}

/* Keep list markers at the top for math content. */
:is(ol, ul) > li div.math > mjx-container > svg {
    vertical-align: top !important;  /* Override element style */
}

/* Avoid that form controls change size on focus. */
.form-control:focus, .form-control:focus-visible {
    border: var(--bs-border-width) solid var(--bs-border-color);
}

/* Random cosmetic fixes */
dd :is(ul, table) {
    margin-bottom: 1rem;  /* Revert basic.css */
}
