figure:has(img.caption-left) figcaption {
    text-align: left;
    width: 90%;
    margin: 0 auto;
}

/* GitHub repository link in the top bar (Furo content-icon-container) */
.topbar-github {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--color-content-foreground);
    margin-right: 0.25rem;
}

.topbar-github:hover {
    color: var(--color-brand-primary);
}

.sidebar-tree .caption,
.sidebar-tree :not(.caption) > .caption-text,
.toctree-wrapper.compound .caption,
.toctree-wrapper.compound :not(.caption) > .caption-text {
    text-transform: none;
    font-size: 1.2rem;
}

/* ---------------------------------------------------------------------------
   The site-wide tree on the Table of Contents page (`{sitetoc}`)
   Furo centres `p.caption`, which is right for figures but not for the section
   headings that separate the parts of the tree.
   --------------------------------------------------------------------------- */
.site-toc > p.caption {
    text-align: left;
    font-size: 1.2rem;
    font-weight: 700;
    margin: 1.75rem 0 0.5rem;
}

.site-toc ul {
    margin-top: 0.25rem;
}

/* ---------------------------------------------------------------------------
   Link colour
   Furo colours unvisited links blue but visited links purple. Keep every link
   blue so the palette stays consistent as a reader works through the guide.
   These overrides have to be scoped to `body`, not `:root`: Furo declares its
   variables on `body`, and a value declared there beats one inherited from the
   root element.
   --------------------------------------------------------------------------- */
body {
    --color-brand-visited: #2757dd;
}

body[data-theme="dark"] {
    --color-brand-visited: #5ca5ff;
}

@media (prefers-color-scheme: dark) {
    body:not([data-theme="light"]) {
        --color-brand-visited: #5ca5ff;
    }
}

/* ---------------------------------------------------------------------------
   Right-hand "On this page" table of contents
   Furo sets the entries in 75% type and secondary grey, and the "On this page"
   heading in 62.5% muted grey. Put both at 87.5% in the primary foreground
   colour, so the panel reads as easily as the page it indexes.
   (--color-foreground-primary follows the theme, so this stays legible in dark
   mode too.)
   --------------------------------------------------------------------------- */
body {
    --toc-font-size: var(--font-size--small);
    --toc-title-font-size: var(--font-size--small);
    --color-toc-item-text: var(--color-foreground-primary);
    --color-toc-title-text: var(--color-foreground-primary);
}

/* ---------------------------------------------------------------------------
   Julia docstrings rendered by the `{docstring}` directive
   (docs/_ext/juliadocstrings.py)
   --------------------------------------------------------------------------- */
/* The selector has to out-specify furo-extensions.css's
   `[role=main] .container { padding-left: 0; padding-right: 0 }`, which would
   otherwise strip the horizontal padding off the box. */
[role="main"] .julia-docstring.docutils.container {
    border: 1px solid var(--color-background-border);
    border-left: 3px solid var(--color-brand-primary);
    border-radius: 0.2rem;
    padding: 0.75rem 1rem 0.25rem;
    margin: 1rem 0 1.5rem;
    background: var(--color-background-secondary);
}

.julia-docstring > p.julia-docstring-header {
    margin: 0 0 0.5rem;
    font-size: 0.85rem;
    color: var(--color-foreground-secondary);
}

.julia-docstring > p.julia-docstring-header code.julia-docstring-name {
    font-size: 1rem;
    font-weight: 700;
    background: none;
    padding-left: 0;
}

.julia-docstring .highlight,
.julia-docstring pre {
    background: var(--color-background-primary);
}

.julia-docstring p.rubric {
    font-size: 1rem;
    font-weight: 700;
    margin-top: 1rem;
    margin-bottom: 0.25rem;
    border-bottom: none;
}

/* Julia / Python switch in the top bar (language-switch.js) */
.language-switch {
    display: inline-flex;
    align-items: center;
    margin-right: 0.75rem;
    border: 1px solid var(--color-background-border);
    border-radius: 0.4rem;
    overflow: hidden;
    font-size: 0.8rem;
    line-height: 1;
}

.language-switch-option {
    padding: 0.3rem 0.6rem;
    color: var(--color-foreground-secondary);
    text-decoration: none;
}

.language-switch-option:hover {
    color: var(--color-foreground-primary);
    background: var(--color-background-hover);
}

.language-switch-option.active {
    color: var(--color-background-primary);
    background: var(--color-brand-primary);
    font-weight: 600;
}

.language-switch-option.active:hover {
    color: var(--color-background-primary);
}
