/* LAION-fMRI Documentation — re:vision theme overrides for Furo */

/* Google Fonts: Outfit (body), Fira Code (mono) */
@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500&family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --rv-font-heading: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

body {
    font-size: 15px;
}

/* ---- Color tokens per mode ---- */

/* Dark mode tokens */
body[data-theme="dark"] {
    --rv-bg: #0a0e1a;
    --rv-surface: #111729;
    --rv-surface-light: #1a2140;
    --rv-slate: #2a3050;
    --rv-slate-light: #4a5580;
    --rv-fg: #e8eaf0;
    --rv-fg-dim: #a0a8c0;
    --rv-fg-muted: #6a7090;
    --rv-cyan: #00d4ff;
    --rv-cyan-dim: #006880;
    --rv-coral: #ff6b4a;
    --rv-coral-dim: #803626;
    --rv-code-bg: #0d1117;
    --rv-code-border: #2a3050;
    --rv-inline-code-bg: #1a2140;
    --rv-inline-code-fg: #00d4ff;
    --rv-card-shadow-hover: rgba(0, 212, 255, 0.1);
    --rv-heading-fg: #e8eaf0;
    --rv-h3-fg: #00d4ff;
    --rv-noise-opacity: 0.015;
}

/* Light mode tokens */
body:not([data-theme="dark"]) {
    --rv-bg: #ffffff;
    --rv-surface: #f5f7fa;
    --rv-surface-light: #eef1f6;
    --rv-slate: #d8dde6;
    --rv-slate-light: #b8c0d0;
    --rv-fg: #1a1e2e;
    --rv-fg-dim: #4a5068;
    --rv-fg-muted: #8890a8;
    --rv-cyan: #0090b0;
    --rv-cyan-dim: #b0dce8;
    --rv-coral: #e05535;
    --rv-coral-dim: #fce8e4;
    --rv-code-bg: #f5f7fa;
    --rv-code-border: #d8dde6;
    --rv-inline-code-bg: #eef1f6;
    --rv-inline-code-fg: #0090b0;
    --rv-card-shadow-hover: rgba(0, 144, 176, 0.1);
    --rv-heading-fg: #1a1e2e;
    --rv-h3-fg: #0090b0;
    --rv-noise-opacity: 0;
}

/* ---- Headings: match re:vision system sans ---- */
h1, h2, h3, h4, h5, h6,
.sidebar-title {
    font-family: var(--rv-font-heading) !important;
    letter-spacing: 0;
}

h1 {
    font-size: calc(2.5em - 2px) !important;
    font-weight: 700 !important;
    color: var(--rv-heading-fg) !important;
    border-bottom: 2px solid var(--rv-slate) !important;
    padding-bottom: 0.4em !important;
}

h2 {
    font-size: calc(2em - 2px) !important;
    font-weight: 700 !important;
    color: var(--rv-heading-fg) !important;
}

h3 {
    font-size: calc(1.5em - 2px) !important;
    color: var(--rv-h3-fg) !important;
    font-weight: 600 !important;
}

h4 {
    font-size: calc(1.25em - 2px) !important;
}

h5 {
    font-size: calc(1.125em - 2px) !important;
}

h6 {
    font-size: calc(1em - 2px) !important;
}

/* ---- Links ---- */
.main a,
.sidebar-tree a,
.toc-tree a {
    transition: color 0.15s ease, opacity 0.15s ease;
}

/* ---- Sidebar captions (section labels) ---- */
.sidebar-tree .caption-text {
    color: var(--rv-cyan) !important;
    font-family: var(--rv-font-heading) !important;
    font-size: 0.72rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.08em !important;
    text-transform: uppercase !important;
}

/* Sidebar active item left border */
.sidebar-tree li.current-page > a {
    border-left: 3px solid var(--rv-cyan) !important;
    padding-left: calc(1rem - 3px) !important;
    color: var(--rv-cyan) !important;
}

/* ---- Code blocks ---- */
pre,
.highlight pre,
pre.literal-block {
    background: var(--rv-code-bg) !important;
    border: 1px solid var(--rv-code-border) !important;
    border-radius: 8px !important;
    padding: 1em 1.2em !important;
    font-size: 15px !important;
    line-height: 1.7 !important;
}

.highlighttable .linenodiv {
    font-size: 15px !important;
}

code.literal,
.sig-inline {
    background: var(--rv-inline-code-bg) !important;
    color: var(--rv-inline-code-fg) !important;
    padding: 2px 6px !important;
    border-radius: 4px !important;
    font-size: 1em !important;
    border: 1px solid var(--rv-slate) !important;
}

article code.literal,
article .sig-inline {
    font-size: 15px !important;
}

article .caption-text code.literal {
    font-size: 1em !important;
}

/* ---- Cards (sphinx-design) ---- */
.sd-card {
    background: var(--rv-surface) !important;
    border: 1px solid var(--rv-slate) !important;
    border-radius: 12px !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease !important;
}

.sd-card:hover {
    transform: translateY(-4px) !important;
    box-shadow: 0 8px 32px var(--rv-card-shadow-hover) !important;
    border-color: var(--rv-cyan-dim) !important;
}

.sd-card .sd-card-header {
    background: transparent !important;
    border-bottom: 1px solid var(--rv-slate) !important;
    font-weight: 600;
}

.sd-card .sd-card-footer {
    border-top: 1px solid var(--rv-slate) !important;
    color: var(--rv-fg-dim) !important;
    font-size: 0.85em !important;
}

/* ---- Admonitions ---- */
.admonition {
    background: var(--rv-surface) !important;
    border: 1px solid var(--rv-slate) !important;
    border-radius: 8px !important;
    border-left: 4px solid var(--rv-cyan) !important;
    padding: 1em 1.2em !important;
}

.admonition.warning {
    border-left-color: var(--rv-coral) !important;
}

.admonition.warning > .admonition-title {
    color: var(--rv-coral) !important;
}

.admonition.note > .admonition-title {
    color: var(--rv-cyan) !important;
}

.admonition > .admonition-title {
    background: transparent !important;
    font-weight: 600 !important;
    font-family: var(--rv-font-heading) !important;
}

/* ---- Tables ---- */
table {
    border-collapse: collapse !important;
}

th {
    background: var(--rv-surface-light) !important;
    color: var(--rv-fg) !important;
    font-weight: 600 !important;
    font-family: var(--rv-font-heading) !important;
    border: 1px solid var(--rv-slate) !important;
}

td {
    border: 1px solid var(--rv-slate) !important;
}

table td.stub {
    color: var(--rv-fg) !important;
    font-weight: 500 !important;
}

/* ---- Figures ---- */
.content figure,
.content .figure {
    margin: 2.2rem auto 2.6rem !important;
}

.content figure img,
.content .figure img {
    display: block;
    box-sizing: border-box;
    margin-right: auto;
    margin-left: auto;
    border: 1px solid var(--rv-slate);
    border-radius: 8px;
    background: var(--rv-surface);
    box-shadow: 0 14px 36px rgba(10, 14, 26, 0.08);
}

body[data-theme="dark"] .content figure img,
body[data-theme="dark"] .content .figure img {
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.28);
}

.content figure figcaption,
.content .figure .caption {
    max-width: 48rem;
    margin: 0.8rem auto 0 !important;
    padding: 0.7rem 0 0 1rem;
    border-top: 1px solid var(--rv-slate);
    border-left: 3px solid var(--rv-cyan);
    color: var(--rv-fg-dim) !important;
    font-size: 0.88rem;
    line-height: 1.55;
    text-align: left !important;
}

.content figure figcaption p,
.content .figure .caption {
    margin: 0;
}

/* ---- Tabs (sphinx-tabs) ---- */
.sphinx-tabs-tab {
    background: var(--rv-surface) !important;
    color: var(--rv-fg-dim) !important;
    border: 1px solid var(--rv-slate) !important;
    border-bottom: none !important;
    font-family: 'Outfit', sans-serif !important;
    font-weight: 500 !important;
    transition: background 0.15s ease, color 0.15s ease;
}

.sphinx-tabs-tab[aria-selected="true"] {
    background: var(--rv-surface-light) !important;
    color: var(--rv-cyan) !important;
    border-bottom: 2px solid var(--rv-cyan) !important;
}

.sphinx-tabs-panel {
    background: var(--rv-surface) !important;
    border: 1px solid var(--rv-slate) !important;
    border-radius: 0 0 8px 8px !important;
}

/* ---- Dropdowns (FAQ) ---- */
details {
    background: var(--rv-surface) !important;
    border: 1px solid var(--rv-slate) !important;
    border-radius: 8px !important;
    margin-bottom: 0.75em !important;
}

details > summary {
    color: var(--rv-fg) !important;
    font-weight: 500 !important;
    padding: 0.75em 1em !important;
    cursor: pointer;
}

details > summary:hover {
    color: var(--rv-cyan) !important;
}

/* ---- Scrollbar (dark mode only) ---- */
body[data-theme="dark"] ::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

body[data-theme="dark"] ::-webkit-scrollbar-track {
    background: var(--rv-bg);
}

body[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: var(--rv-slate-light);
    border-radius: 3px;
}

body[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: var(--rv-fg-muted);
}

/* ---- Copy button ---- */
button.copybtn {
    opacity: 0.3;
    transition: opacity 0.2s ease;
}

button.copybtn:hover {
    opacity: 1;
    color: var(--rv-cyan) !important;
}

/* ---- Sphinx-Gallery thumbnail cards ----
 *
 * Each card's RST renders both a ``:doc:`` link (text) and a
 * ``<div class="sphx-glr-thumbnail-title">`` (visible title).
 * The link is meant to be invisible -- it just makes the whole
 * card clickable -- but Furo styles it as a regular paragraph
 * link, so without overrides the title appears twice. These
 * rules collapse the link to a transparent overlay.
 */
.sphx-glr-thumbcontainer {
    position: relative;
    display: inline-block;
    width: 160px;
    margin: 12px;
    padding: 0;
    background: var(--rv-surface);
    border: 1px solid var(--rv-slate);
    border-radius: 6px;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.sphx-glr-thumbcontainer:hover {
    box-shadow: 0 4px 14px var(--rv-card-shadow-hover);
}

.sphx-glr-thumbcontainer img {
    display: block;
    width: 100%;
    height: 140px;
    object-fit: cover;
}

.sphx-glr-thumbcontainer p {
    margin: 0;
    padding: 0;
}

/* Make the :doc: link cover the full card and hide its text. */
.sphx-glr-thumbcontainer a.reference {
    position: absolute;
    inset: 0;
    text-indent: -9999px;
    overflow: hidden;
    z-index: 2;
}

.sphx-glr-thumbnail-title {
    padding: 8px 10px;
    font-size: 0.9em;
    font-weight: 500;
    color: var(--rv-fg);
    text-align: center;
    line-height: 1.3;
    background: var(--rv-surface);
    border-top: 1px solid var(--rv-slate);
}

/* ---- Gallery example pages: wider content + escape-the-column figures ----
 *
 * Furo caps the article column at ~46em which is comfortable for prose
 * but cramped for the wide brain-strip panels we render. On pages that
 * sphinx-gallery generated (detected via the ``.sphx-glr-example-title``
 * heading class), widen the column and let single-image figures spill
 * ~10em beyond it on each side so the plots actually use the screen.
 */
body:has(.sphx-glr-example-title) .content {
    max-width: 70em;
}

/* The .sphx-glr-single-img class only appears on gallery pages, so the
 * rule is auto-scoped without a body selector. */
.sphx-glr-single-img {
    max-width: none;
    width: calc(100% + 12em);
    margin-left: -6em;
    margin-right: -6em;
}

/* Narrow viewports: drop the spill-out so the image stays in the
 * column rather than overflowing the screen. */
@media (max-width: 1100px) {
    .sphx-glr-single-img {
        width: 100%;
        margin-left: 0;
        margin-right: 0;
    }
}

/* ---- Footer navigation ---- */
.prev-next-area a {
    border: 1px solid var(--rv-slate) !important;
    border-radius: 8px !important;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.prev-next-area a:hover {
    border-color: var(--rv-cyan-dim) !important;
    background: var(--rv-surface) !important;
}

/* ---- Smooth scrolling ---- */
html {
    scroll-behavior: smooth;
}

/* ---- Logo in sidebar ---- */
.sidebar-brand {
    padding: 1rem !important;
}

/* ---- Search highlight ---- */
.highlighted {
    background: rgba(0, 212, 255, 0.2) !important;
    color: var(--rv-fg) !important;
    border-radius: 2px;
}

/* ---- Badge images on landing page ---- */
.body img[src*="shields.io"] {
    margin-right: 4px;
}

/* ---- Subtle noise texture (dark mode only) ---- */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: var(--rv-noise-opacity, 0);
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

/* ---- Mobile improvements ---- */
@media screen and (max-width: 768px) {
    .sd-container-fluid {
        padding-left: 1em;
        padding-right: 1em;
    }
}

/* ---- Justified body paragraphs ---- */
article p,
article li > p,
article dd > p {
    text-align: justify;
    text-justify: inter-word;
    hyphens: auto;
}
