:root {
  --bg: #ffffff;
  --text: #1c2430;
  --muted: #5b6573;
  --faint: #8a93a0;
  --line: #e6e8ec;
  --accent: #0f4c81;
  --accent-soft: #eef4fa;
  --code-bg: #f6f7f9;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12161c; --text: #e6e8eb; --muted: #a3abb6; --faint: #7d8794;
    --line: #262d36; --accent: #8cbcec; --accent-soft: #1a2633; --code-bg: #1a2029;
  }
}
:root[data-theme="dark"] {
  --bg: #12161c; --text: #e6e8eb; --muted: #a3abb6; --faint: #7d8794;
  --line: #262d36; --accent: #8cbcec; --accent-soft: #1a2633; --code-bg: #1a2029;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0 auto; max-width: 760px; padding: 0 24px;
  background: var(--bg); color: var(--text);
  font: 16.5px/1.7 var(--sans); -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
b { font-weight: 600; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 12px; top: 12px; background: var(--bg); padding: 6px 10px; border: 1px solid var(--line); z-index: 10; }

/* top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 22px 0; border-bottom: 1px solid var(--line); margin-bottom: 48px;
}
.home { font-family: var(--serif); font-weight: 600; font-size: 1.1rem; color: var(--text); }
.home:hover { text-decoration: none; }
.topbar nav { display: flex; align-items: center; gap: 22px; font-size: .93rem; }
.topbar nav a { color: var(--muted); }
.topbar nav a:hover { color: var(--text); text-decoration: none; }
.theme {
  background: none; border: 1px solid var(--line); border-radius: 8px; width: 32px; height: 32px;
  color: var(--muted); cursor: pointer; display: grid; place-items: center; padding: 0;
}
.theme:hover { color: var(--text); }
.theme svg { width: 16px; height: 16px; }

/* profile header */
.profile { display: grid; grid-template-columns: 220px 1fr; gap: 40px; align-items: start; margin-bottom: 36px; }
.portrait {
  width: 220px; height: 220px; border-radius: 50%;
  background: linear-gradient(140deg, #0f4c81, #0a2a47); color: #fff;
  display: grid; place-items: center; font: 600 3.2rem var(--serif); letter-spacing: .02em;
}
img.portrait { object-fit: cover; display: block; background: var(--line); box-shadow: 0 0 0 4px var(--bg), 0 0 0 5px var(--line), 0 6px 20px rgba(0,0,0,.12); }
h1 { font-family: var(--serif); font-weight: 600; font-size: 2.35rem; line-height: 1.15; margin: 4px 0 6px; letter-spacing: -.01em; }
.affil { margin: 0; font-size: 1.02rem; }
.loc { margin: 0 0 14px; color: var(--muted); font-size: .95rem; }
.links { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, max-content); gap: 4px 28px; font-size: .94rem; }
.links a { display: inline-flex; align-items: center; gap: 8px; }
.links svg { width: 15px; height: 15px; flex: none; }
.handle { color: var(--faint); font-size: .88rem; }

/* sections */
section { margin-bottom: 44px; }
h2 {
  font-family: var(--serif); font-weight: 600; font-size: 1.45rem; margin: 0 0 14px;
  padding-bottom: 6px; border-bottom: 1px solid var(--line);
}
.bio p { margin: 0 0 14px; }
.bio .note { color: var(--muted); }

/* news */
.news { list-style: none; padding: 0; margin: 0; }
.news li { padding: 5px 0 5px 64px; position: relative; }
.news .yr { position: absolute; left: 0; color: var(--faint); font-variant-numeric: tabular-nums; font-size: .92rem; top: 6px; }
.earlier { margin-top: 10px; }
.earlier summary { cursor: pointer; color: var(--muted); font-size: .95rem; padding: 4px 0; }
.earlier summary:hover { color: var(--text); }

/* publications */
.pubs { list-style: none; padding: 0; margin: 0; }
.pub { padding: 14px 0; border-bottom: 1px dashed var(--line); }
.pub:last-child { border-bottom: none; }
.pub-title { font-weight: 600; line-height: 1.45; }
.pub-authors { color: var(--muted); font-size: .94rem; margin-top: 2px; }
.pub-authors b { color: var(--text); }
.pub-venue { font-size: .93rem; margin-top: 2px; font-style: italic; color: var(--muted); }
.venue-tag {
  font-style: normal; font-size: .74rem; font-weight: 600; letter-spacing: .02em;
  background: var(--accent-soft); color: var(--accent); padding: 1px 7px; border-radius: 4px; margin-right: 4px;
}
.star { font-style: normal; font-weight: 600; color: #b5651d; }
.pub-links { font-size: .88rem; margin-top: 4px; color: var(--faint); }
.bib-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }
.bib-btn:hover { text-decoration: underline; text-underline-offset: 3px; }
.bib {
  background: var(--code-bg); border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; margin: 10px 0 0;
  font: .8rem/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; word-break: break-word;
}
.more { margin-top: 12px; font-weight: 500; }

.interests { padding-left: 1.1em; margin: 0; }
.interests li { margin-bottom: 6px; }

/* cv-style lists */
.cv { list-style: none; padding: 0; margin: 0 0 14px; }
.cv li { display: grid; grid-template-columns: 120px 1fr; gap: 16px; padding: 5px 0; }
.cv .when { color: var(--faint); font-size: .92rem; font-variant-numeric: tabular-nums; padding-top: 1px; }

/* publications page */
.page-title { margin-bottom: 8px; }
.lead { color: var(--muted); margin-top: 0; }
.filter { display: flex; flex-wrap: wrap; gap: 6px; margin: 18px 0 30px; }
.filter button {
  font: 500 .86rem var(--sans); padding: 5px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: transparent; color: var(--muted);
}
.filter button:hover { color: var(--text); }
.filter button.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.year-group h2 { font-size: 1.2rem; color: var(--muted); }

footer {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  border-top: 1px solid var(--line); padding: 22px 0 40px; margin-top: 56px;
  color: var(--faint); font-size: .86rem;
}

@media (max-width: 640px) {
  body { font-size: 16px; padding: 0 18px; }
  .topbar { margin-bottom: 32px; }
  .topbar nav { gap: 6px 14px; font-size: .88rem; flex-wrap: wrap; }
  .profile { grid-template-columns: 1fr; gap: 18px; }
  .portrait { width: 170px; height: 170px; font-size: 2.3rem; }
  h1 { font-size: 2rem; }
  .links { grid-template-columns: 1fr 1fr; gap: 4px 16px; }
  .cv li { grid-template-columns: 1fr; gap: 0; }
  .handle { display: none; }
  .news li { padding-left: 0; }
  .news .yr { position: static; margin-right: 6px; }
}
@media print {
  .topbar nav, .bib-btn, .filter { display: none; }
}

/* cv page */
.cv-actions { display: flex; gap: 18px; align-items: center; margin: 18px 0; font-size: .95rem; }
.btn-dl { background: var(--text); color: var(--bg); padding: 7px 14px; border-radius: 6px; font-weight: 500; }
.btn-dl:hover { text-decoration: none; opacity: .9; }
.cv-embed { width: 100%; height: 85vh; min-height: 600px; border: 1px solid var(--line); border-radius: 6px; background: var(--code-bg); }
@media (max-width: 640px) { .cv-embed { height: 70vh; min-height: 420px; } }
