/* ── faucet-stream documentation theme ──────────────────────────────────────
   Warm, restrained identity: a greige paper background with black text as the
   default, and a single dark-green accent used only for emphasis — links,
   the active nav item, buttons, callouts. The rule is strict: wherever a
   dark-green fill appears, its text is white. No teal, no gradients, no noise.
   Light/rust = warm paper; navy/coal/ayu = warm charcoal. Loaded via
   `additional-css` after mdBook's own CSS, so these rules win.
   ──────────────────────────────────────────────────────────────────────── */

:root {
  --fs-green: #247368; /* the accent — dark pine green (fills; white text on it) */
  --fs-green-deep: #17544a; /* hover / link text where more contrast is needed */
  --fs-green-bright: #57a894; /* accent on dark grounds */
  --fs-ink: #1b1b18; /* near-black, warm */
}

/* ── Light / rust: warm greige paper, black text ──────────────────────────── */
.light,
.rust {
  --bg: #dcdcd6; /* warm greige paper */
  --fg: var(--fs-ink);
  --sidebar-bg: #c6c6ba; /* deeper warm greige for clearer separation from the paper */
  --sidebar-fg: var(--fs-ink);
  --sidebar-non-existant: #8a8a7e;
  --sidebar-active: #ffffff;
  --sidebar-spacer: rgba(27, 27, 24, 0.14);
  --scrollbar: rgba(27, 27, 24, 0.3);
  --sidebar-header-border-color: var(--fs-green);
  --links: #1e6055; /* dark green, readable on warm paper */
  --inline-code-color: #17544a;
  --quote-bg: #e4e4dd;
  --quote-border: #c9c9bf;
  --table-border-color: #c6c6bc;
  --table-header-bg: #d3d3ca;
  --table-alternate-bg: #d7d7cf;
  --theme-popup-bg: #e2e2db;
  --theme-popup-border: #c6c6bc;
  --theme-hover: rgba(27, 27, 24, 0.08);
}

/* ── Navy / coal / ayu: warm charcoal, off-white text ─────────────────────── */
.navy,
.coal,
.ayu {
  --bg: #201f1b;
  --fg: #e8e6dd;
  --sidebar-bg: #1a1a16;
  --sidebar-fg: #e8e6dd;
  --sidebar-non-existant: #8f8d82;
  --sidebar-active: #ffffff;
  --sidebar-spacer: rgba(255, 255, 255, 0.09);
  --scrollbar: rgba(255, 255, 255, 0.26);
  --sidebar-header-border-color: var(--fs-green-bright);
  --links: var(--fs-green-bright);
  --inline-code-color: var(--fs-green-bright);
  --quote-bg: #2a2924;
  --quote-border: #3a3931;
  --table-border-color: #38372f;
  --table-header-bg: #26251f;
  --table-alternate-bg: #232219;
  --theme-hover: rgba(255, 255, 255, 0.08);
}

/* ── Sidebar TOC: black text; the active item is a green pill with white text ─ */
.sidebar .sidebar-scrollbox {
  padding: 0.6rem 0.8rem;
}
.chapter li.chapter-item {
  margin: 0.04rem 0;
  line-height: 1.85; /* match the roomy rhythm mdBook gives nested sections */
}
.chapter li.chapter-item > a,
.chapter li.chapter-item > div {
  border-radius: 7px;
  padding: 0.32rem 0.55rem;
  transition: background 0.13s ease, color 0.13s ease;
}
.chapter li.chapter-item > a:hover {
  background: color-mix(in srgb, var(--sidebar-fg) 10%, transparent);
  color: var(--sidebar-fg);
}
.chapter li.chapter-item > a.active {
  background: var(--fs-green);
  color: #fff;
  font-weight: 600;
}
.chapter .part-title {
  color: var(--sidebar-fg);
  opacity: 0.62;
  letter-spacing: 0.04em;
}

/* ── Focus: green ring, not the browser's blue ────────────────────────────── */
.sidebar a:focus:not(:focus-visible),
.content a:focus:not(:focus-visible) {
  outline: none;
}
a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--fs-green);
  outline-offset: 2px;
  border-radius: 4px;
}
.sidebar a:focus-visible {
  outline-offset: -2px;
  border-radius: 7px;
}

/* ── Top menu bar: one soft green hairline ────────────────────────────────── */
.menu-bar {
  border-bottom: 1px solid color-mix(in srgb, var(--fs-green) 22%, transparent);
}

/* ── Content links + accents (quiet) ──────────────────────────────────────── */
.content a:not(.header) {
  text-decoration: none;
}
.content a:not(.header):hover {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
}
::selection {
  background: color-mix(in srgb, var(--fs-green) 24%, transparent);
}
.content a.header:hover {
  color: var(--fs-green);
}

/* ── Blockquote → quiet green callout ─────────────────────────────────────── */
.content blockquote {
  border-inline-start: 3px solid var(--fs-green);
  background: color-mix(in srgb, var(--fs-green) 7%, transparent);
  border-radius: 0 6px 6px 0;
  margin-inline: 0;
  padding: 0.6rem 1rem;
  color: inherit;
}

/* ── Tables: clean, soft warm header ──────────────────────────────────────── */
.content table thead th {
  font-weight: 600;
}

/* ── Navigation + search pick up green ────────────────────────────────────── */
.nav-chapters:hover {
  color: var(--fs-green);
}
#searchbar:focus {
  border-color: var(--fs-green);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--fs-green) 22%, transparent);
  outline: none;
}
mark {
  background: color-mix(in srgb, var(--fs-green) 30%, transparent);
}

/* ── Typography ───────────────────────────────────────────────────────────────
   Comfortable body text at the full content width — no per-element width cap,
   so prose, code, and tables all share the same column and line up:
     · size    — 17px body (16px floor; 17–18px is the long-form optimum).
     · leading — 1.72 line-height (WCAG 1.4.8 asks for ≥1.5).
     · gutters — wider page padding so nothing hugs the edges.
   mdBook uses the 62.5% trick, so 1rem = 10px here.
   ──────────────────────────────────────────────────────────────────────────── */
:root {
  --page-padding: 24px; /* was 15px — symmetric breathing room on both edges */
  --content-max-width: 860px; /* the shared column width for all content */
}
.content {
  font-family: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-size: 1.7rem; /* 17px */
  line-height: 1.72; /* the vertical rhythm / "font gap" */
}
.content h1,
.content h2,
.content h3 {
  letter-spacing: -0.012em;
}
.content h2 {
  margin-top: 2.3rem;
  padding-bottom: 0.2em;
  border-bottom: 1px solid var(--table-border-color, rgba(0, 0, 0, 0.1));
}
.content pre {
  border-radius: 8px;
}
.content .mermaid {
  width: fit-content;
  max-width: 100%;
  margin: 1.6rem auto; /* center the box on the page */
  padding: 1.1rem 1.35rem;
  border: 1px solid var(--table-border-color, #c6c6bc);
  border-radius: 12px;
  background: color-mix(in srgb, var(--fs-green) 4%, transparent);
  text-align: center; /* center the diagram inside the box */
  overflow-x: auto;
}
.content .mermaid svg {
  max-width: 100%;
  height: auto;
}

/* ── Landing hero + cards (introduction.md) ───────────────────────────────── */
.fs-hero {
  text-align: center;
  padding: 2rem 1rem 0.5rem;
}
.fs-hero img {
  max-width: 420px;
  width: 70%;
  height: auto;
}
.fs-hero .fs-tagline {
  font-size: 1.3rem;
  font-weight: 500;
  color: var(--fs-green-deep);
  margin: 1rem auto 1.4rem;
  max-width: 34rem;
  line-height: 1.45;
}
.navy .fs-hero .fs-tagline,
.coal .fs-hero .fs-tagline,
.ayu .fs-hero .fs-tagline {
  color: var(--fs-green-bright);
}
.fs-cta {
  display: inline-flex;
  gap: 0.7rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 0.5rem;
}
.fs-cta a {
  display: inline-block;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  font-weight: 600;
  border-bottom: none !important;
  transition: transform 0.12s ease, background 0.12s ease;
}
.fs-cta a:hover {
  transform: translateY(-1px);
}
.fs-cta a.primary {
  background: var(--fs-green);
  color: #fff !important;
}
.fs-cta a.primary:hover {
  background: var(--fs-green-deep);
}
.fs-cta a.secondary {
  border: 1px solid var(--fs-green) !important;
  color: var(--fs-green-deep) !important;
}
.navy .fs-cta a.secondary,
.coal .fs-cta a.secondary,
.ayu .fs-cta a.secondary {
  border-color: var(--fs-green-bright) !important;
  color: var(--fs-green-bright) !important;
}
.fs-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}
.fs-card {
  border: 1px solid var(--table-border-color, rgba(0, 0, 0, 0.12));
  border-radius: 10px;
  padding: 1rem 1.15rem;
  transition: border-color 0.14s ease, transform 0.14s ease;
}
.fs-card:hover {
  border-color: var(--fs-green);
  transform: translateY(-2px);
}
.fs-card h3 {
  margin-top: 0;
  color: var(--fs-green-deep);
}
.navy .fs-card h3,
.coal .fs-card h3,
.ayu .fs-card h3 {
  color: var(--fs-green-bright);
}
