:root {
  --bg: #f7f7f9;
  --surface: #ffffff;
  --text: #1b1a22;
  --muted: #5f5d6b;
  --rule: #e1dfe8;
  --accent: #4c3d8f;
  --sidebar: 19rem;
}
html[data-theme="dark"] {
  --bg: #141319;
  --surface: #1c1b23;
  --text: #e7e5ee;
  --muted: #a19eb0;
  --rule: #2d2b36;
  --accent: #a99be3;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.65;
}
a { color: var(--accent); text-underline-offset: 2px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
h1, h2, h3 { font-family: inherit; }

/* ---------- Layout ---------- */
.layout { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); max-width: 72rem; margin: 0 auto; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  padding: 3rem 2rem 2rem 2.5rem;
  display: flex; flex-direction: column;
}
main { padding: 3rem 3rem 4rem; max-width: 46rem; }

/* ---------- Sidebar ---------- */
.portrait { width: 9.5rem; height: auto; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 3px; display: block; }
.name { font-size: 2rem; font-weight: 600; line-height: 1.1; letter-spacing: -0.015em; margin: 1.4rem 0 .4rem; }
.role { font-size: .93rem; color: var(--muted); line-height: 1.45; margin: 0 0 1.8rem; }

.toc { list-style: none; margin: 0 0 1.6rem; padding: 0; font-size: .98rem; }
.toc li { margin: .15rem 0; }
.toc a { color: var(--text); text-decoration: none; display: inline-block; padding: .1rem 0; border-bottom: 1px solid transparent; }
.toc a:hover, .toc a.current { color: var(--accent); border-bottom-color: var(--accent); }

.contact { list-style: none; margin: 0; padding: 0; font-size: .92rem; }
.contact li { margin: .2rem 0; }
.contact a { color: var(--muted); text-decoration: none; }
.contact a:hover { color: var(--accent); }
.sidebar-foot { margin-top: auto; padding-top: 1.6rem; }
.theme-toggle {
  font-size: .85rem; color: var(--muted);
  background: none; border: 1px solid var(--rule); border-radius: 999px; padding: .3rem .85rem; cursor: pointer;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- Sections ---------- */
section { padding-top: 1rem; margin-bottom: 3.25rem; scroll-margin-top: 1.5rem; }
section > h2 { font-size: 1.35rem; font-weight: 600; letter-spacing: -0.01em; margin: 0 0 1.1rem; padding-bottom: .45rem; border-bottom: 1px solid var(--rule); }
#about p { margin: 0 0 1rem; }

/* News: a dated timeline */
.news { list-style: none; margin: 0; padding: 0; }
.news li { display: grid; grid-template-columns: 6.5rem 1fr; gap: 1rem; padding: .45rem 0; }
.news time { font-size: .9rem; color: var(--muted); padding-top: .15rem; }

/* Publications */
.pubs { list-style: none; margin: 0; padding: 0; }
.pubs > li { padding: 1rem 0; border-top: 1px solid var(--rule); }
.pubs > li:first-child { border-top: 0; padding-top: 0; }
.kind { font-size: .82rem; color: var(--muted); margin-bottom: .15rem; }
.pub-title { font-weight: 600; margin: 0; line-height: 1.45; }
.authors, .venue { margin: .1rem 0 0; font-size: .98rem; }
.authors strong { font-weight: 700; }
.venue { color: var(--muted); }
.status { font-style: normal; font-weight: 600; color: var(--text); }
.links { margin: .35rem 0 0; font-size: .9rem; display: flex; flex-wrap: wrap; gap: .9rem; }

/* Projects */
.project { display: grid; grid-template-columns: 15rem 1fr; gap: 1.5rem; padding: 1.25rem 0; border-top: 1px solid var(--rule); }
.project:first-of-type { border-top: 0; padding-top: 0; }
.project figure { margin: 0; }
.project img { width: 100%; height: auto; border-radius: 3px; display: block; }
.placeholder {
  aspect-ratio: 16 / 10; border: 1px dashed var(--rule); border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem; color: var(--muted); background: var(--surface);
}
.project h3 { font-size: 1.1rem; font-weight: 600; margin: 0 0 .1rem; line-height: 1.35; }
.project .when { font-size: .88rem; color: var(--muted); margin: 0 0 .5rem; }
.project p { margin: 0 0 .4rem; font-size: 1rem; }

/* Teaching and experience */
.roles { list-style: none; margin: 0; padding: 0; }
.roles li { display: grid; grid-template-columns: 1fr auto; column-gap: 1rem; padding: .55rem 0; border-top: 1px solid var(--rule); }
.roles li:first-child { border-top: 0; }
.roles .what { font-weight: 600; }
.roles .where { color: var(--muted); font-size: .98rem; grid-column: 1; }
.roles .dates { font-size: .88rem; color: var(--muted); grid-row: 1; grid-column: 2; padding-top: .2rem; white-space: nowrap; }
.roles .detail { grid-column: 1 / -1; font-size: .98rem; margin-top: .15rem; }

footer { font-size: .85rem; color: var(--muted); padding-top: 1.5rem; border-top: 1px solid var(--rule); }

/* ---------- Small screens ---------- */
@media (max-width: 860px) {
  .layout { display: block; }
  .sidebar { position: static; height: auto; padding: 2rem 1.5rem 0; }
  .sidebar-top { display: grid; grid-template-columns: 7rem 1fr; gap: 1.25rem; align-items: end; }
  .portrait { width: 7rem; }
  .name { font-size: 1.9rem; margin-top: 0; }
  .toc { display: flex; flex-wrap: wrap; gap: .2rem 1.1rem; margin-bottom: 1rem; }
  .contact { display: flex; flex-wrap: wrap; gap: .2rem 1.1rem; }
  .sidebar-foot { padding-top: 1rem; }
  main { padding: 2.25rem 1.5rem 3rem; }
}
@media (max-width: 560px) {
  .project { grid-template-columns: 1fr; gap: .9rem; }
  .news li { grid-template-columns: 1fr; gap: 0; }
  .roles li { grid-template-columns: 1fr; }
  .roles .dates { grid-row: auto; grid-column: 1; padding-top: 0; }
}
