:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --text: #1d232b;
  --muted: #5c6672;
  --line: #e4e1da;
  --accent: #1f3a5f;
  --accent-soft: #e8eef6;
  --ok: #2f7d4f;
  --serif: "Charter", "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --max: 820px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161b;
    --surface: #181d24;
    --text: #e5e8ec;
    --muted: #9aa4b0;
    --line: #2a313a;
    --accent: #8fb3e0;
    --accent-soft: #1e2a3a;
    --ok: #6cc28f;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
code { font-size: .9em; background: var(--accent-soft); padding: 1px 5px; border-radius: 4px; }

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

.skip { position: absolute; left: -999px; }
.skip:focus { left: 12px; top: 12px; z-index: 10; background: var(--surface); padding: 8px 12px; }

/* Top navigation */
.topbar {
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.nav { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 56px; }
.brand { font-family: var(--serif); font-weight: 700; color: var(--text); text-decoration: none; white-space: nowrap; }
.nav ul { display: flex; gap: 20px; list-style: none; margin: 0; padding: 0; }
.nav ul a { color: var(--muted); text-decoration: none; font-size: .92rem; }
.nav ul a:hover { color: var(--accent); }

/* Hero */
.hero { display: grid; grid-template-columns: 220px 1fr; gap: 36px; padding-top: 64px; padding-bottom: 24px; align-items: stretch; }
.portrait {
  position: relative; width: 100%; min-height: 280px; border-radius: 12px;
  background: var(--accent); color: #fff; display: grid; place-items: center;
  font: 700 2.6rem var(--serif); overflow: hidden;
}
.portrait img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
h1 { font: 700 2.4rem/1.15 var(--serif); margin: 0 0 6px; letter-spacing: -.01em; }
.role { color: var(--muted); margin: 0 0 12px; font-size: 1.05rem; }
.status {
  display: inline-flex; align-items: center; gap: 8px; margin: 0 0 18px;
  font-size: .88rem; font-weight: 600; color: var(--ok);
  background: color-mix(in srgb, var(--ok) 12%, transparent);
  padding: 4px 12px; border-radius: 999px;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.btn {
  display: inline-block; padding: 8px 16px; border-radius: 8px; font-size: .92rem; font-weight: 500;
  text-decoration: none; border: 1px solid var(--line); background: var(--surface); color: var(--text);
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.btn.primary:hover { opacity: .9; color: var(--bg); }

/* Sections */
.block { padding-top: 44px; padding-bottom: 8px; }
h2 {
  font: 700 1.45rem var(--serif); margin: 0 0 20px; padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
h3 { font-size: 1.02rem; margin: 0; line-height: 1.4; }
.lede, .muted { color: var(--muted); }
.lede { margin-top: -6px; }

.interests { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.interests article {
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: 8px; padding: 16px 18px;
}
.interests p { margin: 6px 0 0; color: var(--muted); font-size: .94rem; }

/* Publications */
.head-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.head-row h2 { border: 0; margin: 0; }
.metrics { display: flex; gap: 22px; margin: 0 0 10px; }
.metrics div { text-align: center; }
.metrics dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.metrics dd { margin: 0; font: 700 1.25rem var(--serif); color: var(--accent); }

.pubs { list-style: none; padding: 0; margin: 0; counter-reset: none; }
.pubs li { padding: 14px 0; border-bottom: 1px dashed var(--line); }
.pubs li:last-child { border-bottom: 0; }
.pubs p { margin: 2px 0; }
.pubs .title { font-family: var(--serif); font-weight: 700; font-size: 1.05rem; line-height: 1.4; }
.pubs .authors, .pubs .venue { font-size: .93rem; color: var(--muted); }
.pubs .authors strong { color: var(--text); }
.plinks a { font-size: .85rem; font-weight: 600; }
.tag {
  display: inline-block; font-size: .72rem; font-weight: 600; font-style: normal; color: var(--accent);
  background: var(--accent-soft); padding: 1px 8px; border-radius: 999px; margin-left: 4px; vertical-align: 1px;
}

/* Experience and education entries */
.entry { margin-bottom: 22px; }
.entry-head { display: flex; justify-content: space-between; gap: 16px; align-items: baseline; }
.when { color: var(--muted); font-size: .88rem; white-space: nowrap; }
.where { margin: 2px 0 6px; color: var(--muted); font-size: .93rem; }
.where strong { color: var(--text); }
.entry ul { margin: 6px 0 0; padding-left: 20px; }
.entry li { margin: 3px 0; font-size: .95rem; }

.skills { margin: 0; }
.skills div { display: grid; grid-template-columns: 150px 1fr; gap: 16px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.skills div:last-child { border-bottom: 0; }
.skills dt { font-weight: 600; }
.skills dd { margin: 0; color: var(--muted); }

.refs { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.refs li { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px; }
.refs span { display: block; color: var(--muted); font-size: .88rem; margin-top: 4px; }

.contact .mail { font: 700 1.2rem var(--serif); margin: 8px 0; word-break: break-word; }

.foot {
  display: flex; justify-content: space-between; gap: 12px; margin-top: 48px; padding-top: 20px; padding-bottom: 32px;
  border-top: 1px solid var(--line); color: var(--muted); font-size: .88rem;
}
.foot p { margin: 0; }

/* Phones and tablets */
@media (max-width: 720px) {
  .nav ul { display: none; }
  .hero { grid-template-columns: 1fr; gap: 20px; padding-top: 36px; }
  .portrait { width: 200px; height: 250px; min-height: 0; font-size: 2rem; }
  h1 { font-size: 1.95rem; }
  .interests, .refs { grid-template-columns: 1fr; }
  .head-row { flex-direction: column; align-items: flex-start; }
  .entry-head { flex-direction: column; gap: 0; }
  .skills div { grid-template-columns: 1fr; gap: 2px; }
}

@media print {
  .topbar, .links, .foot a { display: none; }
  body { background: #fff; color: #000; }
}
