:root {
  --bg: #ffffff;
  --text: #16161a;
  --muted: #6f6f76;
  --rule: #e6e6e3;
  --rule-strong: #d3d3ce;
  --accent: #1a4d80;
  --accent-soft: #eef3f9;
  --hover: #f6f6f4;
  --figure-bg: #ffffff;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Helvetica, Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Charter, Georgia, serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131316;
    --text: #e9e9e6;
    --muted: #97979e;
    --rule: #2a2a2e;
    --rule-strong: #3a3a40;
    --accent: #7db3e8;
    --accent-soft: #17263a;
    --hover: #1a1a1f;
    --figure-bg: #f7f7f5;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 2rem; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

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

.wrap {
  max-width: 1040px;
  margin: 0 auto;
  padding: 3rem 2rem 7rem;
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 4rem;
  align-items: start;
}

/* ---------- Sidebar ---------- */
.sidebar { position: sticky; top: 3rem; }

figure.talk {
  margin: 0 0 1.75rem;
  border: none;
  background: none;
}
figure.talk img {
  width: 100%;
  height: auto;
  display: block;
  filter: saturate(.9);
}

.name {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 0 0 .35rem;
}

.role { color: var(--text); font-size: .9rem; font-weight: 500; margin: 0 0 .3rem; }

.affil {
  color: var(--muted);
  font-size: .85rem;
  line-height: 1.45;
  margin: 0 0 .25rem;
}
.affil a { color: var(--muted); }
.affil a:hover { color: var(--accent); }
.affil + nav.side { margin-top: 1.75rem; }

.contact {
  font-size: .85rem;
  color: var(--muted);
  margin: 0 0 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
}

nav.side ul, .links { list-style: none; margin: 0; padding: 0; font-size: .9rem; }
nav.side ul { margin-bottom: 1.5rem; }
nav.side a {
  display: block;
  color: var(--text);
  font-weight: 500;
  padding: .15rem 0;
}
nav.side a:hover { color: var(--accent); text-decoration: none; }

.links { padding: 0; }
.links li { margin-bottom: .35rem; }
.links a { color: var(--muted); }
.links a:hover { color: var(--accent); }

/* ---------- Main ---------- */
main { min-width: 0; }

section { margin-bottom: 3.5rem; scroll-margin-top: 2rem; }
section + section { border-top: 1px solid var(--rule); padding-top: 3rem; }
section:last-child { margin-bottom: 0; }

h2 {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 0 0 1.5rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--rule-strong);
}

.lede { font-size: 1.08rem; line-height: 1.65; margin: 0 0 1.25rem; }
p { margin: 0 0 1.15rem; }
p:last-child { margin-bottom: 0; }

.section-note { color: var(--muted); margin: 0 0 2rem; max-width: 44em; }

h3.sub {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 2.5rem 0 1rem;
}

/* ---------- Publications ---------- */
ol.pubs { list-style: none; margin: 0 -1rem; padding: 0; }
ol.pubs > li {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 0 1rem;
  padding: .9rem 1rem;
  border-radius: 4px;
  transition: background-color .12s ease;
}
ol.pubs > li:hover { background: var(--hover); }

.date {
  font-size: .82rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
  padding-top: .3rem;
  white-space: nowrap;
}

.pub-title {
  display: block;
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.38;
  color: var(--text);
  margin-bottom: .25rem;
}
.pub-title:hover { color: var(--accent); text-decoration: none; }
ol.pubs > li:hover .pub-title { color: var(--accent); }

.authors {
  font-size: .875rem;
  line-height: 1.5;
  color: var(--muted);
  margin: 0 0 .25rem;
}
.authors .me { color: var(--text); font-weight: 700; }
.dim { opacity: .85; }

.meta { font-size: .88rem; color: var(--muted); margin: 0; }
.meta a { text-decoration: underline; text-underline-offset: 2px; }
.meta .sep { opacity: .4; padding: 0 .5rem; }

.award {
  color: var(--text);
  font-weight: 700;
  margin-left: .35rem;
}

/* ---------- Figures ---------- */
figure {
  margin: 1.5rem 0 0;
  border: 1px solid var(--rule);
  border-radius: 3px;
  overflow: hidden;
  background: var(--figure-bg);
}
figure img { display: block; width: 100%; height: auto; }
figcaption {
  font-size: .8rem;
  color: var(--muted);
  padding: .75rem .95rem;
  border-top: 1px solid var(--rule);
  background: var(--bg);
  line-height: 1.55;
}

/* ---------- Explainers (collapsible) ---------- */
details.explainer {
  border-top: 1px solid var(--rule);
  margin: 0 -1rem;
}
details.explainer:last-of-type { border-bottom: 1px solid var(--rule); }

details.explainer summary {
  list-style: none;
  cursor: pointer;
  padding: 1.1rem 2.25rem 1.1rem 1rem;
  position: relative;
  border-radius: 4px;
  transition: background-color .12s ease;
}
details.explainer summary::-webkit-details-marker { display: none; }
details.explainer summary:hover { background: var(--hover); }
details.explainer summary:hover .ex-title { color: var(--accent); }
details.explainer summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.ex-title {
  display: block;
  font-family: var(--serif);
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.38;
  margin-bottom: .2rem;
  max-width: 40em;
}
.ex-deck {
  display: block;
  font-size: .875rem;
  color: var(--muted);
  line-height: 1.5;
  max-width: 44em;
}

/* chevron */
details.explainer summary::after {
  content: "";
  position: absolute;
  right: 1rem;
  top: 1.55rem;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg);
  transition: transform .15s ease;
}
details.explainer[open] summary::after { transform: rotate(-135deg); }
details.explainer summary:hover::after { border-color: var(--accent); }

.ex-body {
  padding: .25rem 1rem 2rem;
  max-width: 44em;
}
.ex-body ul { margin: 0 0 1.15rem; padding-left: 1.15rem; }
.ex-body li { margin-bottom: .25rem; }
.ex-link { margin: 1.25rem 0 0; font-size: .875rem; }
.ex-link a { text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Mobile ---------- */
@media (max-width: 820px) {
  .wrap {
    grid-template-columns: 1fr;
    gap: 2.5rem;
    padding: 2.5rem 1.4rem 4rem;
  }
  .sidebar { position: static; }
  nav.side ul { display: flex; flex-wrap: wrap; gap: .25rem 1.5rem; margin-bottom: 1.25rem; }
  .links { display: flex; flex-wrap: wrap; gap: .25rem 1.5rem; }
  nav.side li, .links li { margin-bottom: 0; }
  ol.pubs { margin: 0 -.75rem; }
  details.explainer { margin: 0 -.75rem; }
  details.explainer summary { padding: 1rem 2rem 1rem .75rem; }
  .ex-body { padding: .25rem .75rem 1.75rem; }
  ol.pubs > li { grid-template-columns: 1fr; gap: .15rem; padding: .8rem .75rem; }
  .date { text-align: left; padding-top: 0; }
}
