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

:root {
  --accent:   #1a56a0;
  --text:     #222;
  --muted:    #555;
  --border:   #ddd;
  --bg:       #fff;
  --bg-light: #f7f8fa;
  --max-w:    860px;
  --font:     -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
}

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

/* ── Layout ─────────────────────────────────────────────────────────────────  */
.container   { max-width: var(--max-w); margin: 0 auto; padding: 0 1.5rem; }

/* ── Header ─────────────────────────────────────────────────────────────────  */
.site-header {
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 0;
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 100;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.site-name {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}
.site-name:hover { text-decoration: none; }

.site-nav { display: flex; gap: 1.4rem; align-items: center; flex-wrap: wrap; }
.site-nav a { font-size: 0.88rem; color: var(--muted); }
.site-nav a.active,
.site-nav a:hover { color: var(--accent); }
.site-nav .cv-link {
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 0.2rem 0.6rem;
  border-radius: 3px;
  font-size: 0.82rem;
}
.site-nav .cv-link:hover { background: var(--accent); color: #fff; text-decoration: none; }

/* ── Main content ───────────────────────────────────────────────────────────  */
.page-content { padding: 2.5rem 1.5rem 4rem; }

/* ── Home / profile ─────────────────────────────────────────────────────────  */
.profile {
  display: flex;
  gap: 2.5rem;
  align-items: flex-start;
  margin-bottom: 2.5rem;
}
.profile-photo {
  flex-shrink: 0;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
}
.profile-info h1 { font-size: 1.55rem; margin-bottom: 0.2rem; }
.profile-info .affiliation { color: var(--muted); margin-bottom: 0.6rem; font-size: 0.9rem; }
.profile-links { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 0.5rem; }
.profile-links a { font-size: 0.85rem; }

/* ── Section headings ───────────────────────────────────────────────────────  */
h2.section-heading {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
  border-bottom: 2px solid var(--accent);
  padding-bottom: 0.25rem;
  margin: 2.2rem 0 1rem;
}

/* ── Publication list ───────────────────────────────────────────────────────  */
.pub-section { margin-bottom: 2.5rem; }
.pub-list    { list-style: none; }

.pub-item {
  display: flex;
  gap: 0.8rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid #eee;
}
.pub-item:last-child { border-bottom: none; }

.pub-num {
  flex-shrink: 0;
  width: 2rem;
  text-align: right;
  color: var(--muted);
  font-size: 0.82rem;
  padding-top: 0.1rem;
}
.pub-body { flex: 1; }
.pub-title {
  font-weight: 500;
  line-height: 1.4;
  margin-bottom: 0.15rem;
}
.pub-title a       { color: var(--text); }
.pub-title a:hover { color: var(--accent); text-decoration: underline; }
.pub-authors       { font-size: 0.87rem; color: var(--muted); margin-bottom: 0.1rem; }
.pub-venue         { font-size: 0.87rem; color: var(--muted); }
.pub-awards        { display: inline-block; margin-left: 0.4rem;
                     font-size: 0.78rem; font-weight: 600;
                     color: #b45309; background: #fef3c7;
                     padding: 0.05rem 0.35rem; border-radius: 3px; }
.pub-note          { font-size: 0.8rem; color: var(--muted); font-style: italic; }
.pub-links         { margin-top: 0.2rem; }
.pub-link-badge {
  display: inline-block;
  font-size: 0.75rem;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 0.05rem 0.4rem;
  border-radius: 3px;
  margin-right: 0.35rem;
  text-decoration: none;
}
.pub-link-badge:hover { background: var(--accent); color: #fff; text-decoration: none; }

/* ── Pub footnote ───────────────────────────────────────────────────────────  */
.pub-footnote { font-size: 0.82rem; color: var(--muted); margin-bottom: 1rem; }

/* ── Talks ──────────────────────────────────────────────────────────────────  */
.talk-list { list-style: none; }
.talk-item { padding: 0.6rem 0; border-bottom: 1px solid #eee; }
.talk-item:last-child { border-bottom: none; }
.talk-header { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; }
.talk-title  { font-weight: 500; }
.talk-year   { flex-shrink: 0; color: var(--muted); font-size: 0.87rem; }
.talk-venues { list-style: disc; margin: 0.3rem 0 0 1.2rem; }
.talk-venues li { font-size: 0.88rem; color: var(--muted); }

/* ── Students ───────────────────────────────────────────────────────────────  */
.student-list { list-style: none; }
.student-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.45rem 0;
  border-bottom: 1px solid #eee;
  gap: 1rem;
  flex-wrap: wrap;
}
.student-item:last-child { border-bottom: none; }
.student-name   { font-weight: 500; }
.student-degree { font-size: 0.87rem; color: var(--muted); }
.student-years  { flex-shrink: 0; font-size: 0.87rem; color: var(--muted); }

/* ── Teaching ───────────────────────────────────────────────────────────────  */
.teaching-group  { margin-bottom: 1.8rem; }
.teaching-group h3 { font-size: 1rem; font-weight: 600; margin-bottom: 0.7rem; color: var(--text); }
.course-list   { list-style: none; }
.course-item   { padding: 0.5rem 0; border-bottom: 1px solid #eee; }
.course-item:last-child { border-bottom: none; }
.course-header { display: flex; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; }
.course-name   { font-weight: 500; }
.course-meta   { font-size: 0.87rem; color: var(--muted); }
.course-desc   { font-size: 0.87rem; color: var(--muted); margin-top: 0.15rem; }

/* ── Service ────────────────────────────────────────────────────────────────  */
.service-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}
.service-table th {
  text-align: left;
  border-bottom: 2px solid var(--border);
  padding: 0.3rem 0.5rem 0.3rem 0;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.service-table td { padding: 0.35rem 0.5rem 0.35rem 0; border-bottom: 1px solid #eee; }
.service-table tr:last-child td { border-bottom: none; }

/* ── Group photo (students page) ────────────────────────────────────────────  */
.group-photo-wrap {
  margin-bottom: 2rem;
}
.group-photo {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  object-position: center top;
  border-radius: 6px;
  border: 1px solid var(--border);
  display: block;
}
.group-photo-caption {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 0.4rem;
  font-style: italic;
}

/* ── Photos ─────────────────────────────────────────────────────────────────  */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.2rem;
  margin-bottom: 2rem;
}
.photo-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border);
  display: block;
}
.photo-caption {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 0.35rem;
  line-height: 1.4;
}
.photo-event {
  font-style: italic;
}

/* ── News feed ───────────────────────────────────────────────────────────────  */
.news-list {
  list-style: none;
  margin: 0.5rem 0 1rem;
  padding: 0;
}
.news-item {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  flex-wrap: wrap;
}
.news-item:last-child { border-bottom: none; }
.news-date {
  flex-shrink: 0;
  min-width: 5.5rem;
  color: var(--muted);
  font-size: 0.82rem;
}
.news-badge {
  flex-shrink: 0;
  display: inline-block;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.news-badge--paper   { background: #dbeafe; color: #1e40af; }
.news-badge--award   { background: #fef3c7; color: #92400e; }
.news-badge--hiring  { background: #ede9fe; color: #5b21b6; }
.news-badge--student { background: #d1fae5; color: #065f46; }
.news-badge--talk    { background: #e0f2fe; color: #0369a1; }
.news-badge--other   { background: var(--bg-light); color: var(--muted); }
.news-text { flex: 1; }

/* ── Topic filters ───────────────────────────────────────────────────────────  */
.topic-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin: 1rem 0 1.5rem;
}
.topic-filter-label {
  font-size: 0.85rem;
  color: var(--muted);
  margin-right: 0.25rem;
}
.topic-btn {
  padding: 0.25rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.topic-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.topic-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ── Stats page ─────────────────────────────────────────────────────────────  */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 1.5rem 0 2rem;
}
.stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.2rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-light);
  text-align: center;
}
.stat-number {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}
.stat-label {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 0.35rem;
}
.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin: 1rem 0 1.5rem;
}
.stats-table th {
  text-align: left;
  padding: 0.4rem 0.75rem;
  border-bottom: 2px solid var(--border);
  font-weight: 600;
  color: var(--muted);
}
.stats-table td {
  padding: 0.35rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.stats-table tr:last-child td { border-bottom: none; }
@media (max-width: 600px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Footer ─────────────────────────────────────────────────────────────────  */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.2rem 0;
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
}

/* ── Responsive ─────────────────────────────────────────────────────────────  */
@media (max-width: 600px) {
  .profile { flex-direction: column; }
  .profile-photo { width: 120px; height: 120px; }
  .pub-item { flex-direction: column; gap: 0.3rem; }
  .pub-num  { text-align: left; width: auto; }
}
