:root {
  color-scheme: light;
  --bg: #f6f1e7;
  --surface: #fcf9f2;
  --text: #2a251f;
  --muted: #6e665a;
  --line: #e3dac9;
  --accent: #2c5d7f;
  --accent-hover: #1c4260;
  --me: #1a1611;
  --tag-bg: #e9e1d1;
  --tag-text: #6a4a24;
  --thumb-bg: #ffffff;
  --code-bg: #efe8da;
  --star: #a8501c;
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

.page {
  max-width: 880px;
  margin: 0 auto;
  padding: 56px 24px 40px;
}

/* ---------- Intro ---------- */
.intro {
  display: grid;
  grid-template-columns: 1fr 200px;
  gap: 40px;
  align-items: start;
  margin-bottom: 48px;
}
.intro h1 {
  font-family: "Source Serif 4", Georgia, serif;
  font-weight: 600;
  font-size: 2.4rem;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 18px;
}
.role {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0 0 20px;
}
.intro p { margin: 0 0 14px; }
.portrait {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  object-fit: cover;
  margin-top: 8px;
}
.links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin-top: 20px;
}
.links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: color 0.15s, transform 0.15s;
}
.links a:hover,
.links a:focus-visible {
  color: var(--accent);
  transform: translateY(-1px);
  text-decoration: none;
}
.links svg {
  height: 24px;
  width: 24px;
  fill: currentColor;
}

/* ---------- Sections ---------- */
section { margin-bottom: 44px; }
h2 {
  font-family: "Source Serif 4", Georgia, serif;
  font-weight: 600;
  font-size: 1.5rem;
  margin: 0 0 16px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}
.section-head h2 { border: 0; margin: 0; }

/* Publications / Projects tabs */
.tabs { display: flex; gap: 22px; }
.tab {
  font-family: "Source Serif 4", Georgia, serif;
  font-weight: 600;
  font-size: 1.5rem;
  line-height: 1.3;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: 0 0 6px;
  color: var(--muted);
  cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.note[hidden] { display: none; }
.note { margin: 0; color: var(--muted); font-size: 0.85rem; }
.subhead {
  font-size: 1rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 28px 0 4px;
}
.muted { color: var(--muted); font-size: 0.92rem; }

/* ---------- Publications ---------- */
.pub {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 24px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}
.pub:last-of-type { border-bottom: 0; }
.pub.featured {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px;
  margin: 0 -18px 14px;
}

.thumb {
  display: block;
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: 8px;
  overflow: hidden;
  background: var(--thumb-bg);
  border: 1px solid var(--line);
}
.thumb img, .thumb video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.thumb .fit-contain { padding: 6px; }
.thumb-light { background: #fff; }
.thumb-video { background: #000; }

/* Hover zoom: enlarge the graphic in place, over the text beside it */
@media (hover: hover) and (pointer: fine) and (min-width: 721px) {
  .thumb {
    transform-origin: left center;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    cursor: zoom-in;
  }
  .thumb:hover {
    transform: scale(2);
    z-index: 10;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
    transition-delay: 0.12s;
  }
}
@media (prefers-reduced-motion: reduce) {
  .thumb { transition: none; }
}

.pub h3 {
  font-size: 1.04rem;
  font-weight: 600;
  line-height: 1.4;
  margin: 0 0 6px;
}
.pub h3 a { color: var(--text); }
.pub h3 a:hover { color: var(--accent); }
.authors, .venue, .pub-links, .desc { margin: 0 0 4px; font-size: 0.93rem; }
.authors { color: var(--muted); }
.me { color: var(--me); font-weight: 600; }
.venue { font-style: italic; }
.venue strong { font-style: normal; color: var(--star); }
.venue .abbr { font-style: normal; }
.status {
  font-style: normal;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--tag-bg);
  color: var(--tag-text);
  border-radius: 999px;
  padding: 1px 8px;
  margin-left: 6px;
  white-space: nowrap;
  vertical-align: 1px;
}
.pub-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-top: 6px;
}
.pub-links a, .bib-toggle { font-size: 0.88rem; font-weight: 500; }
.pub-links a::before, .bib-toggle::before { content: "["; color: var(--muted); }
.pub-links a::after, .bib-toggle::after { content: "]"; color: var(--muted); }
.bib-toggle {
  font-family: inherit;
  background: none;
  border: 0;
  padding: 0;
  color: var(--accent);
  cursor: pointer;
}
.bib-toggle:hover { color: var(--accent-hover); }
.desc { margin-top: 6px; }
.bibtex {
  margin: 10px 0 0;
  padding: 12px 14px;
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.78rem;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre;
}

footer {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  color: var(--muted);
  font-size: 0.85rem;
}
footer p { margin: 0; }

/* ---------- Mobile ---------- */
@media (max-width: 720px) {
  .page { padding: 32px 16px 32px; }
  .intro { grid-template-columns: 1fr; gap: 20px; }
  .portrait { order: -1; width: 128px; height: 128px; margin: 0; }
  .intro h1 { font-size: 2rem; }
  .pub { grid-template-columns: 1fr; gap: 12px; }
  .section-head { flex-wrap: wrap; row-gap: 4px; }
  .tab { font-size: 1.3rem; }
  .pub.featured { margin: 0 0 14px; padding: 14px; }
}
