/* pypiron docs theme — iron & rust, lifted from the server's own scheme (the
   :root / dark tokens at the top of PAGE_CSS in src/html.rs).

   We recolor Material's BUILT-IN `default` (light) and `slate` (dark) schemes
   rather than inventing custom scheme names. That matters: a custom scheme
   inherits only the light base, so a dark variant must hand-redefine everything
   Material derives for `slate` (shadows, the full code-highlight palette,
   admonition/table/kbd colors, …) — easy to miss one at a time. Building on
   `slate` we inherit all of it; `slate` derives its grays from `--md-hue`, so a
   warm hue tints the whole dark theme, and we override only the brand anchors. */

:root {
  --pi-accent-l: #bf5a2e;       /* rust — light */
  --pi-accent-ink-l: #a04a24;
  --pi-accent-d: #e07b45;       /* rust — dark */
  --pi-accent-ink-d: #ef9460;
  --pi-surface-d: #1f1813;      /* warm near-black card (server --header/--code dark) */
  --pi-border-l: #e7ddd3;
  --pi-border-d: #352c24;
}

/* ---------- light (default) ---------- */
[data-md-color-scheme="default"] {
  --md-primary-fg-color: var(--pi-accent-l);
  --md-primary-fg-color--light: #d07347;
  --md-primary-fg-color--dark: var(--pi-accent-ink-l);
  --md-accent-fg-color: var(--pi-accent-ink-l);

  --md-default-bg-color: #faf7f4;
  --md-code-bg-color: #f3ece4;

  --md-typeset-a-color: var(--pi-accent-l);
}

/* ---------- dark (slate) ---------- */
[data-md-color-scheme="slate"] {
  --md-hue: 28; /* warm the grays slate derives (bg/fg tints, tables, kbd, …) */

  /* exact brand surfaces (deeper than slate's hue-derived defaults) */
  --md-default-bg-color: #15110e;
  --md-default-fg-color: #ece5dd;
  --md-code-bg-color: var(--pi-surface-d);
  --md-admonition-bg-color: var(--pi-surface-d); /* subtle card lift off the page */

  /* dark header band + rust links/accents */
  --md-primary-fg-color: var(--pi-surface-d);
  --md-primary-bg-color: #ece5dd;
  --md-accent-fg-color: var(--pi-accent-ink-d);
  --md-typeset-mark-color: rgba(224, 123, 69, 0.3);

  /* warm a few syntax tokens toward the brand (slate's defaults skew cool) */
  --md-code-hl-keyword-color: var(--pi-accent-ink-d);
  --md-code-hl-operator-color: var(--pi-accent-ink-d);
  --md-code-hl-string-color: #9cc592;
  --md-code-hl-number-color: #e0a35a;
  --md-code-hl-function-color: #e9c46a;
}

/* Material forces a blue link color on slate keyed to its default primary
   (`[data-md-color-scheme=slate][data-md-color-primary=indigo]`, specificity
   0,2,0 — indigo is the default). Beat it (equal specificity, later source) so
   links stay rust rather than reverting to blue. */
[data-md-color-scheme="slate"][data-md-color-scheme] {
  --md-typeset-a-color: var(--pi-accent-ink-d);
}

/* ---------- component tweaks (scheme-agnostic) ---------- */

/* Material softens h1/h2 to a muted token; keep headings at full strength. */
.md-typeset h1,
.md-typeset h2,
.md-typeset h3 {
  color: var(--md-default-fg-color);
}

/* Bold the active nav link (accessibility, beyond the accent color). */
.md-nav__link--active {
  font-weight: 700;
}

/* Warm border + rounding on code blocks, echoing the server's cards. */
[data-md-color-scheme="default"] .md-typeset pre > code {
  border: 1px solid var(--pi-border-l);
  border-radius: 8px;
}
[data-md-color-scheme="slate"] .md-typeset pre > code {
  border: 1px solid var(--pi-border-d);
  border-radius: 8px;
}

/* Content images: round the corners (the benchmark chart carries its own card). */
.md-typeset img {
  border-radius: 8px;
}

/* Theme-aware figures: embed both `name.svg#only-light` and `name-dark.svg#only-dark`
   and the active scheme shows the matching one (same trick as the uv docs). */
[data-md-color-scheme="default"] img[src$="#only-dark"],
[data-md-color-scheme="slate"] img[src$="#only-light"] {
  display: none;
}

/* The logo is a rusted-iron block on transparency; give it a hair of room. */
.md-header__button.md-logo img {
  height: 1.6rem;
  width: auto;
}
