/* ---------- Tokens ---------- */
:root {
  --bg: #fbfaf8;
  --surface: #ffffff;
  --text: #1f1f22;
  --muted: #5d6068;
  --rule: #e4e1dc;
  --accent: #2d5e8c;
  --accent-soft: #e8eff6;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141517;
    --surface: #1c1d20;
    --text: #e7e5e1;
    --muted: #a3a6ad;
    --rule: #2d2f34;
    --accent: #8db6e2;
    --accent-soft: #1f2a36;
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { 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: 17px;
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

img, video { max-width: 100%; display: block; }

.wrap {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 20px;
}

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

/* ---------- Headings ---------- */
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.25; }
h1 { font-size: 2.4rem; margin: 0 0 6px; letter-spacing: -0.01em; }
h2 {
  font-size: 1.45rem;
  margin: 56px 0 20px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule);
}
h3 { font-size: 1.1rem; margin: 0 0 4px; }

/* ---------- Intro ---------- */
.intro { padding-top: 32px; }
.banner {
  width: 100%;
  height: auto;
  aspect-ratio: 5 / 2;
  object-fit: cover;
  border-radius: 10px;
  margin: 0 0 32px;
}
.role { color: var(--muted); margin: 0 0 22px; font-size: 1.02rem; }
.intro p { margin: 0 0 14px; }

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  list-style: none;
  padding: 0;
  margin: 24px 0 0;
}
.links a {
  display: inline-block;
  padding: 6px 14px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.92rem;
}
.links a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

/* ---------- Publications ---------- */
.pubs { list-style: none; padding: 0; margin: 0; }
.pub {
  display: grid;
  grid-template-columns: 230px 1fr;
  gap: 24px;
  padding: 22px 0;
  border-bottom: 1px solid var(--rule);
}
.pub:last-child { border-bottom: 0; }

.thumb {
  aspect-ratio: 16 / 10;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.thumb img, .thumb video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
}

.pub h3 a { color: var(--text); }
.pub h3 a:hover { color: var(--accent); }
.authors { margin: 0; font-size: 0.93rem; color: var(--muted); }
.authors b { color: var(--text); font-weight: 600; }
.venue { margin: 2px 0 8px; font-size: 0.93rem; font-style: italic; color: var(--muted); }
.tag {
  display: inline-block;
  font-style: normal;
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 4px;
  padding: 1px 7px;
  margin-right: 6px;
}
.desc { margin: 0 0 8px; font-size: 0.95rem; }
.pub-links { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 0.9rem; margin: 0; padding: 0; list-style: none; }
.pub-links a::before { content: "["; color: var(--muted); }
.pub-links a::after { content: "]"; color: var(--muted); }

.jobs { padding: 0; margin: 0; list-style: none; }
.jobs li { padding: 12px 0; border-bottom: 1px solid var(--rule); font-size: 0.95rem; }
.jobs li:last-child { border-bottom: 0; }
.job-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 16px; }
.jobs .title { font-weight: 600; }
.jobs .when { color: var(--muted); font-size: 0.9rem; white-space: nowrap; }
.jobs .meta { margin: 2px 0 0; color: var(--muted); }

.earlier { padding: 0; margin: 0; list-style: none; }
.earlier li { padding: 10px 0; border-bottom: 1px solid var(--rule); font-size: 0.95rem; }
.earlier li:last-child { border-bottom: 0; }
.earlier .title { font-weight: 600; }
.earlier .meta { color: var(--muted); }

/* ---------- CV ---------- */
.cv-head { padding-top: 48px; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.cv-head .contact { color: var(--muted); font-size: 0.95rem; margin: 0; }
.cv-head .contact a { color: var(--muted); }
.cv-head .contact a:hover { color: var(--accent); }
.btn {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--bg);
  font-size: 0.92rem;
  font-weight: 600;
}
.btn:hover { text-decoration: none; opacity: 0.9; }

.entry {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0 16px;
  margin: 0 0 22px;
}
.entry h3 { margin: 0; }
.entry .when { color: var(--muted); font-size: 0.9rem; white-space: nowrap; }
.entry .where { grid-column: 1 / -1; color: var(--muted); font-size: 0.95rem; margin: 0 0 4px; }
.entry .body { grid-column: 1 / -1; font-size: 0.95rem; }
.entry .body p { margin: 2px 0; }
.entry ul { margin: 4px 0 0; padding-left: 20px; }
.entry li { margin: 2px 0; }

.cv-pubs { padding-left: 22px; margin: 0; font-size: 0.95rem; }
.cv-pubs li { margin: 0 0 12px; }
.cv-pubs .t { font-weight: 600; }
.cv-pubs b { font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Footer ---------- */
.site-footer {
  margin-top: 64px;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.88rem;
}
.site-footer .wrap { padding-top: 20px; padding-bottom: 32px; }

/* ---------- Small screens ---------- */
@media (max-width: 640px) {
  body { font-size: 16px; }
  .wrap { padding: 0 16px; }
  .nav { gap: 14px; font-size: 0.9rem; }
  h1 { font-size: 2rem; }
  .intro { padding-top: 16px; }
  .banner { border-radius: 8px; margin-bottom: 24px; }
  .pub { grid-template-columns: 1fr; gap: 14px; }
  .entry { grid-template-columns: 1fr; }
  .entry .when { order: -1; }
}

/* ---------- Print (CV PDF) ---------- */
@page { size: letter; margin: 0.55in 0.6in; }
@media print {
  :root {
    --bg: #fff; --surface: #fff; --text: #111; --muted: #444; --rule: #ccc; --accent: #1f4d78; --accent-soft: #fff;
  }
  body { font-size: 10pt; line-height: 1.4; }
  .site-header, .site-footer, .no-print { display: none !important; }
  .wrap { max-width: none; padding: 0; }
  .cv-head { padding-top: 0; }
  h1 { font-size: 20pt; }
  h2 { font-size: 12.5pt; margin: 16px 0 8px; padding-bottom: 3px; }
  h3 { font-size: 10.5pt; }
  .entry { margin-bottom: 10px; break-inside: avoid; }
  .entry .when, .entry .where, .entry .body, .cv-pubs, .cv-head .contact { font-size: 9.5pt; }
  .cv-pubs li { margin-bottom: 6px; break-inside: avoid; }
  a { color: inherit; }
}
