:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --text: #1f2328;
  --muted: #5b6470;
  --rule: #e4e1da;
  --accent: #1d4e89;
  --accent-soft: #e8eef6;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14161a;
    --surface: #1b1e23;
    --text: #e6e6e3;
    --muted: #a0a7b1;
    --rule: #2c3037;
    --accent: #8db4e8;
    --accent-soft: #1f2a38;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

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

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

.wrap { max-width: 920px; margin: 0 auto; padding: 0 16px; }

/* Header and navigation */
header.site {
  border-bottom: 1px solid var(--rule);
  background: var(--surface);
}
header.site .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 24px;
  padding-top: 14px;
  padding-bottom: 14px;
}
.brand {
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text);
}
.brand:hover { text-decoration: none; }
nav.main { display: flex; flex-wrap: wrap; gap: 4px 20px; font-size: 0.95rem; }
nav.main a { color: var(--muted); }
nav.main a[aria-current="page"] { color: var(--text); font-weight: 600; }

main { padding: 36px 0 56px; }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.25; }
h1 { font-size: 2rem; margin: 0 0 4px; }
h2 {
  font-size: 1.35rem;
  margin: 40px 0 14px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--rule);
}
h3 { font-size: 1.1rem; margin: 24px 0 6px; }

.lede { color: var(--muted); margin: 0 0 20px; }

/* Home hero */
.hero {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 32px;
  align-items: start;
}
.hero img {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--rule);
}
.role { color: var(--muted); margin: 0 0 16px; }
.links { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 16px 0 0; padding: 0; list-style: none; font-size: 0.95rem; }

@media (max-width: 640px) {
  .hero { grid-template-columns: 1fr; gap: 20px; }
  .hero img { width: 140px; height: 140px; }
  h1 { font-size: 1.7rem; }
}

/* News */
ul.news { list-style: none; padding: 0; margin: 0; }
ul.news li {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--rule);
}
ul.news li:last-child { border-bottom: 0; }
.date { color: var(--muted); font-size: 0.9rem; font-variant-numeric: tabular-nums; }
@media (max-width: 480px) {
  ul.news li { grid-template-columns: 1fr; gap: 0; }
}

/* Research themes */
.theme {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 18px 20px;
  margin: 0 0 16px;
}
.theme h3 { margin-top: 0; }
.theme p { margin: 0 0 8px; }
.theme .refs { font-size: 0.9rem; color: var(--muted); margin: 0; }

/* Figures */
figure.fig { margin: 4px 0 12px; }
figure.fig img {
  display: block;
  width: 100%;
  height: auto;
  background: #ffffff;
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 8px;
}
figure.fig figcaption { color: var(--muted); font-size: 0.85rem; margin-top: 6px; }

/* Publication entries with a thumbnail */
li.withthumb .pubrow {
  display: grid;
  grid-template-columns: 1fr 160px;
  gap: 16px;
  align-items: start;
}
li.withthumb .pubrow img {
  width: 160px;
  height: 100px;
  object-fit: contain;
  background: #ffffff;
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 4px;
}
@media (max-width: 560px) {
  li.withthumb { grid-template-columns: 1fr; gap: 8px; }
  li.withthumb .pubrow img { width: 100%; height: auto; max-height: 160px; }
}

/* Publications and talks */
ol.pubs, ol.talks { padding-left: 1.4em; margin: 0; }
ol.pubs li, ol.talks li { margin: 0 0 14px; padding-left: 4px; }
.title { font-weight: 600; }
.authors, .venue { display: block; }
.authors { color: var(--text); }
.venue { color: var(--muted); font-size: 0.95rem; }
.venue em { font-style: italic; }
.me { font-weight: 600; text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 3px; }
.tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  margin-left: 6px;
  vertical-align: 1px;
}
.plinks { font-size: 0.9rem; }
.plinks a { margin-right: 10px; }
.note { color: var(--muted); font-size: 0.9rem; }

footer.site {
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.85rem;
  padding: 18px 0 28px;
}

figure.fig.narrow { max-width: 600px; margin-left: auto; margin-right: auto; }

