:root {
  --paper: #f2f1ed;
  --ink: #111111;
  --gray: #7a7a75;
  --rule: #111111;
  --hair: rgba(17, 17, 17, 0.18);
  --sans: "IBM Plex Sans", Helvetica, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
}

* { box-sizing: border-box; }
html { background: var(--paper); }
body {
  margin: 0;
  padding: 20px;
  background: var(--paper);
  color: var(--ink);
  font: 400 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
img { display: block; max-width: 100%; height: auto; }
h2, p, figure { margin: 0; }

/* The drawing frame */
.sheet {
  max-width: 1280px;
  margin: 0 auto;
  border: 1px solid var(--rule);
  outline: 1px solid var(--rule);
  outline-offset: 5px;
  /* Fill the window, so the title block sits at the bottom on short pages */
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 40px);
}
.sheet > * { width: 100%; }
.sheet > :nth-last-child(2) { margin-bottom: 64px; }

/* Header */
.top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--rule);
}
.name { font-weight: 600; letter-spacing: -0.01em; }
.top nav { display: flex; gap: 24px; font-family: var(--mono); font-size: 13px; }

/* Intro: a text panel and a photo panel, split by a rule */
.intro {
  display: grid;
  grid-template-columns: 1fr 300px;
  border-bottom: 1px solid var(--rule);
}
.intro-text {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 48px;
  padding: 28px 32px 32px 24px;
}
.intro-label {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 28px;
  font: 400 12px/1.4 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gray);
}
.intro-lede {
  font-size: clamp(24px, 3.5vw, 48px);
  line-height: 1.14;
  letter-spacing: -0.025em;
  text-wrap: pretty;
}
.intro img {
  width: 100%;
  height: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-left: 1px solid var(--rule);
}

/* Tables */
.block { padding: 56px 24px 8px; }
.block h2 {
  font: 500 12px/1 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 16px;
}
.list { width: 100%; border-collapse: collapse; }
.list th {
  text-align: left;
  font: 400 11px/1 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray);
  padding: 0 16px 10px 0;
  border-bottom: 1px solid var(--rule);
}
.list td {
  vertical-align: top;
  padding: 12px 16px 12px 0;
  border-bottom: 1px solid var(--hair);
}
.list td:first-child, .list td:nth-child(2) { font-family: var(--mono); font-size: 13px; white-space: nowrap; }
#experience td:first-child { width: 128px; }
#experience td:nth-child(2) { font-family: var(--sans); font-size: 15px; font-weight: 500; width: 260px; white-space: normal; }
#experience td:nth-child(3) { width: 260px; }
#experience td:last-child { color: #3a3a37; padding-right: 0; }

/* Project grid */
.work {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.work li { display: flex; flex-direction: column; border: 1px solid var(--rule); }
.work img, .work video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-bottom: 1px solid var(--rule);
  background: #ddd;
}
.work .meta { display: flex; align-items: baseline; gap: 12px; padding: 14px 16px 6px; }
.work .meta span { font: 400 12px/1 var(--mono); color: var(--gray); }
.work h3 { margin: 0; font-size: 15px; font-weight: 600; }
.work p { padding: 0 16px 16px; font-size: 14px; color: #3a3a37; }
.work .links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: auto;
  padding: 10px 16px 12px;
  border-top: 1px solid var(--hair);
}
.work .more { font: 400 12px/1.2 var(--mono); text-transform: uppercase; letter-spacing: 0.06em; }

/* Section heading with a link on the right ("All 12 projects →") */
.block-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-bottom: 16px; }
.block-head h2 { margin-bottom: 0; }
.block-head a { font: 400 12px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.06em; }

/* Notes list: date | title + one line */
.notes-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.notes-list li {
  display: grid;
  grid-template-columns: 128px 1fr;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--hair);
}
.notes-list time { font: 400 13px/1.5 var(--mono); color: var(--gray); }
.notes-list h3 { margin: 0 0 2px; font-size: 15px; font-weight: 600; }
.notes-list h3 a { text-decoration: underline; text-decoration-color: var(--hair); text-underline-offset: 3px; }
.notes-list h3 a:hover { text-decoration-color: currentColor; }
.notes-list p { font-size: 14px; color: #3a3a37; max-width: 80ch; }
.article .notes-list p { margin: 0; font-size: 14px; }

/* Header of the /projects/ and /notes/ index pages */
.page-head { padding: 56px 24px 0; }
.page-head h1 { margin: 0 0 10px; font-size: clamp(28px, 3.4vw, 40px); font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; }
.page-head p { max-width: 60ch; color: #3a3a37; }
.page-head p a { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.page-head + .block { padding-top: 32px; }

/* Project pages */
.article { max-width: 832px; margin: 0 auto; padding: 56px 24px 8px; }
.article h1 { margin: 0 0 8px; font-size: clamp(28px, 3.4vw, 40px); font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; }
.article .lede { margin: 16px 0 20px; font-size: 19px; line-height: 1.5; color: #2a2a28; }
.article .context { display: flex; flex-wrap: wrap; gap: 4px 20px; margin: 0 0 8px; font: 400 12px/1.5 var(--mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--gray); }
.article .context a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.spec { width: 100%; margin: 8px 0 20px; border-collapse: collapse; border-top: 1px solid var(--rule); font-size: 15px; }
.spec td { overflow-wrap: anywhere; }
.spec th, .spec td { padding: 9px 0; border-bottom: 1px solid var(--hair); text-align: left; vertical-align: top; }
.spec th { width: 150px; padding-right: 16px; font: 400 12px/1.6 var(--mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--gray); }
.article h2 {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin: 48px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule);
  font: 500 12px/1.3 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.article h2 time { flex-shrink: 0; white-space: nowrap; font-weight: 400; color: var(--gray); letter-spacing: 0.04em; }
.article p { margin: 0 0 14px; font-size: 16px; line-height: 1.6; }
.article code { font: 0.88em/1 var(--mono); }
.article p a { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.figrow { display: grid; gap: 16px; margin: 20px 0 24px; }
/* Two-up rows: columns in proportion to each picture's aspect ratio (--cols, set per row), so heights match without cropping */
.figrow.n2 { grid-template-columns: var(--cols, 1fr 1fr); align-items: start; }
.figrow img, .figrow video { display: block; width: 100%; height: auto; border: 1px solid var(--rule); background: #ddd; }
.figrow figcaption { margin-top: 6px; font: 400 12px/1.4 var(--mono); color: var(--gray); }
.figrow.even img, .figrow.even video { aspect-ratio: 4 / 3; object-fit: cover; }
.figrow.portrait img, .figrow.portrait video { aspect-ratio: 3 / 4; object-fit: cover; }
.figrow .tall { width: 100%; max-width: 420px; justify-self: center; }
/* Single pictures narrower than the column show at their own size, centred, instead of upscaled */
.figrow .native { width: 100%; max-width: var(--w); justify-self: center; }
.article .placeholder { padding: 12px 14px; border: 1px dashed var(--gray); font: 400 13px/1.5 var(--mono); color: var(--gray); }

/* Title block */
.titleblock {
  display: grid;
  grid-template-columns: 2fr 1fr 2fr 2fr 1fr 1fr;
  margin-top: auto;
  border-top: 1px solid var(--rule);
}
.tb-cell {
  padding: 10px 14px 14px;
  border-right: 1px solid var(--rule);
  font: 400 13px/1.4 var(--mono);
}
.tb-cell:last-child { border-right: 0; }
.tb-cell span {
  display: block;
  margin-bottom: 6px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gray);
}
.tb-wide { font-family: var(--sans); font-weight: 600; font-size: 15px; }

/* Narrow screens: tables become stacked rows */
@media (max-width: 900px) {
  .intro { grid-template-columns: 1fr 240px; }
  .intro-text { padding: 20px 20px 24px 16px; }
  .block { padding: 48px 16px 8px; }
  .top { padding: 14px 16px; }
  .list thead { display: none; }
  .list, .list tbody, .list tr, .list td { display: block; width: auto !important; }
  .list tr { position: relative; padding: 14px 0; border-bottom: 1px solid var(--hair); }
  .list td { border: 0; padding: 0; text-align: left !important; }
  #experience td:nth-child(2) { margin: 2px 0 4px; }
  .work { grid-template-columns: repeat(2, 1fr); gap: 16px; }
  .article { padding: 40px 16px 8px; }
  .page-head { padding: 40px 16px 0; }
  .titleblock { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .tb-cell { overflow-wrap: anywhere; }
  .tb-cell { border-bottom: 1px solid var(--rule); }
  .tb-cell:nth-child(2n) { border-right: 0; }
  .tb-cell:nth-last-child(-n+2) { border-bottom: 0; }
}
@media (max-width: 520px) {
  body { padding: 10px; }
  .sheet { outline-offset: 3px; min-height: calc(100vh - 20px); }
  .top { flex-direction: column; gap: 8px; }
  .top nav { gap: 12px; flex-wrap: wrap; font-size: 11px; }
  .intro { grid-template-columns: 1fr; }
  .intro-text { gap: 28px; padding: 20px 16px 24px; }
  .intro-lede { font-size: 23px; }
  .intro img { aspect-ratio: 4 / 5; height: auto; object-position: 50% 80%; border-left: 0; border-top: 1px solid var(--rule); }
  .work { grid-template-columns: 1fr; }
  .figrow.n2 { grid-template-columns: 1fr; }
  .notes-list li { grid-template-columns: 1fr; gap: 2px; }
  .spec th { width: 110px; }
}

/* Click-to-enlarge figures (zoom.js) */
.figrow img.zoomable { cursor: zoom-in; }
dialog.zoom { max-width: none; max-height: none; width: 100vw; height: 100vh; margin: 0; padding: 24px;
  border: 0; background: rgba(17, 17, 17, 0.92); cursor: zoom-out; }
dialog.zoom[open] { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; }
dialog.zoom::backdrop { background: transparent; }
dialog.zoom img, dialog.zoom video { display: block; width: 100%; height: calc(100vh - 96px); min-height: 0; object-fit: contain; background: none; border: 0; }
dialog.zoom [hidden] { display: none; }
dialog.zoom p { margin: 0; max-width: 900px; font: 400 12px/1.4 var(--mono); color: #d8d7d2; text-align: center; }

/* Videos sit in a frame that carries the border: a video paints on its own layer and can cover
   its own bottom border at fractional heights. */
.figrow .vframe { border: 1px solid var(--rule); background: #ddd; }
.figrow .vframe video { border: 0; }
.figrow video.zoomable { cursor: zoom-in; }
