:root {

    --pst-font-size-base: 16px;
    --pst-font-size-milli: 13px;
    --pst-font-family-base: 'Source Sans Pro', var(--pst-font-family-base-system);
    --pst-font-family-heading: var(--pst-font-family-base);
    --pst-font-family-monospace: 'Source Code Pro', var(--pst-font-family-monospace-system);
    /* colors that aren't responsive to light/dark mode */
    --mne-color-discord: #5865F2;
    /* font weight */
    --mne-font-weight-semibold: 600;
}


html[data-theme="light"] {
    /* pydata-sphinx-theme overrides */
    /* ↓↓↓ use default "info" colors for "primary" */
    --pst-color-primary: #276be9;
    --pst-color-primary-bg: #dce7fc;
    /* ↓↓↓ use default "primary" colors for "info" */
    --pst-color-info: var(--pst-teal-500);
    --pst-color-info-bg: var(--pst-teal-200);
    /* ↓↓↓ use "warning" colors for "secondary" */
    --pst-color-secondary: var(--pst-color-warning);
    --pst-color-secondary-bg: var(--pst-color-warning-bg);
    /* ↓↓↓ make sure new primary (link) color propogates to links on code */
    --pst-color-inline-code-links: var(--pst-color-link);
    /* ↓↓↓ make sure new secondary (hover) color propogates to hovering on table rows */
    --pst-color-table-row-hover-bg: var(--pst-color-secondary-bg);
    /* topbar logo links */
    --mne-color-github: #000;
    --mne-color-discourse: #d0232b;
    --mne-color-mastodon: #2F0C7A;
    /* code block copy button */
    --copybtn-opacity: 0.75;
    /* card header bg color */
    --mne-color-card-header: rgba(0, 0, 0, 0.05);
    /* sphinx-gallery overrides */
    --sg-download-a-background-color: var(--pst-color-primary);
    --sg-download-a-background-image: unset;
    --sg-download-a-border-color: var(--pst-color-border);
    --sg-download-a-color: var(--sd-color-primary-text);
    --sg-download-a-hover-background-color: var(--pst-color-primary-highlight);
    --sg-download-a-hover-box-shadow-1: none;
    --sg-download-a-hover-box-shadow-2: none;
}
html[data-theme="dark"] {
    /* pydata-sphinx-theme overrides */
    /* ↓↓↓ use default "info" colors for "primary" */
    --pst-color-primary: #79a3f2;
    --pst-color-primary-bg: #06245d;
    /* ↓↓↓ use default "primary" colors for "info" */
    --pst-color-info: var(--pst-teal-400);
    --pst-color-info-bg: var(--pst-teal-800);
    /* ↓↓↓ use "warning" colors for "secondary" */
    --pst-color-secondary: var(--pst-color-warning);
    --pst-color-secondary-bg: var(--pst-color-warning-bg);
    /* ↓↓↓ make sure new primary (link) color propogates to links on code */
    --pst-color-inline-code-links: var(--pst-color-link);
    /* ↓↓↓ make sure new secondary (hover) color propogates to hovering on table rows */
    --pst-color-table-row-hover-bg: var(--pst-color-secondary-bg);
    /* topbar logo links */
    --mne-color-github: rgb(240, 246, 252);  /* from their logo SVG */
    --mne-color-discourse: #FFF9AE;  /* from their logo SVG */
    --mne-color-mastodon: #858AFA;  /* www.joinmastodon.org/en/branding */
    /* code block copy button */
    --copybtn-opacity: 0.25;
    /* card header bg color */
    --mne-color-card-header: rgba(255, 255, 255, 0.2);
    /* sphinx-gallery overrides */
    --sg-download-a-background-color: var(--pst-color-primary);
    --sg-download-a-background-image: unset;
    --sg-download-a-border-color: var(--pst-color-border);
    --sg-download-a-color: var(--sd-color-primary-text);
    --sg-download-a-hover-background-color: var(--pst-color-primary-highlight);
    --sg-download-a-hover-box-shadow-1: none;
    --sg-download-a-hover-box-shadow-2: none;
}

/* ************************************************************ Sphinx fixes */

/* API docs parameter lists */
dl.field-list {
    grid-template-columns: auto 1fr;
}

/* make HTML'd pandas dataframes scrollable */
table.dataframe {
    display: block;
    overflow: auto;
}

/* Long API titles need to wrap for mobile */
div[id^="mne-"] h1,
div[id^="examples-using-"] h2 {
    word-break: break-word;
}

/* Don't know */
dl.py.method, dl.py.function {
    font-size: 5rem;
}

/* Function and method headers */
dl.py.method dt, dl.py.function dt { 
    font-size: 0.8rem;
    font-weight: bold;
}

/* Function parameter descriptions */
dl.py.method dd, dl.py.function dd {
    font-size: 0.8rem;
}

/* Class parameter headers */
dl.field-list dt {
    font-size: 0.8rem;
    font-weight: bold;
}

/* Class parameter descriptions */
dl.field-list dd {
    font-size: 0.8rem;
}

/* Examples in smaller text */
div.rubric:contains("Examples") + div.highlight-default {
    font-size: 0.7rem;
}

/* Examples in smaller text - using a more widely supported approach */
.highlight-default {
    font-size: 0.7rem;
}

/* *********************************************** pydata-sphinx-theme fixes */

/* this is most critical for the homepage logos, but affects all images */
html[data-theme="dark"] img {
    filter: none;
}

/* make versionadded smaller and inline with param name */
/* don't do for deprecated / versionchanged; they have extra info (too long to fit) */
div.versionadded > p {
    margin-top: 0;
    margin-bottom: 0;
}
div.versionadded {
    margin: 0;
    margin-left: 0.5rem;
    display: inline-block;
}
/* when FF supports :has(), change to →  dd > p:has(+div.versionadded) */
dd>p {
    display: inline;
}

/* **************************************************** sphinx-gallery fixes */

/* backreference links: restore hover decoration that SG removes */
a.sphx-glr-backref-instance:hover {
    text-decoration: underline;
}
/* backreference links: make non-MNE func/meth calls resemble regular code */
a[class^="sphx-glr-backref-module"] {
    color: var(--pst-color-text-base);
}
/* backreference links: make MNE calls bold and colorful */
a[class^="sphx-glr-backref-module-mne"] {
    color: var(--pst-color-link);
    font-weight: var(--mne-font-weight-semibold);
}
/* suppress redundant note at top of every tutorial and signature at the end */
div.sphx-glr-download-link-note,
p.sphx-glr-signature {
    visibility: hidden;
    height: 0;
    margin: 0;
    padding: 0;
}
/* script/notebook download buttons */
.sphx-glr-download a.download {
    border-radius: 0.5rem;
    /* ↓↓↓↓↓↓↓ these two rules copied from sphinx-design */
    box-shadow: 0 .125rem .25rem var(--sd-color-shadow) !important;
    text-decoration: none;
    transition: color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;
}
.sphx-glr-download a.download code {
    color: var(--sg-download-a-color);
}
.sphx-glr-download a.download::before {
    color: var(--sg-download-a-color);
}
/* Report embedding */
iframe.sg_report {
    width: 95%;
    height: 70vh;
    margin: 20px auto;
    display: block;
    border-style: solid;
}
/* Disable thumbnail tooltips on hover */
.sphx-glr-thumbcontainer[tooltip]:hover::before,
.sphx-glr-thumbcontainer[tooltip]:hover::after {
    display: none;
}

/* Make our external thumbnails (e.g., mne-gui-addons) act like standard SG ones */
.sphx-glr-thumbcontainer a.external {
    bottom: 0;
    display: block;
    left: 0;
    box-sizing: border-box;
    padding: 150px 10px 0;
    position: absolute;
    right: 0;
    top: 0;
}

/* ******************************************************** HTML repr tables */

/* make table responsive to pydata-sphinx-theme's light/dark mode */
.table > :not(caption) > * > * {
    color: var(--pst-color-text-base);
}
.mne-repr-table tbody tr:hover {
    background-color: var(--pst-color-table-row-hover-bg);
}
.mne-repr-section-toggle > button > svg > path {
    fill: var(--pst-color-text-base);
}
/* make the expand/collapse button look nicer */
.mne-repr-section-toggle > button {
    padding: 20%;
}
/* make section header rows more distinct (and harmonize with pydata-sphinx-theme table
style in the process). Color copied from pydata-sphinx-theme; 2px copied from bootstrap.
*/
.mne-repr-table th {
    border-bottom: 2px solid var(--pst-color-primary);
}
/* harmonize the channel names buttons with the rest of the table */
.mne-ch-names-btn {
    font-size: inherit;
    padding: 0.25rem;
    min-width: 1.5rem;
    font-weight: bold;
}
/*
.mne-ch-names-btn:hover {
    background-color: var(--pst-color-);
    text-decoration: underline;
}
.mne-ch-names-btn:focus-visible {
    outline: 0.1875rem solid var(--pst-color-accent);
    outline-offset: 0.1875rem;
}
*/
/* ***************************************************** sphinx-design fixes */
p.btn a {
    color: unset;
}
/* sphinx-design tabs */
html .bd-content .sd-tab-set > label:hover,
.bd-content .sd-tab-set > input:not(:checked) + label:hover {
    opacity: unset;
    color: var(--pst-color-secondary);
    border-color: var(--pst-color-secondary);
}

/* ************************************************************* copy button */
button.copybtn {
    /* always show; https://sphinx-copybutton.readthedocs.io/en/latest/use.html#modify-the-copy-button-s-css */
    opacity: var(--copybtn-opacity);
 }

/* *************************************************** bib reference spacing */
aside.footnote {
    margin-bottom: 0.5rem;
}
aside.footnote:last-child {
    margin-bottom: 1rem;
}

/* ******************************************************** version dropdown */
.dropdown-toggle {
    font-weight: var(--mne-font-weight-semibold);
}

/* ******************************************************* navbar icon links */
.navbar-icon-links svg.fa-square-github {
    color: var(--mne-color-github);
}
.navbar-icon-links svg.fa-discourse {
    color: var(--mne-color-discourse);
}
.navbar-icon-links svg.fa-discord {
    color: var(--mne-color-discord);
}
.navbar-icon-links svg.fa-mastodon {
    color: var(--mne-color-mastodon);
}

/* ************************************************************ nav elements */
/* topbar nav inactive */
.bd-header.navbar-light#navbar-main .navbar-nav li a.nav-link {
    color: var(--pst-color-text-muted);
}
/* topbar nav active */
.bd-header.navbar-light#navbar-main .navbar-nav > li.active > .nav-link {
    font-weight: var(--mne-font-weight-semibold);
}
/* topbar nav hover */
.bd-header.navbar-light#navbar-main .navbar-nav li a.nav-link:focus,
.bd-header.navbar-light#navbar-main .navbar-nav li a.nav-link:hover {
    color: var(--pst-color-secondary);
}

/* *********************************************************** homepage logo */
img.logo {
    max-width: 360px;
    width: 100%;
}

/* **************************************************** homepage quick links */
ul.quicklinks a {
    font-weight: var(--mne-font-weight-semibold);
    color: var(--pst-color-text-base);
    text-decoration: none;
}
ul.quicklinks a svg {
    color: var(--pst-color-text-muted);
}
ul.quicklinks a:hover {
    text-decoration: none;
}
h5.card-header {
    margin-top: 0px;
    margin-bottom: 0px;
    color: var(--pst-color-text-base);
}
h5.card-header::before {
    height: 0px;
    margin-top: 0px;
}
/* ******************************************************* homepage carousel */
div.frontpage-gallery {
    overflow: hidden;
    height: 180px;
    justify-content: center;
}
div.frontpage-gallery a {
    text-decoration: none;
    color: var(--pst-color-text-base);
}
div.frontpage-gallery img.card-img {
    transform: scale(1.8);
    transform-origin: 40% 20%;
    opacity: 0.2;
    transition: 400ms ease-out;
}
div.frontpage-gallery:hover img.card-img {
    transform: scale(1.2);
    opacity: 1.0;
    transition: 400ms ease-out;
}
div.frontpage-gallery .fadeout {
    opacity: 1.0;
    transition: 200ms linear;
}
div.frontpage-gallery:hover .fadeout {
    opacity: 0.0;
    transition: 200ms linear;
}
/* affects the homepage gallery tiles and the homepage sidebar quicklinks card;
   needed for dark mode. */
div.card {
    border: 1px solid var(--pst-color-border);
    background-color: var(--pst-color-background);
}
.card-header {
    border-bottom-color: var(--pst-color-border);
    background-color: var(--mne-color-card-header);
}

/* *************************************** homepage funder/institution logos */
div#funder-logos div.card,
div#funder-logos div.card img,
div#institution-logos div.card,
div#institution-logos div.card img,
div#contributor-avatars div.card,
div#contributor-avatars div.card img {
    background-color: unset;
    border: none;
    border-radius: unset;
}
div#contributor-avatars div.card img {
    width: 2.5em;
}
.contributor-avatar {
    clip-path: circle(closest-side);
}

/* ************************************************************ funders page */
ul.funders li {
    margin-left: 36px;
    text-indent: -36px;
    padding-bottom: 9px;
}
ul.funders li img {
    width: 30px;
    max-height: 24px;
    object-fit: contain;
    background-color: unset !important;
}

/* *********************************************************** contrib guide */
ul.icon-bullets {
    list-style-type: none;
    padding-left: 2em;
    text-indent: -1.5em;
}
.small-stack {
    font-size: 0.5em;
}

/* *********************************************************** miscellaneous */
.hidden {
    display: none;
}
img.hidden {
    visibility: hidden;
}
td.justify {
    text-align-last: justify;
}

/* Matplotlib HTML5 video embedding */
div.sphx-glr-animation video {
    max-width: 100%;
    height: auto;
}

/* fix sidebar scrollbars */
.sidebar-primary-items__end {
    margin-bottom: 0 !important;
    margin-top: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Parameter List Improvements */
.field-body ul {
    margin-top: 0.3em;
    margin-bottom: 0.3em;
    padding-left: 1.5em;
    list-style-type: disc;
}

.field-body ul li {
    margin-bottom: 0.2em;
}

/* Fix for parameter descriptions with dash lists */
.field-body p:has(+ ul) {
    margin-bottom: 0.2em;
}

.field-body dl.simple dt {
    font-weight: 600;
}

/* Make code in parameter descriptions stand out */
.field-body code.literal {
    background-color: #f0f0f0;
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 0.9em;
}

/* Improve function spacing and hierarchy */
dl.py.class > dt {
    font-size: 0.95rem; /* Keep class names slightly larger */
    margin-bottom: 0.5rem;
}

/* Add spacing between functions */
dl.py.method, dl.py.function {
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--pst-color-border);
}

/* Improve function parameter spacing */
dl.field-list > dt {
    margin-top: 0.3rem;
}

dl.field-list > dd {
    margin-bottom: 0.5rem;
}

/* Make function names stand out */
dl.py.method .sig-name, dl.py.function .sig-name {
    font-weight: bold;
    color: var(--pst-color-primary);
}

/* Make method/function qualifiers (like static, classmethod) visually distinct */
dl.py.method .property, dl.py.function .property {
    font-style: italic;
    font-size: 0.75rem;
    color: var(--pst-color-text-muted);
}