:root {
  color-scheme: light;
  --forest: #142c25;
  --forest-light: #1d392f;
  --ink: #22312b;
  --muted: #526158;
  --paper: #f6f2e8;
  --white: #fffcf4;
  --cream: #e9e2d2;
  --line: #d7cdb9;
  --gold: #d5ae71;
  --gold-dark: #765722;
  --serif: Georgia, "Times New Roman", serif;
  --sans: "Segoe UI", system-ui, sans-serif;
  --mono: Consolas, "SFMono-Regular", "Liberation Mono", monospace;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.6 var(--sans);
}
a { color: inherit; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
a, button, input, textarea, summary, pre { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #ad6b18; outline-offset: 4px; }
h1:focus { outline: none; }
.skip-link {
  position: fixed; z-index: 5; top: .6rem; left: .6rem;
  padding: .7rem 1rem; transform: translateY(-200%);
  background: var(--white); color: var(--forest);
}
.skip-link:focus { transform: none; }
.topbar {
  background: #10241e; color: #f2ead9;
  border-bottom: 1px solid #355146;
}
.topbar-inner, .hero-inner, .intake, .archive-grid, .site-footer {
  width: min(100% - 5rem, 1190px);
  margin-inline: auto;
}
.topbar-inner {
  min-height: 74px;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.masthead {
  display: inline-flex; gap: .85rem; align-items: center;
  text-decoration: none; font-weight: 700; letter-spacing: .04em; line-height: 1.1;
}
.masthead small {
  display: block; margin-top: .32rem;
  color: #c9cdbc; font-size: .69rem; font-weight: 500; letter-spacing: .07em;
}
.topbar-right { display: flex; gap: 1.6rem; align-items: center; }
.progress-meter { display: grid; gap: .35rem; min-width: 152px; }
.progress-meter span { color: #d5d6c5; font: .68rem/1.1 var(--mono); white-space: nowrap; }
progress {
  width: 100%; height: 4px; border: 0;
  appearance: none; background: #365448; accent-color: var(--gold);
}
progress::-webkit-progress-bar { background: #365448; }
progress::-webkit-progress-value { background: var(--gold); }
progress::-moz-progress-bar { background: var(--gold); }
.pdf-link {
  color: #e9d8ad; font: .76rem/1 var(--mono);
  padding: .62rem .65rem; border: 1px solid #52655a; text-decoration: none;
}
.pdf-link:hover { border-color: var(--gold); }
.hero {
  color: var(--white);
  background: radial-gradient(ellipse at 83% 38%, #203e32, transparent 62%), var(--forest);
  border-bottom: 1px solid #40564a;
}
.hero-inner {
  display: grid; grid-template-columns: minmax(0, 1.04fr) minmax(0, .96fr);
  align-items: center; gap: clamp(2rem, 5.5vw, 5.2rem);
  padding-block: clamp(3.4rem, 7.5vw, 6.25rem);
}
.eyebrow {
  margin: 0 0 1.1rem;
  font: 700 .72rem/1.4 var(--mono); letter-spacing: .15em; text-transform: uppercase;
}
.hero .eyebrow { color: #e0bf89; }
.hero .eyebrow span {
  display: inline-block; width: .42rem; height: .42rem;
  margin-right: .5rem; background: var(--gold); transform: rotate(45deg);
}
.hero h1 {
  margin: 0;
  font: 400 clamp(3.15rem, 6.5vw, 6.35rem)/.99 var(--serif);
  letter-spacing: -.045em;
}
.subtitle {
  margin: .9rem 0 1.65rem; color: #e5d3ad;
  font: italic clamp(1.4rem, 2.5vw, 2rem)/1.2 var(--serif);
}
.lede {
  max-width: 34rem; margin: 0; color: #e1e2d4;
  font-size: clamp(1rem, 1.35vw, 1.11rem); line-height: 1.68;
}
.hero-actions { margin-top: 1.75rem; }
.action {
  display: inline-flex; justify-content: center; align-items: center; gap: .6rem;
  min-height: 45px; padding: .58rem 1.02rem;
  border: 1px solid #ab9f88; border-radius: 3px; background: var(--white);
  color: var(--forest); font-weight: 700; text-decoration: none;
  line-height: 1.25; text-align: center;
}
.action:hover { background: #e8e1cf; border-color: #7f7157; }
.action-primary { border-color: var(--forest); background: var(--forest); color: var(--white); }
.action-primary:hover { background: #244c3e; color: var(--white); }
.hero .action-primary {
  background: var(--gold); border-color: var(--gold); color: #1e2b23; padding: .76rem 1.13rem;
}
.hero .action-primary:hover { background: #e9c68e; border-color: #e9c68e; }
.hero-figure { margin: 0; min-width: 0; }
.drawing-frame { position: relative; border: 1px solid #557061; background: #172d25; }
.drawing-frame img { display: block; width: 100%; height: auto; }
.drawing-tag {
  position: absolute; color: #d9d0ac; font: .68rem/1.2 var(--mono); letter-spacing: .13em;
}
.drawing-tag-top { top: .85rem; left: .95rem; }
.drawing-tag-bottom { right: .95rem; bottom: .85rem; }
.hero-figure figcaption {
  display: flex; justify-content: space-between; gap: .75rem;
  margin-top: .65rem; color: #d4d9c6; font: .72rem/1.35 var(--mono);
}
.intake {
  display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center;
  gap: clamp(1.5rem, 6vw, 5rem); min-height: 136px; padding-block: 1.45rem;
}
.intake-metrics { display: flex; align-items: stretch; gap: 0; }
.intake-metrics div {
  display: grid; justify-items: start; gap: .2rem;
  padding-inline: clamp(.75rem, 2.65vw, 2.1rem); border-right: 1px solid var(--line);
}
.intake-metrics div:first-child { padding-left: 0; }
.intake-metrics strong { font: 400 2.2rem/1.1 var(--serif); color: var(--forest); }
.intake-metrics span { color: var(--muted); font: .67rem/1.2 var(--mono); letter-spacing: .09em; text-transform: uppercase; }
.intake blockquote {
  margin: 0; color: var(--forest); font: italic clamp(1.13rem, 2vw, 1.6rem)/1.35 var(--serif);
}
.app-status, .noscript {
  width: min(100% - 2rem, 900px); margin: 1.25rem auto; padding: .85rem 1rem;
  background: var(--white); border: 1px solid var(--line); color: var(--ink);
}
.archive { padding-block: clamp(1.8rem, 4.5vw, 3.75rem); }
.archive-grid {
  display: grid; grid-template-columns: minmax(205px, 250px) minmax(0, 1fr);
  gap: clamp(1.25rem, 4vw, 3.25rem); align-items: start;
}
.archive-rail { position: sticky; top: 1rem; min-width: 0; }
.chapter-nav {
  background: #efeadb; border: 1px solid var(--line); border-radius: 3px;
  overflow: hidden;
}
.chapter-nav summary {
  padding: .85rem 1rem; color: var(--forest);
  font-weight: 700; cursor: pointer;
}
.chapter-nav summary:focus-visible { outline-offset: -4px; }
#chapter-list { display: grid; padding: .08rem .45rem .5rem; }
.chapter-link {
  display: flex; align-items: baseline; gap: .55rem; padding: .53rem .5rem;
  min-height: 42px; border: 1px solid transparent; border-radius: 2px;
  color: var(--ink); font-size: .91rem; line-height: 1.28; text-decoration: none;
}
.chapter-link:hover { background: #e6decc; }
.chapter-link[aria-current] { background: #dce5d9; border-color: #b4c3b2; color: #173a2b; font-weight: 700; }
.chapter-number { color: var(--gold-dark); font: .72rem/1.2 var(--mono); flex: 0 0 1.48rem; }
.rail-note { margin: .85rem .15rem 0; color: var(--muted); font-size: .81rem; }
.document-column, .document, .page-blocks { min-width: 0; }
.document {
  background: var(--white); border: 1px solid var(--line); border-top: 4px solid #375f4e;
  padding: clamp(1.2rem, 4.2vw, 3.2rem);
  box-shadow: 0 8px 24px #382d160a;
}
.page-kicker { color: var(--gold-dark); }
.document h1 {
  margin: 0;
  color: var(--forest); font: 400 clamp(2.08rem, 5vw, 3.9rem)/1.04 var(--serif);
  letter-spacing: -.036em; overflow-wrap: anywhere;
}
.page-story {
  margin: 1rem 0 1.6rem; color: var(--muted);
  font: italic clamp(1.04rem, 2vw, 1.24rem)/1.55 var(--serif);
}
.page-blocks > p { margin: 1.05rem 0; }
.evidence {
  margin: 1.2rem 0; padding: .95rem 1.1rem;
  background: #efecdf; border-left: 3px solid #8c9b7d; min-width: 0;
}
.evidence-label {
  display: block; margin: 0 0 .5rem;
  color: var(--gold-dark); font: 700 .72rem/1.45 var(--mono); letter-spacing: .11em; text-transform: uppercase;
}
.evidence-code {
  display: block; max-width: 100%; overflow-x: auto; margin: 0;
  color: #26362e; font: .9rem/1.6 var(--mono);
  white-space: pre; scrollbar-color: #958361 #e6dfce;
}
.evidence-code:focus-visible { outline-offset: 1px; }
.evidence-quote { margin: 0; font: italic 1.11rem/1.55 var(--serif); }
.evidence-quote p, .evidence-aside p { margin: 0; }
.evidence-aside { font-size: .95rem; }
.workspace-notes {
  display: grid; gap: 1rem;
  margin-top: 1.7rem; padding-top: 1.15rem; border-top: 1px solid var(--line);
}
.field { display: grid; align-content: start; gap: .35rem; min-width: 0; margin: .2rem 0; }
.field label, .field > span:first-child { color: var(--forest); font-size: .88rem; font-weight: 700; }
.field small, .field p { margin: 0; color: var(--muted); font-size: .84rem; }
.field input, .field textarea, .answer-form input {
  width: 100%; min-width: 0; padding: .52rem .65rem;
  background: #fffdf8; border: 1px solid #a99f8b; border-radius: 2px; color: var(--ink);
}
.field input { max-width: 22rem; font-family: var(--mono); }
.field textarea { min-height: 88px; resize: vertical; }
.ledger {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem 1rem;
  margin: 1rem 0;
}
fieldset.ledger { border: 1px solid var(--line); padding: .8rem 1rem 1rem; }
.ledger legend { padding-inline: .3rem; color: var(--forest); font-weight: 700; }
.answer-form {
  margin-top: 1.5rem; padding: 1rem 1.1rem;
  background: #ececdf; border: 1px solid var(--line); border-radius: 3px;
}
.answer-form h2 { margin: 0; color: var(--forest); font: 400 1.7rem/1.2 var(--serif); }
.answer-form .action { margin-top: .75rem; }
.check-status { min-height: 1.5em; margin: .7rem 0 0; font-weight: 600; }
.check-status:empty { display: none; }
.pagination {
  display: grid; grid-template-columns: 1fr auto 1fr;
  gap: .75rem; align-items: center; margin-top: 1rem;
}
#prev-page { justify-self: start; }
#next-page { justify-self: end; grid-column: 3; }
#page-count { color: var(--muted); font: .76rem/1.25 var(--mono); grid-column: 2; text-align: center; }
.site-footer {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap;
  gap: .65rem 1rem; padding-block: 1rem 1.35rem; border-top: 1px solid var(--line);
  color: var(--muted); font: .76rem/1.4 var(--mono);
}
.site-footer a { text-underline-offset: .22em; }
@media (max-width: 900px) {
  .topbar-inner, .hero-inner, .intake, .archive-grid, .site-footer { width: min(100% - 2.5rem, 1190px); }
  .archive-grid { grid-template-columns: minmax(167px, 196px) minmax(0, 1fr); gap: 1.15rem; }
  .hero-inner { gap: 1.75rem; }
}
@media (max-width: 680px) {
  .hero-inner { grid-template-columns: 1fr; gap: 2rem; padding-block: 2.75rem 1.9rem; }
  .hero h1 { font-size: clamp(3rem, 10.5vw, 4.75rem); }
  .hero-figure { width: min(100%, 430px); }
  .drawing-frame img { aspect-ratio: 1.18; object-fit: cover; }
  .intake { grid-template-columns: 1fr; gap: 1.2rem; }
  .intake-metrics div { padding-inline: 1rem; }
  .intake-metrics div:last-child { border-right: 0; }
  .archive-grid { grid-template-columns: minmax(0, 1fr); }
  .archive-rail { position: static; }
  .rail-note { display: none; }
  #chapter-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .document { padding: 1.15rem; }
  .evidence { padding: .76rem .82rem; }
  .evidence-code { font-size: .82rem; }
}
@media (max-width: 420px) {
  .topbar-inner, .hero-inner, .intake, .archive-grid, .site-footer { width: calc(100% - 1.5rem); }
  .topbar-inner { min-height: 66px; gap: .5rem; }
  .masthead { gap: .45rem; font-size: .88rem; }
  .masthead small { font-size: .58rem; }
  .masthead img { width: 29px; height: 29px; }
  .topbar-right { gap: .45rem; }
  .progress-meter { min-width: 0; }
  .progress-meter span { font-size: .6rem; white-space: normal; }
  .pdf-link { padding: .48rem .45rem; }
  .ledger { grid-template-columns: 1fr; }
  .answer-form { padding: .8rem; }
}
@media print {
  .topbar, .site-footer, .archive-rail, .pagination, .hero-actions, .workspace-notes { display: none; }
  .archive-grid, .hero-inner { display: block; width: 100%; }
  .document { border: 0; box-shadow: none; padding: 0; }
  .hero { color: var(--ink); background: white; }
  .hero-figure { display: none; }
  .hero .subtitle, .hero .lede { color: var(--ink); }
}
