/* Downstream design system — implemented literally from /design.md.
   Zero-dependency fallback font stack (design.md §4): no network fonts,
   no @font-face. If this renders wrong with fonts missing, the system
   itself is broken, not this page. */

*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  /* Ground and paper — design.md §3 */
  --ink: #0b1220;
  --ink-2: #121b30;
  --ink-3: #1b2743;
  --void: #070c16;
  --paper: #f4f6fb;
  --paper-2: #ffffff;
  --rule: #d9e1f0;

  /* Text — design.md §3 */
  --text: #0b1220;
  --text-body: #4a5872;
  --slate: #5c6b87;
  --quiet: #6e7e9c; /* non-text only */
  --text-d: #93a3c0;
  --quiet-d: #67769a; /* non-text only, on ink */

  /* Status marks — design.md §3. Hue means epistemic status, nothing else. */
  --observed-mark: #1f9e8f;
  --observed-text-paper: #147065;
  --observed-text-ink: #4fc3b2;
  --pending-mark: #d9962b;
  --pending-text-paper: #8a5b0e;
  --pending-text-ink: #d9962b;
  --missed-mark: #e2695c;
  --missed-text-paper: #a33127;
  --missed-text-ink: #e2695c;
  --silent-mark: #8494b0;
  --silent-text-paper: #4a5872;
  --silent-text-ink: #8494b0;
  --struck-mark: #a48ad4;
  --struck-text-paper: #5b3e86;
  --struck-text-ink: #a48ad4;

  /* The one reserved accent — design.md §3 "Reserved". Not teal: ochre only. */
  --accent: #d9962b;

  /* Zero-dependency fallback stack — design.md §4 */
  --serif:
    'Source Serif 4', 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia,
    serif;
  --sans:
    Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
    sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
}

html {
  background: var(--paper);
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-body);
  font-feature-settings:
    'tnum' 1,
    'ss01' 1;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Type roles — design.md §4 scale table, sizes taken literally ---------- */
.display {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 62px;
  line-height: 1;
  color: var(--text);
  margin: 0;
}
h1,
.h1 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 44px;
  line-height: 1.14;
  letter-spacing: -0.01em;
  max-width: 20ch;
  color: var(--text);
  margin: 0;
}
h2,
.h2 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 21px;
  line-height: 1.25;
  color: var(--text);
  margin: 0;
}
h3,
.h3 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 18px;
  line-height: 1.3;
  color: var(--text);
  margin: 0;
}
.lede {
  font-family: var(--sans);
  font-size: 15.5px;
  line-height: 1.55;
  max-width: 96ch;
  color: var(--text-body);
  margin: 0;
}
p,
.body {
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-body);
  max-width: 75ch;
  margin: 0 0 14px;
}
.dense {
  font-family: var(--sans);
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text-body);
}
.caption {
  font-family: var(--sans);
  font-style: italic;
  font-size: 12px;
  line-height: 1.5;
  color: var(--slate);
}
.citation,
code.citation {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-body);
}
.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 10px;
  display: block;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border-radius: 3px;
  padding: 5px 7px;
  white-space: nowrap;
}

strong,
b {
  font-weight: 700;
  color: var(--text);
}
em,
i {
  font-style: italic;
}
a {
  color: inherit;
}
.surface-dark a,
.surface-void a {
  color: var(--text-d);
}

/* ---------- Status chips — design.md §3 "Chip construction" ---------- */
.chip.observed {
  background: rgba(31, 158, 143, 0.14);
  color: var(--observed-text-paper);
}
.chip.pending {
  background: rgba(217, 150, 43, 0.14);
  color: var(--pending-text-paper);
}
.chip.missed {
  background: rgba(226, 105, 92, 0.14);
  color: var(--missed-text-paper);
}
.chip.silent {
  background: rgba(132, 148, 176, 0.14);
  color: var(--silent-text-paper);
}
.chip.struck {
  background: rgba(164, 138, 212, 0.14);
  color: var(--struck-text-paper);
}

.surface-dark .chip.observed,
.surface-void .chip.observed {
  color: var(--observed-text-ink);
}
.surface-dark .chip.pending,
.surface-void .chip.pending {
  color: var(--pending-text-ink);
}
.surface-dark .chip.missed,
.surface-void .chip.missed {
  color: var(--missed-text-ink);
}
.surface-dark .chip.silent,
.surface-void .chip.silent {
  color: var(--silent-text-ink);
}
.surface-dark .chip.struck,
.surface-void .chip.struck {
  color: var(--struck-text-ink);
}

/* contingent_unfunded — design.md §3 rule 3: pending with a 45° hatch, not a sixth hue */
.chip.pending.hatch {
  background-image: repeating-linear-gradient(
    45deg,
    rgba(217, 150, 43, 0.14) 0 3px,
    rgba(217, 150, 43, 0.28) 3px 4px
  );
}

/* Status glyphs, used standalone (design.md §3 "Mark" column: shape carries meaning too) */
.mark {
  font-family: var(--mono);
  display: inline-block;
  width: 1em;
  text-align: center;
}
.mark.observed {
  color: var(--observed-mark);
}
.mark.pending {
  color: var(--pending-mark);
}
.mark.missed {
  color: var(--missed-mark);
}
.mark.silent {
  color: var(--silent-mark);
}
.mark.struck {
  color: var(--struck-mark);
}

/* ---------- Surfaces — dark cover / light content / dark close rhythm, §5 ---------- */
.surface-light {
  background: var(--paper);
  color: var(--text-body);
}
.surface-dark {
  background: var(--ink);
  color: var(--text-d);
}
.surface-void {
  background: var(--void);
  color: var(--text-d);
}
.surface-dark h1,
.surface-dark h2,
.surface-dark h3,
.surface-dark .display {
  color: #fff;
}
.surface-void h1,
.surface-void h2,
.surface-void h3,
.surface-void .display {
  color: #fff;
}
.surface-dark .caption,
.surface-void .caption {
  color: var(--quiet-d);
}

/* ---------- Layout shell ---------- */
.page {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100vh;
}
@media (max-width: 840px) {
  .page {
    grid-template-columns: 1fr;
  }
}
.stage {
  padding: 56px clamp(20px, 5vw, 72px);
}
.stage + .stage {
  border-top: 1px solid var(--rule);
}
.surface-dark + .surface-light .stage,
.surface-void + .surface-light .stage {
  border-top: none;
}
.measure {
  max-width: 75ch;
}
.wide {
  max-width: 96ch;
}

/* ---------- The spine — design.md §5 "The spine" ---------- */
.spine {
  border-right: 1px solid var(--rule);
  background: var(--paper);
  padding: 28px 0;
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow-y: auto;
}
@media (max-width: 840px) {
  .spine {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--rule);
  }
}
.spine-mark {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--text);
  padding: 0 20px 20px;
  display: block;
  text-decoration: none;
}
.spine-mark b {
  color: var(--accent);
}
.spine a {
  display: block;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--slate);
  text-decoration: none;
  padding: 9px 20px;
  border-left: 2px solid transparent;
}
.spine a:hover {
  color: var(--text);
}
.spine a.current {
  color: var(--text);
  border-left-color: var(--accent);
  background: rgba(217, 150, 43, 0.06);
}
.spine a .n {
  color: var(--quiet);
  margin-right: 6px;
}

/* ---------- Cards — design.md §5 ---------- */
.card {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(16, 32, 64, 0.04);
  padding: 20px 22px;
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

/* ---------- Footer caveat line — design.md §5 "The footer line" ---------- */
.footer-caveat {
  border-top: 1px solid var(--rule);
  margin-top: 40px;
  padding-top: 14px;
  font-family: var(--sans);
  font-style: italic;
  font-size: 12px;
  line-height: 1.5;
  color: var(--slate);
}
.surface-dark .footer-caveat,
.surface-void .footer-caveat {
  border-top-color: var(--ink-3);
}

/* ---------- as_of — design.md §1 constraint 1: visible, mono, unhidden ---------- */
.as-of {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--slate);
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.surface-dark .as-of,
.surface-void .as-of {
  color: var(--quiet-d);
}

/* ---------- Square bullet — design.md §4 "Two typographic details" ---------- */
ul.square {
  list-style: none;
  margin: 0;
  padding: 0;
}
ul.square li {
  position: relative;
  padding-left: 18px;
  margin-bottom: 8px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-body);
}
ul.square li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 5px;
  height: 5px;
  border-radius: 1px;
  background: var(--accent);
}

/* ---------- Tables ---------- */
.table-wrap {
  overflow-x: auto;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-family: var(--sans);
  font-size: 13.5px;
  line-height: 1.5;
}
th,
td {
  text-align: left;
  padding: 9px 14px;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}
th {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--slate);
  font-weight: 400;
}
td.mono,
td .mono-cell {
  font-family: var(--mono);
  font-size: 12.5px;
}
td.num {
  font-variant-numeric: tabular-nums;
  font-family: var(--mono);
}
.silent-cell {
  color: var(--quiet);
  font-family: var(--mono);
}

/* ---------- Section counters / spine-style numerals used inline ---------- */
.sec-mark {
  font-family: var(--mono);
  color: var(--accent);
  margin-right: 4px;
}

/* Motion — design.md §5 "Motion". Sparing, on purpose. */
.hoverable {
  transition:
    transform 260ms cubic-bezier(0.2, 0.7, 0.3, 1),
    border-color 260ms cubic-bezier(0.2, 0.7, 0.3, 1);
}
.hoverable:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
}
@media (prefers-reduced-motion: reduce) {
  .hoverable {
    transition: none;
  }
  .hoverable:hover {
    transform: none;
  }
}

kbd {
  font-family: var(--mono);
  font-size: 11px;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 1px 5px;
}
hr {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 24px 0;
}
.surface-dark hr,
.surface-void hr {
  border-top-color: var(--ink-3);
}
