/* Systems Distilled — systemsdistilled.com
   First draft, 2026-09-26. Follows brand/brand-guide.md:
   paper, ink, two greys, one accent (Oxblood); Newsreader + IBM Plex Sans;
   major-third scale on an 18 px base; 20 px gutter on phones.
   No third-party font calls: the woff2 files are in fonts/. */

/* ---- fonts ---------------------------------------------------------- */

@font-face {
  font-family: "Newsreader";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("fonts/newsreader-normal-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Newsreader";
  font-style: italic;
  font-weight: 200 800;
  font-display: swap;
  src: url("fonts/newsreader-italic-latin.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 100 700;
  font-display: swap;
  src: url("fonts/ibm-plex-sans-normal-latin.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: italic;
  font-weight: 100 700;
  font-display: swap;
  src: url("fonts/ibm-plex-sans-italic-latin.woff2") format("woff2");
}

/* ---- tokens --------------------------------------------------------- */

:root {
  color-scheme: light dark;

  --paper: #FAF8F4;
  --ink: #1D1F23;
  --grey: #595C62;
  --rule: #DAD6CE;
  --fill: #ECE9E3;
  --accent: #8A3324;     /* Oxblood */
  --tint: #E2C3BA;
  --accent-2: #1D6B66;   /* Teal */
  --tint-2: #DCEBE7;

  /* roles: where color goes (brand/color-options.md; Oxblood and Teal, James 2026-10-05) */
  --head-rule: var(--accent-2);
  --kind: var(--accent-2);
  --year: var(--accent-2);
  --label: var(--accent-2);
  --bar-fill: var(--tint-2);
  --bar-line: var(--accent-2);
  --now-fill: var(--accent);
  --now-line: var(--accent);
  --own-fill: var(--paper);
  --own-line: var(--accent);

  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "IBM Plex Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;

  --base: 18px;
  --measure: 34em;   /* 65 to 75 characters at 18 px */
  --wide: 52em;      /* figures and card lists */
  --gutter: 20px;
  --unit: 8px;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Guide § 3, dark mapping. Rule, fill and tint are derived (not in the
       guide); flagged in notes/first-draft-notes.md. */
    --paper: #16171A;
    --ink: #E6E3DC;
    --grey: #A2A5AB;
    --rule: #2C2E33;
    --fill: #202226;
    --accent: #D99483;
    --tint: #5A3A33;
    --accent-2: #7FB5AE;
    --tint-2: #213936;
  }
}

@media (min-width: 600px) {
  :root { --gutter: 32px; }
}

/* ---- base ----------------------------------------------------------- */

* { box-sizing: border-box; }

html {
  background: var(--paper);
  font-size: 17px;
  -webkit-text-size-adjust: 100%;
}
@media (min-width: 600px) {
  html { font-size: 18px; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1rem;
  line-height: 1.6;
  font-optical-sizing: auto;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--tint);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}
a:hover, a:focus-visible {
  text-decoration-color: var(--accent);
}
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 600;
  color: var(--ink);
  margin: 0;
}
h1 { font-size: 2rem;    line-height: 1.15; margin-bottom: calc(var(--unit) * 2); }
h2 { font-size: 1.5556rem; line-height: 1.2;  margin-top: calc(var(--unit) * 6); margin-bottom: calc(var(--unit) * 2); }
h3 { font-size: 1.2222rem; line-height: 1.3;  margin-top: calc(var(--unit) * 4); margin-bottom: var(--unit); }
p  { margin: 0 0 calc(var(--unit) * 2); }
ul, ol { margin: 0 0 calc(var(--unit) * 2); padding-left: 1.4em; }
li { margin-bottom: calc(var(--unit) / 2); }

.wrap {
  max-width: var(--wide);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}
.prose { max-width: var(--measure); }

.meta, .kind, .org, .tags, .caption, .url-line {
  font-family: var(--sans);
  font-size: 0.7778rem;   /* 14 px at 18 */
  line-height: 1.4;
  color: var(--grey);
  font-variant-numeric: lining-nums tabular-nums;
}
.meta a, .org a, .tags a, .caption a { color: var(--accent); }

.subtitle {
  font-family: var(--serif);
  font-size: 1.2222rem;
  line-height: 1.45;
  color: var(--grey);
  margin: 0 0 calc(var(--unit) * 2);
}

hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: calc(var(--unit) * 5) 0;
}

/* ---- navigation bar ------------------------------------------------- */

.site-header {
  border-bottom: 1px solid var(--rule);
}
.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: calc(var(--unit) * 1.5) calc(var(--unit) * 3);
  padding-top: calc(var(--unit) * 3);
  padding-bottom: calc(var(--unit) * 2);
}
.wordmark {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1rem;
  line-height: 1.1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.wordmark:hover, .wordmark:focus-visible { text-decoration: none; }
.nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: calc(var(--unit) * 2.5);
  font-family: var(--sans);
  font-size: 0.8333rem;  /* 15 px at 18 */
  font-weight: 500;
  line-height: 1.4;
}
.nav li { margin: 0; }
.nav li a {
  color: var(--ink);
  text-decoration: none;
  padding-bottom: 3px;
  border-bottom: 2px solid transparent;
}
.nav li a:hover, .nav li a:focus-visible { border-bottom-color: var(--tint); }
.nav li a[aria-current="page"] { border-bottom-color: var(--accent); }
@media (max-width: 599px) {
  .nav ul { width: 100%; }
}

/* ---- page frame ----------------------------------------------------- */

main.wrap {
  padding-top: calc(var(--unit) * 5);
  padding-bottom: calc(var(--unit) * 4);
}
.page-head { margin-bottom: calc(var(--unit) * 4); }
.page-head .meta { margin-top: var(--unit); }
section + section { margin-top: calc(var(--unit) * 4); }

/* Home masthead: guide § 4, wordmark 44 / 1.1 regular */
.masthead { margin-bottom: calc(var(--unit) * 5); }
.masthead h1 {
  font-weight: 400;
  font-size: 2.2rem;
  line-height: 1.1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: var(--unit);
}
@media (min-width: 600px) {
  .masthead h1 { font-size: 2.4444rem; }
}
.masthead .url-line { margin-bottom: calc(var(--unit) * 2); }
.masthead .tagline {
  font-family: var(--serif);
  font-size: 1.2222rem;
  line-height: 1.45;
  margin: 0;
}

/* ---- artifact card (guide § 7) -------------------------------------- */

.cards { margin: 0; padding: 0; list-style: none; }
.card {
  border-top: 1px solid var(--rule);
  padding: calc(var(--unit) * 2) 0;
  margin: 0;
}
.cards > .card:last-child { border-bottom: 1px solid var(--rule); }
.card .kind { margin: 0; }
.card .title {
  font-family: var(--serif);
  font-size: 1.1111rem;   /* 20 px at 18 */
  line-height: 1.3;
  margin: calc(var(--unit) / 2) 0;
}
.card .title a {
  color: var(--ink);
  text-decoration: none;
}
.card .title a:hover, .card .title a:focus-visible {
  text-decoration: underline;
  text-decoration-color: var(--accent);
}
.card .org, .card .tags { margin: 0; }
.card .tags { margin-top: calc(var(--unit) / 2); }
.card .note {
  font-family: var(--serif);
  font-size: 0.9rem;
  color: var(--grey);
  margin: calc(var(--unit) / 2) 0 0;
  max-width: var(--measure);
}

.year-group { margin-top: calc(var(--unit) * 5); }
.year-group h2 { margin-top: 0; }

/* ---- quote with provenance (guide § 7) ------------------------------ */

.quote {
  margin: calc(var(--unit) * 5) 0;
  max-width: var(--measure);
}
.quote blockquote {
  margin: 0;
  padding: calc(var(--unit) / 2) 0 calc(var(--unit) / 2) calc(var(--unit) * 2.5);
  border-left: 2px solid var(--accent);
  font-family: var(--serif);
  font-size: 1.2222rem;
  line-height: 1.45;
  color: var(--ink);
}
.quote blockquote p { margin: 0; }
.quote figcaption { margin-top: var(--unit); }

/* ---- figures (guide § 6) -------------------------------------------- */

.figure { margin: calc(var(--unit) * 4) 0; max-width: var(--wide); }
/* On a phone the diagram keeps its label size and scrolls inside the
   figure; the page itself never scrolls sideways. */
.figure-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.figure svg.diagram {
  display: block;
  width: 100%;
  max-width: 800px;
  min-width: 680px;
  height: auto;
  font-family: var(--sans);
  font-size: 13px;
  font-variant-numeric: lining-nums tabular-nums;
}
.figure-note {
  font-family: var(--sans);
  font-size: 0.7778rem;
  line-height: 1.4;
  color: var(--grey);
  border: 1px dashed var(--grey);
  border-radius: 2px;
  padding: var(--unit) calc(var(--unit) * 1.5);
  margin: var(--unit) 0 0;
  max-width: var(--measure);
}
.figure-placeholder {
  border: 1px dashed var(--grey);
  background: var(--fill);
  border-radius: 2px;
  padding: calc(var(--unit) * 7) var(--gutter);
  text-align: center;
  font-family: var(--sans);
  font-size: 0.7778rem;
  color: var(--grey);
}
.figure figcaption { margin-top: var(--unit); }

/* ---- about page ----------------------------------------------------- */

.portrait {
  display: block;
  width: 150px;
  height: auto;
  border-radius: 2px;
  margin: 0 0 calc(var(--unit) * 2);
}
@media (min-width: 600px) {
  .portrait {
    float: right;
    width: 180px;
    margin: 0 0 calc(var(--unit) * 2) calc(var(--unit) * 4);
  }
}
.about-lead::after { content: ""; display: table; clear: both; }

.career { list-style: none; padding: 0; margin: 0; }
.career li {
  border-top: 1px solid var(--rule);
  padding: calc(var(--unit) * 1.5) 0;
  margin: 0;
}
.career li:last-child { border-bottom: 1px solid var(--rule); }
.career .role { font-family: var(--serif); font-size: 1rem; margin: 0; }
.career .span { margin: 2px 0 0; }

.community {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: 0.7778rem;
  line-height: 1.4;
  font-variant-numeric: lining-nums tabular-nums;
}
.community th, .community td {
  text-align: left;
  vertical-align: top;
  padding: calc(var(--unit) * 1.25) calc(var(--unit) * 1.5) calc(var(--unit) * 1.25) 0;
  border-top: 1px solid var(--rule);
}
.community th { color: var(--grey); font-weight: 500; border-top: 0; }
.community tr:last-child td { border-bottom: 1px solid var(--rule); }
.community td:first-child { font-family: var(--serif); font-size: 0.95rem; color: var(--ink); }
.community td:nth-child(3) { white-space: nowrap; }
@media (max-width: 599px) {
  .community thead { display: none; }
  .community tr { display: block; border-top: 1px solid var(--rule); padding: var(--unit) 0; }
  .community td { display: block; border: 0; padding: 2px 0; }
  .community tr:last-child td { border: 0; }
  .community tr:last-child { border-bottom: 1px solid var(--rule); }
}

/* ---- footer --------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--rule);
  margin-top: calc(var(--unit) * 6);
}
.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: calc(var(--unit) * 2) calc(var(--unit) * 3);
  padding-top: calc(var(--unit) * 3);
  padding-bottom: calc(var(--unit) * 6);
  font-family: var(--sans);
  font-size: 0.7778rem;
  line-height: 1.4;
  color: var(--grey);
}
.site-footer p { margin: 0; }
.site-footer .lockup {
  display: flex;
  align-items: center;
  gap: calc(var(--unit) * 1.5);
}
/* Monogram, brand guide section 5: SD in Newsreader 600, Ink on a Paper
   square, with a 1 px Accent line under the letters. The URL goes with it. */
.site-footer .monogram {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--rule);
  font-family: var(--serif);
  font-weight: 600;
  font-size: 20px;
  line-height: 1;
  letter-spacing: 0.03em;
  color: var(--ink);
  position: relative;
}
.site-footer .monogram::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 7px;
  height: 1px;
  background: var(--accent);
}

/* ---- print ---------------------------------------------------------- */

@media print {
  .site-header, .site-footer { border-color: #999; }
  a { color: inherit; }
}

/* ---- career: era bar (About; brand/career-companies-mockup.html p. 1) ----
   Two rows on one axis of years, 2001 to now. Each bar carries its start
   and width as CSS variables (--s, --w, percentages of the axis). On wide
   screens the bars sit in lanes; below 900 px each bar is its own row with
   the name, the years and a thin track. HTML and CSS only; no script. */

.career-wide { max-width: var(--wide); }
.era-bar {
  margin: var(--unit) 0 calc(var(--unit) * 3);
  font-family: var(--sans);
  font-size: 0.7222rem;          /* 13 px at 18 */
  line-height: 18px;
  font-variant-numeric: lining-nums tabular-nums;
}
.era-group {
  font-size: 0.6667rem;          /* 12 px */
  font-weight: 500;
  line-height: 1.3;
  color: var(--grey);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0 0 6px;
}
.lane + .era-group { margin-top: 14px; }
.lane { list-style: none; margin: 0; padding: 0; }
.lane .bar { margin: 0; }
.lane a { display: block; }
.track { display: block; }
.seg {
  display: block;
  background: var(--fill);
  border: 1.5px solid var(--grey);
  border-radius: 2px;
}
.bar.now .seg { background: var(--tint); border-color: var(--accent); }
.bar.pre .seg { background: repeating-linear-gradient(135deg, var(--grey) 0 1px, var(--paper) 1px 5px); }
.bar-label { white-space: nowrap; }
.bar-name { font-weight: 500; }
.lane-employers .bar-name { color: var(--ink); }
.bar-years, .bar-state { color: var(--grey); font-weight: 400; }
.axis {
  position: relative;
  height: 22px;
  border-top: 1px solid var(--rule);
  margin-top: var(--unit);
  color: var(--grey);
}
.axis span { position: absolute; top: 3px; left: var(--x); transform: translateX(-50%); }
.axis .first { transform: none; }
.axis .last { transform: translateX(-100%); }
.era-bar .figcap {
  font-size: 0.7778rem;
  line-height: 1.4;
  color: var(--grey);
  margin: 4px 0 0;
}

@media (max-width: 899px) {
  /* stacked rows: label line, then a thin track with the bar to scale */
  .era-bar { font-size: 0.7778rem; line-height: 1.4; }
  .lane .bar { margin: 0 0 9px; }
  .bar-label { display: flex; gap: var(--unit); align-items: baseline; }
  .bar-years { margin-left: auto; }
  .track { position: relative; height: 8px; margin-top: 3px; }
  .track::before { content: ""; position: absolute; left: 0; right: 0; top: 3.5px; height: 1px; background: var(--rule); }
  .seg { position: absolute; top: 0; bottom: 0; left: var(--s); width: var(--w); }
  .axis { display: none; }
}

@media (min-width: 900px) {
  .lane { position: relative; height: 18px; margin: 0 0 5px; }
  .lane-employers { height: 62px; margin-bottom: var(--unit); }
  .lane .bar, .lane .bar > a {
    position: absolute;
    top: 0;
    height: 18px;
    left: var(--s);
    width: var(--w);
  }
  .lane .bar > a { left: 0; width: 100%; }
  .lane-employers .bar { width: calc(var(--w) - 3px); }
  .lane-employers .bar.last { width: var(--w); }
  .track, .seg { position: absolute; inset: 0; }
  .lane .bar-label { z-index: 1; }   /* above the track, which follows it in the markup */
  .lane-employers .bar-label { position: absolute; left: 3px; top: 22px; line-height: 17px; }
  .lane-employers .bar-name, .lane-employers .bar-years { display: block; }
  .lane-employers .y-rest { display: none; }
  .lane-own .bar-label { position: absolute; top: 0; }
  .lane-own .label-in .bar-label { left: 7px; }
  .lane-own .label-before .bar-label { right: calc(100% + 8px); text-align: right; }
  .lane-own .bar-state::before, .lane-own .bar-years::before { content: " · "; }
}

/* ---- career: era rows (Option F) ---------------------------------- */

.essay { list-style: none; margin: 4px 0 0; padding: 0; max-width: var(--wide); }
.essay > li {
  border-top: 1px solid var(--rule);
  padding: calc(var(--unit) * 2) 0 calc(var(--unit) * 1.5);
  margin: 0;
}
.essay > li:last-child { border-bottom: 1px solid var(--rule); }
.essay h3 { margin: 0; font-size: 1.2222rem; line-height: 1.3; }
.essay .yrs {
  font-family: var(--sans);
  font-size: 0.7778rem;
  line-height: 1.4;
  color: var(--grey);
  margin: 2px 0 6px;
  font-variant-numeric: lining-nums tabular-nums;
}
.essay .kick {
  font-family: var(--sans);
  font-size: 0.6667rem;
  font-weight: 500;
  line-height: 1.3;
  color: var(--grey);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0 0 var(--unit);
}
.essay .roles { list-style: none; margin: 0 0 calc(var(--unit) * 1.5); padding: 0; font-family: var(--sans); font-size: 0.7778rem; font-weight: 500; line-height: 1.4; }
.essay .roles li { margin: 0 0 4px; }
.essay .roles .span { font-weight: 400; color: var(--grey); margin-left: 6px; font-variant-numeric: lining-nums tabular-nums; }
.essay .story { font-family: var(--serif); font-size: 1rem; line-height: 1.55; margin: 0; max-width: var(--measure); }
@media (min-width: 700px) {
  .essay > li { display: grid; grid-template-columns: 250px 1fr; gap: calc(var(--unit) * 4.5); }
  .essay .roles { margin-bottom: 0; }
}

/* ---- companies page (mockup p. 2 and 3) --------------------------- */

.tier {
  font-family: var(--sans);
  font-size: 0.7222rem;
  font-weight: 500;
  line-height: 1.3;
  color: var(--grey);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: calc(var(--unit) * 4) 0 calc(var(--unit) * 2.5);
}
.feat { margin: 0 0 calc(var(--unit) * 4.5); max-width: var(--wide); }
.feat h3 { font-size: 1.5556rem; line-height: 1.2; margin: 0 0 var(--unit); }
.feat .rl {
  font-family: var(--sans);
  font-size: 0.8333rem;
  line-height: 1.4;
  color: var(--grey);
  margin: 0 0 var(--unit);
  font-variant-numeric: lining-nums tabular-nums;
}
.feat .ext { font-family: var(--sans); font-size: 0.7778rem; line-height: 1.4; margin: 0 0 calc(var(--unit) * 1.5); }
.feat .para { font-family: var(--serif); font-size: 1rem; line-height: 1.6; margin: 0 0 calc(var(--unit) * 1.25); max-width: var(--measure); }
.feat .from { font-family: var(--sans); font-size: 0.7778rem; line-height: 1.4; color: var(--grey); margin: 0; }
.ledger {
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: calc(var(--unit) * 2.25) 0 calc(var(--unit) * 2);
  max-width: var(--wide);
}
.ledger h3 { font-size: 1.2222rem; line-height: 1.3; margin: 0 0 6px; }
.ledger .rl { font-family: var(--sans); font-size: 0.7778rem; line-height: 1.4; color: var(--grey); margin: 0 0 var(--unit); }
.ledger .line { font-family: var(--serif); font-size: 1rem; line-height: 1.55; margin: 0; max-width: var(--measure); }
@media (min-width: 700px) {
  .feat, .ledger { display: grid; grid-template-columns: 290px 1fr; gap: calc(var(--unit) * 5); }
  .feat .ext { margin-bottom: 0; }
  .ledger .rl { margin-bottom: 0; }
}

/* ---- color roles (brand/color-options.md) ----------------------------
   Color only; no size, weight or layout. Last in the file so these win. */
.site-header { border-bottom-color: var(--head-rule); }
.kind { color: var(--kind); }
.year-group h2 { color: var(--year); }
.era-group, .essay .kick, .tier, .community th { color: var(--label); }
.lane-employers .seg { background: var(--bar-fill); border-color: var(--bar-line); }
.lane-employers .bar.now .seg { background: var(--now-fill); border-color: var(--now-line); }
.lane-own .seg { background: var(--own-fill); border-color: var(--own-line); }
.lane-own .bar.pre .seg { background: repeating-linear-gradient(135deg, var(--own-line) 0 1px, var(--paper) 1px 5px); }
