/* ── Self-hosted Inter variable font ──────────────────────────────── */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('assets/fonts/InterVariable.woff2') format('woff2');
}

/* ── Theme variables ──────────────────────────────────────────────── */
:root {
  --bg: #ffffff;
  --surface: #f8f9fa;
  --text: #1a1a2e;
  --muted: #6c757d;
  --accent: #1a56db;
  --accent-hover: #1240a8;
  --border: #dee2e6;
  --nav-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  --photo-border: #dee2e6;
  --tag-bg: #e9ecef;
  --tag-text: #495057;
  --outer-bg: #eaebec;
}

:root.dark {
  --bg: #0f1117;
  --surface: #1a1f2e;
  --text: #e2e8f0;
  --muted: #8b99b5;
  --accent: #60a5fa;
  --accent-hover: #93c5fd;
  --border: #2a3040;
  --nav-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  --photo-border: #2a3040;
  --tag-bg: #1e2535;
  --tag-text: #8b99b5;
  --outer-bg: #07090e;
}

/* ── Reset / Base ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
  background: var(--bg);
  min-height: 100%;
  transition: background 0.2s ease;
}

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  transition: background 0.2s ease, color 0.2s ease;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: 960px;
  margin: 0 auto;
  border-right: 1px solid var(--border);
  border-left: 1px solid var(--border);
}

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

sup { font-size: 0.65em; vertical-align: super; }

/* ── Nav ──────────────────────────────────────────────────────────── */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--nav-shadow);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.nav-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 2.5rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.nav-brand:hover { color: var(--accent); text-decoration: none; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

/* ── Priority-plus "More" overflow widget ─────────────────────────── */
.nav-more {
  position: relative;
  display: flex;
  align-items: center;
}
/* Author `display:flex` above beats the UA `[hidden]{display:none}` rule — restore it */
.nav-more[hidden] { display: none; }

.nav-more-btn {
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: 0.875rem;
  letter-spacing: 0.01em;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
  transition: color 0.15s;
}
.nav-more-btn:hover { color: var(--text); }

.nav-more-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  z-index: 200;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1), 0 1px 4px rgba(0,0,0,0.06);
  list-style: none;
  padding: 0.4rem 0;
  min-width: 140px;
}

.nav-more-menu li a {
  display: block;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  letter-spacing: 0.01em;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
}
.nav-more-menu li a:hover,
.nav-more-menu li a.active {
  color: var(--text);
  background: var(--surface);
  text-decoration: none;
}

.nav-links a {
  font-size: 0.875rem;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.01em;
  transition: color 0.15s;
}
.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
  text-decoration: none;
}

/* ── Nav actions (theme toggle + burger) ─────────────────────────── */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* Burger — hidden on desktop, revealed on mobile */
#nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--muted);
  transition: color 0.15s, border-color 0.15s;
  flex-shrink: 0;
}
#nav-toggle:hover { color: var(--text); border-color: var(--muted); }

/* Swap burger ↔ close icon via nav state */
#nav-toggle .icon-close { display: none; }
nav.nav-open #nav-toggle .icon-close { display: block; }
nav.nav-open #nav-toggle .icon-burger { display: none; }

/* ── Theme toggle ─────────────────────────────────────────────────── */
#theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--muted);
  transition: color 0.15s, border-color 0.15s;
  flex-shrink: 0;
}
#theme-toggle:hover { color: var(--text); border-color: var(--muted); }

/* ── Main layout ──────────────────────────────────────────────────── */
main {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 3rem 2.5rem 4rem;
  flex: 1;
}

/* ── Profile (index page) ─────────────────────────────────────────── */
.profile {
  display: flex;
  gap: 2.75rem;
  align-items: flex-start;
  margin-bottom: 3.5rem;
}

.profile-photo-wrap {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.1rem;
  width: 210px;
}

.profile-photo {
  width: 190px;
  height: 190px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--photo-border);
  display: block;
  transition: border-color 0.2s;
}

.profile-photo-placeholder {
  width: 190px;
  height: 190px;
  border-radius: 50%;
  background: var(--surface);
  border: 3px solid var(--border);
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.social-links {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.social-links a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 7px;
  color: var(--muted);
  border: 1px solid var(--border);
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  text-decoration: none;
}
.social-links a:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--surface);
  text-decoration: none;
}

.profile-identity {
  text-align: center;
}

.profile-identity h1 {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin-bottom: 0.2rem;
}

.profile-identity .role {
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 0.15rem;
}

.profile-identity .affil {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.5;
}

.profile-email {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.35rem;
}

.profile-info .bio {
  font-size: 0.9375rem;
  margin-bottom: 0.85rem;
  color: var(--text);
}

.profile-info .interests {
  font-size: 0.9rem;
  color: var(--muted);
}
.profile-info .interests strong { color: var(--text); }

/* ── Sections ─────────────────────────────────────────────────────── */
.section {
  margin-bottom: 3rem;
}

.section h2,
.page-title {
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 1.25rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}

.see-all {
  display: inline-block;
  margin-top: 0.9rem;
  font-size: 0.875rem;
  color: var(--accent);
}
.see-all:hover { color: var(--accent-hover); }

/* ── News list ────────────────────────────────────────────────────── */
.news-list {
  list-style: none;
}

.news-list li {
  display: flex;
  gap: 1.5rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  align-items: center;
}
.news-list li:last-child { border-bottom: none; }

.news-date {
  flex-shrink: 0;
  font-size: 0.78rem;
  color: var(--muted);
  width: 2rem;
  text-align: center;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

/* ── Publications ─────────────────────────────────────────────────── */
/* ── Publication filters ──────────────────────────────────────────── */
.pub-filters {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 1.75rem;
}

.pub-filter {
  background: none;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.3em 0.9em;
  font-size: 0.78rem;
  font-family: inherit;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.pub-filter:hover { color: var(--text); border-color: var(--muted); }
.pub-filter.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.pub-list li.pub-hidden { display: none; }

/* ── ──────────────────────────────────────────────────────────────── */
.pub-year-header {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  margin: 1.75rem 0 0.75rem;
  letter-spacing: 0.02em;
}

.pub-list {
  list-style: none;
  counter-reset: pub-counter;
}

.pub-list li {
  counter-increment: pub-counter;
  display: flex;
  gap: 1rem;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--border);
}
.pub-list li:last-child { border-bottom: none; }

.pub-list li::before {
  content: counter(pub-counter) ".";
  flex-shrink: 0;
  color: var(--muted);
  font-size: 0.8rem;
  width: 1.75rem;
  text-align: right;
  padding-top: 0.15rem;
  font-variant-numeric: tabular-nums;
}

/* When year-grouped, override the counter to start at the right number */
.pub-list[start] { counter-reset: pub-counter attr(start, integer); }
/* Note: counter-reset with attr() is not widely supported, so we set it via style attr */

.pub-content {}

.pub-title {
  font-size: 0.9375rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: var(--text);
  line-height: 1.4;
}

.pub-authors {
  font-size: 0.84rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
  line-height: 1.5;
}

.pub-authors .me {
  font-weight: 600;
  color: var(--text);
}

.pub-venue {
  font-size: 0.84rem;
  color: var(--muted);
}

.pub-venue em { font-style: italic; }

.pub-type-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.15em 0.5em;
  border-radius: 4px;
  margin-right: 0.45em;
  vertical-align: baseline;
  line-height: 1.6;
}
.pub-type-badge.conf     { background: #dbeafe; color: #1d4ed8; }
.pub-type-badge.journal  { background: #dcfce7; color: #15803d; }
.pub-type-badge.workshop { background: #ede9fe; color: #6d28d9; }
.pub-type-badge.poster   { background: #fef3c7; color: #b45309; }
.pub-type-badge.demo     { background: #cffafe; color: #0e7490; }
.pub-type-badge.preprint { background: #f1f5f9; color: #475569; }

:root.dark .pub-type-badge.conf     { background: #1e3a5f; color: #93c5fd; }
:root.dark .pub-type-badge.journal  { background: #14532d; color: #4ade80; }
:root.dark .pub-type-badge.workshop { background: #2e1065; color: #c4b5fd; }
:root.dark .pub-type-badge.poster   { background: #451a03; color: #fcd34d; }
:root.dark .pub-type-badge.demo     { background: #0a2030; color: #67e8f9; }
:root.dark .pub-type-badge.preprint { background: #1e293b; color: #94a3b8; }

.pub-venue .forthcoming {
  font-style: normal;
  font-size: 0.78rem;
  color: var(--muted);
}

.pub-links {
  margin-top: 0.5rem;
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
}

.pub-link {
  font-size: 0.72rem;
  padding: 0.18em 0.55em;
  border-radius: 4px;
  background: var(--tag-bg);
  color: var(--tag-text);
  text-decoration: none;
  border: 1px solid var(--border);
  transition: background 0.15s, color 0.15s;
}
.pub-link:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  text-decoration: none;
}

.pub-award {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  padding: 0.18em 0.55em;
  border-radius: 4px;
  background: #fef3c7;
  color: #92400e;
  font-weight: 600;
}
:root.dark .pub-award {
  background: #2d1b00;
  color: #fbbf24;
}

.jfa-note {
  margin-top: 1.5rem;
  font-size: 0.8rem;
  color: var(--muted);
}

/* ── Teaching ─────────────────────────────────────────────────────── */
.teaching-list {
  list-style: none;
}

.teaching-list li {
  display: flex;
  gap: 1.5rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  align-items: baseline;
}
.teaching-list li:last-child { border-bottom: none; }

.teaching-term {
  flex-shrink: 0;
  width: 80px;
  font-size: 0.8rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.teaching-code {
  font-weight: 600;
  color: var(--accent);
}

.teaching-body { flex: 1; }

.teaching-title {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 0.15rem;
}

.teaching-with {
  font-size: 0.8rem;
  color: var(--muted);
}

/* ── Section intro blurb ──────────────────────────────────────────── */
.section-intro {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 1.25rem;
  line-height: 1.7;
}

/* ── Mentorship ───────────────────────────────────────────────────── */
.mentorship-group {
  display: flex;
  gap: 1.5rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}
.mentorship-group:last-child { border-bottom: none; }

.mentorship-role {
  flex-shrink: 0;
  width: 140px;
  font-size: 0.78rem;
  color: var(--muted);
  padding-top: 0.1rem;
}

.mentorship-names {
  list-style: none;
  font-size: 0.9rem;
  line-height: 1.8;
  flex: 1;
}

/* ── Blog index ───────────────────────────────────────────────────── */
.blog-list {
  list-style: none;
}

.blog-list li {
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--border);
}
.blog-list li:last-child { border-bottom: none; }

.blog-post-title {
  font-size: 0.9375rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.blog-post-date {
  font-size: 0.78rem;
  color: var(--muted);
}

.blog-empty {
  font-size: 0.875rem;
  color: var(--muted);
  padding: 1rem 0;
}

/* ── Blog post prose ───────────────────────────────────────────────── */
.blog-post-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.blog-post-header h1 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.3;
  margin-bottom: 0.5rem;
}

.blog-post-header .post-date {
  font-size: 0.84rem;
  color: var(--muted);
}

.prose {
  font-size: 0.9375rem;
  line-height: 1.85;
}

.prose h2 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

.prose h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.prose p { margin-bottom: 1rem; }

.prose ul, .prose ol { padding-left: 1.5rem; margin-bottom: 1rem; }
.prose li { margin-bottom: 0.25rem; }

.prose code {
  font-family: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;
  font-size: 0.85em;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.1em 0.35em;
}

.prose pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin-bottom: 1rem;
}
.prose pre code { background: none; border: none; padding: 0; font-size: 0.85rem; }

.prose blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 1rem;
  color: var(--muted);
  margin: 1rem 0;
}

.prose hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }

.prose img { max-width: 100%; border-radius: 6px; margin: 1rem 0; }

/* ── Last updated ──────────────────────────────────────────────────── */
.footer-updated {
  margin-top: 0.25rem;
  font-size: 0.72rem;
}

/* ── Footer ───────────────────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--border);
  padding: 1.25rem 1.5rem;
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
  transition: border-color 0.2s;
}

footer a { color: var(--muted); text-decoration: none; }
footer a:hover { color: var(--accent); }

/* ── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 640px) {
  /* Nav: brand + actions on one row; links collapse below */
  .nav-inner {
    flex-wrap: wrap;
    height: auto;
    padding: 0.85rem 1.25rem;
    align-items: center;
  }

  .nav-brand { flex: 1; }

  #nav-toggle { display: flex; }

  nav { border-radius: 0; }

  /* Hidden by default; revealed when nav gets .nav-open */
  .nav-links {
    display: none;
    order: 3;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    border-top: 1px solid var(--border);
    margin-top: 0.6rem;
    padding-bottom: 0.25rem;
  }

  nav.nav-open .nav-links { display: flex; }

  .nav-links a {
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    white-space: normal;
  }

  .nav-links a:last-child { border-bottom: none; }

  /* Main content: tighter horizontal padding on narrow screens */
  main { padding: 2.5rem 1.25rem 3rem; }

  /* Profile: stack photo above text, centre the header block */
  .profile {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1.75rem;
  }

  .profile-identity h1 { font-size: 1.4rem; }

  /* Long prose stays left-aligned even when the block is centred */
  .profile-info .bio,
  .profile-info .interests { text-align: left; }

  /* Teaching list stacks on mobile; news list stays as a row */
  .teaching-list li {
    flex-direction: column;
    gap: 0.2rem;
  }

  .pub-list li { gap: 0.5rem; }

  body {
    border-left: none;
    border-right: none;
  }
}
