:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --text: #1d2430;
  --muted: #5b6573;
  --accent: #1f3a5f;
  --accent-soft: #e6ecf4;
  --rule: #e3e1da;
  --link: #1f4f8a;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161d;
    --surface: #181d26;
    --text: #e4e7ec;
    --muted: #9aa3b0;
    --accent: #9cb8de;
    --accent-soft: #223047;
    --rule: #2a313d;
    --link: #8fb6ec;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--rule);
}
.nav-inner {
  max-width: 920px;
  margin: 0 auto;
  padding: 0.7rem 16px;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.nav-name {
  font-family: var(--serif);
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}
.nav-links {
  display: flex;
  gap: 1.1rem;
  overflow-x: auto;
  scrollbar-width: none;
  font-size: 0.92rem;
}
.nav-links::-webkit-scrollbar { display: none; }
.nav-links a { color: var(--muted); white-space: nowrap; }
.nav-links a:hover { color: var(--accent); text-decoration: none; }

/* ---------- layout ---------- */
main {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 16px 4rem;
}

section { padding-top: 2.6rem; }

h2 {
  font-family: var(--serif);
  font-size: 1.45rem;
  font-weight: 600;
  color: var(--accent);
  margin: 0 0 1rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--rule);
}
h3 {
  font-size: 1.02rem;
  font-weight: 600;
  margin: 0;
}

/* ---------- hero ---------- */
.hero {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 2rem;
  align-items: start;
  padding-top: 3rem;
}
.avatar {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: 3rem;
  font-weight: 600;
  object-fit: cover;
}
.hero h1 {
  font-family: var(--serif);
  font-size: 2.1rem;
  line-height: 1.2;
  margin: 0 0 0.3rem;
}
.role { color: var(--muted); margin: 0 0 1rem; }
.bio p { margin: 0 0 0.8rem; }
.status {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 6px;
  padding: 0.35rem 0.75rem;
  font-size: 0.93rem;
  font-weight: 500;
  margin: 0.2rem 0 1rem;
}
.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.links a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid var(--rule);
  background: var(--surface);
  border-radius: 6px;
  padding: 0.3rem 0.75rem;
  font-size: 0.9rem;
  color: var(--text);
}
.links a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.links a.primary { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.icon { width: 1em; height: 1em; flex: none; }

a:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ---------- interests ---------- */
.tags { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.8rem; }
.callout {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  padding: 0.7rem 0.95rem;
  margin: 1rem 0;
}
.callout strong { color: var(--accent); }
.tag-group {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 1rem;
  align-items: baseline;
  margin-top: 0.5rem;
}
.tag-group .tags { margin-top: 0; }
.tag-label { color: var(--muted); font-size: 0.88rem; font-weight: 500; }
.tag {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 0.2rem 0.75rem;
  font-size: 0.88rem;
}

/* ---------- news ---------- */
.news { list-style: none; margin: 0; padding: 0; }
.news li {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 1rem;
  padding: 0.45rem 0;
  border-bottom: 1px dashed var(--rule);
}
.news li:last-child { border-bottom: 0; }
.news-more summary {
  cursor: pointer;
  color: var(--link);
  font-size: 0.92rem;
  padding: 0.45rem 0;
  border-top: 1px dashed var(--rule);
}
.date { color: var(--muted); font-size: 0.92rem; font-variant-numeric: tabular-nums; }

/* ---------- publications ---------- */
.pubs { list-style: none; margin: 0; padding: 0; }
.pubs > li {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 1.2rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--rule);
}
.pubs > li:last-child { border-bottom: 0; }

/* briefly highlight the item an in-page link jumps to */
.pubs > li:target, .entry:target { animation: target-flash 2s ease-out; }
@keyframes target-flash {
  from { background: var(--accent-soft); }
  to { background: transparent; }
}
.thumb {
  width: 120px;
  aspect-ratio: 4 / 3;
  border-radius: 6px;
  border: 1px solid var(--rule);
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.15;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  object-fit: cover;
}
.thumb span:first-child { font-size: 1.15rem; }
.thumb span:last-child { font-size: 0.85rem; font-weight: 400; }
.pub-body { min-width: 0; }
.pub-title { font-weight: 600; display: block; }
.pub-authors, .pub-venue { display: block; font-size: 0.94rem; }
.pub-venue { color: var(--muted); }
.me { font-weight: 600; text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 3px; }
.pub-links { margin-top: 0.35rem; font-size: 0.88rem; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.pub-links a, .pub-btn {
  font: inherit;
  color: var(--link);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 0.05rem 0.55rem;
  cursor: pointer;
}
.pub-links a:hover, .pub-btn:hover { border-color: var(--accent); text-decoration: none; }
.pub-btn[aria-expanded="true"] { background: var(--accent-soft); border-color: var(--accent); }
.pub-note { font-size: 0.92rem; margin: 0.45rem 0 0; color: var(--text); }
.pub-panel {
  margin-top: 0.6rem;
  padding: 0.7rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  font-size: 0.9rem;
}
.pub-panel p { margin: 0; }
.pub-panel p + p { margin-top: 0.6rem; }
.entry .pub-btn { font-size: 0.85rem; margin-left: 0.3rem; }
.rec-img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 4px;
  border: 1px solid var(--rule);
  margin-bottom: 0.5rem;
}

/* ---------- entries ---------- */
.entry { padding: 0.8rem 0; border-bottom: 1px solid var(--rule); }
.entry:last-child { border-bottom: 0; }
.entry-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
}
.entry-head .date { white-space: nowrap; }
.entry-sub { color: var(--muted); font-size: 0.94rem; font-style: italic; margin: 0.1rem 0 0.35rem; }
.entry ul { margin: 0.3rem 0 0; padding-left: 1.15rem; }
.entry li { margin: 0.2rem 0; }

/* ---------- grid cards ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.9rem;
}
.card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 0.9rem 1rem;
}
#beyond .cards { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.card h3 { font-size: 0.98rem; margin-bottom: 0.25rem; }
.card p { margin: 0; font-size: 0.92rem; color: var(--muted); }

.plain { margin: 0; padding-left: 1.15rem; }
.plain li { margin: 0.3rem 0; }

.cta { margin: 0.8rem 0 0; font-size: 0.92rem; color: var(--muted); }

/* ---------- collapsed "Earlier roles" ---------- */
.earlier summary { cursor: pointer; list-style: none; }
.earlier summary::-webkit-details-marker { display: none; }
.earlier-title { font-weight: 600; font-size: 1.02rem; }
.earlier-title::after { content: " · show"; color: var(--link); font-weight: 400; font-size: 0.88rem; }
.earlier[open] .earlier-title::after { content: " · hide"; }

footer {
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.88rem;
  text-align: center;
  padding: 1.5rem 16px 2rem;
}

/* ---------- mobile ---------- */
@media (max-width: 640px) {
  .hero { grid-template-columns: 1fr; gap: 1.2rem; padding-top: 2rem; }
  .avatar { width: 110px; height: 110px; font-size: 2.3rem; }
  .hero h1 { font-size: 1.7rem; }
  .news li { grid-template-columns: 1fr; gap: 0; }
  .tag-group { grid-template-columns: 1fr; gap: 0.3rem; margin-top: 0.8rem; }
  .entry-head { flex-direction: column; gap: 0; }
  .nav-name { display: none; }
  .pubs > li { grid-template-columns: 1fr; gap: 0.5rem; }
  .thumb { display: none; }
}

/* ---------- print ---------- */
@media print {
  :root {
    --bg: #fff; --surface: #fff; --text: #000; --muted: #333;
    --accent: #1f3a5f; --accent-soft: #eef2f7; --rule: #ccc; --link: #1f3a5f;
  }
  body { font-size: 11pt; }
  .nav, .links, .thumb, .pub-btn, .news-more summary, .earlier-title::after { display: none; }
  .pubs > li { grid-template-columns: 1fr; }
  main { max-width: none; padding: 0; }
  section { padding-top: 1.2rem; }
  .entry, .pubs > li, .callout, .tag-group { break-inside: avoid; }
  h2 { break-after: avoid; }
  a { color: inherit; }
}
