/* Layout: a manuscript page. One reading column, a right-hand margin for
   editor's notes (facts, sources, grades), and blue-pencil proof marks as
   the one recurring flourish. Margin notes fold inline on narrow screens. */
:root {
  --paper: #f4f5f7;
  --ink: #161a22;
  --ink-2: #4b5261;
  --rule: #d8dbe2;
  --pencil: #2d4fd6;
  --pencil-wash: #e2e7fb;
  --display: "Newsreader", "Iowan Old Style", Georgia, serif;
  --text: "Newsreader", "Iowan Old Style", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --measure: 38rem;
  --margin-col: 15rem;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #111419;
    --ink: #e6e8ec;
    --ink-2: #a2a8b5;
    --rule: #2a2f39;
    --pencil: #93a6ff;
    --pencil-wash: #1c2340;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #111419;
  --ink: #e6e8ec;
  --ink-2: #a2a8b5;
  --rule: #2a2f39;
  --pencil: #93a6ff;
  --pencil-wash: #1c2340;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--text);
  font-size: 1.1875rem;
  line-height: 1.6;
  font-optical-sizing: auto;
}
img { max-width: 100%; height: auto; }
a { color: var(--pencil); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--pencil); outline-offset: 3px; border-radius: 2px; }

.wrap {
  max-width: calc(var(--measure) + var(--margin-col) + 4rem);
  margin: 0 auto;
  padding-inline: clamp(1rem, 4vw, 2rem);
}

/* Utility type */
.label {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
}

/* Masthead */
.masthead {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  padding-block: 1.5rem;
  border-bottom: 1px solid var(--rule);
}
.masthead .name {
  font-family: var(--display);
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
}
.masthead nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; }
.masthead nav a {
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--ink-2);
  text-decoration: none;
}
.masthead nav a:hover, .masthead nav a[aria-current="page"] { color: var(--pencil); }

/* Proof marks: the signature device */
.struck {
  position: relative;
  text-decoration: none;
  color: var(--ink-2);
  white-space: nowrap;
}
.struck::after {
  content: "";
  position: absolute;
  left: -0.05em;
  right: -0.05em;
  top: 55%;
  height: 0.09em;
  min-height: 2px;
  background: var(--pencil);
  border-radius: 1px;
  transform: rotate(-2deg);
  transform-origin: left center;
  animation: strike 700ms cubic-bezier(.6,.1,.3,1) 300ms both;
}
.insert {
  text-decoration: none;
  color: var(--pencil);
  font-style: italic;
  position: relative;
}
@keyframes strike { from { transform: rotate(-2deg) scaleX(0); } to { transform: rotate(-2deg) scaleX(1); } }
@media (prefers-reduced-motion: reduce) { .struck::after { animation: none; } }

/* Home hero */
.hero { padding-block: clamp(3rem, 9vw, 6.5rem) clamp(2rem, 5vw, 3.5rem); }
.hero h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.5rem, 7vw, 4.75rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 0;
  max-width: 15ch;
  text-wrap: balance;
}
.hero .lede {
  margin: 1.75rem 0 0;
  max-width: var(--measure);
  font-size: 1.3125rem;
  color: var(--ink-2);
  text-wrap: pretty;
}

/* Sections */
.section { padding-block: 2.5rem; border-top: 1px solid var(--rule); }
.section > .label { display: block; margin-bottom: 1.5rem; }
.section h2 {
  font-family: var(--display);
  font-weight: 500;
  font-size: 1.75rem;
  line-height: 1.2;
  margin: 0 0 1rem;
  text-wrap: balance;
}

/* Work index */
.work-list { list-style: none; margin: 0; padding: 0; display: grid; }
.work-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.5rem 2rem;
  padding-block: 1.5rem;
  border-bottom: 1px solid var(--rule);
}
.work-item:first-child { padding-top: 0; }
.work-item:last-child { border-bottom: 0; padding-bottom: 0; }
.work-item h3 {
  font-family: var(--display);
  font-size: clamp(1.5rem, 3.2vw, 2rem);
  font-weight: 500;
  line-height: 1.15;
  margin: 0 0 0.4rem;
  text-wrap: balance;
}
.work-item { position: relative; }
.work-item h3 a { color: var(--ink); text-decoration: none; }
/* The whole entry, status pill included, opens the case study */
.work-item h3 a::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.work-item:hover h3 a, .work-item h3 a:focus-visible { color: var(--pencil); }
.work-item h3 a:focus-visible { outline: none; }
.work-item:has(h3 a:focus-visible) { outline: 2px solid var(--pencil); outline-offset: 6px; border-radius: 4px; }
.work-item .status { transition: background-color 150ms, color 150ms, border-color 150ms; }
.work-item:hover .status { border-color: var(--pencil); color: var(--pencil); background: var(--pencil-wash); }
.status::after { content: " \2192"; }
.work-item p { margin: 0; color: var(--ink-2); max-width: var(--measure); }
.work-item .tags { margin-top: 0.6rem; }
.status {
  align-self: start;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  color: var(--ink-2);
}
.status.open { border-color: var(--pencil); color: var(--pencil); }
@media (max-width: 560px) {
  .work-item { grid-template-columns: minmax(0, 1fr); }
  .status { justify-self: start; order: -1; }
}

/* About + contact */
.two-col {
  display: grid;
  grid-template-columns: minmax(0, var(--measure)) minmax(0, var(--margin-col));
  gap: 1.5rem 4rem;
}
.two-col p { margin: 0 0 1rem; text-wrap: pretty; }
@media (max-width: 860px) { .two-col { grid-template-columns: minmax(0, 1fr); } }
.facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.9rem; }
.facts li { display: grid; gap: 0.1rem; font-size: 1rem; }
.copy-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; }
.email { font-family: var(--mono); font-size: 0.9375rem; user-select: all; overflow-wrap: anywhere; }
.btn {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--pencil);
  border-radius: 999px;
  background: transparent;
  color: var(--pencil);
  cursor: pointer;
}
.btn:hover { background: var(--pencil-wash); }

/* Footer */
.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-block: 2rem 3rem;
  border-top: 1px solid var(--rule);
  font-size: 0.9375rem;
  color: var(--ink-2);
}

/* Case study / long-form pages */
.article-head { padding-block: clamp(2.5rem, 7vw, 4.5rem) 2rem; max-width: calc(var(--measure) + 4rem); }
.article-head .label { display: block; margin-bottom: 1rem; }
.article-head h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.25rem, 6vw, 3.75rem);
  line-height: 1.08;
  letter-spacing: -0.015em;
  margin: 0;
  text-wrap: balance;
}
.article-head .dek {
  margin: 1.25rem 0 0;
  font-size: 1.3125rem;
  color: var(--ink-2);
  max-width: var(--measure);
  text-wrap: pretty;
}

.block {
  display: grid;
  grid-template-columns: minmax(0, var(--measure)) minmax(0, var(--margin-col));
  gap: 0 4rem;
  padding-block: 1.75rem;
  border-top: 1px solid var(--rule);
}
.block > .body { min-width: 0; }
.block h2 {
  font-family: var(--display);
  font-weight: 500;
  font-size: 1.75rem;
  line-height: 1.2;
  margin: 0 0 1rem;
  text-wrap: balance;
}
.block p { margin: 0 0 1.1rem; text-wrap: pretty; }
.block p:last-child { margin-bottom: 0; }
.note {
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--ink-2);
  border-left: 2px solid var(--pencil);
  padding-left: 0.9rem;
  align-self: start;
  display: grid;
  gap: 0.75rem;
}
.note dl { margin: 0; display: grid; gap: 0.6rem; }
.note dt { font-family: var(--mono); font-size: 0.6875rem; letter-spacing: 0.08em; text-transform: uppercase; }
.note dd { margin: 0; color: var(--ink); }
.note .num { font-variant-numeric: tabular-nums; }
@media (max-width: 860px) {
  .block { grid-template-columns: minmax(0, 1fr); }
  .note { margin-top: 1.25rem; }
}

/* Adjective-to-rule proof table */
.rules { list-style: none; margin: 1.25rem 0 1.5rem; padding: 0; display: grid; gap: 1.25rem; }
.rules li {
  display: grid;
  grid-template-columns: 8.5rem minmax(0, 1fr);
  gap: 0.25rem 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px dashed var(--rule);
}
.rules li:last-child { border-bottom: 0; padding-bottom: 0; }
.rules .adj { font-family: var(--display); font-size: 1.375rem; line-height: 1.3; }
.rules .adj .struck { color: var(--ink-2); }
.rules .rule { margin: 0; }
@media (max-width: 560px) { .rules li { grid-template-columns: minmax(0, 1fr); } }

.fields { list-style: none; margin: 1rem 0 1.25rem; padding: 0; display: grid; gap: 0.6rem; }
.fields li { display: grid; grid-template-columns: 9rem minmax(0, 1fr); gap: 0.2rem 1rem; }
.fields .label { padding-top: 0.3rem; }
@media (max-width: 560px) { .fields li { grid-template-columns: minmax(0, 1fr); } }

.method {
  margin: 0.5rem 0 0;
  font-family: var(--display);
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  line-height: 1.3;
  font-weight: 400;
  text-wrap: balance;
}

.back { padding-block: 2rem 0; font-family: var(--mono); font-size: 0.8125rem; }

/* Exhibits: recreated artifacts, set off as separate objects */
.exhibit {
  margin: 1.5rem 0;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: color-mix(in srgb, var(--paper) 92%, var(--pencil-wash));
  overflow: hidden;
}
.exhibit-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--rule);
}
.exhibit-head .label:last-child { color: var(--pencil); }
.exhibit dl { margin: 0; padding: 0.4rem 1rem 0.9rem; display: grid; }
.exhibit dl > div {
  display: grid;
  grid-template-columns: 8rem minmax(0, 1fr);
  gap: 0.15rem 1rem;
  padding-block: 0.55rem;
  border-bottom: 1px dashed var(--rule);
  font-size: 1rem;
  line-height: 1.5;
}
.exhibit dl > div:last-child { border-bottom: 0; }
.exhibit dt { font-family: var(--mono); font-size: 0.6875rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); padding-top: 0.25rem; }
.exhibit dd { margin: 0; }
.exhibit .cite { display: block; font-family: var(--mono); font-size: 0.75rem; color: var(--pencil); margin-top: 0.15rem; }
@media (max-width: 560px) { .exhibit dl > div { grid-template-columns: minmax(0, 1fr); } }

.kinds { list-style: none; margin: 1.25rem 0 1.5rem; padding: 0; display: grid; gap: 1rem; }
.kinds li { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr); gap: 0.2rem 1.5rem; padding-bottom: 1rem; border-bottom: 1px dashed var(--rule); }
.kinds li:last-child { border-bottom: 0; padding-bottom: 0; }
.kinds .kind { font-family: var(--display); font-size: 1.375rem; line-height: 1.3; }
.kinds p { margin: 0; }
.kinds .agents { display: block; font-family: var(--mono); font-size: 0.8125rem; color: var(--ink-2); margin-bottom: 0.2rem; }
@media (max-width: 560px) { .kinds li { grid-template-columns: minmax(0, 1fr); } }

.uses { margin: 1rem 0 1.25rem; padding-left: 1.1rem; display: grid; gap: 0.6rem; }
.uses li::marker { color: var(--pencil); }
.pull { font-family: var(--display); font-style: italic; font-size: 1.5rem; line-height: 1.35; color: var(--pencil); margin: 0 0 1.1rem; text-wrap: balance; }

/* Numbered elements where order is the content */
.four { list-style: none; counter-reset: four; margin: 1.25rem 0 1.5rem; padding: 0; display: grid; gap: 1.5rem; }
.four li { counter-increment: four; display: grid; grid-template-columns: 2.5rem minmax(0, 1fr); gap: 0 1rem; }
.four li::before {
  content: counter(four);
  font-family: var(--display);
  font-size: 2rem;
  line-height: 1;
  color: var(--pencil);
  padding-top: 0.1rem;
}
.four h3 { font-family: var(--display); font-size: 1.3125rem; font-weight: 600; line-height: 1.3; margin: 0; }
.four .q { display: block; font-style: italic; color: var(--pencil); margin: 0.15rem 0 0.4rem; }
.four p { margin: 0; }

/* Comparison table */
.table-wrap { overflow-x: auto; margin: 1.25rem 0 1.5rem; }
.compare { width: 100%; min-width: 32rem; border-collapse: collapse; font-size: 1rem; line-height: 1.5; }
.compare th, .compare td { text-align: left; vertical-align: top; padding: 0.7rem 0.9rem 0.7rem 0; border-bottom: 1px solid var(--rule); }
.compare thead th { font-family: var(--mono); font-size: 0.6875rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); font-weight: 500; }
.compare tbody th { font-family: var(--mono); font-size: 0.6875rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); font-weight: 500; width: 7rem; padding-top: 0.95rem; }
.compare td:last-child { color: var(--ink); }
.compare td:nth-child(2) { color: var(--ink-2); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Diagrams: inline SVG drawn from the page tokens */
.diagram { margin: 1.75rem 0; color: var(--ink); }
.diagram-scroll { overflow-x: auto; }
.diagram svg { display: block; width: 100%; height: auto; min-width: 30rem; }
.diagram figcaption { margin-top: 0.7rem; font-size: 0.9375rem; line-height: 1.5; color: var(--ink-2); }
.dg-line { fill: none; stroke: currentColor; stroke-opacity: 0.3; stroke-width: 1; }
.dg-frame { fill: none; stroke: currentColor; stroke-opacity: 0.45; stroke-width: 1.25; }
.dg-box { fill: var(--paper); stroke: currentColor; stroke-opacity: 0.45; stroke-width: 1.25; }
.dg-pen { fill: none; stroke: var(--pencil); stroke-width: 2; }
.dg-pen-thin { fill: none; stroke: var(--pencil); stroke-width: 1.25; }
.dg-pen-fill { fill: var(--pencil); }
.dg-wash { fill: var(--pencil-wash); }
.dg-bar { fill: currentColor; fill-opacity: 0.16; }
.dg-head { fill: currentColor; fill-opacity: 0.05; }
.dg-t { font-family: var(--text); font-size: 13px; fill: currentColor; }
.dg-t-lg { font-family: var(--text); font-size: 19px; fill: currentColor; }
.dg-m { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.06em; fill: var(--ink-2); }
.dg-mp { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.06em; fill: var(--pencil); }
.dg-paper { fill: var(--paper); font-family: var(--mono); font-size: 11px; font-weight: 500; }
