/* Site-wide "land-survey / blueprint" theme — the same visual identity
 * as the home page (book/src/index.md, book/src/css/landing.css),
 * applied everywhere else as typography + a palette overlay on
 * mdBook's own theme system, not a second copy of the landing page's
 * hero/card treatment (reference pages are read for the information,
 * not the pitch). Loaded via book.toml's additional-css, after
 * mdBook's own css/variables-*.css / general-*.css / chrome-*.css in
 * <head> — same specificity, later source wins, no !important needed
 * except where mdBook's own rule already uses one (--mono-font, since
 * `code { font-family: var(--mono-font) !important; }` already exists
 * upstream).
 */

@font-face {
  font-family: "LG Plex Cond";
  font-weight: 600;
  src: url(fonts/PlexSansCond-SemiBold.woff2) format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "LG Plex Cond";
  font-weight: 700;
  src: url(fonts/PlexSansCond-Bold.woff2) format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "LG Plex Serif";
  font-weight: 400;
  font-style: normal;
  src: url(fonts/PlexSerif-Regular.woff2) format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "LG Plex Serif";
  font-weight: 400;
  font-style: italic;
  src: url(fonts/PlexSerif-Italic.woff2) format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "LG Plex Mono";
  font-weight: 400;
  src: url(fonts/PlexMono-Regular.woff2) format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "LG Plex Mono";
  font-weight: 500;
  src: url(fonts/PlexMono-Medium.woff2) format("woff2");
  font-display: swap;
}

/* ---- palette: same tokens as landing.css, mapped onto mdBook's own
   custom properties instead of a scoped wrapper class, since this
   needs to apply to the whole page, every page. Two variants only —
   light/rust converge on the light blueprint palette, coal/navy/ayu on
   the dark one — rather than five distinct looks, so the site reads as
   one product regardless of which of mdBook's picker options a reader
   has chosen. */
.light, .rust, html:not(.js) {
  --bg: #e9edf3;
  --fg: #0f1826;
  --sidebar-bg: #dce4ef;
  --sidebar-fg: #22314a;
  --sidebar-non-existant: #8a9ab3;
  --sidebar-active: #a8671f;
  --sidebar-spacer: #c7d2e2;
  --icons: #5a6c87;
  --icons-hover: #0f1826;
  --links: #8a5417;
  --inline-code-color: #8a5417;
  --theme-popup-bg: #f5f7fa;
  --theme-popup-border: #b9c6d9;
  --theme-hover: #dce4ef;
  --quote-bg: #dce4ef;
  --quote-border: #b9c6d9;
  --table-border-color: #b9c6d9;
  --table-header-bg: #c7d2e2;
  --table-alternate-bg: #f5f7fa;
  --search-mark-bg: #f0e2cd;
  --sidebar-header-border-color: #a8671f;
}

.coal, .navy, .ayu {
  --bg: #0f1930;
  --fg: #dde6f3;
  --sidebar-bg: #0b1424;
  --sidebar-fg: #b9c8e0;
  --sidebar-non-existant: #4c6690;
  --sidebar-active: #d99a46;
  --sidebar-spacer: #1c2c4d;
  --icons: #7f95b3;
  --icons-hover: #dde6f3;
  --links: #e0ab63;
  --inline-code-color: #e0ab63;
  --theme-popup-bg: #142140;
  --theme-popup-border: #4c6690;
  --theme-hover: #17274a;
  --quote-bg: #142140;
  --quote-border: #263a5c;
  --table-border-color: #263a5c;
  --table-header-bg: #1c2c4d;
  --table-alternate-bg: #0b1424;
  --search-mark-bg: #2c2312;
  --sidebar-header-border-color: #d99a46;
}

@media (prefers-color-scheme: dark) {
  html:not(.js) {
    --bg: #0f1930;
    --fg: #dde6f3;
    --sidebar-bg: #0b1424;
    --sidebar-fg: #b9c8e0;
    --sidebar-non-existant: #4c6690;
    --sidebar-active: #d99a46;
    --sidebar-spacer: #1c2c4d;
    --icons: #7f95b3;
    --icons-hover: #dde6f3;
    --links: #e0ab63;
    --inline-code-color: #e0ab63;
    --theme-popup-bg: #142140;
    --theme-popup-border: #4c6690;
    --theme-hover: #17274a;
    --quote-bg: #142140;
    --quote-border: #263a5c;
    --table-border-color: #263a5c;
    --table-header-bg: #1c2c4d;
    --table-alternate-bg: #0b1424;
    --search-mark-bg: #2c2312;
    --sidebar-header-border-color: #d99a46;
  }
}

:root {
  --mono-font: "LG Plex Mono", "Source Code Pro", Consolas, monospace;
}

html {
  font-family: "LG Plex Serif", Georgia, serif;
}

h1, h2, h3, h4, h5, h6 {
  font-family: "LG Plex Cond", "IBM Plex Sans Condensed", sans-serif;
  font-weight: 600;
  letter-spacing: 0.002em;
}

h1 { font-weight: 700; }

.menu-title {
  font-family: "LG Plex Cond", "IBM Plex Sans Condensed", sans-serif;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.sidebar .chapter { font-family: "LG Plex Mono", "Source Code Pro", monospace; font-size: 1.4rem; }
.sidebar .chapter li { line-height: 1.5; }
.sidebar .part-title {
  margin-top: 1.25rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--sidebar-spacer);
  color: var(--sidebar-active);
  font-family: "LG Plex Cond", "IBM Plex Sans Condensed", sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.content main { line-height: 1.68; }
.content main > h1:first-child { margin-bottom: 0.8em; }
.content main > h1:first-child::after {
  content: "";
  display: block;
  width: 3rem;
  margin-top: 0.45em;
  border-bottom: 2px solid var(--sidebar-active);
}

.doc-path-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 1.5rem 0 2.25rem;
}
.doc-path {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-height: 9rem;
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--table-border-color);
  background: var(--table-alternate-bg);
  color: var(--fg);
  text-decoration: none;
}
.doc-path:hover { border-color: var(--sidebar-active); }
.doc-path span {
  color: var(--sidebar-active);
  font-family: var(--mono-font);
  font-size: 0.72em;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.doc-path strong {
  font-family: "LG Plex Cond", "IBM Plex Sans Condensed", sans-serif;
  font-size: 1.2em;
}
.doc-path small { color: var(--sidebar-fg); font-size: 0.9em; }

@media (max-width: 700px) {
  .doc-path-grid { grid-template-columns: 1fr; }
}

/* Governed workflow: semantic flow first, command sequence second. */
.gov-flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin: 1.5rem 0 1.25rem;
  border: 1px solid var(--table-border-color);
  background: var(--table-border-color);
}
.gov-stage {
  min-width: 0;
  padding: 1.15rem;
  background: var(--table-alternate-bg);
}
.gov-kicker,
.gov-command-number {
  display: block;
  margin-bottom: 0.8rem;
  color: var(--sidebar-active);
  font-family: var(--mono-font);
  font-size: 0.72em;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.gov-stage p { margin: 0.5rem 0 0; font-size: 0.9em; }
.gov-source {
  padding: 0.65rem 0;
  border-top: 1px solid var(--table-border-color);
}
.gov-source-spo { border-bottom: 1px solid var(--table-border-color); }
.gov-source p { margin-top: 0.25rem; }
.gov-caption { color: var(--sidebar-active); font-family: var(--mono-font); }
.gov-object { display: block; overflow-wrap: anywhere; }
.gov-object + p { margin-bottom: 1rem; }
.gov-stack {
  display: grid;
  gap: 0.25rem;
  justify-items: center;
  padding: 0.75rem;
  border-left: 2px solid var(--sidebar-active);
  background: var(--quote-bg);
  font-family: "LG Plex Cond", "IBM Plex Sans Condensed", sans-serif;
  letter-spacing: 0.035em;
  text-align: center;
  text-transform: uppercase;
}
.gov-stack span { color: var(--sidebar-active); }
.gov-invariants {
  display: grid;
  gap: 0.35rem;
  margin-top: 1rem;
  color: var(--sidebar-active);
  font-family: var(--mono-font);
  font-size: 0.78em;
}

.gov-command-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 1.25rem 0 1.75rem;
}
.gov-command {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 1.2rem;
  border: 1px solid var(--table-border-color);
  background: var(--table-alternate-bg);
}
.gov-command h3 { margin: 0 0 0.5rem; text-transform: uppercase; }
.gov-command p { margin: 0 0 1rem; }
.gov-command pre {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  margin: auto 0 0;
  overflow-x: auto;
  white-space: pre;
}

@media (max-width: 900px) {
  .gov-flow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  .gov-flow,
  .gov-command-grid { grid-template-columns: minmax(0, 1fr); }
  .gov-stage,
  .gov-command { padding: 1rem; }
}

/* Blockquotes read as callouts (survey annotation), not generic italics */
blockquote {
  border-left: 3px solid var(--sidebar-active);
  background: var(--quote-bg);
  padding: 0.6em 1.2em;
  border-radius: 0;
}

/* Sharp corners throughout — consistent with the landing page's
   "survey plat" language (corner ticks, not rounded cards) */
pre, code, .theme-popup, table, blockquote, img {
  border-radius: 0;
}

a { text-decoration-thickness: 1px; text-underline-offset: 0.15em; }
