:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --text: #1c1b19;
  --muted: #6b6862;
  --faint: #9a968e;
  --line: #e7e3db;
  --accent: #8a3b12;
  --accent-soft: #f4ebe4;
  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --max: 820px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141412;
    --surface: #1c1c19;
    --text: #ebe8e1;
    --muted: #a7a399;
    --faint: #75716a;
    --line: #2d2c28;
    --accent: #e39a6c;
    --accent-soft: #2a211b;
  }
  .email img { filter: invert(1) hue-rotate(180deg) brightness(1.1); mix-blend-mode: screen; }
}

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

html { scroll-behavior: smooth; scroll-padding-top: 5rem; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
}

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

a { color: inherit; text-decoration-color: var(--line); text-underline-offset: 3px; transition: color .15s, text-decoration-color .15s; }
a:hover { color: var(--accent); text-decoration-color: currentColor; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 1.5rem; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; height: 3.75rem; }
.brand { font-family: var(--serif); font-size: 1.15rem; font-weight: 500; text-decoration: none; letter-spacing: -.01em; }
.nav { display: flex; gap: 1.4rem; font-size: .875rem; }
.nav a { text-decoration: none; color: var(--muted); }
.nav a:hover { color: var(--accent); }

/* Hero */
.hero { display: grid; grid-template-columns: 1fr 230px; gap: 3rem; align-items: center; padding: 4.5rem 0 3.5rem; }
.hero h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.4rem, 6vw, 3.4rem);
  line-height: 1.05;
  letter-spacing: -.02em;
  margin: 0 0 1rem;
}
.tagline { font-size: 1.1rem; color: var(--muted); margin: 0 0 1.75rem; max-width: 34rem; }
.portrait { border-radius: 4px; aspect-ratio: 4 / 5; object-fit: cover; width: 100%; height: auto; filter: grayscale(1) contrast(1.05); }

.links { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem; margin-left: -.55rem; }
.icon-link { display: inline-grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: 50%; color: var(--muted); }
.icon-link:hover { background: var(--accent-soft); color: var(--accent); }
.icon-link svg { width: 1.1rem; height: 1.1rem; fill: currentColor; }

/* Sections */
section { padding: 3rem 0; border-top: 1px solid var(--line); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 2rem; }
h2 { font-family: var(--serif); font-weight: 400; font-size: 1.9rem; letter-spacing: -.01em; margin: 0; }
.count { font-size: .8rem; color: var(--faint); }
h3 { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--faint); margin: 2.25rem 0 1rem; }
h3:first-of-type { margin-top: 0; }

/* Education */
.edu { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
.edu article { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.edu img { width: 100%; aspect-ratio: 16 / 7; object-fit: cover; filter: grayscale(1); }
.edu .body { padding: 1.1rem 1.25rem 1.25rem; }
.edu h4 { font-family: var(--serif); font-size: 1.2rem; font-weight: 500; margin: 0 0 .2rem; }
.edu p { margin: 0; color: var(--muted); font-size: .9rem; }
.edu .degree { color: var(--text); font-size: 1rem; margin-bottom: .5rem; }

/* Timeline-ish rows (experience) */
.rows { list-style: none; margin: 0; padding: 0; }
.rows li { display: grid; grid-template-columns: 1fr auto; gap: .25rem 1.5rem; padding: .85rem 0; border-bottom: 1px dashed var(--line); }
.rows li:last-child { border-bottom: 0; }
.rows .org { font-weight: 500; }
.rows .code { font-weight: 400; font-size: .8em; color: var(--faint); margin-left: .2rem; }
.rows .role { color: var(--muted); font-size: .9rem; grid-column: 1; }
.rows .when { text-align: right; font-size: .85rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.rows .where { text-align: right; font-size: .8rem; color: var(--faint); grid-column: 2; }

/* Publications */
.year-group { display: grid; grid-template-columns: 4.5rem 1fr; gap: 1rem; padding: 1.25rem 0; border-bottom: 1px solid var(--line); }
.year-group:last-of-type { border-bottom: 0; }
.year { font-family: var(--serif); font-size: 1.3rem; color: var(--faint); line-height: 1.3; }
.pubs { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.1rem; }
.pub-title { font-weight: 500; line-height: 1.4; }
.pub-title a { text-decoration: none; }
.pub-title a:hover { text-decoration: underline; }
.pub-meta { font-size: .875rem; color: var(--muted); margin-top: .15rem; }
.pub-meta .me { color: var(--text); font-weight: 500; }
.venue { display: inline-block; font-size: .72rem; font-weight: 600; letter-spacing: .03em; color: var(--accent); background: var(--accent-soft); padding: .05rem .5rem; border-radius: 3px; margin-right: .4rem; vertical-align: 1px; }
.extra { font-size: .8rem; margin-left: .35rem; color: var(--accent); }

.patent { margin-top: 2.5rem; padding: 1.25rem 1.5rem; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
.patent h3 { margin: 0 0 .5rem; }

/* Honors */
.honors { list-style: none; margin: 0; padding: 0; }
.honors li { position: relative; padding: .6rem 0 .6rem 1.5rem; border-bottom: 1px dashed var(--line); }
.honors li:last-child { border-bottom: 0; }
.honors li::before { content: ""; position: absolute; left: .2rem; top: 1.25rem; width: .4rem; height: .4rem; border-radius: 50%; background: var(--faint); }
.honors li.featured::before { background: var(--accent); }
.honors li.featured { font-weight: 500; }

/* Contact */
.email img { max-width: 320px; width: 100%; mix-blend-mode: multiply; }

footer { border-top: 1px solid var(--line); padding: 2rem 0 3rem; font-size: .8rem; color: var(--faint); }
footer .wrap { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }

/* Responsive */
@media (max-width: 720px) {
  .brand { flex-shrink: 0; }
  .nav { min-width: 0; overflow-x: auto; gap: 1rem; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .hero { grid-template-columns: 1fr; gap: 2rem; padding-top: 3rem; }
  .portrait { max-width: 200px; order: -1; }
  .edu { grid-template-columns: 1fr; }
  .year-group { grid-template-columns: 1fr; gap: .5rem; }
  .rows li { grid-template-columns: 1fr; }
  .rows .when, .rows .where { text-align: left; grid-column: 1; }
}
