/* RuleFlow docs theme override — layers brand tokens on top of mdBook's
   built-in "light" and "navy" themes via CSS variables (see
   design_handoff_ruleflow/BRAND.md + tokens.css). We do not fork the theme;
   we only override variables + typography. */

/* ---- Light theme = Paper --------------------------------------------- */
.light, html:not(.js) {
  --bg: var(--rf-paper);
  --fg: var(--rf-carbon);

  --sidebar-bg: var(--rf-surface-light);
  --sidebar-fg: var(--rf-neutral-900);
  --sidebar-non-existant: var(--rf-neutral-200);
  --sidebar-active: var(--rf-flame-deep);
  --sidebar-spacer: var(--rf-divider-light);

  --icons: var(--rf-neutral-400);
  --icons-hover: var(--rf-carbon);

  --links: var(--rf-flame-deep);

  --inline-code-color: var(--rf-flame-deep);

  --theme-popup-bg: var(--rf-surface-light);
  --theme-popup-border: var(--rf-border-light-2);
  --theme-hover: var(--rf-divider-light);

  --quote-bg: var(--rf-neutral-100);
  --quote-border: var(--rf-border-light-2);

  --table-border-color: var(--rf-border-light);
  --table-header-bg: var(--rf-neutral-100);
  --table-alternate-bg: #fbf9f5;

  --search-mark-bg: #fde5cf;
  --searchresults-li-bg: #fdf1e6;

  --color-scheme: light;
}

/* ---- Dark theme ("navy" repurposed) = Carbon -------------------------- */
.navy {
  --bg: var(--rf-carbon);
  --fg: var(--rf-paper);

  --sidebar-bg: var(--rf-surface-dark);
  --sidebar-fg: var(--rf-neutral-200);
  --sidebar-non-existant: var(--rf-neutral-600);
  --sidebar-active: #fb923c;
  --sidebar-spacer: var(--rf-border-dark);

  --icons: var(--rf-neutral-400);
  --icons-hover: var(--rf-paper);

  --links: #fb923c;

  --inline-code-color: #fdba74;

  --theme-popup-bg: var(--rf-surface-dark);
  --theme-popup-border: var(--rf-border-dark-2);
  --theme-hover: var(--rf-border-dark);

  --quote-bg: var(--rf-border-dark);
  --quote-border: var(--rf-border-dark-2);

  --table-border-color: var(--rf-border-dark);
  --table-header-bg: var(--rf-border-dark-2);
  --table-alternate-bg: #1f1b15;

  --search-mark-bg: #7c2d12;
  --searchresults-li-bg: #201a12;

  --color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  html:not(.js) {
    --bg: var(--rf-carbon);
    --fg: var(--rf-paper);
    --sidebar-bg: var(--rf-surface-dark);
    --sidebar-fg: var(--rf-neutral-200);
    --links: #fb923c;
    --inline-code-color: #fdba74;
    --color-scheme: dark;
  }
}

/* ---- Typography -------------------------------------------------------- */
body {
  font-family: var(--rf-font-ui);
  font-weight: 400;
}

h1, h2, h3, h4, h5, h6,
.menu-title,
.chapter li a {
  font-family: var(--rf-font-display);
  letter-spacing: var(--rf-tracking-display);
  font-weight: 700;
}

h1 { font-weight: 800; }

.content h1 { font-size: 2.2em; }
.content h2 { font-size: 1.5em; margin-top: 1.8em; }
.content h3 { font-size: 1.2em; }

code, pre, kbd, samp,
.hljs,
.sidebar .chapter code {
  font-family: var(--rf-font-mono);
}

pre {
  border-radius: var(--rf-radius-card);
  border: 1px solid var(--table-border-color);
}

a {
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* Flame accent, used sparingly: current chapter marker + inline strong */
.chapter li.chapter-item a.active,
.chapter li a.active {
  color: var(--rf-flame);
  font-weight: 700;
}

::selection {
  background: var(--rf-flame);
  color: var(--rf-carbon);
}

/* Menu bar accent line */
#menu-bar {
  border-bottom: 1px solid var(--table-border-color);
}

blockquote {
  border-left: 3px solid var(--rf-flame);
  border-radius: 0 var(--rf-radius-control) var(--rf-radius-control) 0;
}

.theme-popup {
  border-radius: var(--rf-radius-control);
}

table thead {
  font-family: var(--rf-font-display);
  letter-spacing: -0.01em;
}
