:root {
  --bg: #fbfbf9;
  --text: #1d1d1b;
  --muted: #626260;
  --rule: #e3e2dd;
  --accent: #1f5c4b;
  --accent-soft: rgba(31, 92, 75, 0.3);
  --label: 14rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151716;
    --text: #e7e5e0;
    --muted: #a09f9a;
    --rule: #2c2f2d;
    --accent: #86c8ad;
    --accent-soft: rgba(134, 200, 173, 0.35);
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Newsreader", Charter, "Iowan Old Style", Georgia, serif;
  font-size: 18px;
  line-height: 1.6;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

main {
  max-width: 58rem;
  margin: 0 auto;
  padding: 4.5rem 1.5rem 5rem;
}

/* Two-column rows: label on the left, content on the right (like the CV) */
.row {
  display: grid;
  grid-template-columns: var(--label) minmax(0, 1fr);
  column-gap: 2.75rem;
}
section.row {
  border-top: 1px solid var(--rule);
  padding: 2rem 0;
}

h1, h2 { font-weight: 600; margin: 0; }

h2 {
  font-size: 1rem;
  line-height: 1.6;
  letter-spacing: 0.01em;
}

ul { list-style: none; margin: 0; padding: 0; }

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--accent-soft);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: text-decoration-color 0.15s;
}
a:hover { text-decoration-color: currentColor; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Intro */
.intro { padding-bottom: 2.75rem; }
.portrait {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 2px;
}
h1 {
  font-size: 2.2rem;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin-bottom: 0.45rem;
}
.affiliation {
  color: var(--muted);
  line-height: 1.45;
  margin: 0 0 1.4rem;
}
.intro p { margin-top: 0; }
.contact li { margin: 0.15rem 0; }

/* Papers */
.papers li + li { margin-top: 1.6rem; }
.papers.wip li + li { margin-top: 0.7rem; }
.papers .title {
  display: block;
  font-weight: 550;
  line-height: 1.4;
  text-decoration: none;
}
.papers a.title:hover { text-decoration: underline; }
.byline {
  display: block;
  color: var(--muted);
  margin-top: 0.2rem;
}
.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 1.2rem;
  margin-top: 0.3rem;
  font-size: 0.92rem;
}

.toggle {
  font: inherit;
  color: var(--accent);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.toggle:hover { text-decoration: underline; text-underline-offset: 0.18em; }
.toggle::after {
  content: "";
  display: inline-block;
  width: 0.36em;
  height: 0.36em;
  margin-left: 0.4em;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-0.2em) rotate(45deg);
  transition: transform 0.15s;
}
.toggle[aria-expanded="true"]::after { transform: translateY(0.02em) rotate(-135deg); }

.abstract {
  margin: 0.7rem 0 0;
  padding-left: 1rem;
  border-left: 2px solid var(--rule);
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.55;
}

/* Teaching */
.entries li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1.5rem;
}
.entries li + li { margin-top: 0.75rem; }
.note {
  display: block;
  color: var(--muted);
  font-style: italic;
}
.when {
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Phones: stack labels above content */
@media (max-width: 640px) {
  body { font-size: 17px; }
  main { padding: 2.5rem 1rem 3rem; }
  .row { grid-template-columns: minmax(0, 1fr); }
  h2 { margin-bottom: 0.8rem; }
  .portrait { width: 10rem; margin-bottom: 1.4rem; }
  h1 { font-size: 1.9rem; }
  .entries li { display: block; }
  .when { display: block; font-size: 0.92rem; }
}
