/* Host Notes — newspaper-meets-research-notebook. System fonts only. */

:root {
  --ink: #1e1c18;
  --ink-soft: #403b33;
  --paper: #fbf7ee;
  --paper-deep: #f3ecdb;
  --butter: #f2d675;
  --butter-soft: #f7e6ab;
  --coral: #b8402a;
  --coral-bright: #a33522;
  --rule: #c9bfa9;
  --rule-strong: #6b6152;
  --white: #fffdf8;
  --focus: #0d47a1;
  --serif: Georgia, "Iowan Old Style", "Times New Roman", Times, serif;
  --sans: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  --measure: 42rem;
  --page-max: 78rem;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.6;
}

/* ---------- contrast-safe link defaults ---------- */
a { color: var(--coral-bright); text-decoration-thickness: 0.08em; text-underline-offset: 0.18em; }
a:hover { color: var(--ink); text-decoration-color: var(--coral); }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--ink); color: var(--white);
  padding: 0.6rem 1rem; z-index: 50; font-family: var(--sans); font-weight: 700;
}
.skip-link:focus { left: 0.5rem; top: 0.5rem; }

/* ---------- shared header ---------- */
.site-header {
  border-bottom: 3px double var(--rule-strong);
  background: var(--paper);
}
.header-inner {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 1.1rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem 1.5rem;
}
.brand {
  margin: 0;
  font-family: var(--serif);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.brand a {
  color: var(--ink);
  text-decoration: none;
  font-size: 1.5rem;
  border-bottom: 3px solid var(--coral);
  padding-bottom: 0.05rem;
}
.brand a:hover { color: var(--ink); border-bottom-color: var(--ink); }
.brand-note {
  display: block;
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-top: 0.35rem;
}
.site-nav ul {
  list-style: none;
  margin: 0; padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.4rem;
}
.site-nav a {
  font-family: var(--sans);
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  padding: 0.2rem 0;
}
.site-nav a:hover { border-bottom-color: var(--coral); }

/* ---------- page shell ---------- */
.page {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 1.75rem 1.25rem 3rem;
}
.page > section + section { margin-top: 3rem; }

.kicker {
  font-family: var(--sans);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 0.85rem;
  border-top: 3px solid var(--ink);
  padding-top: 0.7rem;
}

h1 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(2rem, 1.1rem + 3.6vw, 3.6rem);
  line-height: 1.06;
  letter-spacing: -0.018em;
  margin: 0 0 1rem;
  max-width: 22ch;
  text-wrap: balance;
}

h2 {
  font-family: var(--serif);
  font-size: clamp(1.4rem, 1.05rem + 1.2vw, 2rem);
  line-height: 1.15;
  letter-spacing: -0.012em;
  margin: 0 0 0.75rem;
}

h3 { font-family: var(--serif); font-size: 1.16rem; line-height: 1.25; margin: 0 0 0.45rem; }

.standfirst {
  font-family: var(--serif);
  font-size: clamp(1.08rem, 1rem + 0.5vw, 1.32rem);
  line-height: 1.5;
  color: var(--ink-soft);
  max-width: var(--measure);
  margin: 0 0 1rem;
}

.dateline {
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.03em;
  color: var(--ink-soft);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 0.45rem 0;
  margin: 0 0 1.2rem;
  max-width: var(--measure);
}

/* ---------- buttons ---------- */
.btn-primary, .btn-quiet {
  display: inline-block;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  padding: 0.7rem 1.15rem;
  text-decoration: none;
  border: 2px solid var(--ink);
}
.btn-primary {
  background: var(--butter);
  color: var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
}
.btn-primary:hover { background: var(--butter-soft); color: var(--ink); }
.btn-primary:active { box-shadow: 1px 1px 0 var(--ink); transform: translate(2px, 2px); }
.btn-quiet {
  background: transparent;
  color: var(--ink);
  border-color: var(--rule-strong);
  margin-left: 0.7rem;
}
.btn-quiet:hover { border-color: var(--ink); color: var(--ink); }
.masthead-actions { margin: 0; display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.masthead-actions .btn-quiet { margin-left: 0; }

/* ---------- masthead ---------- */
.masthead { border-bottom: 1px solid var(--rule); padding-bottom: 1.75rem; }
.masthead h1 { max-width: 20ch; }

/* ---------- chain figure ---------- */
.chain-figure {
  margin: 2rem 0 0;
  border: 1px solid var(--rule);
  background: var(--white);
  padding: 0.9rem 0.9rem 0.7rem;
}
.chain-svg { display: block; width: 100%; height: auto; }
.chain-bg { fill: var(--paper-deep); stroke: var(--rule); stroke-width: 1; }
.chain-node rect { fill: var(--butter); stroke: var(--ink); stroke-width: 1.6; }
.chain-node text {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 700;
  fill: var(--ink);
  text-anchor: middle;
}
.chain-node-end rect { fill: var(--white); stroke-width: 2.4; }
.chain-link path { fill: none; stroke: var(--coral); stroke-width: 2.2; }
.chain-note {
  font-family: var(--mono);
  font-size: 11.5px;
  fill: #554d40;
}
.chain-figure figcaption {
  font-family: var(--sans);
  font-size: 0.82rem;
  color: var(--ink-soft);
  margin-top: 0.6rem;
  line-height: 1.45;
}
.fig-label { font-weight: 700; color: var(--ink); }

/* ---------- belt (three definitions) ---------- */
.belt-intro, .guide-intro, .sources-intro {
  max-width: var(--measure);
  color: var(--ink-soft);
  margin: 0 0 1.4rem;
}
.belt-list {
  list-style: none;
  margin: 0; padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-top: 2px solid var(--ink);
}
.belt-item {
  padding: 1rem 1.1rem 0.8rem 0;
  border-right: 1px solid var(--rule);
}
.belt-item:last-child { border-right: 0; }
.belt-item p { margin: 0 0 0.5rem; font-size: 0.98rem; line-height: 1.5; }
.belt-item .tab {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  background: var(--butter);
  color: var(--ink);
  border-bottom: 3px solid var(--coral);
  padding: 0.18rem 0.5rem;
  margin-bottom: 0.7rem;
}
.belt-item .belt-source {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: #5a5245;
  line-height: 1.4;
  margin-bottom: 0;
}

/* ---------- workbench ---------- */
.workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 1.5rem 2.5rem;
  border-top: 3px double var(--rule-strong);
  border-bottom: 3px double var(--rule-strong);
  padding: 1.6rem 0;
}
.workbench-lead p { color: var(--ink-soft); max-width: 34rem; }
.workbench-cta { margin-top: 1.1rem; }
.field-ledger {
  list-style: none;
  margin: 0; padding: 0;
  counter-reset: none;
}
.field-ledger li {
  display: grid;
  grid-template-columns: 2.6rem minmax(0, 1fr);
  gap: 0.15rem 0.7rem;
  align-items: baseline;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--rule);
  font-size: 0.95rem;
  line-height: 1.45;
}
.field-ledger li:first-child { border-top: 1px solid var(--rule); }
.ledger-num {
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--coral-bright);
}
.field-ledger strong { font-family: var(--sans); font-size: 0.9rem; }

/* ---------- guide index ---------- */
.guide-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  border-top: 2px solid var(--ink);
}
.guide-card {
  padding: 1rem 1.3rem 1.1rem 0;
  border-bottom: 1px solid var(--rule);
}
.guide-card:nth-child(odd) { border-right: 1px solid var(--rule); padding-right: 1.3rem; }
.guide-card:nth-child(even) { padding-left: 1.3rem; }
.guide-card:nth-last-child(-n+2) { border-bottom: 0; }
.guide-num {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 0.3rem;
}
.guide-card p:last-child { margin: 0; color: var(--ink-soft); font-size: 0.96rem; }
.guide-card h3 a { color: var(--ink); text-decoration: none; border-bottom: 2px solid var(--coral); }
.guide-card h3 a:hover { color: var(--coral-bright); }

/* ---------- source table ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-top: 2px solid var(--ink); }
.source-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  min-width: 38rem;
}
.source-table caption {
  caption-side: top;
  text-align: left;
  font-family: var(--sans);
  font-size: 0.78rem;
  color: var(--ink-soft);
  padding: 0.5rem 0 0.7rem;
}
.source-table th, .source-table td {
  text-align: left;
  vertical-align: top;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--rule);
  line-height: 1.45;
}
.source-table thead th {
  font-family: var(--sans);
  font-size: 0.74rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  background: var(--paper-deep);
  border-bottom: 2px solid var(--ink);
}
.source-table tbody th { font-family: var(--serif); font-size: 0.95rem; width: 30%; }
.source-table tbody th a { color: var(--coral-bright); }

/* ---------- about strip ---------- */
.about-strip { border-top: 3px solid var(--ink); padding-top: 1.4rem; }
.about-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; }
.about-cols p { margin: 0; color: var(--ink-soft); font-size: 0.98rem; }
.about-more { margin: 1rem 0 0; font-family: var(--sans); font-weight: 700; font-size: 0.9rem; }

/* ---------- footer ---------- */
.site-footer {
  border-top: 3px double var(--rule-strong);
  background: var(--paper-deep);
  margin-top: 2rem;
}
.footer-inner {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 1.4rem 1.25rem 1.8rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: 1rem 2rem;
  align-items: start;
}
.footer-brand {
  margin: 0;
  font-family: var(--sans);
  font-size: 0.84rem;
  color: var(--ink-soft);
  max-width: 26rem;
  line-height: 1.5;
}
.footer-nav ul {
  list-style: none;
  margin: 0; padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1.2rem;
}
.footer-nav a {
  font-family: var(--sans);
  font-size: 0.82rem;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--rule-strong);
}
.footer-nav a:hover { border-bottom-color: var(--coral); color: var(--coral-bright); }

/* =========================================================
   ARTICLE PAGES (.article.page.article)
   ========================================================= */
.article.page { padding-top: 1.75rem; }
.article-header {
  border-bottom: 3px double var(--rule-strong);
  padding-bottom: 1.4rem;
  margin-bottom: 1.8rem;
}
.article-header h1 { max-width: 26ch; }
.article-header .meta {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--ink-soft);
  margin: 0.8rem 0 0;
}
.article-body { max-width: 46rem; }
.article-body p { margin: 0 0 1rem; }
.article-body h2 {
  margin: 2.2rem 0 0.7rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--rule);
}
.article-body h3 { margin: 1.6rem 0 0.5rem; }
.article-body ul, .article-body ol { margin: 0 0 1.1rem; padding-left: 1.4rem; }
.article-body li { margin-bottom: 0.4rem; }
.article-body blockquote {
  margin: 1.2rem 0;
  padding: 0.6rem 1rem;
  border-left: 4px solid var(--coral);
  background: var(--paper-deep);
  font-style: italic;
}
.article-body blockquote p:last-child { margin-bottom: 0; }
.article-body .source-note {
  font-family: var(--sans);
  font-size: 0.84rem;
  color: var(--ink-soft);
  background: var(--butter-soft);
  border-left: 3px solid var(--ink);
  padding: 0.6rem 0.9rem;
  margin: 1.2rem 0;
}
.article-body .source-note p:last-child { margin-bottom: 0; }
.article-body table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
.article-body th, .article-body td { border: 1px solid var(--rule); padding: 0.5rem 0.65rem; vertical-align: top; text-align: left; }
.article-body th { background: var(--paper-deep); font-family: var(--sans); font-size: 0.82rem; }

/* =========================================================
   TOOL PAGE (.page.page-tool)
   ========================================================= */
.page-tool .page-head { border-bottom: 3px double var(--rule-strong); padding-bottom: 1.3rem; }
.page-tool h1 { max-width: 26ch; }

.notice {
  border: 2px solid var(--ink);
  padding: 0.8rem 1rem;
  margin: 1.2rem 0;
  font-family: var(--sans);
  font-size: 0.9rem;
  line-height: 1.5;
}
.notice p { margin: 0; }
.notice-warn { background: var(--butter-soft); }

.tool-panel {
  margin-top: 2rem;
  border-top: 3px solid var(--ink);
  padding-top: 1.2rem;
}
.tool-intro { max-width: var(--measure); color: var(--ink-soft); }

fieldset {
  border: 1px solid var(--rule);
  padding: 1rem 1.1rem 1.2rem;
  margin: 1.2rem 0 0;
  background: var(--white);
}
fieldset[disabled] { opacity: 1; background: var(--paper-deep); }
legend {
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  padding: 0 0.45rem;
  color: var(--ink);
}

.field { margin: 0 0 1.1rem; }
.field:last-child { margin-bottom: 0; }
.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 1.4rem;
  margin-bottom: 1.1rem;
}
.field-row .field { margin-bottom: 0; }

.field label {
  display: block;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ink);
  margin-bottom: 0.2rem;
}
.req { font-weight: 600; font-size: 0.78rem; color: var(--coral-bright); letter-spacing: 0.02em; }
.hint {
  font-family: var(--sans);
  font-size: 0.82rem;
  color: var(--ink-soft);
  margin: 0 0 0.4rem;
  line-height: 1.45;
}

.field input,
.field textarea {
  width: 100%;
  max-width: 100%;
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.45;
  color: var(--ink);
  background: var(--white);
  border: 2px solid var(--rule-strong);
  border-radius: 0;
  padding: 0.55rem 0.6rem;
}
.field textarea { resize: vertical; min-height: 4.5rem; }
.field input::placeholder, .field textarea::placeholder { color: #6a6255; opacity: 1; }
.field input:hover, .field textarea:hover { border-color: var(--ink); }
.field input:focus-visible, .field textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; border-color: var(--ink); }
.fieldset-disabled .field input, fieldset[disabled] .field input,
fieldset[disabled] .field textarea { cursor: not-allowed; }

.field-note {
  font-family: var(--sans);
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink);
  background: var(--butter-soft);
  border-left: 4px solid var(--coral);
  padding: 0.5rem 0.8rem;
  margin: 1.2rem 0 0;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1.2rem 0 0.8rem;
}
.controls button {
  font-family: var(--sans);
  font-size: 0.94rem;
  font-weight: 700;
  padding: 0.6rem 1.05rem;
  border: 2px solid var(--ink);
  background: var(--butter);
  color: var(--ink);
  cursor: pointer;
  border-radius: 0;
}
.controls button:hover:not(:disabled) { background: var(--butter-soft); }
.controls button:active:not(:disabled) { transform: translate(1px, 1px); }
.controls button:disabled {
  background: #e4ddcb;
  color: #4a443a;
  border-color: var(--rule-strong);
  cursor: not-allowed;
}
.controls #run { box-shadow: 3px 3px 0 var(--ink); }
.controls #run:disabled { box-shadow: none; }

.status {
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--ink-soft);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 0.55rem 0;
  margin: 0 0 1rem;
  min-height: 2.4em;
  overflow-wrap: anywhere;
}
.status.is-error { color: #8f2a17; border-color: var(--coral); }
.status.is-ok { color: var(--ink); }

.results {
  border: 1px solid var(--rule);
  background: var(--white);
  padding: 1rem 1.1rem;
  min-height: 3rem;
  overflow-wrap: anywhere;
}
.results-placeholder { margin: 0; font-family: var(--sans); font-size: 0.9rem; color: var(--ink-soft); }
.results h3 { font-family: var(--sans); font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; margin: 0 0 0.6rem; }
.results dl { margin: 0; display: grid; grid-template-columns: minmax(0, 12rem) minmax(0, 1fr); gap: 0.35rem 1rem; }
.results dt { font-family: var(--sans); font-weight: 700; font-size: 0.86rem; }
.results dd { margin: 0; font-size: 0.94rem; }
.results pre {
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.5;
  background: var(--paper-deep);
  border: 1px solid var(--rule);
  padding: 0.7rem;
  overflow-x: auto;
  max-width: 100%;
}

.notes { margin-top: 2.5rem; border-top: 3px solid var(--ink); padding-top: 1.2rem; }
.notes p { max-width: var(--measure); color: var(--ink-soft); }
.source-list { padding-left: 1.2rem; max-width: var(--measure); }
.source-list li { margin-bottom: 0.6rem; font-size: 0.96rem; }
.source-list a { font-weight: 700; }

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 900px) {
  .belt-list { grid-template-columns: 1fr; border-top-width: 2px; }
  .belt-item { border-right: 0; border-bottom: 1px solid var(--rule); padding: 1rem 0; }
  .belt-item:last-child { border-bottom: 0; }
  .workbench { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; }
  .about-cols { grid-template-columns: 1fr; gap: 0.9rem; }
  .results dl { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  body { font-size: 1rem; }
  .header-inner { padding: 0.9rem 1rem; }
  .page { padding: 1.2rem 1rem 2.4rem; }
  .site-nav ul { gap: 0.25rem 1rem; }
  .site-nav a { font-size: 0.8rem; }
  .guide-links { grid-template-columns: 1fr; }
  .guide-card, .guide-card:nth-child(odd), .guide-card:nth-child(even) { border-right: 0; padding: 0.9rem 0; border-bottom: 1px solid var(--rule); }
  .guide-card:last-child { border-bottom: 0; }
  .field-row { grid-template-columns: 1fr; gap: 1.1rem; }
  .masthead-actions { flex-direction: column; align-items: stretch; }
  .masthead-actions .btn-primary, .masthead-actions .btn-quiet { text-align: center; }
  .chain-figure { padding: 0.55rem 0.55rem 0.5rem; }
  .chain-node text { font-size: 15px; }
  .chain-note { font-size: 14px; }
  .controls button { flex: 1 1 100%; }
  .fieldset, fieldset { padding: 0.8rem 0.8rem 1rem; }
  .footer-inner { padding: 1.2rem 1rem 1.6rem; }
  .source-table { min-width: 34rem; }
}

@media (max-width: 420px) {
  h1 { font-size: 1.85rem; line-height: 1.1; }
  .brand a { font-size: 1.3rem; }
  .results dl { gap: 0.2rem; }
  .article-header h1 { font-size: 1.75rem; }
}

/* Motion: respect preference; only button press displacement is used elsewhere */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .btn-primary:active, .controls button:active:not(:disabled) { transform: none; }
}

@media (prefers-contrast: more) {
  .belt-item .belt-source, .dateline, .status, .guide-num, .chain-note { color: var(--ink); }
  .field input::placeholder, .field textarea::placeholder { color: var(--ink-soft); }
}

@media print {
  .site-nav, .site-footer, .masthead-actions, .controls, .skip-link { display: none; }
  body { background: #fff; color: #000; }
  .page { max-width: none; }
}

/* Verified layout corrections */
.source-table{width:100%;min-width:0;table-layout:fixed;overflow-wrap:anywhere}.source-table a{overflow-wrap:anywhere}
