:root {
  --ink: #16231f;
  --muted: #505b57;
  --quiet: #65706b;
  --paper: #f5f3ed;
  --surface: #fffefa;
  --line: #dce1dc;
  --line-dark: #bdc7c1;
  --green: #1e6b4e;
  --green-dark: #124a37;
  --mint: #dcefe6;
  --amber: #a8600c;
  --amber-bg: #fff1d9;
  --red: #9b3c32;
  --red-bg: #fbe7e2;
  --card-bg: var(--surface);
  --card-line: var(--line);
  --diagram-fg: var(--ink);
  --diagram-muted: var(--quiet);
  --badge-bg: #16231f;
  --badge-fg: #dfff82;
  --font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #eef3ef;
    --muted: #9fb0a8;
    --quiet: #aeb9b3;
    --paper: #16231f;
    --surface: #1b2a24;
    --line: #33433c;
    --line-dark: #43524c;
    --green: #6fd6a8;
    --green-dark: #8fe6bd;
    --mint: #1f3a30;
    --amber: #f0b866;
    --amber-bg: #3a2c14;
    --red: #f0958a;
    --red-bg: #3a1e1a;
    --card-bg: #1b2a24;
    --card-line: #33433c;
    --diagram-fg: #eef3ef;
    --diagram-muted: #9fb0a8;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
main { max-width: 980px; margin: 0 auto; padding: 28px 28px 100px; }

.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 750; text-decoration: none; padding: 13px 10px; margin: -13px 0 15px -10px; }
.back-link:hover { color: var(--green); }

header.page-head { display: flex; flex-direction: column; gap: 18px; margin-bottom: 56px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 30px; height: 30px; border-radius: 50%; background: var(--badge-bg); color: var(--badge-fg); display: grid; place-items: center; font-weight: 800; font-size: 13px; flex: 0 0 auto; }
.brand-word { font-weight: 800; font-size: 13px; letter-spacing: .06em; color: var(--muted); text-transform: uppercase; }
.eyebrow { color: var(--green); font-size: 11px; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(32px, 4.4vw, 46px); letter-spacing: -.03em; line-height: 1.06; text-wrap: balance; }
h1 em { font-family: var(--serif); font-style: italic; font-weight: 400; color: var(--green); }
.dek { max-width: 640px; margin: 0; color: var(--muted); font-size: 17px; line-height: 1.55; }
.context-line { display: flex; flex-wrap: wrap; gap: 10px 20px; padding-top: 20px; margin-top: 8px; border-top: 1px solid var(--line-dark); color: var(--quiet); font-size: 12px; font-weight: 650; }
.context-line span + span { padding-left: 20px; border-left: 1px solid var(--line-dark); }

section.figure-block { margin-bottom: 64px; }
section.figure-block:last-of-type { margin-bottom: 48px; }
.figure-kicker { color: var(--green); font-size: 10px; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; margin-bottom: 8px; }
.figure-block h2 { margin: 0 0 10px; font-size: clamp(22px, 2.8vw, 28px); letter-spacing: -.02em; text-wrap: balance; }
.figure-intro { margin: 0 0 26px; max-width: 700px; color: var(--muted); font-size: 15px; line-height: 1.6; }

figure { margin: 0; padding: 0; }
.diagram-frame { background: var(--card-bg); border: 1px solid var(--card-line); border-radius: 16px; padding: 28px; overflow-x: auto; }
.diagram-frame svg { display: block; max-width: 100%; height: auto; color: var(--diagram-fg); }
figcaption { margin-top: 14px; color: var(--quiet); font-size: 12.5px; line-height: 1.55; max-width: 660px; }
figcaption strong { color: var(--muted); font-weight: 700; }

.grounding { margin-top: 18px; padding: 16px 18px; background: var(--mint); border-radius: 12px; color: var(--green-dark); font-size: 12.5px; line-height: 1.6; }
.grounding strong { font-weight: 800; }

.terminal-frame { background: #0b120f; border-radius: 14px; border: 1px solid rgba(255,255,255,0.09); overflow: hidden; }
.terminal-chrome { display: flex; align-items: center; gap: 7px; padding: 11px 16px; background: #131c18; border-bottom: 1px solid rgba(255,255,255,0.07); }
.terminal-chrome .dot { width: 10px; height: 10px; border-radius: 50%; background: #4a5750; }
.terminal-chrome .dot:nth-child(1) { background: #e5645a; }
.terminal-chrome .dot:nth-child(2) { background: #e8b95c; }
.terminal-chrome .dot:nth-child(3) { background: #5fc27a; }
.terminal-title { margin-left: 8px; font: 700 10.5px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .03em; color: #7c8a83; }
.terminal-body { margin: 0; padding: 20px 22px 6px; overflow-x: auto; color: #cfdbd4; font: 12.5px/1.7 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.term-block { margin-bottom: 22px; }
.term-line { white-space: pre; }
.term-prompt { color: #8fe6bd; }
.term-output { color: #b7c4bd; }
.terminal-body.js-anim .term-line { opacity: 0; transform: translateY(2px); }
.terminal-body.js-anim .term-line.is-shown { opacity: 1; transform: none; transition: opacity .15s ease, transform .15s ease; }
.terminal-replay { margin: 0 22px 20px; padding: 8px 14px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.16); background: transparent; color: #9fb0a8; font: 700 10.5px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .04em; text-transform: uppercase; cursor: pointer; }
.terminal-replay:hover { color: #eef3ef; border-color: rgba(255,255,255,0.32); }
.terminal-replay[hidden] { display: none; }

footer.notes-footer { border-top: 1px solid var(--line-dark); padding-top: 22px; margin-top: 8px; color: var(--quiet); font-size: 11.5px; line-height: 1.6; }
footer.notes-footer p { margin: 0 0 8px; max-width: 720px; }
footer.notes-footer p:last-child { margin-bottom: 0; }

@media (max-width: 640px) {
  main { padding: 20px 18px 70px; }
  .diagram-frame { padding: 18px; }
  .terminal-body { padding: 16px 16px 4px; font-size: 11.5px; }
  .terminal-replay { margin: 0 16px 18px; }
}
