:root {
  --ink: #172126;
  --muted: #607078;
  --paper: #f6f7f2;
  --surface: #ffffff;
  --surface-soft: #edf1eb;
  --line: #d9ded6;
  --navy: #163a43;
  --navy-deep: #0c2930;
  --mint: #b9e2ce;
  --mint-strong: #63b68d;
  --coral: #ee795f;
  --yellow: #f5c35a;
  --code: #0f262b;
  --code-ink: #d9f0e7;
  --shadow: 0 18px 50px rgba(20, 45, 48, .10);
  --radius: 18px;
  --sidebar: 276px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 28px; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: #176c55; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: #0d4f40; }
img { max-width: 100%; }
button { font: inherit; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  width: var(--sidebar);
  padding: 30px 20px;
  color: #dcece5;
  background:
    radial-gradient(circle at 18% 8%, rgba(99,182,141,.22), transparent 28%),
    linear-gradient(165deg, var(--navy) 0%, var(--navy-deep) 80%);
  overflow-y: auto;
}

.brand { display: flex; align-items: center; gap: 12px; color: white; text-decoration: none; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 13px;
  color: var(--navy-deep);
  background: var(--mint);
  font-family: Georgia, serif;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -.04em;
}
.brand-copy { display: grid; line-height: 1.12; }
.brand-copy strong { font-size: 15px; letter-spacing: .02em; }
.brand-copy span { margin-top: 4px; color: #9fc7b7; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }

.nav-label {
  margin: 34px 10px 10px;
  color: #82aa9b;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.nav-list { display: grid; gap: 4px; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 42px;
  padding: 9px 11px;
  border-radius: 10px;
  color: #c6ddd4;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}
.nav-link:hover { color: white; background: rgba(255,255,255,.07); }
.nav-link.active { color: var(--navy-deep); background: var(--mint); }
.nav-num { width: 23px; color: #79aa96; font-size: 11px; font-variant-numeric: tabular-nums; }
.nav-link.active .nav-num { color: #346556; }
.nav-divider { height: 1px; margin: 22px 8px; background: rgba(255,255,255,.10); }
.version-card {
  margin-top: 28px;
  padding: 14px;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 13px;
  color: #a9c7bb;
  background: rgba(255,255,255,.045);
  font-size: 11px;
}
.version-card strong { display: block; margin-bottom: 3px; color: white; font-size: 12px; }
.version-links { display: flex; gap: 10px; margin-top: 9px; }
.version-links a { color: var(--mint); font-weight: 700; text-decoration: none; }
.version-links a:hover { color: white; }

.mobile-bar { display: none; }
.page { margin-left: var(--sidebar); min-height: 100vh; }
.content { width: min(1040px, calc(100% - 72px)); margin: 0 auto; padding: 62px 0 100px; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  color: #437565;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .15em;
  text-transform: uppercase;
}
.eyebrow::before { content: ""; width: 24px; height: 2px; background: var(--coral); }
.hero { position: relative; padding: 26px 0 46px; border-bottom: 1px solid var(--line); }
.hero h1 {
  max-width: 850px;
  margin: 0;
  color: var(--navy-deep);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(42px, 6vw, 72px);
  font-weight: 500;
  line-height: .98;
  letter-spacing: -.045em;
}
.hero h1 em { color: #28755e; font-style: italic; }
.hero .lede { max-width: 730px; margin: 24px 0 0; color: var(--muted); font-size: clamp(17px, 2vw, 21px); line-height: 1.55; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--navy);
  border-radius: 999px;
  color: white;
  background: var(--navy);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
}
.button:hover { color: white; background: var(--navy-deep); }
.button.secondary { color: var(--navy); background: transparent; }
.button.secondary:hover { background: #e8eee8; }

.section { padding: 50px 0 4px; }
.section[id] { scroll-margin-top: 20px; }
.section-kicker { color: var(--coral); font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
h2 {
  margin: 6px 0 16px;
  color: var(--navy-deep);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(30px, 4vw, 44px);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -.025em;
}
h3 { margin: 30px 0 10px; color: var(--navy); font-size: 19px; line-height: 1.3; }
h4 { margin: 22px 0 8px; color: var(--navy); font-size: 15px; }
p { margin: 0 0 18px; }
.section > p, .measure { max-width: 780px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.principles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 28px; }
.card {
  padding: 23px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,.74);
  box-shadow: 0 1px 0 rgba(255,255,255,.8) inset;
}
.card .index { color: var(--coral); font-family: Georgia, serif; font-size: 14px; font-style: italic; }
.card h3 { margin: 20px 0 8px; font-size: 17px; }
.card p { margin: 0; color: var(--muted); font-size: 13px; }
.card.accent { color: white; border-color: var(--navy); background: var(--navy); }
.card.accent h3 { color: white; }
.card.accent p { color: #bed6cc; }

.primitive {
  display: grid;
  grid-template-columns: 1fr 52px 1fr 52px 1fr;
  align-items: stretch;
  margin-top: 30px;
}
.primitive-card {
  position: relative;
  min-height: 230px;
  padding: 26px 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.primitive-card::after {
  content: attr(data-letter);
  position: absolute;
  right: -4px;
  bottom: -28px;
  color: rgba(22,58,67,.06);
  font-family: Georgia, serif;
  font-size: 120px;
  line-height: 1;
}
.primitive-card .type { color: #568574; font-size: 10px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.primitive-card h3 { margin: 12px 0 8px; font-family: Georgia, serif; font-size: 27px; font-weight: 500; }
.primitive-card p { color: var(--muted); font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 18px; }
.chip { padding: 5px 9px; border-radius: 999px; color: #396556; background: #e4f1e9; font-size: 10px; font-weight: 700; }
.arrow { display: grid; place-items: center; color: var(--coral); font-size: 22px; }

.callout {
  position: relative;
  margin: 28px 0;
  padding: 22px 24px 22px 55px;
  border: 1px solid #cfddd5;
  border-radius: 15px;
  background: #eaf3ed;
}
.callout::before { content: "i"; position: absolute; left: 22px; top: 22px; display: grid; place-items: center; width: 21px; height: 21px; border-radius: 50%; color: white; background: #2f7b62; font-family: Georgia, serif; font-style: italic; }
.callout strong { color: var(--navy); }
.callout p:last-child { margin-bottom: 0; }
.callout.warning { border-color: #ead6a9; background: #fbf1d6; }
.callout.warning::before { content: "!"; background: #a76f15; font-family: inherit; font-style: normal; }

pre {
  position: relative;
  margin: 22px 0 28px;
  padding: 24px;
  overflow-x: auto;
  border: 1px solid #27444a;
  border-radius: 16px;
  color: var(--code-ink);
  background: var(--code);
  box-shadow: 0 14px 30px rgba(12,41,48,.12);
  font: 12.5px/1.65 "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  tab-size: 2;
}
pre[data-label] { padding-top: 46px; }
pre[data-label]::before { content: attr(data-label); position: absolute; top: 14px; left: 24px; color: #7eaa9b; font: 700 9px/1 Inter, sans-serif; letter-spacing: .14em; text-transform: uppercase; }
code { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; }
:not(pre) > code { padding: 2px 6px; border: 1px solid #d6dfd8; border-radius: 6px; color: #295c4d; background: #edf2ed; font-size: .86em; }
.tok-key { color: #f5c35a; }
.tok-string { color: #9fdfc3; }
.tok-comment { color: #6f9890; }

.split { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(280px, .9fr); gap: 28px; align-items: start; }
.split > * { min-width: 0; }
.sticky-card { position: sticky; top: 24px; }
.steps { margin: 25px 0 0; padding: 0; list-style: none; counter-reset: step; }
.steps li { position: relative; min-height: 78px; padding: 2px 0 24px 54px; counter-increment: step; }
.steps li:not(:last-child)::after { content: ""; position: absolute; left: 17px; top: 38px; bottom: 0; width: 1px; background: var(--line); }
.steps li::before { content: counter(step); position: absolute; left: 0; top: 0; display: grid; place-items: center; width: 35px; height: 35px; border-radius: 50%; color: var(--navy-deep); background: var(--mint); font-size: 12px; font-weight: 800; }
.steps strong { display: block; color: var(--navy); }
.steps span { display: block; margin-top: 3px; color: var(--muted); font-size: 13px; }

.flow {
  display: grid;
  grid-template-columns: 1fr 38px 1fr 38px 1fr;
  align-items: center;
  margin: 28px 0;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.flow-node { min-height: 105px; padding: 18px; border-radius: 14px; color: var(--navy); background: var(--surface-soft); }
.flow-node strong { display: block; margin-bottom: 8px; }
.flow-node span { display: block; color: var(--muted); font-size: 11px; }
.flow-node.engine { color: white; background: var(--navy); }
.flow-node.engine span { color: #bad2c8; }
.flow-arrow { text-align: center; color: var(--coral); }

.diagram-figure { margin: 30px 0 38px; }
.diagram-canvas {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.diagram-figure figcaption {
  max-width: 780px;
  margin: 12px 4px 0;
  color: var(--muted);
  font-size: 12px;
}
.diagram-figure figcaption a { margin-left: 5px; font-weight: 700; }

.table-wrap { margin: 24px 0 32px; overflow-x: auto; border: 1px solid var(--line); border-radius: 15px; background: white; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { padding: 13px 16px; color: #527166; background: #edf2ed; font-size: 10px; letter-spacing: .1em; text-align: left; text-transform: uppercase; }
td { padding: 15px 16px; border-top: 1px solid var(--line); vertical-align: top; }
td:first-child { color: var(--navy); font-weight: 700; white-space: nowrap; }
td code { white-space: nowrap; }

.path-list { display: grid; gap: 10px; margin-top: 24px; }
.path-item { display: grid; grid-template-columns: 200px 1fr; gap: 20px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.path-item strong { color: var(--navy); font-size: 13px; }
.path-item span { color: var(--muted); font-size: 13px; }

.footer { display: flex; justify-content: space-between; gap: 20px; margin-top: 72px; padding-top: 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.footer a { font-weight: 700; }

@media (max-width: 980px) {
  :root { --sidebar: 236px; }
  .content { width: min(880px, calc(100% - 42px)); }
  .principles { grid-template-columns: 1fr 1fr; }
  .primitive { grid-template-columns: 1fr; gap: 12px; }
  .arrow { min-height: 22px; transform: rotate(90deg); }
}

@media (max-width: 760px) {
  .sidebar { display: none; }
  .mobile-bar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; justify-content: space-between; height: 58px; padding: 0 18px; color: white; background: var(--navy-deep); }
  .mobile-bar .brand-mark { width: 34px; height: 34px; border-radius: 10px; font-size: 14px; }
  .menu-button { border: 0; color: white; background: transparent; font-size: 13px; font-weight: 700; }
  body.nav-open .sidebar { display: block; width: min(320px, 88vw); top: 58px; padding-top: 20px; box-shadow: 20px 0 40px rgba(0,0,0,.22); }
  .page { margin-left: 0; }
  .content { width: calc(100% - 34px); padding-top: 34px; }
  .hero { padding-top: 12px; }
  .hero h1 { font-size: 44px; }
  .principles, .split { grid-template-columns: 1fr; }
  .sticky-card { position: static; }
  .flow { grid-template-columns: 1fr; gap: 10px; }
  .flow-arrow { transform: rotate(90deg); }
  .path-item { grid-template-columns: 1fr; gap: 3px; }
  .footer { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
