/*
  Design tokens. Change a color or font here and it updates everywhere.
  Look: an engineer's report. Warm paper, near-black ink, one rescue-orange accent,
  a serif for reading, a sans for headings, a mono for labels and numbers.
*/
:root {
  --paper: #f6f8fa;
  --panel: #e9eef2;
  --ink: #10161c;
  --muted: #56626d;
  --rule: #d3dbe2;
  --accent: #0a6fc2;
  --accent-ink: #ffffff;

  --font-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-ui: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;

  --wrap: 940px;
  --measure: 68ch;
  --gap: clamp(1.1rem, 4vw, 1.8rem);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0d1217;
    --panel: #151c23;
    --ink: #e7edf2;
    --muted: #96a3af;
    --rule: #27313a;
    --accent: #4aa8ff;
    --accent-ink: #0d1217;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img, video { display: block; max-width: 100%; height: auto; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 0.2em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

h1, h2, h3 { font-family: var(--font-ui); font-weight: 600; letter-spacing: -0.015em; line-height: 1.2; margin: 0; }
p { margin: 0 0 1rem; }

.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gap); }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--ink); color: var(--paper); padding: 0.5rem 0.75rem; z-index: 10; }

/* Labels and small mono text */
.label, .eyebrow, .row-meta, .project-meta, .ch-when, figcaption, .btn, .site-header nav a, .tools-line, .back, .link-arrow, .next-label {
  font-family: var(--font-mono);
}
.eyebrow { text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.75rem; color: var(--accent); margin-bottom: 0.6rem; }

/* Header */
.site-header { border-bottom: 1px solid var(--rule); }
.header-inner { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding-block: 1rem; flex-wrap: wrap; }
.site-name { font-family: var(--font-ui); font-weight: 600; text-decoration: none; font-size: 1.05rem; }
.site-name:hover { color: var(--accent); }
.site-header nav { display: flex; gap: 1.4rem; flex-wrap: wrap; }
.site-header nav a { text-decoration: none; font-size: 0.85rem; }
.site-header nav a:hover { color: var(--accent); }
.site-header nav a[aria-current="page"] { color: var(--accent); text-decoration: underline; text-underline-offset: 0.35em; }

/* Buttons and small bits */
.btn { display: inline-block; padding: 0.3rem 0.7rem; border: 1px solid var(--ink); color: var(--ink); text-decoration: none; font-size: 0.8rem; background: transparent; }
.btn:hover { background: var(--ink); color: var(--paper); }
.link-arrow { text-decoration: none; font-family: var(--font-mono); font-size: 0.85rem; }
.link-arrow::after { content: " \2192"; color: var(--accent); }

/* Home intro */
.intro { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: clamp(1.5rem, 5vw, 3rem); align-items: start; padding-block: clamp(2rem, 6vw, 3.5rem) 1.5rem; }
.intro h1 { font-size: clamp(2.1rem, 5vw, 2.8rem); margin-bottom: 0.4rem; }
.tagline { font-family: var(--font-ui); color: var(--muted); margin-bottom: 1.3rem; }
.status { font-weight: 600; }
.portrait { margin: 0; }
.portrait img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border: 1px solid var(--rule); }
.portrait figcaption { font-size: 0.74rem; color: var(--muted); margin-top: 0.5rem; line-height: 1.4; }

/* Sections */
.section { padding-block: clamp(1.6rem, 4vw, 2.4rem); }
.section-title { font-size: 1.35rem; margin-bottom: 1.1rem; padding-top: 0.9rem; border-top: 1px solid var(--rule); }
.section-title.sub { margin-top: 1.8rem; font-size: 1.1rem; border-top: 1px solid var(--rule); }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; border-top: 1px solid var(--rule); padding-top: 0.9rem; margin-bottom: 1.1rem; }
.section-head .section-title { border-top: 0; padding-top: 0; margin-bottom: 0; }
.page-head { padding-block: clamp(1.8rem, 5vw, 3rem) 1rem; }
.page-head h1 { font-size: clamp(2rem, 5vw, 2.6rem); margin-bottom: 0.5rem; }
.page-lede { color: var(--muted); max-width: 58ch; }

/* What I'm working on */
.now { display: grid; grid-template-columns: 1.1fr 1fr; gap: clamp(1.2rem, 4vw, 2.2rem); align-items: center; }
.now video { width: 100%; border: 1px solid var(--rule); background: #000; }
.now h3 { font-size: 1.35rem; margin-bottom: 0.6rem; }

/* Project and entry rows */
.rows { margin: 0; }
.row { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 1.3rem; padding: 1.15rem 0; border-top: 1px solid var(--rule); color: inherit; text-decoration: none; align-items: start; }
.rows > :last-child { border-bottom: 1px solid var(--rule); }
.row-thumb { width: 150px; aspect-ratio: 4 / 3; object-fit: cover; border: 1px solid var(--rule); background: var(--panel); }
.row-thumb.ph { display: grid; place-items: center; font-family: var(--font-mono); font-size: 1.4rem; color: var(--accent); background: repeating-linear-gradient(135deg, transparent 0 6px, var(--rule) 6px 7px), var(--panel); }
.row h3 { font-size: 1.15rem; margin-bottom: 0.25rem; }
a.row:hover h3 { color: var(--accent); }
.row p { margin: 0 0 0.45rem; font-size: 1rem; }
.row-meta { font-size: 0.75rem; color: var(--muted); margin: 0 !important; }
.row.no-thumb { grid-template-columns: minmax(0, 1fr); }
.row .links { margin: 0.5rem 0 0; display: flex; gap: 0.5rem; flex-wrap: wrap; }
.row details { margin-top: 0.7rem; }
.row summary { cursor: pointer; font-family: var(--font-mono); font-size: 0.8rem; color: var(--accent); }
.row .pdf-embed { margin: 0.8rem 0 0; }
.sub-note { color: var(--muted); max-width: 60ch; }

/* Publications */
.pubs { list-style: none; padding: 0; margin: 0; }
.pub { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 1.2rem; padding: 1.1rem 0; border-top: 1px solid var(--rule); align-items: start; }
.pubs > :last-child { border-bottom: 1px solid var(--rule); }
.pub-thumb { width: 110px; aspect-ratio: 4 / 3; object-fit: cover; border: 1px solid var(--rule); }
.pub-thumb.ph { background: repeating-linear-gradient(135deg, transparent 0 6px, var(--rule) 6px 7px), var(--panel); }
.pub-title { font-family: var(--font-ui); font-weight: 600; margin-bottom: 0.2rem; line-height: 1.35; }
.pub-authors { color: var(--muted); font-size: 0.95rem; margin: 0 0 0.2rem; }
.pub-meta { font-style: italic; margin: 0 0 0.5rem; font-size: 0.95rem; }
.pub-links { margin: 0; display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* Toolbox and outside the lab */
.toolbox { margin: 0; }
.toolbox > div { display: grid; grid-template-columns: 12rem minmax(0, 1fr); gap: 1rem; padding: 0.8rem 0; border-top: 1px solid var(--rule); }
.toolbox > :last-child { border-bottom: 1px solid var(--rule); }
.toolbox dt { font-family: var(--font-mono); font-size: 0.8rem; color: var(--muted); padding-top: 0.2rem; }
.toolbox dd { margin: 0; }
.tool-use { color: var(--muted); font-style: italic; margin: 0 0 0.3rem !important; font-size: 0.97rem; }
.chips { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0 0.2rem; font-family: var(--font-ui); font-size: 0.93rem; }
.chips li + li::before { content: "·"; margin: 0 0.5rem; color: var(--accent); }
.lede { max-width: 62ch; }

/* Dated lists (experience, education) */
.chapters { list-style: none; padding: 0; margin: 0 0 1rem; }
.chapters li { display: grid; grid-template-columns: 10.5rem minmax(0, 1fr); gap: 1.2rem; padding: 0.95rem 0; border-top: 1px solid var(--rule); align-items: baseline; }
.chapters li:last-child { border-bottom: 1px solid var(--rule); }
.ch-when { font-size: 0.78rem; color: var(--muted); margin: 0; }
.chapters h3 { font-size: 1.05rem; margin-bottom: 0.15rem; }
.chapters p { margin: 0; max-width: 62ch; }

/* Footer */
.site-footer { margin-top: 3rem; border-top: 1px solid var(--ink); }
.footer-inner { padding-block: 1.6rem 2.4rem; }
.footer-lede { font-family: var(--font-ui); font-weight: 600; margin-bottom: 0.8rem; max-width: 56ch; }
.contact-links { list-style: none; padding: 0; margin: 0; display: flex; gap: 0.4rem 1.6rem; flex-wrap: wrap; font-family: var(--font-mono); font-size: 0.85rem; }

/* Project pages */
.project { padding-block: 1.6rem 3rem; }
.back { display: inline-block; margin-bottom: 1.4rem; font-family: var(--font-mono); font-size: 0.8rem; text-decoration: none; }
.back::before { content: "\2190  "; color: var(--accent); }
.project-title { font-size: clamp(1.9rem, 4.6vw, 2.6rem); margin-bottom: 0.7rem; }
.project-summary { font-size: 1.2rem; max-width: 60ch; color: var(--muted); }
.project-meta { color: var(--muted); font-size: 0.8rem; margin: 0 0 1.6rem; }
.project-hero { margin: 0 0 1.8rem; }
.project-hero img, .project-hero video { width: 100%; border: 1px solid var(--rule); }
.project-hero figcaption, .prose figcaption { font-size: 0.76rem; color: var(--muted); margin-top: 0.45rem; line-height: 1.45; }

.tools-line { font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted); margin-bottom: 0.9rem; }
.project-links { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 0; }

.prose { counter-reset: fig; }
.prose > p, .prose > ul, .prose > ol, .prose > h2, .prose > h3, .prose > .callout, .prose > table { max-width: var(--measure); }
.prose h2 { font-size: 1.5rem; margin: 2.6rem 0 0.8rem; padding-top: 0.8rem; border-top: 1px solid var(--rule); }
.prose h3 { font-size: 1.1rem; margin: 1.5rem 0 0.4rem; }
.prose figure { margin: 2rem 0; }
.prose img, .prose video { width: 100%; border: 1px solid var(--rule); }
.prose figure:not(.pdf-embed) figcaption::before { counter-increment: fig; content: "Fig. " counter(fig) "   "; color: var(--accent); }
.prose ul, .prose ol { padding-left: 1.2rem; }
.prose li { margin-bottom: 0.4rem; }
.prose table { width: 100%; border-collapse: collapse; margin: 1.4rem 0; font-family: var(--font-ui); font-size: 0.92rem; }
.prose th, .prose td { text-align: left; padding: 0.45rem 0.6rem 0.45rem 0; border-bottom: 1px solid var(--rule); }
.prose th { font-family: var(--font-mono); font-weight: 400; font-size: 0.75rem; color: var(--muted); border-bottom: 1px solid var(--ink); }
.prose .callout { border-left: 3px solid var(--accent); padding: 0.1rem 0 0.1rem 1rem; margin: 1.5rem 0; }
.prose .callout strong { color: var(--accent); }

.figure-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; margin: 2rem 0; }
.figure-row figure { margin: 0 !important; }
.mode-card { border-top: 2px solid var(--ink); padding-top: 0.6rem; }
.mode-card h3 { font-family: var(--font-mono); font-weight: 500; font-size: 0.78rem !important; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); margin: 0 0 0.4rem !important; }
.mode-card p { margin: 0; }

.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.4rem 2rem; align-items: center; margin: 2.2rem 0; }
.split.flip > :first-child { order: 2; }
.split > div > :first-child { margin-top: 0; }
.split > div > :last-child { margin-bottom: 0; }
.split figure { margin: 0 !important; }
.split.wide { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); }
.split.tall-media { align-items: start; }
.split .stack { display: grid; gap: 1.1rem; }
.pdf-embed { margin: 2rem 0; }
.pdf-embed iframe { width: 100%; height: min(80vh, 880px); border: 1px solid var(--rule); background: var(--panel); }
.pdf-embed figcaption { margin-top: 0.45rem; }

.next-project { margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--ink); }
.next-label { display: block; font-family: var(--font-mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.next-project a { font-family: var(--font-ui); font-weight: 600; font-size: 1.25rem; text-decoration: none; }
.next-project a:hover { color: var(--accent); }

@media (max-width: 760px) {
  .intro, .now, .split, .split.wide, .figure-row { grid-template-columns: 1fr; }
  .portrait { order: -1; max-width: 220px; }
  .split.flip > :first-child { order: 0; }
  .row { grid-template-columns: 96px minmax(0, 1fr); gap: 0.9rem; }
  .row-thumb { width: 96px; }
  .pub { grid-template-columns: 80px minmax(0, 1fr); }
  .pub-thumb { width: 80px; }
  .toolbox > div, .chapters li { grid-template-columns: 1fr; gap: 0.2rem; }
}

.row h3 a { text-decoration: none; }
.row h3 a::after { content: " \2192"; color: var(--accent); font-family: var(--font-mono); font-size: 0.85em; }

/* Header logo mark (the WLH circle, tinted to the text color) */
.logo { display: inline-block; width: 1.7rem; height: 1.7rem; vertical-align: -0.5rem; margin-right: 0.55rem; background-color: var(--ink); -webkit-mask: url("../img/logo-mask.png") center / contain no-repeat; mask: url("../img/logo-mask.png") center / contain no-repeat; }
.site-name { display: inline-flex; align-items: center; }
.site-name .logo { vertical-align: 0; }
.site-header nav a[aria-current="page"] { text-decoration: underline; text-underline-offset: 0.35em; }

/* Project plates: image over text, no card chrome */
.plates { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2.2rem 1.8rem; }
.plates.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.plate { display: block; color: inherit; text-decoration: none; }
.plate:hover { text-decoration: none; }
.plate-img { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border: 1px solid var(--rule); background: var(--panel); }
.plate-img.ph { display: grid; place-items: center; font-family: var(--font-mono); font-size: 1.6rem; color: var(--accent); background: repeating-linear-gradient(135deg, transparent 0 6px, var(--rule) 6px 7px), var(--panel); }
.plate h3 { font-size: 1.1rem; margin: 0.75rem 0 0.25rem; }
.plate:hover h3 { color: var(--accent); }
.plate p { margin: 0 0 0.35rem; font-size: 0.95rem; }
.plate .row-meta { margin: 0; }
@media (max-width: 760px) { .plates, .plates.three { grid-template-columns: 1fr; } }

/* Project header: one headline result, then role and tools */
.result { font-size: 1.25rem; line-height: 1.45; max-width: 52ch; margin: 0 0 1.4rem; padding-left: 1rem; border-left: 3px solid var(--accent); }
.spec { display: block; border: 0; padding: 0; margin-bottom: 2rem; }
.spec-role { margin-bottom: 0.4rem; }
.background p { max-width: 64ch; }

.statement { font-size: 1.3rem; line-height: 1.4; font-weight: 500; margin-bottom: 0.8rem; }

.site-name, .site-header nav a, .back, .next-project a { color: var(--ink); }
.site-header nav a:hover, .site-name:hover, .back:hover, .next-project a:hover { color: var(--accent); text-decoration: none; }
.site-header nav a[aria-current="page"] { color: var(--accent); }
.link-arrow { color: var(--accent); }

/* Project cards: small, three across, grouped (like a thumbnail grid) */
.jump { font-family: var(--font-mono); font-size: 0.82rem; color: var(--muted); }
.jump a { margin-left: 0.8rem; }
.group { padding-block: 1.2rem 0.4rem; }
.group-title { font-size: 1.15rem; margin-bottom: 1rem; padding-top: 0.8rem; border-top: 1px solid var(--rule); font-family: var(--font-mono); font-weight: 500; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.2rem; }
.card { position: relative; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--rule); transition: border-color 0.12s ease; }
.card:hover { border-color: var(--accent); }
.card-link { position: absolute; inset: 0; z-index: 1; }
.card-media { aspect-ratio: 16 / 9; overflow: hidden; border-bottom: 1px solid var(--rule); background: var(--paper); }
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.card-ph { height: 100%; display: grid; place-items: center; font-family: var(--font-mono); font-size: 1.2rem; color: var(--accent); background: repeating-linear-gradient(135deg, transparent 0 6px, var(--rule) 6px 7px); }
.card-body { padding: 0.8rem 0.9rem 0.9rem; display: flex; flex-direction: column; flex: 1; }
.card h3 { font-size: 1rem; line-height: 1.3; margin: 0 0 0.35rem; }
.card:hover h3 { color: var(--accent); }
.card-sum { font-size: 0.9rem; line-height: 1.45; color: var(--ink); margin: 0 0 0.5rem; }
.card-meta { font-family: var(--font-mono); font-size: 0.68rem; color: var(--muted); margin: auto 0 0; line-height: 1.4; }
.card-links { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.6rem 0 0; position: relative; z-index: 2; }
.card-links .btn { font-size: 0.68rem; padding: 0.1rem 0.45rem; }
@media (max-width: 860px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .cards { grid-template-columns: 1fr; } }
