:root {
  --bg: #ffffff;
  --bg-header: rgba(255, 255, 255, 0.86);
  --surface: #f4f5f6;
  --text: #15171a;
  --muted: #5b6068;
  --faint: #8a9098;
  --hairline: #e8eaec;
  --hairline-soft: #f1f3f4;
  --accent: #2056c7;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131517;
    --bg-header: rgba(19, 21, 23, 0.86);
    --surface: #1e2124;
    --text: #e8eaed;
    --muted: #9aa1a9;
    --faint: #6c727a;
    --hairline: #25292d;
    --hairline-soft: #1d2024;
    --accent: #80a4f0;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

.wrap {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 24px;
}

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

h1 {
  font-size: 2.1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0 0 0.4rem;
}

h2 { font-size: 1.15rem; font-weight: 600; letter-spacing: -0.01em; margin: 2.2rem 0 0.7rem; }
h3 { font-size: 1rem; font-weight: 600; margin: 1.6rem 0 0.5rem; }

code, pre, kbd { font-family: var(--mono); font-size: 0.85em; }
code { background: var(--surface); padding: 0.1em 0.35em; border-radius: 4px; }
pre {
  background: var(--surface);
  padding: 0.9rem 1.1rem;
  border-radius: 8px;
  overflow-x: auto;
  line-height: 1.55;
}
pre code { background: none; padding: 0; }

hr { border: none; border-top: 1px solid var(--hairline); margin: 1.8rem 0; }

blockquote {
  margin: 1rem 0;
  padding: 0.1rem 1.1rem;
  border-left: 2px solid var(--hairline);
  color: var(--muted);
}

img { max-width: 100%; height: auto; border-radius: 8px; }

table {
  border-collapse: collapse;
  width: 100%;
  margin: 1rem 0;
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
}
th, td { text-align: left; padding: 0.5rem 0.7rem 0.5rem 0; border-bottom: 1px solid var(--hairline); }
th {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--faint);
}

::selection { background: var(--accent); color: #fff; }

/* header / footer */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-header);
  backdrop-filter: blur(10px) saturate(1.4);
  -webkit-backdrop-filter: blur(10px) saturate(1.4);
  border-bottom: 1px solid var(--hairline);
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.7rem;
  padding-bottom: 0.7rem;
}

.monogram {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: var(--text);
  color: var(--bg);
  border-radius: 5px;
  padding: 0.15rem 0.45rem;
}
.monogram:hover { text-decoration: none; }

.site-header nav { display: flex; flex-wrap: wrap; gap: 1.3rem; }
.site-header nav a { color: var(--muted); font-size: 0.85rem; }
.site-header nav a:hover { color: var(--text); text-decoration: none; }
.site-header nav a.active { color: var(--text); font-weight: 500; }

main.wrap { padding-top: 3.5rem; padding-bottom: 3.5rem; }

.site-footer { border-top: 1px solid var(--hairline); }

.footer-inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.3rem 1rem;
  padding-top: 1rem;
  padding-bottom: 1.4rem;
  color: var(--faint);
  font-size: 0.82rem;
}
.site-footer a { color: var(--faint); }
.site-footer a:hover { color: var(--text); text-decoration: none; }

/* home */

.hero {
  display: flex;
  gap: 2.2rem;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 2.8rem;
}

.hero-text { flex: 1; min-width: 0; }

.hero h1 { font-size: 2.4rem; margin-bottom: 0.9rem; }

.bio p { margin: 0 0 0.7rem; color: var(--muted); font-size: 0.95rem; }
.bio a { color: var(--text); text-decoration: underline; text-decoration-color: var(--hairline); text-underline-offset: 3px; }
.bio a:hover { text-decoration-color: var(--accent); color: var(--accent); }

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.6rem;
  margin: 1rem 0 0;
  font-size: 0.8rem;
  color: var(--faint);
}
.meta-row a { color: var(--faint); }
.meta-row a:hover { color: var(--accent); text-decoration: none; }
.meta-row > *:not(:first-child)::before {
  content: "·";
  margin-right: 0.6rem;
  color: var(--hairline);
}

.portrait {
  width: 124px;
  height: 124px;
  object-fit: cover;
  border-radius: 10px;
  flex-shrink: 0;
  margin-top: 0.35rem;
  border: 1px solid var(--hairline);
}

/* sections */

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.2rem 1rem;
  border-bottom: 1px solid var(--hairline);
  padding-bottom: 0.45rem;
  margin: 2.6rem 0 0.2rem;
}

.section-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text);
}

.section-aside { font-size: 0.8rem; color: var(--faint); }
.section-aside:hover { color: var(--accent); text-decoration: none; }

/* publications */

.page-lead {
  color: var(--faint);
  font-size: 0.9rem;
  margin: 0 0 1.6rem;
  font-variant-numeric: tabular-nums;
}

.pub-group {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  column-gap: 18px;
}

.pub-year {
  font-size: 0.82rem;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  padding-top: 0.85rem;
  position: sticky;
  top: 3.4rem;
  align-self: start;
}

.pub {
  border-bottom: 1px solid var(--hairline-soft);
  padding: 0.72rem 0 0.66rem;
}

.pub-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: -0.005em;
  line-height: 1.45;
}

.pub:hover .pub-title { color: var(--accent); }

.pub-meta {
  margin: 0.15rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.1rem 0.8rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.pub-byline { min-width: 0; }
.pub-byline .me { color: var(--text); }

.pub-venue { color: var(--accent); font-weight: 500; }
.pub-venue.is-preprint { color: var(--faint); font-weight: 400; }

.pub-actions {
  margin-left: auto;
  display: flex;
  gap: 0.7rem;
  white-space: nowrap;
}

.pub-actions a,
.pub-actions button {
  font-family: var(--sans);
  font-size: 0.78rem;
  color: var(--accent);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  line-height: inherit;
}
.pub-actions a:hover,
.pub-actions button:hover { text-decoration: underline; text-underline-offset: 3px; }

.pub-fold {
  margin: 0.55rem 0 0.2rem;
  padding: 0.75rem 0.95rem;
  background: var(--surface);
  border-radius: 8px;
  font-size: 0.84rem;
  line-height: 1.6;
  color: var(--muted);
}

/* news */

.news {
  display: grid;
  grid-template-columns: 5rem minmax(0, 1fr);
  row-gap: 0.5rem;
  padding-top: 0.9rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.news-date { color: var(--faint); font-variant-numeric: tabular-nums; font-size: 0.82rem; padding-top: 0.05rem; }

/* misc */

.students-note {
  margin-top: 2.8rem;
  padding: 0.9rem 1.1rem;
  background: var(--surface);
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--muted);
}
.students-note p { margin: 0; }

.course-list { padding-left: 1.2rem; }
.course-list li { margin: 0.35rem 0; }

.backlink { margin-top: 2rem; font-size: 0.88rem; }

.prose { max-width: 680px; }
.prose > :first-child { margin-top: 0; }
.prose li { margin: 0.2rem 0; }

@media (max-width: 600px) {
  .site-header { position: static; }
  .header-inner { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
  .site-header nav { gap: 0.95rem; }
  .hero { flex-direction: column-reverse; gap: 1.1rem; }
  .hero h1 { font-size: 1.9rem; }
  .portrait { width: 88px; height: 88px; }
  .pub-group { grid-template-columns: 1fr; }
  .pub-year {
    position: static;
    padding: 1.1rem 0 0;
    font-weight: 600;
    color: var(--text);
  }
  .pub-actions { margin-left: 0; }
  .news { grid-template-columns: 4.4rem minmax(0, 1fr); }
}
