/* ============================================================
   combustion-skin.css — reskin layer for the module pages.
   Loaded AFTER each page's own inline <style>, so it overrides
   the design tokens and re-tints every token-driven widget to
   the shared Combustion system (ember brand, cool neutrals,
   graph-paper field) — matching the index + the Thermodynamics
   sister course. No widget markup is touched.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=IBM+Plex+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  /* re-tinted neutrals */
  --paper:      #ffffff;
  --paper-2:    #f4f5f8;
  --paper-3:    #eaecf1;
  --ink:        #16181d;
  --ink-soft:   #3a404c;
  --ink-faint:  #727a8a;
  --line:       #e3e6ec;
  --line-soft:  #eef0f4;

  /* ember brand replaces the old flame oklch */
  --flame:      #c0421e;
  --flame-deep: #97310f;
  --flame-soft: #fbe9e1;
  --blue:       #2f74d8;
  --blue-soft:  #e4eefb;
  --gas:        #e4eefb;

  /* thermo-system aliases (used by the injected top bar / Present) */
  --brand: #c0421e; --brand-d: #97310f; --brand-soft: #fbe9e1; --brand-line: #f1cfbf;
  --muted: #727a8a; --faint: #aeb4bf; --panel: #ffffff; --bg: #f6f5f3;
  --display: 'Space Grotesk', sans-serif;
  --sans: 'IBM Plex Sans', sans-serif;
  --mono: 'IBM Plex Mono', monospace;
}

/* engineering graph-paper field (matches index + thermo) */
body {
  background-color: #f6f5f3;
  background-image:
    linear-gradient(to right, rgba(192,66,30,.035) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(192,66,30,.035) 1px, transparent 1px);
  background-size: 28px 28px;
  padding-top: 60px;               /* clear the sticky top bar */
}

/* ---------- injected sticky top bar ---------- */
.csb-topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  background: rgba(255,255,255,.85);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.csb-inner { display: flex; align-items: center; gap: 16px; height: 60px; max-width: 1180px; margin: 0 auto; padding: 0 32px; }
.csb-brand { display: flex; align-items: center; gap: 11px; font-family: var(--display); font-weight: 600; font-size: 15.5px; letter-spacing: -.01em; color: var(--ink); text-decoration: none; }
.csb-glyph { width: 28px; height: 28px; border-radius: 7px; background: var(--brand); color: #fff; display: grid; place-items: center; font-family: var(--mono); font-weight: 600; font-size: 14px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }
.csb-ch { font-family: var(--mono); font-size: 12px; color: var(--muted); padding-left: 12px; margin-left: 4px; border-left: 1px solid var(--line); white-space: nowrap; }
.csb-ch b { color: var(--brand-d); font-weight: 600; }
.csb-spacer { flex: 1; }
.csb-nav { display: flex; gap: 4px; }
.csb-nav a { font-family: var(--sans); font-size: 13.5px; color: var(--ink-soft); padding: 7px 12px; border-radius: 8px; font-weight: 500; text-decoration: none; }
.csb-nav a:hover { background: var(--line-soft); color: var(--ink); }
.csb-present { margin-left: 6px; flex: none; display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 12px; font-weight: 600; padding: 6px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--ink-soft); cursor: pointer; white-space: nowrap; }
.csb-present:hover { border-color: var(--brand-line); color: var(--ink); }
.csb-present.on { background: var(--brand); color: #fff; border-color: var(--brand); }
@media (max-width: 1080px) { .csb-ch { display: none; } }
@media (max-width: 820px) { .csb-nav { display: none; } }
@media print { .csb-topbar { display: none; } body { padding-top: 0; } }

/* ---------- restyle the existing prev/next (modnav) to the thermo look ---------- */
.modnav { max-width: var(--maxw, 980px) !important; }
.modnav-inner { border-top: 1px solid var(--line); border-bottom: none; }
.modnav a { display: flex !important; flex-direction: column !important; gap: 5px !important; justify-content: flex-start; }
.modnav-dir, .modnav-num, .modnav-title { display: block; line-height: 1.25; }
.modnav-title { font-family: var(--display) !important; font-weight: 600 !important; }
.modnav-dir, .modnav-num { font-family: var(--mono) !important; }
.modnav-num { color: var(--brand-d) !important; }
.modnav-home { justify-content: center !important; }
.modnav-home:hover { border-color: var(--brand-line) !important; }

/* range thumbs etc. already key off --flame, so they re-tint automatically */

/* ============================================================
   "Going further" endmatter — advanced rigour cues + a further-
   reading list with editable / fillable slots. Markup comes from
   the shared <Endmatter> component in tex.jsx. Fonts hard-set to
   the module's editorial pairing (Newsreader serif / Spline mono)
   so it matches the body regardless of token overrides.
   ============================================================ */
.endmatter { margin-top: 12px; }
.endmatter .kicker .num { color: var(--flame-deep); }

.em-lede {
  font-family: "Newsreader", Georgia, serif;
  font-style: italic;
  font-size: 20px; line-height: 1.5;
  color: var(--ink-soft);
  max-width: 47ch;
  margin: 2px 0 30px;
  text-wrap: pretty;
}

/* advanced / rigour cues */
.em-threads { margin: 0 0 40px; border-top: 1px solid var(--line); }
.em-thread {
  display: grid; grid-template-columns: 156px 1fr; gap: 28px;
  padding: 20px 0; border-bottom: 1px solid var(--line);
}
.em-tag {
  font-family: "Spline Sans Mono", monospace;
  font-size: 11px; font-weight: 500; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--flame-deep);
  line-height: 1.5; padding-top: 3px;
}
.em-body {
  font-family: "Newsreader", Georgia, serif;
  font-size: 17.5px; line-height: 1.58; color: var(--ink-soft);
  text-wrap: pretty;
}
.em-body b, .em-body .lead-in { color: var(--ink); font-weight: 600; }
.em-body em { font-style: italic; color: var(--ink); }
.em-body .tex-inline { font-size: 1em; white-space: nowrap; }
.em-body a { color: var(--flame-deep); text-decoration: none; border-bottom: 1px solid var(--line); }
.em-body a:hover { border-bottom-color: var(--flame-deep); }

/* further-reading list */
.em-reading { margin-top: 2px; }
.em-rhead { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.em-rk {
  font-family: "Spline Sans Mono", monospace;
  font-size: 12.5px; font-weight: 600; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--ink);
}
.em-rhint {
  font-family: "Spline Sans Mono", monospace;
  font-size: 11.5px; color: var(--ink-faint);
}
.reflist { list-style: none; margin: 14px 0 4px; padding: 0; }
.ref { display: grid; grid-template-columns: 28px 1fr; gap: 14px; padding: 17px 0; border-top: 1px solid var(--line-soft); }
.ref:first-child { border-top: 1px solid var(--line); }
.ref-i {
  font-family: "Spline Sans Mono", monospace;
  font-size: 13px; font-weight: 500; color: var(--ink-faint);
  padding-top: 3px; text-align: right;
}
.ref-cite { font-family: "Newsreader", Georgia, serif; font-size: 17.5px; line-height: 1.5; color: var(--ink); text-wrap: pretty; }
.ref-cite b { font-weight: 600; }
.ref-cite i { font-style: italic; color: var(--ink-soft); }
.ref-venue { font-family: "Spline Sans Mono", monospace; font-size: 12.5px; color: var(--ink-faint); white-space: nowrap; }
.ref-note { font-family: "Newsreader", Georgia, serif; font-style: italic; font-size: 15.5px; line-height: 1.52; color: var(--ink-soft); margin-top: 6px; max-width: 62ch; text-wrap: pretty; }
.ref-note b { font-style: normal; font-weight: 600; color: var(--ink-soft); }
.ref-fill { display: inline-flex; align-items: center; gap: 10px; margin-top: 10px; }
.fill-k { font-family: "Spline Sans Mono", monospace; font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-faint); }
.fill-slot {
  font-family: "Spline Sans Mono", monospace; font-size: 12px;
  color: var(--flame-deep); border-bottom: 1px dashed var(--flame);
  padding: 1px 30px 3px 4px; white-space: nowrap;
}

/* blank "add your own" slot */
.ref-empty .ref-i { color: var(--flame); }
.ref-add {
  font-family: "Spline Sans Mono", monospace; font-size: 12.5px;
  color: var(--ink-soft); border: 1px dashed var(--line);
  border-radius: 5px; padding: 12px 15px; background: var(--paper-2);
}
.ref-addh { color: var(--ink-faint); }

@media (max-width: 640px) {
  .em-thread { grid-template-columns: 1fr; gap: 8px; }
  .em-tag { padding-top: 0; }
}

/* Present mode: scale up the reading column for projection */
html[data-present] .page { max-width: 1180px !important; }
html[data-present] body { font-size: 21px; }
html[data-present] .csb-present { background: var(--brand); color: #fff; border-color: var(--brand); }
