/* FerroEHR book theme — brand recolour of the mdBook "rust"/"coal" themes.
   Design tokens per docs/plans/w1-docs-website.md §3a. Only recolours; keeps
   mdBook's typography and layout. */

:root {
  --rs-rust: #b7410e;
  --rs-rust-600: #9a360b;
  --rs-umber: #5a2408;
  --rs-umber-050: #f6ede7;
}

/* ── Light themes (light / rust) ─────────────────────────────────────────── */
.light,
.rust {
  --links: var(--rs-rust);
  --sidebar-active: var(--rs-rust);
  --inline-code-color: var(--rs-umber);
  --search-mark-bg: #e4a06a;
}

/* The rust theme pairs LIGHT content with a DARK sidebar (#3b2e2a), so its
   active link (--rs-rust #b7410e) reads 2.34:1 there — WCAG 1.4.3 fail. The
   `light` theme keeps a light sidebar (#fafafa, 5.5:1) and is untouched. Give
   rust the dark-theme active colour (#f08040 = 4.89:1 on its sidebar); --links
   stays #b7410e because rust's CONTENT is light. */
.rust {
  --sidebar-active: #f08040;
}

.light .content code,
.rust .content code {
  background-color: var(--rs-umber-050);
}

/* ── Dark themes (coal / navy / ayu) ─────────────────────────────────────── */
.coal,
.navy,
.ayu {
  --links: #f08040; /* brightened rust; 5.26:1 on the coal/navy sidebar, WCAG 1.4.3 AA (was #e4712f = 4.48:1, fail) */
  --sidebar-active: #f08040;
  --inline-code-color: #e4a06a;
}

/* mdBook's default .menu-title colour (#43484d) is 1.98:1 on the ayu top bar
   and 1.52:1 on coal/navy — below the 3:1 large-text floor (WCAG 1.4.3). Give
   it a legible muted foreground on the dark themes; light is untouched (the
   default reads 9.24:1 there). */
.coal .menu-title,
.navy .menu-title,
.ayu .menu-title {
  color: #9aa0a6; /* 6.94:1 on ayu, 5.32:1 on coal/navy */
}

/* ── Target size (WCAG 2.2 2.5.8, mdBook chrome ≥ 24×24 CSS px) ────────────── */
/* mdBook's top-bar icon links (print, git repository) render 36×22 and the
   sidebar chapter links 81×21 — both one pixel class under the 24px minimum
   height. Give them a 24px min-height without moving anything else. */
.right-buttons a {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
}
.chapter li a {
  min-height: 24px;
  display: flex;
  align-items: center;
/* ── Code syntax-highlight contrast (mdBook's highlight.js themes) ─────────── */
/* mdBook's bundled highlight themes miss the WCAG 1.4.3 4.5:1 floor on two
   tokens; override them (custom.css loads after the highlight CSS). */
/* Light: .hljs-string #008200 is 4.34:1 on the code background. Scoped to the
   light themes only — #007000 on a dark code bg is 2.61:1, so a global override
   would break the dark themes (they keep their own lighter green). */
.light .hljs-string,
.rust .hljs-string {
  color: #007000; /* 5.48:1 on the light code background #f6ede7 */
}
/* Dark: .hljs-comment #5c6773 is 2.87:1 on both coal and ayu code backgrounds. */
.coal .hljs-comment,
.navy .hljs-comment,
.ayu .hljs-comment {
  color: #8a95a3; /* 5.44:1 on coal, 5.46:1 on ayu */
}

/* ── Shared brand touches ────────────────────────────────────────────────── */
/* In-prose links are underlined so they are distinguishable from surrounding
   text without relying on colour (WCAG 2.2 1.4.1); axe reports the rust link
   colour as link-in-text-block otherwise. Heading anchor links opt out below —
   they are not in a text block and the underline would be noise. */
/* Address by the id (#mdbook-content = .content) so specificity is 1,0,1 and
   beats mdBook's own `.content a { text-decoration: none }` (0,1,1) by the
   cascade, not by stylesheet load order — which is fragile and was letting the
   underline silently lose. */
#mdbook-content a,
#mdbook-content a:visited {
  color: var(--links);
  text-decoration: underline;
}
#mdbook-content a:hover {
  color: var(--rs-rust-600);
}
/* Heading anchor links (mdBook's `.header`) are not prose — no underline. The
   id keeps this above the base rule too. */
#mdbook-content a.header {
  text-decoration: none;
}

/* Rust-tinted rule under page headings. */
.content h1,
.content h2 {
  border-bottom: 2px solid var(--rs-rust);
  padding-bottom: 0.2em;
}

/* Version picker + API link injected into the top menu bar (§2e). */
#rs-version-picker {
  margin: 0 0.5rem;
  font: inherit;
  color: var(--fg);
  background: var(--theme-hover, transparent);
  border: 1px solid var(--rs-rust);
  border-radius: 4px;
  padding: 0.15rem 0.35rem;
  cursor: pointer;
}
#rs-api-link {
  display: inline-flex;
  align-items: center;
  /* Use the themed --links, not raw --rs-rust: #b7410e is 3.33:1 on the ayu
     top bar (WCAG 1.4.3 fail). --links carries the theme-correct value —
     #b7410e on light (5.56:1), #f08040 on the dark themes (6.93:1 on ayu). */
  color: var(--links);
  font-weight: 600;
  text-decoration: none;
  padding: 0 0.5rem;
}
#rs-api-link:hover {
  color: var(--rs-rust-600);
}
