:root {
  --bg: #fdfcfa;
  --text: #1f1f1f;
  --muted: #6b6b6b;
  --faint: #e7e4de;
  --accent: #1f5fa8;
  --accent-hover: #0f3f78;
  --tag-bg: #eef3f9;
  --tag-text: #1f5fa8;
  --highlight: #fff4d6;
  --serif: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16171a;
    --text: #e6e4df;
    --muted: #9c9a95;
    --faint: #2c2d31;
    --accent: #7fb0ea;
    --accent-hover: #a9cbf3;
    --tag-bg: #1f2a38;
    --tag-text: #9cc2f0;
    --highlight: #3a3220;
  }
}

:root[data-theme="dark"] {
  --bg: #16171a;
  --text: #e6e4df;
  --muted: #9c9a95;
  --faint: #2c2d31;
  --accent: #7fb0ea;
  --accent-hover: #a9cbf3;
  --tag-bg: #1f2a38;
  --tag-text: #9cc2f0;
  --highlight: #3a3220;
}

* { box-sizing: border-box; }

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

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

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 56px 20px 40px;
}

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

/* ---------- header ---------- */
.intro {
  display: flex;
  gap: 36px;
  align-items: flex-start;
}
.intro-text { flex: 1; min-width: 0; }

h1 {
  font-size: 2.3rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.15;
  margin: 0 0 6px;
}
.tagline {
  font-family: var(--sans);
  font-size: 0.86rem;
  color: var(--muted);
  margin: 0 0 18px;
}

.photo {
  width: 180px;
  height: 180px;
  flex-shrink: 0;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 1px var(--faint);
}

.links {
  font-family: var(--sans);
  font-size: 0.86rem;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 0 0 4px;
  padding: 0;
  list-style: none;
}
.links a { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- sections ---------- */
section { margin-top: 48px; }
#about { margin-top: 32px; }

h2 {
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin: 0 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--faint);
}

p { margin: 0 0 14px; }

/* ---------- questions ---------- */
.questions { margin: 0 0 18px; }
.questions dt { font-weight: 600; margin-top: 10px; }
.questions dd { margin: 0; color: var(--muted); }

.reading, .also {
  font-size: 0.92rem;
  color: var(--muted);
}
.label {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  margin-right: 4px;
}

/* ---------- independent research ---------- */
.h2-note { font-weight: 400; letter-spacing: 0.04em; margin-left: 6px; }
.projects { margin: 0; padding-left: 1.2em; }
.projects li { margin-bottom: 10px; }
.projects li::marker { color: var(--muted); }
.projects .with { color: var(--muted); font-size: 0.92rem; }

/* ---------- papers ---------- */
.papers { list-style: none; margin: 0; padding: 0; }
.paper { margin: 0 0 22px; }
.paper-title { font-weight: 600; line-height: 1.4; }
.paper-title a { color: var(--text); }
.paper-title a:hover { color: var(--accent); }
.authors {
  font-size: 0.92rem;
  color: var(--muted);
  margin-top: 2px;
}
.authors .me { color: var(--text); font-weight: 600; }
.authors-note { font-size: 0.92rem; color: var(--muted); margin-top: 2px; font-style: italic; }
.more-authors {
  font: inherit;
  color: var(--accent);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.more-authors:hover { text-decoration: underline; }
.meta {
  font-family: var(--sans);
  font-size: 0.8rem;
  margin-top: 4px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
}
.venue {
  background: var(--tag-bg);
  color: var(--tag-text);
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 4px;
}
.venue.star { background: var(--highlight); color: var(--text); }
.blurb {
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: 4px;
}

/* ---------- experience ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0 16px;
  margin-bottom: 16px;
}
.timeline .org { font-weight: 600; }
.timeline .role { color: var(--muted); }
.timeline .when {
  font-family: var(--sans);
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
  padding-top: 4px;
}
.timeline .desc {
  grid-column: 1 / -1;
  font-size: 0.92rem;
  color: var(--muted);
}

/* ---------- writing ---------- */
.callout {
  border: 1px solid var(--faint);
  border-radius: 8px;
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.callout p { margin: 0; }
.button {
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--accent);
  color: var(--bg);
  padding: 7px 14px;
  border-radius: 6px;
  white-space: nowrap;
}
.button:hover { background: var(--accent-hover); color: var(--bg); text-decoration: none; }

/* ---------- fun facts ---------- */
.facts { margin: 0; padding-left: 1.2em; }
.facts li { margin-bottom: 8px; }
.facts li::marker { color: var(--muted); }

/* ---------- footer ---------- */
footer {
  margin-top: 56px;
  padding-top: 16px;
  border-top: 1px solid var(--faint);
  font-family: var(--sans);
  font-size: 0.78rem;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.theme-toggle {
  font: inherit;
  color: var(--muted);
  background: none;
  border: 1px solid var(--faint);
  border-radius: 999px;
  padding: 2px 10px;
  cursor: pointer;
}
.theme-toggle:hover { color: var(--text); }

[hidden] { display: none !important; }

/* ---------- small screens ---------- */
@media (max-width: 640px) {
  body { font-size: 17px; }
  main { padding: 32px 16px 32px; }
  .intro { flex-direction: column-reverse; gap: 20px; }
  .photo { width: 128px; height: 128px; }
  h1 { font-size: 1.9rem; }
  .timeline li { grid-template-columns: 1fr; }
  .timeline .when { padding-top: 0; }
}

/* ---------- light lists ---------- */
.plain { margin: 0; padding: 0; list-style: none; }
.plain li { margin-bottom: 8px; }
.plain strong { font-weight: 600; }
.muted { color: var(--muted); }
.paper { margin-bottom: 18px; }
