@font-face {
  font-family: 'Source Serif 4';
  src: url('fonts/source-serif-4-var.woff2') format('woff2');
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'IBM Plex Mono';
  src: url('fonts/ibm-plex-mono-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #FCFCFA;
  --ink: #16161A;
  --ink-muted: #5A5A63;
  --rule: #DCDCD6;
  --rule-strong: #B8B8B0;

  /* Semantic accent palette. Applied only to states, never to prose or chrome. */
  --accent: #8C2F26;         /* oxblood: HIGH confidence, focus rings */
  --accent-review: #8A5A00;  /* amber: MED confidence, "for review" flags */
  --accent-coded: #2D5A3D;   /* deep green: verified / coded / complete */

  --font-prose: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --font-data: 'IBM Plex Mono', Consolas, 'Courier New', monospace;

  --measure: 68ch;
  --gutter: 1.5rem;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-prose);
  font-size: 1.125rem;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: 100%;
}

.wrap {
  max-width: 54rem;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

p,
li {
  max-width: var(--measure);
}

a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.15em;
  text-decoration-thickness: 1px;
}

a:hover {
  text-decoration-thickness: 2px;
}

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

.skip {
  position: absolute;
  left: -9999px;
}

.skip:focus {
  position: static;
  display: inline-block;
  padding: 0.75rem var(--gutter);
}

/* Header */

.site-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.75rem;
  align-items: baseline;
  justify-content: space-between;
  padding: 1.5rem 0 1.25rem;
  border-bottom: 1px solid var(--rule);
}

.wordmark {
  font-weight: 600;
  font-size: 1.0625rem;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.site-head nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  font-size: 0.9375rem;
}

.site-head nav a[aria-current='page'] {
  text-decoration-thickness: 2px;
}

/* Sections */

main {
  padding: 1.75rem 0 1rem;
}

section + section {
  margin-top: 1.75rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--rule);
}

h1 {
  font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.3rem);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.011em;
  margin: 0;
  max-width: 22ch;
}

h2 {
  font-size: 1.1875rem;
  font-weight: 600;
  margin: 0 0 1rem;
}

h3 {
  font-size: 1.0625rem;
  font-weight: 600;
  margin: 0 0 0.4rem;
}

.standfirst {
  color: var(--ink-muted);
  font-size: 1rem;
  margin: 0.4rem 0 0;
}

.lede {
  margin-top: 0;
}

/* Ruled list: the site's core structural device, in place of cards */

.ruled {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--rule);
}

.ruled > li {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--rule);
  max-width: var(--measure);
}

/* Section rule below already closes the list; two lines read as a mistake */
.ruled > li:last-child {
  border-bottom: none;
}

.ruled--spaced > li {
  padding: 1rem 0;
}

.ruled p {
  margin: 0.35rem 0 0;
}

.detail {
  color: var(--ink-muted);
  font-size: 0.9375rem;
  margin: 0.5rem 0 0;
}

.detail dt {
  float: left;
  clear: left;
  width: 8.5rem;
  font-weight: 600;
}

.detail dd {
  margin: 0 0 0.2rem 8.5rem;
}

/* Work list table: the place the accent palette lives most visibly */

.worklist-scroll {
  overflow-x: auto;
  margin-top: 0.5rem;
  border-top: 2px solid var(--rule-strong);
}

.worklist {
  border-collapse: collapse;
  width: 100%;
  min-width: 40rem;
  font-family: var(--font-data);
  font-size: 0.875rem;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

.worklist th,
.worklist td {
  text-align: left;
  vertical-align: top;
  padding: 0.5rem 1rem 0.5rem 0;
  border-bottom: 1px solid var(--rule);
}

.worklist thead th {
  font-weight: 400;
  color: var(--ink-muted);
  border-bottom: 1px solid var(--rule-strong);
  white-space: nowrap;
}

.worklist .conf-high,
.worklist .conf-med,
.worklist .conf-low {
  white-space: nowrap;
  font-weight: 400;
}

.worklist .conf-high { color: var(--accent); }
.worklist .conf-med  { color: var(--accent-review); }
.worklist .conf-low  { color: var(--ink-muted); }

/* Muted rows read as low-signal without shouting it */
.worklist tr.row-low td {
  color: var(--ink-muted);
}
.worklist tr.row-low td:first-child { color: var(--ink); }

.caption {
  color: var(--ink-muted);
  font-size: 0.875rem;
  margin: 0.75rem 0 0;
}

/* Only narrow viewports actually have to scroll the work list */
.scroll-hint {
  display: none;
}

/* Rule card: one rule shown in its declarative form -- the most credible artefact */

.rule-card {
  margin: 1rem 0 0;
  padding: 1rem 1.1rem;
  border: 1px solid var(--rule-strong);
  border-left: 3px solid var(--accent);
  background: transparent;
  font-family: var(--font-data);
  font-size: 0.8125rem;
  line-height: 1.65;
  overflow-x: auto;
}

.rule-card pre {
  margin: 0;
  white-space: pre;
  color: var(--ink);
}

.rule-card .k { color: var(--ink-muted); }         /* keyword column */
.rule-card .tag-high    { color: var(--accent); }
.rule-card .tag-review  { color: var(--accent-review); }
.rule-card .tag-coded   { color: var(--accent-coded); }

/* Output list: what each engagement produces, in the trade's own shorthand */

.output-list {
  margin: 0.75rem 0 0;
  padding: 0.7rem 0.9rem;
  border-left: 2px solid var(--rule-strong);
  font-family: var(--font-data);
  font-size: 0.8125rem;
  line-height: 1.7;
  color: var(--ink);
}

.output-list .label {
  color: var(--ink-muted);
  display: block;
  margin-bottom: 0.15rem;
}

.output-list ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.output-list li {
  padding-left: 1.1rem;
  position: relative;
  max-width: none;
}

.output-list li::before {
  content: "·";
  position: absolute;
  left: 0.2rem;
  color: var(--ink-muted);
}

/* Flow chain: a text-only vertical diagram for the data-handling page */

.flow-chain {
  margin: 1rem 0 0;
  padding: 1rem 0.25rem;
  font-family: var(--font-data);
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--ink);
}

.flow-chain ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

.flow-chain li {
  position: relative;
  padding: 0.35rem 0 0.35rem 1.4rem;
  max-width: none;
}

.flow-chain li::before {
  content: "";
  position: absolute;
  left: 0.35rem;
  top: 0;
  bottom: 0;
  border-left: 1px solid var(--rule-strong);
}

.flow-chain li:first-child::before { top: 50%; }
.flow-chain li:last-child::before  { bottom: 50%; }

.flow-chain li::after {
  content: "";
  position: absolute;
  left: 0.35rem;
  top: 50%;
  width: 0.65rem;
  border-top: 1px solid var(--rule-strong);
}

.flow-chain .step-note {
  color: var(--ink-muted);
  display: block;
  font-size: 0.8125rem;
}

.flow-chain .verified {
  color: var(--accent-coded);
}

/* Contact block */

.contact-lines {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 2.5rem;
}

.contact-lines li {
  margin: 0;
}

/* Footer */

.site-foot {
  margin-top: 2.5rem;
  padding: 1.25rem 0 2.5rem;
  border-top: 1px solid var(--rule);
  font-size: 0.9375rem;
  color: var(--ink-muted);
}

.site-foot p {
  margin: 0 0 0.4rem;
}

.site-foot nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-top: 0.9rem;
}

@media (max-width: 34rem) {
  body {
    font-size: 1.0625rem;
  }

  .detail dt {
    float: none;
    width: auto;
  }

  .detail dd {
    margin-left: 0;
    margin-bottom: 0.6rem;
  }

  .scroll-hint {
    display: inline;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
