/* Direction B, Lab notebook. Design spike: hand-written, no framework. */

@font-face {
  font-family: "Newsreader";
  src: url("../fonts/newsreader-latin-opsz-normal.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Plex Mono";
  src: url("../fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Plex Mono";
  src: url("../fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  --paper: #f5f3ee;
  --paper-2: #ecE8e0;
  --ink: #1b1a17;
  --ink-2: #57534b;
  --rule: #d9d5cc;
  --rule-strong: #b9b4a9;
  --accent: #8c2f1e;
  --accent-soft: rgba(140, 47, 30, 0.1);
  --mark-2: #8a857a;
  --plate-frame: #1b1a17;

  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --mono: "Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --measure: 36rem;
  --margin-col: 15rem;
  --gutter: 3rem;
  --page: calc(var(--measure) + var(--gutter) + var(--margin-col));
  --pad: 1.25rem;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121110;
    --paper-2: #1a1917;
    --ink: #e7e4dd;
    --ink-2: #a39e94;
    --rule: #2c2a26;
    --rule-strong: #45423c;
    --accent: #e8795a;
    --accent-soft: rgba(232, 121, 90, 0.14);
    --mark-2: #7d786e;
    --plate-frame: #2c2a26;
    color-scheme: dark;
  }
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.1875rem;          /* 19px */
  line-height: 1.55;
  font-optical-sizing: auto;
  font-variant-numeric: oldstyle-nums proportional-nums;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  hanging-punctuation: first;
}

@media (min-width: 64rem) {
  body { font-size: 1.25rem; }   /* 20px */
}

a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-color: var(--rule-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
a:hover { text-decoration-color: var(--accent); color: var(--accent); }

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

p { margin: 0 0 1em; text-wrap: pretty; }

h1, h2, h3 {
  font-weight: 400;
  line-height: 1.1;
  margin: 0;
  text-wrap: balance;
}

img { display: block; max-width: 100%; height: auto; }

.skip {
  position: absolute; left: -999px; top: 0;
  background: var(--ink); color: var(--paper);
  padding: 0.5rem 0.75rem; font-family: var(--mono); font-size: 0.8rem;
}
.skip:focus { left: 0.5rem; top: 0.5rem; }

/* Mono voice: labels, numbers, captions, metadata */
.mono, .label, .meta, figcaption, .readout, table, .note .src {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums lining-nums;
}

.label {
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
}

/* ---------- Page frame ---------- */
.page {
  max-width: calc(var(--page) + 2 * var(--pad));
  margin: 0 auto;
  padding: 0 var(--pad);
}

.masthead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 0 0.9rem;
  border-bottom: 1px solid var(--rule);
}
.masthead .home {
  font-size: 1.05rem;
  text-decoration: none;
  letter-spacing: 0.005em;
}
.masthead nav {
  display: flex;
  gap: 1.25rem;
  align-items: baseline;
}
.masthead nav a {
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--ink-2);
  text-decoration: none;
}
.masthead nav a:hover { color: var(--accent); }

/* ---------- The two-column report grid ---------- */
/* Each .row is a paragraph (or block) with an optional margin note beside it. */
.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}
.note {
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--ink-2);
  border-left: 1px solid var(--rule-strong);
  padding: 0.1rem 0 0.1rem 0.85rem;
  margin: -0.25rem 0 1.25rem;
}
.note p { margin: 0 0 0.5em; }
.note .src {
  display: block;
  font-size: 0.75rem;
  margin-top: 0.35rem;
}
.note strong { color: var(--ink); font-weight: 500; }

@media (min-width: 60rem) {
  .row {
    grid-template-columns: minmax(0, var(--measure)) var(--margin-col);
    column-gap: var(--gutter);
    align-items: start;
  }
  .row > :not(.note) { grid-column: 1; }
  .row > .note {
    grid-column: 2;
    grid-row: 1 / span 3;
    margin: 0.3rem 0 0;
  }
}

/* ---------- Home ---------- */
.intro {
  padding: 4.5rem 0 3.5rem;
}
.intro h1 {
  font-size: clamp(2.6rem, 8vw, 4.25rem);
  font-weight: 400;
  letter-spacing: -0.018em;
  line-height: 1;
  margin-bottom: 1.6rem;
}
.lede {
  font-size: clamp(1.3rem, 3.2vw, 1.6rem);
  line-height: 1.38;
  max-width: 34rem;
  margin-bottom: 1.1rem;
}
.intro .standfirst {
  color: var(--ink-2);
  max-width: var(--measure);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 0.5rem;
}

.index { list-style: none; margin: 0; padding: 0; }
.entry {
  border-bottom: 1px solid var(--rule);
  padding: 1.75rem 0 2rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.1rem;
}
.entry h2 {
  font-size: clamp(1.9rem, 5vw, 2.5rem);
  letter-spacing: -0.012em;
  margin-bottom: 0.45rem;
}
.entry h2 a { text-decoration: none; }
.entry h2 a:hover { color: var(--accent); }
.entry .what { margin: 0 0 1rem; max-width: 34rem; }
.readout {
  font-size: 0.875rem;
  line-height: 1.5;
  margin: 0 0 0.9rem;
  padding-left: 0.85rem;
  border-left: 2px solid var(--accent);
}
.readout b { font-weight: 500; color: var(--ink); }
.readout .cond { color: var(--ink-2); display: block; }
.links {
  font-family: var(--mono);
  font-size: 0.8125rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.links a { display: inline-block; padding: 0.55rem 0; margin: -0.55rem 0; }
.entry .year { color: var(--ink-2); }
.thumb {
  border: 1px solid var(--plate-frame);
  background: #121110;
  max-width: 22rem;
}
.thumb img { width: 100%; height: auto; }

@media (min-width: 60rem) {
  .entry {
    grid-template-columns: 6rem minmax(0, 1fr) 22rem;
    column-gap: 2rem;
    padding: 2.25rem 0 2.5rem;
  }
  .entry .year { grid-column: 1; grid-row: 1; padding-top: 0.85rem; }
  .entry .body { grid-column: 2; grid-row: 1; }
  .entry .thumb { grid-column: 3; grid-row: 1; margin-top: 0.6rem; align-self: start; }
}

.contact { padding: 3.5rem 0 1rem; }
.contact dl {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr);
  gap: 0.6rem 1rem;
  margin: 1.25rem 0 0;
  font-size: 1.05rem;
}
.contact dt { padding-top: 0.2rem; }
.contact dd { margin: 0; }

/* ---------- Placeholders: obvious on purpose ---------- */
.ph {
  font-family: var(--mono);
  font-size: 0.8em;
  line-height: 1.5;
  color: var(--ink-2);
  background: var(--accent-soft);
  outline: 1px dashed var(--accent);
  outline-offset: 1px;
  padding: 0.05em 0.35em;
}
.ph::before { content: "TO FILL: "; color: var(--accent); font-weight: 500; }

/* ---------- Case study ---------- */
.crumb {
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--ink-2);
  padding-top: 2.75rem;
}
.crumb a { text-decoration: none; }

.title {
  padding: 1.25rem 0 2rem;
}
.title h1 {
  font-size: clamp(3rem, 11vw, 5.5rem);
  letter-spacing: -0.025em;
  line-height: 0.95;
  margin-bottom: 1.1rem;
}
.title .dek {
  font-size: clamp(1.3rem, 3.2vw, 1.6rem);
  line-height: 1.35;
  max-width: 36rem;
  margin: 0;
}

.meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem 1.5rem;
  margin: 0 0 2.5rem;
  padding: 1rem 0;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--rule);
  font-size: 0.8125rem;
  line-height: 1.45;
}
.meta div { min-width: 0; }
.meta dt { margin-bottom: 0.2rem; }
.meta dd { margin: 0; }
.meta .wide { grid-column: 1 / -1; }
.meta .links { margin-top: 0.1rem; }
@media (min-width: 60rem) {
  .meta { grid-template-columns: 9rem 14rem minmax(0, 1fr) minmax(0, 1.3fr); gap: 1.5rem; }
  .meta .wide { grid-column: auto; }
}

/* Plates: real screenshots, framed like figures in a report */
.plate { margin: 0 0 2.75rem; }
.plate .frame {
  border: 1px solid var(--plate-frame);
  background: #121110;
}
.plate figcaption, figure.fig figcaption {
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--ink-2);
  margin-top: 0.7rem;
  max-width: 44rem;
}
figcaption .n { color: var(--ink); font-weight: 500; margin-right: 0.5rem; }
@media (min-width: 60rem) {
  .plate { margin-bottom: 3.5rem; }
}

article section { margin-bottom: 2.75rem; }
article h2 {
  font-size: clamp(1.6rem, 4vw, 2rem);
  letter-spacing: -0.01em;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  margin-bottom: 1rem;
}
article h2 .label { display: block; margin-bottom: 0.6rem; }

ol.steps { margin: 0 0 1em; padding: 0; list-style: none; counter-reset: s; }
ol.steps li {
  counter-increment: s;
  position: relative;
  padding-left: 2.1rem;
  margin-bottom: 0.85em;
}
ol.steps li::before {
  content: counter(s);
  position: absolute;
  left: 0;
  top: 0.32em;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--accent);
  border: 1px solid currentColor;
  width: 1.35rem; height: 1.35rem;
  display: grid; place-items: center;
  font-variant-numeric: lining-nums;
}
ol.steps b { font-weight: 600; }

code {
  font-family: var(--mono);
  font-size: 0.82em;
  background: var(--paper-2);
  padding: 0.05em 0.3em;
}

/* Dot plot: results figure */
.fig { margin: 0.5rem 0 2rem; }
.dotplot {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--ink-2);
  border-top: 1px solid var(--ink);
  padding-top: 0.75rem;
}
.dp-row {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr);
  align-items: center;
  height: 2.75rem;
  border-bottom: 1px solid var(--rule);
}
.dp-row .k b { color: var(--ink); font-weight: 500; display: block; }
.track { position: relative; height: 100%; }
.track .tick {
  position: absolute; top: 0; bottom: 0;
  left: calc((var(--v) - 0.4) / 0.6 * 100%);
  border-left: 1px dotted var(--rule-strong);
}
.dot {
  position: absolute;
  top: 50%;
  left: calc((var(--v) - 0.4) / 0.6 * 100%);
  width: 11px; height: 11px;
  margin: -5.5px 0 0 -5.5px;
  border-radius: 50%;
}
.dot.ctl { border: 1.5px solid var(--mark-2); background: var(--paper); }
.dot.ns  { background: var(--mark-2); }
.dot.e2e { border: 1.5px solid var(--accent); background: var(--paper); }
.dot.ep  { background: var(--accent); width: 13px; height: 13px; margin: -6.5px 0 0 -6.5px; }
.dp-axis {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr);
  height: 1.6rem;
}
.dp-axis .track span {
  position: absolute; top: 0.35rem;
  left: calc((var(--v) - 0.4) / 0.6 * 100%);
  transform: translateX(-50%);
}
.dp-axis .track span:last-child { transform: translateX(-100%); }
.legend {
  display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem;
  margin: 0.4rem 0 0; padding: 0; list-style: none;
}
.legend li { display: flex; align-items: center; gap: 0.45rem; }
.legend .dot { position: static; margin: 0; flex: none; }

/* Tables */
.table-wrap { overflow-x: auto; margin: 0 0 1.5rem; }
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.8125rem;
  line-height: 1.4;
}
caption {
  text-align: left;
  font-size: 0.75rem;
  color: var(--ink-2);
  padding-bottom: 0.6rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
th, td { padding: 0.55rem 0.75rem 0.55rem 0; text-align: right; vertical-align: baseline; }
th:first-child, td:first-child { text-align: left; }
thead th { font-weight: 500; border-bottom: 1px solid var(--ink); color: var(--ink-2); }
tbody tr { border-bottom: 1px solid var(--rule); }
tbody th { font-weight: 400; color: var(--ink); }
tr.us td, tr.us th { color: var(--accent); font-weight: 500; }

.decisions { margin: 0; padding: 0; list-style: none; }
.decisions li {
  padding: 0 0 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--rule);
}
.decisions li:last-child { border-bottom: 0; }
.decisions b { font-weight: 600; }

.next {
  border-top: 1px solid var(--ink);
  padding: 1.5rem 0 1rem;
  margin-top: 1rem;
}
.next a { font-size: clamp(1.8rem, 5vw, 2.4rem); text-decoration: none; letter-spacing: -0.01em; }
.next a:hover { color: var(--accent); }

.colophon {
  border-top: 1px solid var(--rule);
  margin-top: 4rem;
  padding: 1.25rem 0 2.5rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--ink-2);
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 2rem;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

.nw { white-space: nowrap; }

/* Video: a click-to-load facade, so the page makes no YouTube request until asked */
.video { aspect-ratio: 16 / 9; position: relative; }
.video iframe, .facade { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.facade { padding: 0; margin: 0; background: #121110; cursor: pointer; display: block; }
.facade img { width: 100%; height: 100%; object-fit: cover; opacity: 0.82; }
.facade .play {
  position: absolute; left: 0; bottom: 0;
  background: #f5f3ee; color: #1b1a17;
  font-size: 0.8125rem; padding: 0.7rem 1rem;
  display: flex; gap: 0.75rem; align-items: baseline;
}
.facade .play::before { content: ""; width: 0; height: 0; align-self: center;
  border-left: 9px solid #8c2f1e; border-top: 5.5px solid transparent; border-bottom: 5.5px solid transparent; }
.facade .play .dim { color: #57534b; }
.facade:hover img { opacity: 1; }
.facade:focus-visible { outline-offset: 4px; }

/* Home: featured projects, one line and one number each */
.featured { list-style: none; margin: 0; padding: 0; }
.feat {
  border-bottom: 1px solid var(--rule);
  padding: 1.5rem 0 1.6rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.4rem;
}
.feat h3 { font-size: clamp(1.75rem, 5vw, 2.1rem); letter-spacing: -0.012em; }
.feat h3 a {
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--rule-strong);
  text-underline-offset: 0.14em;
}
.feat h3 a:hover { color: var(--accent); text-decoration-color: var(--accent); }
.feat .what { margin: 0 0 0.5rem; }
.feat .key { margin: 0; }
.feat .num {
  display: block;
  font-size: 1.9rem;
  line-height: 1.1;
  font-variant-numeric: lining-nums tabular-nums;
  color: var(--accent);
  margin-bottom: 0.3rem;
}
.feat .cond {
  display: block;
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--ink-2);
}
@media (min-width: 60rem) {
  .feat {
    grid-template-columns: 12rem minmax(0, 1fr) 17rem;
    column-gap: 2rem;
    align-items: baseline;
    padding: 1.9rem 0 2rem;
  }
  .feat .what { margin: 0; }
}
.more { font-family: var(--mono); font-size: 0.8125rem; margin: 1.25rem 0 0; }
.more a { display: inline-block; padding: 0.55rem 0; }
.page-title { padding-top: 3.5rem; }

/* Projects page: shorter entries with no case study yet */
.entry.compact { padding: 1.5rem 0 1.6rem; row-gap: 0.6rem; }
.entry.compact h2 { font-size: clamp(1.6rem, 4.5vw, 2rem); }
.entry.compact .what { margin-bottom: 0.75rem; }
.links .label { padding: 0.1rem 0; }
@media (min-width: 60rem) {
  .entry.compact { grid-template-columns: 6rem minmax(0, 1fr) 22rem; padding: 1.75rem 0 1.9rem; }
  .entry.compact .year { padding-top: 0.55rem; }
}

/* Home: headshot beside the name, in the margin column on desktop */
.intro-head {
  /* Portrait grows with the screen but always leaves the name room for one line. */
  --portrait: clamp(3.5rem, calc(100vw - 19rem), 7rem);
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--portrait);
  column-gap: 1rem;
  align-items: center;
}
.intro .intro-head h1 { grid-column: 1; grid-row: 1; margin-bottom: 0; }
.portrait { grid-column: 2; grid-row: 1; display: block; }
.portrait img {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  border: 1px solid var(--rule-strong);
}
.intro-head .lede { grid-column: 1 / -1; grid-row: 2; margin: 1.6rem 0 0.6rem; max-width: var(--measure); text-wrap: balance; }
.intro-head .intro-more { grid-column: 1 / -1; grid-row: 3; max-width: var(--measure); margin-bottom: 1.1rem; }
@media (min-width: 60rem) {
  .intro-head {
    grid-template-columns: minmax(0, var(--measure)) var(--margin-col);
    column-gap: var(--gutter);
    align-items: start;
  }
  .portrait { grid-row: 2 / span 2; width: 13rem; margin-top: 1.95rem; }
  .intro-head .lede, .intro-head .intro-more { grid-column: 1; }
}

/* Bar figure (Docket) */
.bars { font-family: var(--mono); font-size: 0.78rem; color: var(--ink-2); border-top: 1px solid var(--ink); padding-top: 0.5rem; }
.bar-row {
  display: grid;
  grid-template-columns: 8.5rem minmax(0, 1fr) 4rem;
  gap: 0.75rem;
  align-items: center;
  height: 2.4rem;
  border-bottom: 1px solid var(--rule);
}
.bar-row .track { height: 0.7rem; }
.bar-row .track i { display: block; height: 100%; width: calc(var(--n) / 20 * 100%); background: var(--mark-2); }
.bar-row .v { text-align: right; color: var(--ink); }
.bar-row.us .track i { background: var(--accent); }
.bar-row.us .k, .bar-row.us .v { color: var(--accent); font-weight: 500; }
@media (max-width: 30rem) { .bar-row { grid-template-columns: 6.5rem minmax(0, 1fr) 3.5rem; gap: 0.5rem; } }

/* 404 */
.notfound { padding: 4rem 0 6rem; }
.notfound h1 { font-size: clamp(2.6rem, 8vw, 4rem); letter-spacing: -0.018em; margin-bottom: 1.2rem; }

/* About page */
.prose-block { padding-top: 2.25rem; max-width: var(--measure); }
.prose-block .section-head { margin-bottom: 1.1rem; }
.prose-block p { margin: 0 0 1rem; }

/* Projects: obvious links, one image size */
.entry h2 a, .feat h3 a {
  text-decoration-line: underline;
  text-decoration-thickness: 2px;
  text-decoration-color: var(--accent);
  text-underline-offset: 0.16em;
}
.entry h2 a::after, .feat h3 a::after { content: " \2192"; font-size: 0.7em; color: var(--accent); }
.entry h2 a:hover, .feat h3 a:hover { color: var(--accent); }
.links { gap: 0.5rem 0.5rem; margin-top: 0.2rem; }
.links a.btn {
  display: inline-block;
  margin: 0;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--ink-2);
  border-radius: 4px;
  text-decoration: none;
  color: var(--ink);
}
.links a.btn:hover { border-color: var(--accent); color: var(--accent); }
.thumb { display: block; aspect-ratio: 16 / 10; overflow: hidden; transition: border-color .15s; }
.thumb:hover { border-color: var(--accent); }
.thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top left; display: block; }
/* Home featured: text left, image right, same image size as Projects */
.feat { grid-template-columns: minmax(0, 1fr); gap: 1.1rem; }
.feat .feat-body > * + * { margin-top: 0.5rem; }
.feat .links { margin-top: 1rem; }
.more a.btn {
  display: inline-block; padding: 0.5rem 0.7rem; border: 1px solid var(--ink-2);
  border-radius: 4px; text-decoration: none; color: var(--ink);
}
.more a.btn:hover { border-color: var(--accent); color: var(--accent); }
@media (min-width: 60rem) {
  .feat { grid-template-columns: minmax(0, 1fr) 22rem; column-gap: 2rem; align-items: start; }
  .feat .thumb { margin-top: 0.4rem; }
}
.thumb { max-width: none; }
/* About: one block per role, prose */
.role { padding: 0.3rem 0 1.5rem; }
.role + .role { border-top: 1px solid var(--rule); padding-top: 1.5rem; }
.role h3 { font-size: 1.4rem; font-weight: 400; margin: 0; }
.role .role-meta { color: var(--ink-2); margin: 0.35rem 0 0.75rem; line-height: 1.5; }
.role p:last-child { margin: 0; }

/* About: childhood photo */
.about-intro { padding-top: 2.25rem; }
.about-intro .about-text { max-width: var(--measure); }
.about-intro p { margin: 0 0 1rem; }
.kid-photo { margin: 0.5rem 0 0; max-width: 25rem; }
@media (min-width: 60rem) {
  .about-intro { display: grid; grid-template-columns: minmax(0, var(--measure)) 22rem; gap: 3rem; align-items: start; }
  .kid-photo { margin-top: 0.35rem; }
}
.kid-photo img { display: block; width: 100%; height: auto; border: 1px solid var(--plate-frame); }
