:root {
  --ink: #0E2A3D;
  --ink-soft: #33506308;
  --paper: #F6F4EF;
  --paper-card: #FFFFFF;
  --line: #DCD8CC;
  --accent: #C77B3E;
  --accent-soft: #F0E3D2;
  --text: #1B2B33;
  --text-muted: #5C6B72;
  --serif: "Fraunces", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--ink); }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  background: var(--ink);
  color: #F6F4EF;
}
.wordmark {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.15rem;
  letter-spacing: 0.01em;
  color: #F6F4EF;
  text-decoration: none;
}
.wordmark span { color: var(--accent); }
.topnav { display: flex; gap: 24px; }
.topnav a {
  color: #E7E2D6;
  text-decoration: none;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 1px solid transparent;
  padding-bottom: 3px;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.topnav a:hover, .topnav a[aria-current="page"] {
  color: #FFFFFF;
  border-color: var(--accent);
}

/* ---------- Page header ---------- */
.doc-header {
  max-width: 1080px;
  margin: 0 auto;
  padding: 56px 32px 28px;
}
.doc-header .eyebrow {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 14px;
}
.doc-header h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2.1rem, 4vw, 3.1rem);
  line-height: 1.08;
  margin: 0 0 12px;
  color: var(--ink);
}
.doc-header .lede {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 62ch;
  margin: 0 0 18px;
}
.doc-meta {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--text-muted);
  border-top: 1px solid var(--line);
  padding-top: 16px;
}
.doc-meta strong { color: var(--ink); font-weight: 600; }

/* ---------- Layout: content + rail ---------- */
.doc-layout {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 32px 96px;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 56px;
  align-items: start;
}

.toc {
  position: sticky;
  top: 88px;
  border-left: 2px solid var(--line);
  padding-left: 20px;
}
.toc .toc-label {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 14px;
}
.toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: toc;
}
.toc li { counter-increment: toc; margin: 0 0 10px; }
.toc a {
  display: flex;
  gap: 10px;
  text-decoration: none;
  font-size: 0.86rem;
  color: var(--text-muted);
  line-height: 1.4;
}
.toc a::before {
  content: counter(toc, decimal-leading-zero);
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--accent);
  flex: none;
  padding-top: 1px;
}
.toc a:hover { color: var(--ink); }

.doc-body { min-width: 0; }

.doc-body section {
  padding: 30px 0;
  border-bottom: 1px solid var(--line);
  scroll-margin-top: 90px;
}
.doc-body section:last-child { border-bottom: none; }

.doc-body h2 {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 14px;
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.doc-body h2 .num {
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--accent);
  font-weight: 500;
}
.doc-body p { margin: 0 0 14px; color: var(--text); }
.doc-body ul { margin: 0 0 14px; padding-left: 0; list-style: none; }
.doc-body ul li {
  position: relative;
  padding-left: 22px;
  margin-bottom: 10px;
  color: var(--text);
}
.doc-body ul li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 8px;
  height: 1px;
  background: var(--accent);
}
.doc-body ul li strong { color: var(--ink); }

.callout {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  padding: 14px 18px;
  border-radius: 2px;
  font-size: 0.92rem;
  color: var(--ink);
  margin: 0 0 14px;
}

.fields {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 4px 20px;
  background: var(--paper-card);
  margin: 8px 0 18px;
}
.fields li::before { display: none; }
.fields li { padding-left: 0; }

/* ---------- Cross-link card ---------- */
.crosslink {
  margin-top: 40px;
  padding: 22px 24px;
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.crosslink p { margin: 0; color: var(--text-muted); font-size: 0.92rem; }
.crosslink a {
  font-family: var(--mono);
  font-size: 0.82rem;
  text-decoration: none;
  color: var(--ink);
  border-bottom: 1px solid var(--accent);
  padding-bottom: 2px;
  white-space: nowrap;
}

/* ---------- Footer ---------- */
footer.site-footer {
  background: var(--ink);
  color: #C9CFCB;
  padding: 36px 32px;
  font-size: 0.85rem;
}
footer.site-footer .footer-inner {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
footer.site-footer a { color: #E7E2D6; text-decoration: none; }
footer.site-footer a:hover { text-decoration: underline; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .doc-layout { grid-template-columns: 1fr; }
  .toc {
    position: static;
    border-left: none;
    border-top: 1px solid var(--line);
    padding-left: 0;
    padding-top: 20px;
  }
  .topbar { padding: 16px 20px; }
  .doc-header { padding: 40px 20px 24px; }
  .doc-layout { padding: 0 20px 64px; }
}
