/* Site styles — a single centred column with plain sections separated by
   thin rules. Shared by the homepage, the publications page, and writing. */

:root {
  --bg: #ffffff;
  --text: #212529;
  --muted: #5c636a;
  --faint: #8a9096;
  --rule: #e3e5e8;
  --link: #1a56b0;
  --link-hover: #0d3c82;
  --button-border: #cfd4da;
  --button-hover: #f3f5f7;
  --photo-bg: #ecebe6;

  --sans:
    -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

:root[data-theme='dark'] {
  --bg: #141517;
  --text: #e6e6e4;
  --muted: #a3a7ac;
  --faint: #7e8389;
  --rule: #2a2d31;
  --link: #8ab4f8;
  --link-hover: #b3cdfb;
  --button-border: #3a3e44;
  --button-hover: #1e2023;
  --photo-bg: #24262a;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

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

a {
  color: var(--link);
  text-decoration: none;
}

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

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
  border-radius: 3px;
}

.page {
  max-width: 740px;
  margin: 0 auto;
  padding: 0 24px 40px;
}

/* ---------- Top bar ---------- */

.topbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 22px;
  padding: 22px 0 0;
  font-size: 14px;
}

.topbar a {
  color: var(--muted);
}

.topbar a:hover,
.topbar a[aria-current='page'] {
  color: var(--text);
  text-decoration: none;
}

.topbar .brand {
  margin-right: auto;
  white-space: nowrap;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  margin-left: -6px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--muted);
  cursor: pointer;
}

.theme-toggle:hover {
  color: var(--text);
  background: var(--button-hover);
}

.theme-toggle svg {
  width: 17px;
  height: 17px;
}

.theme-toggle .icon-sun,
:root[data-theme='dark'] .theme-toggle .icon-moon {
  display: none;
}

:root[data-theme='dark'] .theme-toggle .icon-sun {
  display: block;
}

/* ---------- Hero ---------- */

.hero {
  padding: 28px 0 8px;
  text-align: center;
}

.photo {
  margin: 0 auto;
  width: 132px;
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  background: var(--photo-bg);
}

.photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero h1 {
  margin: 20px 0 0;
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.2;
}

.role {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 16px;
}

.buttons {
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.buttons a {
  display: inline-block;
  padding: 5px 14px;
  border: 1px solid var(--button-border);
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
}

.buttons a:hover {
  background: var(--button-hover);
  text-decoration: none;
}

/* ---------- Sections ---------- */

section {
  margin-top: 40px;
}

h2 {
  margin: 0 0 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

section > p {
  margin: 0 0 12px;
}

.about p {
  text-align: justify;
  hyphens: auto;
  -webkit-hyphens: auto;
}

/* Topic labels inside a section (e.g. publication groups): small caps with a
   hairline, so they read as dividers rather than titles. */
h3 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 30px 0 12px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}

h3::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--rule);
}

h2 + h3 {
  margin-top: 6px;
}

/* ---------- Interactive note cards ---------- */

.note-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.note-card {
  display: grid;
  gap: 4px;
  align-content: start;
  padding: 16px 18px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  color: var(--text);
  transition:
    border-color 120ms ease,
    background-color 120ms ease;
}

.note-card:hover {
  border-color: var(--button-border);
  background: var(--button-hover);
  color: var(--text);
  text-decoration: none;
}

.note-card-meta {
  color: var(--faint);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.note-card-title {
  font-size: 16.5px;
  font-weight: 600;
  line-height: 1.4;
}

.note-card-title::after {
  content: ' \2192';
  color: var(--link);
}

.note-card-text {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

/* ---------- News ---------- */

.news {
  margin: 0;
  padding: 0;
  list-style: none;
}

.news li {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 12px;
}

.news li + li {
  margin-top: 6px;
}

.news time {
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

/* ---------- Mini-CV ---------- */

.timeline {
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline li {
  display: grid;
  grid-template-columns: 1fr 32px;
  gap: 20px;
  align-items: center;
}

.timeline li + li {
  margin-top: 14px;
}

.timeline strong {
  display: block;
  font-weight: 600;
}

.sub {
  display: block;
  color: var(--muted);
  font-size: 15px;
}

.logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 6px;
  background: #ffffff;
  padding: 2px;
}

/* ---------- Publications ---------- */

.pubs {
  margin: 0;
  padding: 0;
  list-style: none;
}

.pubs li {
  color: var(--muted);
  font-size: 15.5px;
  line-height: 1.6;
}

.pubs li + li {
  margin-top: 16px;
}

.pubs .title {
  display: block;
  margin-bottom: 2px;
  color: var(--text);
  font-size: 16.5px;
  font-weight: 600;
  line-height: 1.45;
}

.pubs strong {
  color: var(--text);
  font-weight: 600;
}

.venue-line {
  display: block;
  margin-top: 2px;
}

.pubs .venue {
  margin-right: 6px;
  color: var(--text);
  font-weight: 600;
}

.pub-links {
  white-space: nowrap;
}

.note {
  margin: 18px 0 0;
  color: var(--faint);
  font-size: 14px;
}

.all-pubs {
  margin: 10px 0 0;
  font-size: 15px;
  font-weight: 500;
}

.also {
  display: block;
  font-size: 14px;
}

.bib-toggle {
  padding: 0;
  border: 0;
  background: none;
  color: var(--link);
  font: inherit;
  cursor: pointer;
}

.bib-toggle:hover {
  color: var(--link-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.bib {
  margin: 8px 0 4px;
  padding: 12px 14px;
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--button-hover);
  color: var(--text);
  font-size: 12.5px;
  line-height: 1.5;
  white-space: pre;
}

/* ---------- Subpage headers ---------- */

.page-header {
  padding: 40px 0 4px;
}

.page-header h1,
.article h1 {
  margin: 0;
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.25;
}

.lede {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 17px;
}

.page-header + section {
  margin-top: 28px;
}

/* ---------- Writing index ---------- */

.entries {
  margin: 0;
  padding: 0;
  list-style: none;
}

.entries li + li {
  margin-top: 26px;
}

.entries .meta {
  display: block;
  color: var(--faint);
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}

.entries .entry-title {
  display: block;
  margin-top: 2px;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
}

.entries .entry-title a {
  color: var(--text);
}

.entries .entry-title a:hover {
  color: var(--link);
}

.entries p {
  margin: 4px 0 0;
  color: var(--muted);
}

/* ---------- Articles ---------- */

.article {
  padding-top: 40px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--faint);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.article > .pub-links {
  display: block;
  margin-top: 12px;
  font-size: 15px;
}

.figure {
  margin: 32px 0 0;
}

.figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: #ffffff;
}

.figure figcaption {
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.article section {
  margin-top: 36px;
}

.article ul:not(.pubs) {
  margin: 0;
  padding-left: 20px;
}

.article ul:not(.pubs) li + li {
  margin-top: 8px;
}

.back {
  margin: 40px 0 0;
  font-size: 15px;
}

/* ---------- Plain lists ---------- */

.plain {
  margin: 0;
  padding-left: 18px;
}

.plain li + li {
  margin-top: 4px;
}

/* ---------- Footer ---------- */

footer {
  margin-top: 48px;
  padding-top: 18px;
  border-top: 1px solid var(--rule);
  color: var(--faint);
  font-size: 13.5px;
  text-align: center;
}

/* Draft-only marker for placeholders that still need real content. */
.todo {
  outline: 1px dashed #d93025;
  outline-offset: 2px;
}

/* ---------- Narrow screens ---------- */

@media (max-width: 600px) {
  .page {
    padding: 0 16px 32px;
  }

  .topbar {
    gap: 14px;
  }

  .topbar .brand {
    font-size: 14px;
  }

  .hero {
    padding-top: 16px;
  }

  .photo {
    width: 112px;
  }

  .hero h1 {
    font-size: 26px;
  }

  .pub-links {
    white-space: normal;
  }

  /* Narrow columns justify poorly; fall back to ragged-right without hyphens. */
  .about p {
    text-align: left;
    hyphens: manual;
    -webkit-hyphens: manual;
  }

  .note-cards {
    grid-template-columns: minmax(0, 1fr);
  }

  .buttons {
    gap: 6px;
  }

  .buttons a {
    padding: 4px 10px;
    font-size: 13.5px;
  }
}
