:root {
  --text: #222;
  --muted: #777;
  --rule: #e6e6e6;
  --link: #1a5fb4;
  --bg: #fff;
  --bar-bg: rgba(255, 255, 255, 0.85);
  --item-hover: #f7f9fb;
}

@media (prefers-color-scheme: dark) {
  :root {
    --text: #ddd;
    --muted: #999;
    --rule: #333;
    --link: #7fb0ec;
    --bg: #161616;
    --bar-bg: rgba(22, 22, 22, 0.85);
    --item-hover: #1d2023;
  }
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 72px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 "Lato", -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
}

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

/* Top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bar-bg);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
.topbar.scrolled { border-bottom-color: var(--rule); }
.topbar-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
}
.topbar nav { display: flex; gap: 22px; font-size: 0.95rem; }
.topbar nav a {
  color: var(--muted);
  padding-bottom: 2px;
  border-bottom: 1.5px solid transparent;
}
.topbar nav a:hover { color: var(--text); text-decoration: none; }
.topbar nav a.active { color: var(--text); border-bottom-color: var(--text); }

.wrapper {
  max-width: 760px;
  margin: 0 auto;
  padding: 28px 20px 32px;
}

h1.name {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 2px;
}
.tagline { color: var(--muted); margin-bottom: 18px; }

h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 44px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--rule);
}

p { margin: 0 0 12px; }

/* Profile */
.profile {
  display: flex;
  gap: 36px;
  align-items: flex-start;
}
.profile-bio { flex: 1; }
.profile-image { flex: 0 0 170px; margin-top: 6px; }
.profile-image img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}
.links { text-align: center; font-size: 0.95rem; margin-top: 18px; }

/* Dated lists (news, experience) */
ul.dated { list-style: none; margin: 0; padding: 0; }
ul.dated li {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 12px;
  padding: 5px 0;
}
.date { color: var(--muted); font-size: 0.95rem; white-space: nowrap; }

h3.group {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 20px 0 4px;
}
h3.group:first-of-type { margin-top: 8px; }

/* Research items */
.item {
  display: flex;
  gap: 20px;
  margin: 0 -10px;
  padding: 18px 10px;
  border-bottom: 1px solid var(--rule);
  border-radius: 8px;
  transition: background-color 180ms ease;
}
.item:hover, .item:focus-within { background: var(--item-hover); }
.item:last-child { border-bottom: none; }
.item p { margin: 0; }
.thumb { flex: 0 0 190px; }
.thumb img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border: 1px solid var(--rule);
  border-radius: 4px;
  display: block;
}
.item-body { flex: 1; min-width: 0; }
.venue {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.item-title { font-size: 1.05rem; font-weight: 700; margin: 2px 0; line-height: 1.4; }
.item-title a { color: var(--text); }
.item-title a:hover { color: var(--link); text-decoration: none; }
.authors { font-size: 0.95rem; }
.tldr { font-size: 0.95rem; color: var(--muted); margin-top: 4px !important; }
.item-links { font-size: 0.9rem; margin-top: 4px !important; }
.item-links a { margin-right: 14px; }

footer {
  margin-top: 48px;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
  font-size: 0.85rem;
  color: var(--muted);
}

@media (max-width: 600px) {
  .profile { flex-direction: column-reverse; align-items: center; gap: 16px; }
  .profile-bio { width: 100%; min-width: 0; }
  .profile-image { flex-basis: auto; width: 140px; margin-top: 0; }
  .profile-bio h1.name, .tagline { text-align: center; }
  ul.dated li { grid-template-columns: 1fr; gap: 0; padding: 6px 0; }
  .item { flex-direction: column; gap: 12px; margin: 0; padding-left: 0; padding-right: 0; }
  .thumb { flex-basis: auto; width: 100%; min-width: 0; }
  .topbar nav { gap: 16px; font-size: 0.9rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

@media (max-width: 440px) {
  .topbar-inner { justify-content: center; }
}

.nowrap { white-space: nowrap; }
