:root {
  --bg: #f8fafc;
  --bg-secondary: #f1f5f9;
  --text: #0f172a;
  --text-muted: #64748b;
  --card-bg: rgba(255, 255, 255, 0.7);
  --card-border: rgba(226, 232, 240, 0.8);
  --brand: #3b82f6;
  --brand-hover: #2563eb;
  --brand-light: #eff6ff;
  --shadow-color: rgba(59, 130, 246, 0.1);

  /* ── Design System Accents ───────────────────────────────────────────── */
  --accent-purple: #8b5cf6;
  --accent-purple-light: rgba(139, 92, 246, 0.12);
  --accent-purple-text: #5b21b6;
  --accent-green: #10b981;
  --accent-green-light: rgba(16, 185, 129, 0.12);
  --accent-green-text: #065f46;
  --accent-amber: #f59e0b;
  --accent-amber-light: rgba(245, 158, 11, 0.12);
  --accent-amber-text: #92400e;
  --accent-pink: #ec4899;
  --accent-pink-light: rgba(236, 72, 153, 0.12);
  --accent-pink-text: #9d174d;
  --pub-category-text: #334155;
  --error-bg: #fee;
  --error-text: #900;

  /* ── Radius tokens ───────────────────────────────────────────────────── */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-ms: 8px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --radius-full: 999px;

  /* ── Typography tokens ─────────────────────────────────────────────────── */
  --font-sans: 'Figtree', ui-sans-serif, system-ui, sans-serif;
  --font-display: 'Bricolage Grotesque', var(--font-sans);
  --font-mono: 'Fragment Mono', 'Fira Mono', ui-monospace, monospace;

  /* Type scale — major-third ratio (×1.25) */
  --text-xs:      0.72rem;   /* fine meta, status labels          */
  --text-sm:      0.875rem;  /* secondary UI, filters, metadata   */
  --text-base:    1.0625rem; /* body                              */
  --text-lg:      1.25rem;   /* lead / tagline                    */
  --text-xl:      1.75rem;   /* section headings (h2)             */
  --text-display: clamp(2.25rem, 5vw, 3.75rem); /* h1 name        */
}

:root[data-theme='dark'] {
  --bg: #0b1120;
  --bg-secondary: #0f172a;
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --card-bg: rgba(30, 41, 59, 0.6);
  --card-border: rgba(51, 65, 85, 0.6);
  --brand: #60a5fa;
  --brand-hover: #93c5fd;
  --brand-light: rgba(59, 130, 246, 0.1);
  --shadow-color: rgba(0, 0, 0, 0.4);

  /* ── Design System Accents (Dark) ────────────────────────────────────── */
  --accent-purple: #a78bfa;
  --accent-purple-light: rgba(139, 92, 246, 0.2);
  --accent-purple-text: #c084fc;
  --accent-green: #34d399;
  --accent-green-light: rgba(52, 211, 153, 0.15);
  --accent-green-text: #34d399;
  --accent-amber: #fbbf24;
  --accent-amber-light: rgba(245, 158, 11, 0.2);
  --accent-amber-text: #fbbf24;
  --accent-pink: #f472b6;
  --accent-pink-light: rgba(236, 72, 153, 0.2);
  --accent-pink-text: #f472b6;
  --pub-category-text: #94a3b8;
  --error-bg: rgba(239, 68, 68, 0.15);
  --error-text: #fca5a5;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-optical-sizing: auto;
  font-kerning: normal;
  color: var(--text);
  background-color: var(--bg);
  background-image: radial-gradient(circle at top right, var(--bg-secondary) 0%, var(--bg) 60%);
  background-attachment: fixed;
  line-height: 1.65;
  transition: background-color 0.4s ease, color 0.4s ease;
}

h1, h2, h3, h4, .brand, .eyebrow {
  font-family: var(--font-display);
  text-wrap: balance;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 6vw;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  border-bottom: 1px solid var(--card-border);
  transition: background 0.4s ease, border-color 0.4s ease;
}

.brand {
  color: var(--brand);
  font-weight: 600;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.desktop-nav {
  display: flex;
  gap: 1.2rem;
  flex-wrap: wrap;
}

.desktop-nav a {
  text-decoration: none;
  font-family: var(--font-sans);
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: color 0.2s ease;
}

.desktop-nav a:hover {
  color: var(--brand);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

#menu-toggle {
  display: none; /* Hidden on desktop viewports */
}

/* ── Mobile menu popover drawer ───────────────────────────────────────────── */

.mobile-menu {
  /* Reset default popover positioning and appearance */
  border: none;
  padding: 1.5rem 2rem;
  margin: 0 0 0 auto; /* Align to the right edge */
  width: min(300px, 80vw);
  height: 100dvh;
  max-height: 100dvh;
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-left: 1px solid var(--card-border);
  box-shadow: -10px 0 30px var(--shadow-color);
  
  display: flex;
  flex-direction: column;
  gap: 2rem;
  box-sizing: border-box;

  /* Transition using allow-discrete for entry/exit animation */
  transition: 
    transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), 
    overlay 0.4s allow-discrete, 
    display 0.4s allow-discrete;
  transform: translateX(100%);
}

.mobile-menu:popover-open {
  transform: translateX(0);
}

@starting-style {
  .mobile-menu:popover-open {
    transform: translateX(100%);
  }
}

/* Backdrop */
.mobile-menu::backdrop {
  background: rgba(15, 23, 42, 0.3);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: 
    opacity 0.4s ease, 
    overlay 0.4s allow-discrete, 
    display 0.4s allow-discrete;
}

.mobile-menu:popover-open::backdrop {
  opacity: 1;
}

@starting-style {
  .mobile-menu:popover-open::backdrop {
    opacity: 0;
  }
}

.mobile-menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--card-border);
  padding-bottom: 0.75rem;
}

.mobile-menu-title {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

#menu-close {
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s ease;
}

#menu-close:hover {
  background: var(--bg-secondary);
  color: var(--brand);
}

.mobile-nav {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.mobile-nav a {
  text-decoration: none;
  font-family: var(--font-sans);
  color: var(--text);
  font-size: var(--text-base);
  font-weight: 500;
  padding: 0.5rem 0;
  border-bottom: 1px solid transparent;
  transition: all 0.2s ease;
  display: inline-block;
}

.mobile-nav a:hover {
  color: var(--brand);
  padding-left: 4px;
}

#theme-toggle {
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  color: var(--text);
  border-radius: 50%;
  width: 2.5rem;
  height: 2.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

#theme-toggle:hover {
  transform: rotate(15deg) scale(1.1);
  border-color: var(--brand);
}

.layout {
  width: min(1000px, 92vw);
  margin: 4rem auto 6rem; /* Generous top/bottom layout spacing */
  display: grid;
  gap: 2.5rem; /* Better breathing room between cards */
}

.card {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 2.5rem; /* Generous padding */
  box-shadow: 0 4px 12px var(--shadow-color);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.4s ease;
}

/* Scroll-triggered reveal layout */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.hero.card:hover {
  box-shadow: 0 10px 30px var(--shadow-color);
}

.hero {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 3.5rem;
  align-items: center;
  padding: 3rem 2.5rem;
}

.hero-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.eyebrow {
  color: var(--brand);
  font-weight: 600;
  margin: 0;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-size: 0.85rem;
}

h1 {
  margin: 0.5rem 0;
  font-size: var(--text-display);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.025em;
}

.tagline {
  margin: 0 0 1.5rem 0;
  color: var(--text-muted);
  font-size: var(--text-lg);
  font-weight: 400;
  line-height: 1.5;
}

.bio {
  margin: 0;
  font-size: var(--text-base);
  max-width: 65ch;
  line-height: 1.75;
}

.hero-links {
  margin-top: 2rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.hero-links a {
  text-decoration: none;
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: var(--text-sm);
  border: 1px solid var(--card-border);
  border-radius: 999px;
  padding: 0.6rem 1.2rem;
  color: var(--text);
  background: var(--card-bg);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.hero-links a:hover {
  border-color: var(--brand);
  color: white;
  background: var(--brand);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow-color);
}

.hero-photo-wrap {
  position: relative;
  display: flex;
  justify-content: center;
}

.photo-glow {
  position: absolute;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--brand), var(--accent-purple));
  filter: blur(40px);
  opacity: 0.15;
  border-radius: var(--radius-lg);
  z-index: 0;
}

#profile-photo {
  position: relative;
  z-index: 1;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: var(--radius-lg);
  border: 2px solid var(--card-border);
  box-shadow: 0 12px 24px var(--shadow-color);
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

#profile-photo:hover {
  transform: scale(1.03);
}

h2 {
  margin: 0 0 1rem 0;
  font-size: var(--text-xl);
  font-weight: 600;
  letter-spacing: -0.015em;
}

.muted {
  color: var(--text-muted);
  margin: 0;
}

.pill-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.pill-list li {
  border: 1px solid var(--card-border);
  border-radius: var(--radius-ms);
  padding: 0.5rem 1.2rem;
  background: var(--brand-light);
  color: var(--brand);
  font-weight: 500;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s ease;
}

.pill-list li:hover {
  border-color: var(--brand);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px var(--shadow-color);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--card-border);
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
}

.head-left {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.head-left h2 {
  margin: 0;
  border: none;
  padding: 0;
}

.view-all-link {
  color: var(--brand);
  text-decoration: none;
  font-weight: 600;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: all 0.2s ease;
}

.view-all-link:hover {
  color: var(--brand-hover);
}

.view-all-link .arrow {
  transition: transform 0.2s ease;
}

.view-all-link:hover .arrow {
  transform: translateX(4px);
}

.pub-filters {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.filter-btn {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--text-muted);
  padding: 0.4rem 1rem;
  border-radius: var(--radius-full);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.filter-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
  transform: translateY(-1px);
}

.filter-btn.active {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
  box-shadow: 0 4px 12px var(--shadow-color);
}

.pub-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.pub-card {
  border: none;
  border-bottom: 1px solid var(--card-border);
  border-radius: 0;
  padding: 1.25rem 1rem;
  margin: 0 -1rem;
  background: transparent;
  box-shadow: none;
  transition: background-color 0.2s ease, border-color 0.2s ease;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.pub-card:last-child {
  border-bottom: none;
}

.pub-card:hover {
  background-color: var(--brand-light);
  border-radius: var(--radius-ms);
  border-bottom-color: transparent;
}

.pub-card h3 {
  margin: 0 0 0.5rem 0;
  font-size: var(--text-base);
  line-height: 1.4;
}

.pub-card h3 a {
  color: var(--text);
  text-decoration: none;
  transition: color 0.2s ease;
}

.pub-card h3 a:hover {
  color: var(--brand);
}

.pub-category {
  display: inline-block;
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 400;
  color: var(--pub-category-text);
  background: var(--bg-secondary);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-xs);
  margin-bottom: 0.5rem;
  width: fit-content;
}

.pub-meta {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.pub-links {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.8rem;
  flex-wrap: wrap;
}

.pub-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: var(--text-xs);
  font-family: var(--font-sans);
  font-weight: 600;
  color: var(--brand);
  background: var(--brand-light);
  padding: 0.25rem 0.7rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.2s ease, color 0.2s ease;
}

.pub-link:hover {
  background: var(--brand);
  color: white;
  transform: translateY(-2px);
}

ul {
  padding-left: 1.5rem;
}

ul li {
  margin-bottom: 0.5rem;
}

ul li strong {
  color: var(--text);
  font-weight: 600;
}

footer {
  width: min(1000px, 92vw);
  margin: 0 auto 3rem;
  text-align: center;
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-family: var(--font-sans);
}

/* ─── Shared section utilities ─────────────────────────────────────────────── */

.section-intro {
  margin: -0.25rem 0 0;
  color: var(--text-muted);
  font-size: 0.93rem;
}

.year-label {
  margin: 0 0 0.9rem 0;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 400;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.group-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-light);
  color: var(--brand);
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  letter-spacing: 0;
}

.item-link {
  color: var(--brand);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  font-family: var(--font-sans);
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  transition: color 0.2s ease;
}

.item-link:hover { color: var(--brand-hover); }

.item-link:hover .arrow {
  transform: translateX(3px);
}

.item-link .arrow {
  display: inline-block;
  transition: transform 0.2s ease;
}

/* ─── Teaching ──────────────────────────────────────────────────────────────── */

.content-year-group {
  margin-bottom: 2rem;
}

.content-year-group:last-child {
  margin-bottom: 0;
}

.teaching-cards {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.teaching-card {
  border: none;
  border-bottom: 1px solid var(--card-border);
  border-radius: 0;
  padding: 1.25rem 1rem;
  margin: 0 -1rem;
  background: transparent;
  box-shadow: none;
  transition: background-color 0.2s ease, border-color 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-width: 0;
  min-height: 0;
}

.teaching-card:last-child {
  border-bottom: none;
}

.teaching-card:hover {
  background-color: var(--brand-light);
  border-radius: var(--radius-ms);
  border-bottom-color: transparent;
}

.teaching-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.2rem;
}

.teaching-type {
  display: inline-block;
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 400;
  padding: 0.22rem 0.55rem;
  border-radius: var(--radius-sm);
}

.teaching-type[data-type="lab"],
.teaching-type[data-type="exercise"]  { color: var(--accent-purple-text); background: var(--accent-purple-light); }
.teaching-type[data-type="course"],
.teaching-type[data-type="lecture"]   { color: var(--brand); background: var(--brand-light); }
.teaching-type[data-type="seminar"]   { color: var(--accent-green-text); background: var(--accent-green-light); }
.teaching-type[data-type="workshop"]  { color: var(--accent-amber-text); background: var(--accent-amber-light); }
.teaching-type[data-type="tutoring"]  { color: var(--accent-pink-text); background: var(--accent-pink-light); }

.teaching-hours {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  background: var(--bg-secondary);
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  margin-left: auto;
}

.teaching-title {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
}

.teaching-role {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--brand);
  font-weight: 500;
  font-family: var(--font-sans);
}

.teaching-meta {
  margin: 0;
  font-size: 0.84rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0;
}

.teaching-meta span + span::before {
  content: ' · ';
  white-space: pre;
}

.teaching-description {
  margin: 0.15rem 0 0;
  font-size: 0.87rem;
  color: var(--text-muted);
  line-height: 1.6;
  flex: 1;
}

/* ─── Student Supervision ───────────────────────────────────────────────────── */

.students-group {
  margin-bottom: 2rem;
}

.students-group:last-child {
  margin-bottom: 0;
}

.students-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.student-card {
  border: none;
  border-bottom: 1px solid var(--card-border);
  border-radius: 0;
  padding: 1.25rem 1rem;
  margin: 0 -1rem;
  background: transparent;
  box-shadow: none;
  transition: background-color 0.2s ease, border-color 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-width: 0;
  min-height: 0;
}

.student-card:last-child {
  border-bottom: none;
}

.student-card:hover {
  background-color: var(--brand-light);
  border-radius: var(--radius-ms);
  border-bottom-color: transparent;
}

.student-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.2rem;
}

.student-degree {
  display: inline-block;
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 400;
  padding: 0.22rem 0.55rem;
  border-radius: var(--radius-sm);
}

.student-degree[data-degree="bachelor"] { color: var(--accent-green-text); background: var(--accent-green-light); }
.student-degree[data-degree="master"]   { color: var(--accent-amber-text); background: var(--accent-amber-light); }
.student-degree[data-degree="phd"]      { color: var(--accent-purple-text); background: var(--accent-purple-light); }

.student-status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  font-weight: 400;
  color: var(--text-muted);
  margin-left: auto;
}

.student-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

.student-status[data-status="ongoing"] .student-status-dot {
  background: var(--accent-green);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent-green) 50%, transparent);
  animation: pulse-dot 2.2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent-green) 50%, transparent); }
  60%  { box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent-green) 0%, transparent); }
  100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent-green) 0%, transparent); }
}

.student-name {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text);
}

.student-topic {
  margin: 0;
  font-size: 0.92rem;
  font-style: italic;
  color: var(--text);
  line-height: 1.45;
}

.student-description {
  margin: 0.1rem 0 0;
  font-size: 0.87rem;
  color: var(--text-muted);
  line-height: 1.6;
  flex: 1;
}

.student-cosup {
  margin: 0.1rem 0 0;
  font-size: 0.84rem;
  color: var(--text-muted);
}

.student-cosup-label {
  font-weight: 600;
  color: var(--text);
}

.student-cosup a {
  color: var(--brand);
  text-decoration: none;
  transition: color 0.2s ease;
}

.student-cosup a:hover {
  color: var(--brand-hover);
}

.student-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid var(--card-border);
}

.student-year {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.student-footer-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.student-grade {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  color: var(--brand);
}

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    text-align: center;
    padding: 2rem 1rem;
  }
  
  .hero-content {
    order: 2;
  }
  
  .hero-photo-wrap {
    order: 1;
    max-width: 250px;
    margin: 0 auto;
  }
  
  .hero-links {
    justify-content: center;
  }
  
  .desktop-nav {
    display: none;
  }
  
  #menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text);
    border-radius: var(--radius-ms);
    width: 2.5rem;
    height: 2.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
  }
  
  #menu-toggle:hover {
    border-color: var(--brand);
    background: var(--brand-light);
    color: var(--brand);
  }
}

@media (max-width: 600px) {
  .card {
    padding: 1.25rem;
    border-radius: var(--radius-md);
  }
  .hero {
    padding: 2rem 1.25rem;
  }
  .layout {
    margin: 1.5rem auto 3rem;
    gap: 1rem;
  }
}

/* ── Keyboard focus indicators ─────────────────────────────────────────────── */

/* Remove browser default outline; replace with a consistent branded indicator.
   :focus-visible fires only for keyboard navigation, not mouse clicks. */
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
}

.desktop-nav a:focus-visible,
.mobile-nav a:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 4px;
  border-radius: var(--radius-xs);
}

#menu-toggle:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
  border-radius: var(--radius-ms);
}

#menu-close:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.filter-btn:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
  border-radius: var(--radius-full);
}

.hero-links a:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
  border-radius: var(--radius-full);
}

#theme-toggle:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 4px;
  border-radius: var(--radius-full);
}

.pub-link:focus-visible,
.item-link:focus-visible,
.view-all-link:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
  border-radius: var(--radius-xs);
}

/* ── Reduced motion ───────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }

  /* Pulse animation on ongoing student cards */
  @keyframes pulse-dot {
    0%, 100% { box-shadow: none; }
  }

  /* Theme toggle rotation */
  #theme-toggle:hover {
    transform: none;
  }

  /* Pub/teaching/student card hover — keep the border-color signal, skip the motion */
  .pub-card:hover,
  .teaching-card:hover,
  .student-card:hover {
    transform: none;
  }

  /* Hero links hover — keep the color/bg change, skip the lift */
  .hero-links a:hover {
    transform: none;
  }

  /* Suppress mobile menu transitions and backdrop transitions */
  .mobile-menu {
    transition: none !important;
    transform: none !important;
  }

  .mobile-menu:not(:popover-open) {
    display: none !important;
  }

  .mobile-menu::backdrop {
    transition: none !important;
  }
}

.error-banner {
  padding: 1rem;
  background: var(--error-bg);
  color: var(--error-text);
  border-radius: var(--radius-ms);
  margin-bottom: 1.5rem;
  border: 1px solid color-mix(in srgb, var(--error-text) 20%, transparent);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
}

/* Prevent CLS (Layout Shift) by hiding optional/dynamic sections by default before JS load */
#cv,
#projects,
#students,
#publications,
#teaching {
  display: none;
}
