:root {
  color-scheme: light dark;
  --paper: #f4f1e9;
  --paper-deep: #ebe6da;
  --ink: #191918;
  --muted: #66645e;
  --faint: #8f8b81;
  --rule: #cbc5b8;
  --blue: #075dd8;
  --orange: #e94f24;
  --green: #087d5b;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #151614;
    --paper-deep: #1d1f1c;
    --ink: #efeee8;
    --muted: #aaa89f;
    --faint: #7e8179;
    --rule: #383b36;
    --blue: #72a9ff;
    --orange: #ff805c;
    --green: #62d4ac;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    linear-gradient(90deg, transparent 0, transparent calc(100% - 1px), color-mix(in srgb, var(--rule) 22%, transparent) 100%) 0 0 / 4.5rem 100%,
    var(--paper);
  color: var(--ink);
  font: 16px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration-color: var(--faint);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.24em;
}
a:hover { text-decoration-color: var(--orange); }
button, input { font: inherit; }
.muted-title { color: var(--muted); }
.table-scroll { overflow-x: auto; }
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.55rem 0.8rem;
  transform: translateY(-160%);
  background: var(--ink);
  color: var(--paper);
}
.skip-link:focus { transform: translateY(0); }

.frame {
  width: min(76rem, calc(100% - 3rem));
  margin: 0 auto;
}

.masthead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 4.75rem;
  border-bottom: 1px solid var(--rule);
  font: 0.78rem/1.4 var(--mono);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.brand { font-weight: 700; text-decoration: none; }
.brand span { color: var(--muted); font-weight: 400; }
.nav-links { display: flex; flex-wrap: wrap; gap: 0.7rem 1.4rem; }
.nav-links a { color: var(--muted); text-decoration: none; }
.nav-links a:hover { color: var(--ink); }

.eyebrow,
.section-label,
.row-index,
.meta-label,
.article-meta,
.chip {
  font: 600 0.72rem/1.45 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.eyebrow, .section-label, .row-index { color: var(--blue); }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(16rem, 0.5fr);
  gap: clamp(3rem, 8vw, 8rem);
  align-items: end;
  padding: clamp(5rem, 13vw, 10rem) 0 clamp(4rem, 10vw, 7.5rem);
}
.hero-copy { max-width: 53rem; }
.hero h1,
.article-hero h1 {
  margin: 0;
  font-size: clamp(3rem, 8.2vw, 7rem);
  font-weight: 670;
  letter-spacing: -0.065em;
  line-height: 0.92;
}
.hero .eyebrow,
.article-hero .eyebrow { margin: 0 0 1.2rem; }
.intro {
  max-width: 48rem;
  margin: 2rem 0 0;
  color: var(--muted);
  font-size: clamp(1.12rem, 2vw, 1.4rem);
  line-height: 1.55;
}
.actions { display: flex; flex-wrap: wrap; gap: 0.7rem 1.4rem; margin-top: 2rem; }
.actions a { font-weight: 650; }

.signal-signature {
  position: relative;
  display: grid;
  grid-template-rows: 6.5rem auto;
  gap: 0.75rem;
  min-height: 14rem;
  border-left: 1px solid var(--rule);
  padding-left: 1.4rem;
}
.signal-signature svg {
  display: block;
  width: 100%;
  height: 6.5rem;
  overflow: hidden;
}
.signal-signature path {
  fill: none;
  stroke: var(--orange);
  stroke-width: 2;
  stroke-linecap: square;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 9 7;
  animation: signal-drift 7s linear infinite;
}
.signal-signature dl { margin: 0; }
.signal-signature div {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 0.75rem;
  padding: 0.55rem 0;
  border-top: 1px solid var(--rule);
  font-size: 0.85rem;
}
.signal-signature dt { color: var(--faint); font-family: var(--mono); }
.signal-signature dd { margin: 0; }
@keyframes signal-drift { to { stroke-dashoffset: -64; } }

.section {
  padding: clamp(4.5rem, 9vw, 7.5rem) 0;
  border-top: 1px solid var(--rule);
}
.section-head {
  display: grid;
  grid-template-columns: minmax(9rem, 0.32fr) minmax(0, 1fr);
  gap: 2rem;
  margin-bottom: 2.75rem;
}
.section-label { margin: 0; }
.section-head h2,
.article-body h2 {
  max-width: 24ch;
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.4rem);
  letter-spacing: -0.04em;
  line-height: 1.08;
}
.section-head p {
  max-width: 48rem;
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.ledger { border-bottom: 1px solid var(--rule); }
.ledger-row {
  display: grid;
  grid-template-columns: minmax(6rem, 0.22fr) minmax(12rem, 0.46fr) minmax(0, 1fr);
  gap: 1.5rem;
  padding: 1.65rem 0;
  border-top: 1px solid var(--rule);
}
.ledger-row h3 { margin: 0; font-size: 1.12rem; line-height: 1.35; }
.ledger-row p { margin: 0; color: var(--muted); }
.ledger-row .stack { margin-top: 0.5rem; color: var(--faint); font: 0.75rem/1.5 var(--mono); }
.ledger-row .source-link { margin-top: 0.65rem; font: 0.75rem/1.5 var(--mono); }
.ledger-row .source-link a { color: var(--ink); }

.evidence-line {
  display: grid;
  grid-template-columns: 5rem minmax(9rem, 0.4fr) minmax(0, 1fr);
  gap: 1rem;
  padding: 1.1rem 0;
  border-top: 1px solid var(--rule);
}
.evidence-line:last-child { border-bottom: 1px solid var(--rule); }
.evidence-line strong { font-size: 0.95rem; }
.evidence-line span:last-child { color: var(--muted); }

.article-hero {
  max-width: 62rem;
  padding: clamp(5rem, 12vw, 9rem) 0 clamp(4rem, 9vw, 7rem);
}
.article-hero h1 { max-width: 14ch; }
.article-hero .intro { max-width: 50rem; }
.article-meta { display: flex; flex-wrap: wrap; gap: 0.5rem 1.1rem; margin-top: 2rem; color: var(--faint); }

.article-body {
  display: grid;
  grid-template-columns: minmax(10rem, 0.28fr) minmax(0, 1fr);
  gap: clamp(2rem, 7vw, 7rem);
  padding: 4.5rem 0;
  border-top: 1px solid var(--rule);
}
.article-body > * { min-width: 0; }
.article-body aside { color: var(--faint); font: 0.76rem/1.65 var(--mono); }
.prose { max-width: 48rem; }
.prose > :first-child { margin-top: 0; }
.prose p, .prose li { color: var(--muted); }
.prose p { margin: 1.1rem 0; }
.prose h2 { margin: 3.8rem 0 1.25rem; }
.prose h2:first-child { margin-top: 0; }
.prose h3 { margin: 2.25rem 0 0.75rem; font-size: 1.2rem; }
.prose pre {
  margin: 1.5rem 0;
  padding: 1.15rem 1.25rem;
  overflow-x: auto;
  background: var(--paper-deep);
  border: 1px solid var(--rule);
  font: 0.8rem/1.7 var(--mono);
}
.prose code { font-family: var(--mono); }
.prose :not(pre) > code { color: var(--ink); }
.prose blockquote {
  margin: 2rem 0;
  padding-left: 1.25rem;
  border-left: 3px solid var(--orange);
  color: var(--ink);
  font-size: 1.12rem;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 2rem 0 3rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.87rem;
}

@media (max-width: 780px) {
  body { background-size: 3rem 100%; }
  .frame { width: min(100% - 2rem, 76rem); }
  .hero { grid-template-columns: 1fr; }
  .signal-signature { min-height: 11rem; }
  .section-head, .article-body { grid-template-columns: 1fr; gap: 1.25rem; }
  .ledger-row { grid-template-columns: 4rem minmax(0, 1fr); gap: 0.75rem 1rem; }
  .ledger-row > div:last-child { grid-column: 2; }
  .evidence-line { grid-template-columns: 3.5rem minmax(0, 1fr); }
  .evidence-line span:last-child { grid-column: 2; }
}

@media (max-width: 520px) {
  .masthead { align-items: flex-start; padding: 1.1rem 0; }
  .nav-links { justify-content: flex-end; max-width: 12rem; }
  .nav-links a:nth-child(2) { display: none; }
  .hero h1, .article-hero h1 { font-size: clamp(2.8rem, 15vw, 4.5rem); }
  .site-footer { flex-direction: column; }
}

@media print {
  :root { color-scheme: light; --paper: #fff; --ink: #111; --muted: #444; --faint: #666; --rule: #bbb; }
  body { background: #fff; font-size: 10.5pt; }
  .masthead, .signal-signature, .site-footer, .actions, .skip-link { display: none !important; }
  .frame { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .signal-signature path { animation: none; }
}
