:root {
  --paper: #F6F7F9;
  --surface: #FFFFFF;
  --ink: #1B2330;
  --muted: #5A6472;
  --rule: #DCE0E6;
  --accent: #1E5A85;
  --accent-soft: #E6EEF5;

  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Public Sans", "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #12171E;
    --surface: #181E27;
    --ink: #E4E8ED;
    --muted: #9AA4B1;
    --rule: #2A3340;
    --accent: #7FB2DA;
    --accent-soft: #1D2A38;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

.layout {
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 4.5rem;
  padding: 4rem 2rem 5rem;
}

/* ---------- Sidebar ---------- */
.side {
  position: sticky;
  top: 3rem;
  align-self: start;
}
.portrait {
  width: 100%;
  max-width: 260px;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  display: block;
  border-radius: 4px;
  background: var(--rule);
}
.side h1 {
  font-weight: 500;
  font-size: 2.6rem;
  line-height: 1.05;
  letter-spacing: -0.015em;
  margin: 1.75rem 0 0.75rem;
}
.role {
  font-family: var(--sans);
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--muted);
  margin: 0 0 1.5rem;
}
.role span { display: block; }

.contact {
  list-style: none;
  padding: 1.25rem 0 0;
  margin: 0;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.9rem;
  display: grid;
  gap: 0.45rem;
}
.contact .email { color: var(--ink); }
.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.1rem;
}

.toc {
  margin-top: 2rem;
  font-family: var(--sans);
  font-size: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.1rem;
}
.toc a { color: var(--muted); text-decoration: none; white-space: nowrap; }
.toc a:hover { color: var(--accent); }

/* ---------- Main ---------- */
main { max-width: 720px; }

.intro {
  font-size: 1.45rem;
  line-height: 1.5;
  margin: 0 0 4rem;
}
.intro p { margin: 0 0 0.9rem; }
.intro .sub { font-size: 1.125rem; color: var(--muted); }

section { margin-bottom: 4.5rem; scroll-margin-top: 2rem; }

h2 {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--muted);
  margin: 0 0 1.75rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--rule);
}

.paper {
  padding: 0 0 2.25rem;
  margin: 0 0 2.25rem;
  border-bottom: 1px solid var(--rule);
}
.paper:last-child { border-bottom: 0; margin-bottom: 0; }

.paper h3 {
  font-size: 1.4rem;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.005em;
  margin: 0 0 0.4rem;
}
.paper h3 a { color: var(--ink); text-decoration: none; }
.paper h3 a:hover { color: var(--accent); text-decoration: underline; }

.coauthors {
  font-family: var(--sans);
  font-size: 0.88rem;
  color: var(--muted);
  margin: 0 0 0.9rem;
}
.coauthors a { color: var(--muted); }
.coauthors a:hover { color: var(--accent); }

.abstract {
  margin: 0 0 1rem;
  hyphens: auto;
}

.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0; padding: 0; list-style: none; }
.actions a {
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
}
.actions a:hover { background: var(--accent); color: var(--surface); }

.wip h3 a, .wip h3 { color: var(--ink); }

/* ---------- Notes ---------- */
.section-intro { color: var(--muted); margin: -0.75rem 0 2rem; }
.note {
  padding: 0 0 2rem 1.25rem;
  margin: 0 0 2rem;
  border-left: 2px solid var(--accent-soft);
}
.note:last-child { margin-bottom: 0; padding-bottom: 0; }
.note-meta {
  font-family: var(--sans);
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0 0 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.note-meta .tag {
  color: var(--accent);
  background: var(--accent-soft);
  padding: 0.1rem 0.55rem;
  border-radius: 3px;
}
.note h3 {
  font-size: 1.3rem;
  font-weight: 500;
  line-height: 1.3;
  margin: 0 0 0.5rem;
}
.note h3 a { color: var(--ink); text-decoration: none; }
.note h3 a:hover { color: var(--accent); text-decoration: underline; }
.note p { margin: 0 0 1rem; }

/* ---------- Teaching ---------- */
.teach-group { margin-bottom: 2.25rem; }
.teach-group h3 {
  font-size: 1.25rem;
  font-weight: 500;
  margin: 0 0 1rem;
}
.teach-group h4 {
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  margin: 1.25rem 0 0.4rem;
}
.courses { list-style: none; padding: 0; margin: 0; }
.courses li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.25rem 1.5rem;
  padding: 0.55rem 0;
  border-bottom: 1px dotted var(--rule);
}
.courses .where { color: var(--muted); font-size: 1rem; display: block; }
.courses .when {
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  padding-top: 0.2rem;
}

footer {
  font-family: var(--sans);
  font-size: 0.8rem;
  color: var(--muted);
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; gap: 3rem; padding: 2.5rem 1.25rem 4rem; }
  .side { position: static; display: grid; grid-template-columns: 140px 1fr; gap: 0 1.5rem; align-items: start; }
  .portrait { max-width: 140px; grid-row: span 2; }
  .side h1 { margin-top: 0; font-size: 2.1rem; }
  .contact, .toc { grid-column: 1 / -1; }
  .contact { margin-top: 1.5rem; }
  .toc { margin-top: 1.25rem; }
  .intro { font-size: 1.25rem; margin-bottom: 3rem; }
}
@media (max-width: 480px) {
  .side { grid-template-columns: 1fr; }
  .portrait { max-width: 180px; grid-row: auto; margin-bottom: 1.25rem; }
  .courses li { grid-template-columns: 1fr; }
  .courses .when { padding-top: 0; }
}

/* Current page in the menu */
.toc a[aria-current="page"] { color: var(--ink); font-weight: 600; }

/* Notes page header */
.page-title {
  font-weight: 500;
  font-size: 2.2rem;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 0.75rem;
}
.page-intro { color: var(--muted); margin: 0 0 3rem; }

.note + footer { margin-top: 3.5rem; }
