/* Self-hosted, so no visitor's IP and referrer reach a third party on every
   page load, and there is no second origin to resolve. Both are variable latin
   subsets: one file covers every weight used here. SIL OFL 1.1 — see
   assets/fonts/LICENSE.md. */
@font-face {
  font-family: "JetBrains Mono";
  src: url("/assets/fonts/jetbrains-mono-latin.woff2") format("woff2");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("/assets/fonts/source-serif-4-latin.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("/assets/fonts/source-serif-4-latin-italic.woff2") format("woff2");
  font-weight: 200 900;
  font-style: italic;
  font-display: swap;
}

:root {
  --paper:  #eef1f2;
  --card:   #ffffff;
  --ink:    #10161c;
  --muted:  #5d6b73;
  --rule:   #d3dadd;
  --accent: #12676f;
  --deep:   #2b2a55;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Source Serif 4", Georgia, "Times New Roman", serif;
  font-size: 17px;
  line-height: 1.62;
}
/* Prose fills the column, the same width as the figures; the larger size on
   desktop keeps a full line near 85 characters. */
@media (min-width: 1024px) { body { font-size: 18px; } }
.sheet {
  max-width: 66rem;
  margin: 0 auto;
  background: var(--card);
  padding: 3.5rem clamp(1.25rem, 4vw, 3.5rem) 4rem;
  min-height: 100vh;
}
.mono, .meta, .contact, .btn, .site-nav, footer, .tag, .eyebrow {
  font-family: Helvetica, "Helvetica Neue", Arial, sans-serif;
}

/* ---- staging banner ---- */
.staging {
  margin: 0;
  padding: 0.6rem clamp(1.25rem, 4vw, 3.5rem);
  background: var(--deep);
  color: #fff;
  font-family: Helvetica, "Helvetica Neue", Arial, sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  text-align: center;
}
.staging a { color: #fff; }

/* ---- skip link ---- */
.skip {
  position: absolute; left: -9999px;
  background: var(--ink); color: #fff; padding: 0.6rem 1rem; z-index: 10;
}
.skip:focus { left: 0.5rem; top: 0.5rem; }

/* ---- site nav ---- */
.site-nav {
  max-width: 66rem;
  margin: 0 auto;
  background: var(--card);
  border-bottom: 1px solid var(--rule);
  padding: 0 clamp(1.25rem, 4vw, 3.5rem);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 1.5rem;
  font-size: 0.78rem;
}
.site-nav .home {
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-right: auto;
  padding: 1rem 0;
}
.site-nav a { color: var(--ink); text-decoration: none; padding: 1rem 0; display: inline-block; }
.site-nav a:hover { color: var(--accent); }
.site-nav a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--accent); }

/* ---- hero ---- */
.name {
  font-family: Helvetica, "Helvetica Neue", Arial, sans-serif;
  font-weight: 600;
  font-size: clamp(2.1rem, 6vw, 3.1rem);
  letter-spacing: 0.06em;
  line-height: 1.05;
  margin: 0 0 1rem;
}
.eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.75rem;
}
.hero .tagline {
  font-size: clamp(1.05rem, 2.4vw, 1.3rem);
  color: var(--muted);
  margin: 0 0 1.5rem;
  max-width: 42ch;
}
.intro p { margin: 0 0 1rem; }

.contact {
  font-size: 0.8rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.4rem;
  padding-bottom: 1.75rem;
  border-bottom: 2px solid var(--ink);
}
.contact .k { color: var(--muted); }
.contact a { color: var(--accent); text-decoration: none; border-bottom: 1px solid var(--rule); }
.contact a:hover { border-bottom-color: var(--accent); }

.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 1.75rem 0 0; }
.btn {
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-decoration: none;
  padding: 0.6rem 1.1rem;
  border: 1px solid var(--ink);
  color: var(--ink);
  background: transparent;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.btn.primary { background: var(--ink); color: var(--card); }
.btn { display: inline-flex; align-items: center; gap: 0.5em; }
.btn svg { width: 1.05em; height: 1.05em; fill: currentColor; flex: none; }
.btn:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---- sections: label rail on the left, content on the right ---- */
.section { display: grid; grid-template-columns: 9rem 1fr; gap: 0 2rem; margin-top: 3rem; }
.section > h2 {
  font-family: Helvetica, "Helvetica Neue", Arial, sans-serif;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  color: var(--muted);
  text-transform: uppercase;
  margin: 0.35rem 0 0;
  position: sticky;
  top: 1.5rem;
  align-self: start;
}
.section > .body { min-width: 0; }
.section > .body > :first-child { margin-top: 0; }

/* The sheet is wide so figures and tables get room on desktop; resume entries
   keep the measure they were set at, since their dates sit flush right. */
.entry, table.skills { max-width: 42rem; }
.entry { padding-bottom: 1.9rem; }
.entry + .entry { padding-top: 1.9rem; border-top: 1px solid var(--rule); }
.entry-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 1rem;
  align-items: baseline;
  justify-content: space-between;
}
.entry h3 { font-family: Helvetica, "Helvetica Neue", Arial, sans-serif; font-size: 1.06rem; font-weight: 600; margin: 0; }
.meta { font-size: 0.76rem; color: var(--muted); white-space: nowrap; }
.subtitle { color: var(--muted); font-size: 0.94rem; margin: 0.15rem 0 0; }
.subtitle a { color: var(--accent); }

/* Signature: bullets sit against a stack of slices — the volume/depth motif
   from the MRI and multi-view-stereo work. One accessory, nothing else loud. */
ul.bullets {
  list-style: none;
  margin: 0.9rem 0 0;
  padding: 0 0 0 1.4rem;
  background-image: repeating-linear-gradient(
    to bottom, var(--accent) 0 3px, transparent 3px 8px
  );
  background-size: 2px 100%;
  background-repeat: no-repeat;
}
ul.bullets li { margin-bottom: 0.55rem; }
ul.bullets li:last-child { margin-bottom: 0; }

table.skills { border-collapse: collapse; width: 100%; }
table.skills th {
  text-align: left;
  vertical-align: top;
  font-weight: 600;
  font-size: 0.94rem;
  padding: 0.45rem 1.25rem 0.45rem 0;
  white-space: nowrap;
}
table.skills td { vertical-align: top; padding: 0.45rem 0; font-size: 0.94rem; }
table.skills tr + tr th, table.skills tr + tr td { border-top: 1px solid var(--rule); }

/* ---- project cards ---- */
.cards { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr)); }
.card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--rule);
  background: var(--card);
  transition: border-color 0.15s, transform 0.15s;
  min-width: 0;
}
.card:hover { border-color: var(--accent); }
.card .thumb {
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
  aspect-ratio: 16 / 10;
  display: block;
  overflow: hidden;
}
/* contain, not cover: figures, wide architecture diagrams and square GIFs all
   land in the same grid, and cropping them would cut the substance out. */
.card .thumb img,
.card .thumb video { width: 100%; height: 100%; object-fit: contain; display: block; }
.card .thumb.count {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  text-decoration: none;
}
.card .thumb.count span {
  font-family: Helvetica, "Helvetica Neue", Arial, sans-serif;
  font-size: 2.5rem;
  line-height: 1;
  letter-spacing: 0.1em;
  /* the glyph sits on the baseline, so nudge it back onto the optical centre */
  transform: translateY(-0.28em);
  color: var(--muted);
  transition: color 0.15s;
}
.card.more:hover .thumb.count span { color: var(--accent); }
.card .card-body { padding: 1.25rem 1.35rem 1.4rem; display: flex; flex-direction: column; flex: 1; }
.card h3 { font-family: Helvetica, "Helvetica Neue", Arial, sans-serif; margin: 0 0 0.35rem; font-size: 1.02rem; font-weight: 600; line-height: 1.35; }
.card h3 a { color: var(--ink); text-decoration: none; }
.card h3 a:hover { color: var(--accent); }
/* Whole card clickable, without nesting the other links inside the anchor. */
.card h3 a::after { content: ""; position: absolute; inset: 0; }
.card { position: relative; }
.card p { margin: 0 0 1rem; font-size: 0.92rem; color: var(--muted); }
.card .card-meta { font-size: 0.72rem; color: var(--muted); margin: 0 0 0.6rem; }
.card .tags { margin-top: auto; }

.tags { display: flex; flex-wrap: wrap; gap: 0.35rem; list-style: none; padding: 0; margin: 1rem 0 0; }
.tag {
  font-size: 0.68rem;
  letter-spacing: 0.03em;
  color: var(--muted);
  border: 1px solid var(--rule);
  padding: 0.15rem 0.5rem;
  white-space: nowrap;
}

/* ---- project page ---- */
.page-head { border-bottom: 2px solid var(--ink); padding-bottom: 1.75rem; }
.page-head h1 {
  font-family: Helvetica, "Helvetica Neue", Arial, sans-serif;
  font-size: clamp(1.7rem, 4.5vw, 2.5rem);
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 0.5rem;
}
.page-head .context { color: var(--muted); margin: 0; font-size: 0.95rem; }
.prose p { margin: 0 0 1rem; }
.prose > :last-child { margin-bottom: 0; }
.prose a { color: var(--accent); }
.prose code {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.86em;
  background: var(--paper);
  padding: 0.08em 0.35em;
  border-radius: 2px;
  overflow-wrap: break-word;
}
.prose ul { padding-left: 1.1rem; margin: 0 0 1rem; }
.prose ul li { margin-bottom: 0.6rem; }

figure { margin: 1.75rem 0; }
figure img { max-width: 100%; max-height: 80vh; width: auto; height: auto; display: block; background: var(--paper); }
figure.pair img { width: 100%; object-fit: contain; }
figure video { max-width: 100%; max-height: 80vh; width: auto; height: auto; display: block; background: var(--paper); }
figure.demo { margin: 1.75rem 0; }
@media (min-width: 721px) {
  /* Reach back under the section label, so the demo is wider than the measure
     the prose is set to. Clicking landmarks accurately wants the room. */
  figure.demo { margin-left: -11rem; }
}
figure.demo iframe {
  width: 100%;
  border: 1px solid var(--rule);
  background: var(--card);
  display: block;
}
a.zoom { display: block; }
a.zoom:hover img { outline: 1px solid var(--accent); outline-offset: 2px; }
figure.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
figure.pair figcaption { grid-column: 1 / -1; }
figcaption {
  font-family: Helvetica, "Helvetica Neue", Arial, sans-serif;
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.6rem;
}

/* Wide tables scroll inside their own box; the page never scrolls sideways. */
.table-wrap { overflow-x: auto; margin: 1.25rem 0; }
table.data { border-collapse: collapse; width: 100%; font-size: 0.88rem; }
table.data th, table.data td { text-align: left; padding: 0.5rem 1rem 0.5rem 0; white-space: nowrap; }
table.data thead th {
  font-family: Helvetica, "Helvetica Neue", Arial, sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 500;
  border-bottom: 1px solid var(--ink);
}
table.data tbody tr + tr td { border-top: 1px solid var(--rule); }
table.data tr.mine td { font-weight: 600; color: var(--accent); }

pre {
  background: var(--paper);
  border-left: 2px solid var(--accent);
  padding: 1rem 1.15rem;
  overflow-x: auto;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82rem;
  line-height: 1.6;
  margin: 1.25rem 0;
}
pre code { background: none; padding: 0; font-size: inherit; }

.pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 3.5rem; }

footer {
  margin-top: 3.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  font-size: 0.72rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.25rem;
  justify-content: space-between;
}
footer a { color: var(--accent); }
footer nav { display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem; }

@media (max-width: 720px) {
  .sheet { padding-top: 2.5rem; }
  .section { grid-template-columns: 1fr; gap: 0.75rem; }
  .section > h2 { position: static; padding-bottom: 0.5rem; border-bottom: 1px solid var(--rule); }
  .meta { white-space: normal; }
  table.skills, table.skills tbody, table.skills tr, table.skills th, table.skills td { display: block; }
  table.skills th { padding-bottom: 0.1rem; }
  table.skills tr + tr th { border-top: 1px solid var(--rule); padding-top: 0.9rem; }
  table.skills tr + tr td { border-top: 0; }
  figure.pair { grid-template-columns: 1fr; }
  .site-nav .home { margin-right: 1rem; }
}
@media print {
  body { background: #fff; }
  .sheet { max-width: none; padding: 0; }
  .actions, .site-nav, .skip, .pager { display: none; }
  .section > h2 { position: static; }
}
a:focus-visible, .btn:focus-visible { outline: 2px solid var(--deep); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } html { scroll-behavior: auto; } }
