:root {
  --bg: #ffffff;
  --surface: #f6f5f9;
  --text: #1d1b22;
  --muted: #5d5a66;
  --accent: #5b3e96;
  --accent-soft: #ece6f7;
  --border: #e3e0ea;
  --maxw: 900px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131217;
    --surface: #1c1a22;
    --text: #e9e7ee;
    --muted: #a6a2b1;
    --accent: #b9a2ec;
    --accent-soft: #2a2238;
    --border: #2d2a36;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16.5px;
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.hero-text p:not(.links) a, .news a, .timeline a, .projects a, .pubs a, .drawer a, .press a, .cvhead a { text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }

.topnav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 22px;
  padding: 12px 16px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
  font-size: 15px;
}
.topnav a { color: var(--muted); }
.topnav a:hover { color: var(--accent); text-decoration: none; }

main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px;
}

section, .hero, .paper { scroll-margin-top: 64px; }

.cvhead { padding: 40px 0 0; }
.cvhead h1 { margin: 0 0 8px; font-size: 2rem; line-height: 1.2; }
.cvhead p { margin: 0; color: var(--muted); }
.pubs { margin: 0; padding-left: 20px; }
.pubs li { padding: 5px 0; }

.hero {
  display: flex;
  gap: 36px;
  align-items: flex-start;
  padding: 48px 0 28px;
}
.portrait {
  width: 200px;
  height: 200px;
  flex-shrink: 0;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--accent-soft);
}
.hero h1 { margin: 0; font-size: 2.3rem; line-height: 1.15; letter-spacing: -0.01em; }
.role { margin: 6px 0 10px; color: var(--muted); }
.links { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 16px; font-weight: 600; }
.note { font-weight: 600; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 14px 0 0; }
.tags li {
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 3px 12px;
  font-size: 14px;
}

h2 {
  font-size: 1.45rem;
  margin: 44px 0 16px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.news, .timeline, .plain { list-style: none; padding: 0; margin: 0; }
.news li, .timeline li {
  display: grid;
  grid-template-columns: 125px 1fr;
  align-items: baseline;
  gap: 14px;
  padding: 7px 0;
}
.date { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 15px; }
.plain li { padding: 5px 0 5px 18px; position: relative; }
.plain li::before { content: ""; position: absolute; left: 2px; top: 0.85em; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.plain .sub { list-style: none; margin: 4px 0 0; padding: 0; }
.plain .sub li { padding: 2px 0 2px 18px; font-size: 15px; color: var(--muted); }
.plain .sub li::before { top: 0.7em; background: transparent; border: 1.5px solid var(--accent); }

.paper {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
  padding: 20px;
  margin-bottom: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.paper:target {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  animation: flash 1.6s ease-out;
}
.timeline li, .plain li { scroll-margin-top: 64px; }
.plain li:target { border-radius: 8px; background: var(--accent-soft); }
.timeline li:target {
  margin: 0 -10px;
  padding: 7px 10px;
  border-radius: 8px;
  background: var(--accent-soft);
}
@keyframes flash {
  from { background: var(--accent-soft); }
  to { background: var(--surface); }
}
.paper > * { min-width: 0; }
.projects { list-style: none; padding: 0; margin: 0; }
.projects li { padding: 14px 0; border-bottom: 1px solid var(--border); }
.projects li:first-child { padding-top: 0; }
.projects li:last-child { border-bottom: 0; }
.projects h3 { margin: 0 0 2px; font-size: 1.05rem; line-height: 1.35; }
.projects .venue { margin: 0 0 6px; }
.projects p { margin: 0 0 8px; }
.projects li > :last-child { margin-bottom: 0; }
.media { margin: 0; }
.media img, .media video {
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: contain;
  border-radius: 8px;
  background: #000;
  display: block;
}
.media img[src*="icar"] { background: #fff; }
.media img[src*="koala"] { background: #fff; padding: 12px; }
.media figcaption { font-size: 13px; color: var(--muted); margin-top: 6px; line-height: 1.4; }
.paper h3 { margin: 0 0 6px; font-size: 1.1rem; line-height: 1.35; }
.authors { margin: 0; font-size: 15px; }
.venue { margin: 2px 0 10px; font-style: italic; color: var(--muted); font-size: 15px; }
.press { margin: -6px 0 10px; font-size: 14px; color: var(--muted); }
.paper .body p:last-child { margin-bottom: 0; }
.teaser { margin: 0 0 12px; }
.plinks { display: flex; flex-wrap: wrap; gap: 8px; }
.plinks a, .pill {
  display: inline-block;
  padding: 2px 12px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.6;
  cursor: pointer;
}
.plinks a:hover, .pill:hover, .pill[aria-expanded="true"] { background: var(--accent-soft); text-decoration: none; }
.drawer { margin-top: 12px; font-size: 15px; color: var(--muted); }
.drawer[hidden] { margin-top: 0; }
.drawer p { margin: 0; }
.bib { position: relative; }
.bib pre {
  margin: 0;
  padding: 34px 14px 12px;
  overflow-x: auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text);
}
.bib .copy {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 1px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.reel {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 8px 0 0;
}
.tile { display: block; color: var(--muted); font-size: 14px; }
.tile:hover { color: var(--accent); text-decoration: none; }
.tile video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: 8px;
  background: #000;
  margin-bottom: 6px;
}

footer {
  max-width: var(--maxw);
  margin: 50px auto 0;
  padding: 18px 20px 36px;
  color: var(--muted);
  font-size: 14px;
  border-top: 1px solid var(--border);
}

@media (max-width: 720px) {
  .hero { flex-direction: column; align-items: center; text-align: left; padding-top: 28px; gap: 20px; }
  .hero h1 { text-align: center; }
  .role, .links { justify-content: center; text-align: center; }
  .portrait { width: 150px; height: 150px; }
  .paper { grid-template-columns: 1fr; padding: 16px; }
  .news li, .timeline li { grid-template-columns: 1fr; gap: 0; }
  .reel { grid-template-columns: repeat(3, 78%); overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; }
  .tile { scroll-snap-align: start; }
  .topnav { gap: 2px 14px; font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .paper:target { animation: none; }
}
