/*
 * custom.css — sphinxawesome_theme compatible
 *
 * NOTE: This file must NOT use --pst-color-* variables or .bd-* selectors.
 * Those belong to pydata-sphinx-theme / sphinx-book-theme and do not exist
 * here. All overrides use standard CSS selectors or sphinxawesome variables.
 */

@import url("https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,400;0,500;1,400&display=swap");

/* ── Monospace font for all code ─────────────────────────────────────────── */
code,
kbd,
samp,
pre,
.highlight pre,
tt.literal,
code.literal {
  font-family:
    "JetBrains Mono", "Fira Code", "Cascadia Code", "SF Mono", "Consolas",
    monospace;
}

/* ── Code block sizing and shape ─────────────────────────────────────────── */
/* Single border lives on pre; div.highlight only clips the radius. */
div.highlight {
  border-radius: 8px;
  overflow: hidden;
}

.highlight pre {
  font-size: 0.9rem;
  line-height: 1.65;
  border-radius: 8px;
  border: 1px solid #d0d7de; /* override theme.css's var(--color-border) */
  margin-top: 0; /* theme adds a large top-margin — reset it */
  padding: 1rem 1.25rem;
  font-feature-settings:
    "liga" 1,
    "calt" 1;
}

html[data-theme="dark"] .highlight pre {
  border-color: #30363d;
}

/* Inline code */
code.literal,
p code,
li code,
td code {
  font-family: "JetBrains Mono", "Fira Code", "SF Mono", "Consolas", monospace;
  font-size: 0.82em;
  border-radius: 4px;
  padding: 0.15em 0.4em;
  background: #f3f4f6;
  border: 1px solid #e2e4e8;
  color: #c2185b;
}

html[data-theme="dark"] code.literal,
html[data-theme="dark"] p code,
html[data-theme="dark"] li code,
html[data-theme="dark"] td code {
  background: #161b22;
  border-color: #30363d;
  color: #ff7b72;
}

/* ── Syntax highlighting — light palette (GitHub-inspired) ──────────────── */
/* keywords: blue   │ strings: green  │ fn/class defs: purple               */
/* comments: gray   │ numbers: blue   │ variable names: neutral (no colour)  */
div.highlight,
.highlight pre {
  background: #f6f8fa;
  color: #24292f;
}
/* def, class, import, from, if, return, for, … → blue */
.highlight .k,
.highlight .kn,
.highlight .kd,
.highlight .kr,
.highlight .kc,
.highlight .kw {
  color: #0550ae;
  font-weight: 600;
}
/* string literals → green */
.highlight .s,
.highlight .s1,
.highlight .s2,
.highlight .sa,
.highlight .sb,
.highlight .sc,
.highlight .sd,
.highlight .se,
.highlight .si,
.highlight .sh {
  color: #116329;
}
/* numbers → blue */
.highlight .mi,
.highlight .mf,
.highlight .mh,
.highlight .mo {
  color: #0550ae;
}
/* function names in definitions → purple */
.highlight .nf,
.highlight .fm {
  color: #8250df;
}
/* class names in definitions → purple */
.highlight .nc {
  color: #8250df;
  font-weight: 600;
}
/* decorators (@property, @staticmethod, …) → purple */
.highlight .nd {
  color: #8250df;
}
/* builtins (print, len, range, …) → blue */
.highlight .nb,
.highlight .bp {
  color: #0969da;
}
/* namespace / module names → neutral */
.highlight .nn {
  color: #24292f;
}
/* operators → neutral */
.highlight .o,
.highlight .ow {
  color: #24292f;
}
/* comments → gray italic */
.highlight .c,
.highlight .c1,
.highlight .cm,
.highlight .cs,
.highlight .cp {
  color: #6e7781;
  font-style: italic;
}
/* variable / param names → NEUTRAL (no colour; avoid painting everything) */
.highlight .n,
.highlight .na,
.highlight .nv,
.highlight .py,
.highlight .p {
  color: #24292f;
}

/* ── Syntax highlighting — dark palette (GitHub Dark) ──────────────────── */
html[data-theme="dark"] div.highlight,
html[data-theme="dark"] .highlight pre {
  background: #0d1117;
  color: #e6edf3;
}
/* keywords → blue */
html[data-theme="dark"] .highlight .k,
html[data-theme="dark"] .highlight .kn,
html[data-theme="dark"] .highlight .kd,
html[data-theme="dark"] .highlight .kr,
html[data-theme="dark"] .highlight .kc,
html[data-theme="dark"] .highlight .kw {
  color: #79c0ff;
  font-weight: 600;
}
/* strings → green */
html[data-theme="dark"] .highlight .s,
html[data-theme="dark"] .highlight .s1,
html[data-theme="dark"] .highlight .s2,
html[data-theme="dark"] .highlight .sa,
html[data-theme="dark"] .highlight .se,
html[data-theme="dark"] .highlight .si,
html[data-theme="dark"] .highlight .sh {
  color: #7ee787;
}
/* numbers → blue */
html[data-theme="dark"] .highlight .mi,
html[data-theme="dark"] .highlight .mf,
html[data-theme="dark"] .highlight .mh {
  color: #79c0ff;
}
/* function names → purple */
html[data-theme="dark"] .highlight .nf,
html[data-theme="dark"] .highlight .fm {
  color: #d2a8ff;
}
/* class names → purple */
html[data-theme="dark"] .highlight .nc {
  color: #d2a8ff;
  font-weight: 600;
}
/* decorators → purple */
html[data-theme="dark"] .highlight .nd {
  color: #d2a8ff;
}
/* builtins → blue */
html[data-theme="dark"] .highlight .nb,
html[data-theme="dark"] .highlight .bp {
  color: #79c0ff;
}
/* namespace names → neutral */
html[data-theme="dark"] .highlight .nn {
  color: #e6edf3;
}
/* operators → neutral */
html[data-theme="dark"] .highlight .o,
html[data-theme="dark"] .highlight .ow {
  color: #e6edf3;
}
/* comments → gray */
html[data-theme="dark"] .highlight .c,
html[data-theme="dark"] .highlight .c1,
html[data-theme="dark"] .highlight .cm,
html[data-theme="dark"] .highlight .cp {
  color: #8b949e;
  font-style: italic;
}
/* variable / param names → NEUTRAL */
html[data-theme="dark"] .highlight .n,
html[data-theme="dark"] .highlight .na,
html[data-theme="dark"] .highlight .nv,
html[data-theme="dark"] .highlight .py,
html[data-theme="dark"] .highlight .p {
  color: #e6edf3;
}

/* ── Sidebar nav section separators ─────────────────────────────────────── */
/* All p.caption elements are flat siblings inside a single <nav>.            */
/* The ~ combinator targets every caption that follows the first one,         */
/* adding a hairline rule above it without an orphan border at the top.       */
#left-sidebar nav p.caption ~ p.caption {
  border-top: 1px solid #d0d7de;
  padding-top: 0.85rem;
  margin-top: 0.5rem;
}

html[data-theme="dark"] #left-sidebar nav p.caption ~ p.caption {
  border-top-color: #30363d;
}

/* ── List item spacing — Tailwind prose adds too much gap ────────────────── */
/* Scoped to #content so sidebar/nav lists are unaffected */
#content ul li,
#content ol li {
  margin-top: 0.2rem;
  margin-bottom: 0.2rem;
  line-height: 1.55;
}

/* Numpydoc field lists (Parameters, Returns, etc.) */
#content dl > dd > ul li,
#content dl > dd > ol li {
  margin-top: 0.1rem;
  margin-bottom: 0.1rem;
}
