:root {
  --ink: #1c2b39;
  --paper: #faf9f7;
  --paper-2: #efece6;
  --verdigris: #4e565d;
  --verdigris-dim: #7d848a;
  --brass: #b10e10;
  --text: #24303a;
  --text-soft: #5b6570;
  --line: #d7d1bf;
  --font-display: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --max: 920px;

  /* Type scale — four sizes, everything on the site uses one of them. */
  --text-sm: 14.5px;
  --text-base: 16px;
  --text-lg: 19px;
  --text-xl: clamp(28px, 4.2vw, 42px);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; 
  background: var(--paper); 
  color: var(--text);
  font-family: var(--font-body); 
  line-height: 1.55; 
  -webkit-font-smoothing: antialiased;
}

/* ---------- ACCESSIBILITY & LINKS ---------- */
a {
  color: var(--verdigris);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
a:hover {
  color: var(--brass);
  text-decoration-color: var(--brass);
}
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--brass); 
  outline-offset: 3px;
}

/* Optimized: Uses GPU transform instead of layout-thrashing 'top' property */
.skip-link {
  position: absolute;
  top: 0;
  left: 16px;
  background: var(--brass);
  color: #ffffff;
  padding: 8px 14px;
  z-index: 100;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  text-decoration: none;
  border-radius: 0 0 4px 4px;
  transform: translateY(-100%);
  transition: transform 0.15s ease;
}
.skip-link:focus {
  transform: translateY(0);
  outline: 2px solid var(--ink);
}

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 28px; }

/* ---------- MASTHEAD & STICKY NAV ---------- */
header.masthead { padding: 22px 0 0; background: var(--paper-2); }
.masthead-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-bottom: 18px; }
.institution-badges { display: flex; align-items: center; gap: 14px; }
.institution-badges .logo-box { width: 231px; height: 78px; display: flex; align-items: center; justify-content: center; }
.institution-badges .logo-box img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; opacity: .85; filter: saturate(.75); }

.name-row { padding: 6px 0 26px; }
.name-block h1 {
  display: inline; font-family: var(--font-display); font-weight: 600; font-size: var(--text-lg);
  margin: 0; letter-spacing: .01em; color: var(--ink);
}
.name-block .role { display: inline; font-size: var(--text-base); color: var(--text-soft); }
.name-block .role::before { content: " — "; }
.name-block .role a { border-bottom: 1px solid var(--line); }

nav.primary {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--paper-2);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  width: 100%;
}
nav.primary ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2px 6px; }
nav.primary a {
  display: inline-block; padding: 13px 14px; font-family: var(--font-mono); font-size: var(--text-sm);
  letter-spacing: .06em; text-transform: uppercase; color: var(--text); text-decoration: none;
  border-bottom: 2px solid transparent;
}
nav.primary a:hover { color: var(--ink); border-bottom-color: var(--line); }
nav.primary a.active { color: var(--brass); border-bottom-color: var(--brass); font-weight: 700; }

/* ---------- LAYOUT ---------- */
main.layout { padding: 40px 0 70px; }

.page-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 14px; margin-bottom: 8px; }
.page-head h2 { font-family: var(--font-display); font-size: var(--text-xl); margin: 0; color: var(--ink); font-weight: 600; }
.page-head .count {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-soft);
  margin-left: auto;
}
.page-sub { color: var(--text-soft); font-size: var(--text-base); max-width: 68ch; margin: 6px 0 28px; }

.contact-list { list-style: none; margin: 0; padding: 0; font-size: var(--text-base); display: flex; flex-wrap: wrap; }
.contact-list li { color: var(--text-soft); margin: 0 48px 20px 0; }
.contact-list li:last-child { margin-right: 0; }
.contact-list strong { display: block; color: var(--text); font-weight: 600; font-size: var(--text-sm); margin-bottom: 4px; }
@media (max-width:560px) { .contact-list li { margin-right: 28px; } }

/* ---------- SECTION TITLES & PROSE ---------- */
section { margin-bottom: 56px; }
section > h2.section-title {
  font-family: var(--font-mono); font-size: var(--text-sm); letter-spacing: .14em; text-transform: uppercase;
  color: var(--brass); margin: 0 0 16px; display: flex; align-items: center; gap: 12px;
}
section > h2.section-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }

section > p { font-size: var(--text-base); max-width: 68ch; color: var(--text); }
section > p + p { margin-top: 14px; }
.aside-note { font-size: var(--text-base); color: var(--text-soft); border-left: 2px solid var(--line); padding-left: 14px; margin-top: 20px; max-width: 68ch; }

/* Supervision Keywords Tags */
.keyword-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.keyword-tags span {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-soft);
  background: var(--paper-2);
  border: 1px solid var(--line);
  padding: 3px 9px;
  border-radius: 4px;
  user-select: none;
}

/* ---------- BOOK QUOTE ---------- */
.book-quote { border-left: 3px solid var(--brass); padding: 2px 0 2px 22px; margin: 0 0 48px; }
.book-quote-text {
  font-family: var(--font-display); font-style: italic; font-size: var(--text-base); color: var(--ink);
  line-height: 1.5; margin: 0 0 8px; max-width: 108ch;
}
.book-quote-attribution {
  font-family: var(--font-display); font-size: var(--text-base); color: var(--text-soft); letter-spacing: .03em; margin: 0;
}

.about-body { display: flex; gap: 32px; align-items: flex-start; flex-wrap: wrap; }
.about-body p { flex: 1; min-width: 280px; font-size: var(--text-base); max-width: 68ch; color: var(--text); margin: 0; }
.about-body .monogram {
  width: 120px; height: 120px; border-radius: 50%; background: var(--ink); color: var(--paper);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  font-family: var(--font-display); font-size: 40px; letter-spacing: .04em;
}
.about-body .avatar {
  width: 120px; height: 120px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
  border: 1px solid var(--line); display: block;
}
@media (max-width:560px) { .about-body { flex-direction: column-reverse; gap: 20px; } }

/* ---------- EVENT LIST ---------- */
.event-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.event { display: grid; grid-template-columns: 96px 1fr; gap: 18px; padding: 16px 4px; border-bottom: 1px solid var(--line); }
.event:last-child { border-bottom: none; }
.event .when { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--verdigris); line-height: 1.5; }
.event h3 { margin: 0 0 4px; font-family: var(--font-display); font-size: var(--text-lg); font-weight: 600; color: var(--ink); }
.event h3 a { 
  color: var(--ink); 
  text-decoration: underline; 
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
.event h3 a:hover { 
  color: var(--brass); 
  text-decoration-thickness: 2px;
}
.event .loc { font-size: var(--text-base); color: var(--text-soft); margin: 0 0 4px; }
.event .deadline {
  display: inline-block; font-family: var(--font-mono); font-size: var(--text-sm); letter-spacing: .03em; color: var(--brass);
  background: rgba(177,14,16,.08); border: 1px solid rgba(177,14,16,.3); border-radius: 3px; padding: 2px 7px; margin-top: 4px;
}
.event .role-tag {
  display: inline-block; font-family: var(--font-mono); font-size: var(--text-sm); letter-spacing: .04em; text-transform: uppercase;
  color: var(--verdigris); border: 1px solid var(--line); border-radius: 3px; padding: 2px 7px; margin-top: 4px;
}
.event.past h3 { color: var(--text-soft); }
.event.past { opacity: .75; }
@media (max-width:520px) { .event { grid-template-columns: 1fr; gap: 4px; } }

/* ---------- CONTROLS (PAPERS FILTER & SEARCH) ---------- */
.controls {
  position: sticky;
  top: 45px;
  z-index: 95;
  background: var(--paper);
  display: flex; 
  align-items: center; 
  justify-content: space-between; 
  gap: 16px; 
  flex-wrap: wrap;
  padding: 14px 0; 
  border-top: 1px solid var(--line); 
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
}
.filter-group { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.filter-label {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 3px 9px;
  margin-right: 6px;
  user-select: none;
}

.filter-tabs { display: flex; gap: 2px; flex-wrap: wrap; }

.filter-tabs button {
  font-family: var(--font-mono); 
  font-size: var(--text-sm); 
  letter-spacing: .04em; 
  text-transform: uppercase;
  background: transparent; 
  border: none; 
  border-bottom: 2px solid transparent; 
  color: var(--text-soft);
  padding: 4px 10px; 
  cursor: pointer;
  transition: none; /* Instant snap, zero CSS engine overhead */
}

/* Optimized: Uses subtle text-shadow to simulate weight without shifting button dimensions */
.filter-tabs button.active { 
  color: var(--ink); 
  border-bottom-color: var(--brass); 
  text-shadow: 0 0 0.4px var(--ink); 
}

.search-box { position: relative; }
.search-box input {
  font-family: var(--font-body); font-size: var(--text-base); padding: 8px 14px 8px 32px;
  border: 1px solid var(--line); border-radius: 20px; background: var(--paper-2);
  color: var(--text); width: 220px; max-width: 100%;
}
.search-box::before {
  content: "⌕"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-soft); font-size: var(--text-base); pointer-events: none;
}

/* ---------- EVENT SERIES ---------- */
.series-list { display: flex; flex-direction: column; gap: 2px; margin-top: 16px; }
.series-row {
  display: grid; grid-template-columns: 130px 1fr; gap: 18px;
  padding: 16px 4px; border-bottom: 1px solid var(--line);
}
.series-row:last-child { border-bottom: none; }
.series-abbr { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--verdigris); letter-spacing: .04em; }
.series-full { font-family: var(--font-display); font-size: var(--text-base); font-weight: 600; color: var(--ink); margin: 0 0 6px; }
.series-editions { font-size: var(--text-sm); color: var(--text-soft); margin: 0; line-height: 1.7; }
.series-editions a { color: var(--text-soft); }
.series-editions a:hover { color: var(--brass); }
@media (max-width:560px) { .series-row { grid-template-columns: 1fr; gap: 6px; } }

/* ---------- PAPERS LIST ---------- */
.year-group { margin-top: 30px; }
.year-heading {
  font-family: var(--font-mono); font-size: var(--text-sm); color: var(--brass); letter-spacing: .08em;
  display: flex; align-items: center; gap: 12px; margin-bottom: 6px;
}
.year-heading::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.paper { display: grid; grid-template-columns: 88px 1fr; gap: 16px; padding: 16px 4px; border-bottom: 1px solid var(--line); }
.paper:last-child { border-bottom: none; }
.paper .tag {
  font-family: var(--font-mono); font-size: var(--text-sm); letter-spacing: .05em; text-transform: uppercase;
  color: var(--verdigris); border: 1px solid var(--line); border-radius: 3px; padding: 3px 6px; height: fit-content; text-align: center;
}
.paper .tag.conference { color: var(--brass); }
.paper .tag.book { color: #7a5ea8; }
.paper .tag.thesis { color: var(--text-soft); }
.paper h3 { margin: 0 0 5px; font-family: var(--font-display); font-weight: 600; font-size: var(--text-lg); color: var(--ink); }
.paper .meta { font-size: var(--text-base); color: var(--text-soft); }
.paper .venue { color: var(--text); }
.paper .links { margin-top: 6px; display: flex; gap: 14px; }
.paper .links a { font-family: var(--font-mono); font-size: var(--text-sm); letter-spacing: .03em; }

/* Optimized: Strips transitions from hidden elements to prevent invisible layout loops */
.paper.hidden { 
  display: none !important; 
  transition: none !important; 
  animation: none !important; 
}

/* BibTeX Code Viewer */
details.bibtex-toggle {
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}
details.bibtex-toggle summary {
  cursor: pointer;
  color: var(--verdigris);
  user-select: none;
}
details.bibtex-toggle summary:hover {
  color: var(--brass);
}
pre.bibtex-code {
  background: var(--paper-2);
  border: 1px solid var(--line);
  padding: 12px;
  border-radius: 4px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text);
  margin: 8px 0 0;
  white-space: pre-wrap;
}

@media (max-width:560px) {
  .paper { grid-template-columns: 1fr; gap: 6px; }
  .controls { flex-direction: column; align-items: stretch; }
  .search-box input { width: 100%; }
}

/* ---------- TEACHING: COURSE CARDS ---------- */
.course-list { display: flex; flex-direction: column; gap: 2px; }
.course { display: grid; grid-template-columns: 130px 1fr; gap: 18px; padding: 20px 4px; border-bottom: 1px solid var(--line); }
.course:last-child { border-bottom: none; }
.course .term { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--verdigris); line-height: 1.5; }
.course .term .level {
  display: inline-block; margin-top: 6px; font-size: var(--text-sm); letter-spacing: .04em; text-transform: uppercase;
  color: var(--brass); border: 1px solid var(--line); border-radius: 3px; padding: 2px 6px;
}
.course h3 { margin: 0 0 6px; font-family: var(--font-display); font-size: var(--text-lg); font-weight: 600; color: var(--ink); }
.course p.desc { font-size: var(--text-base); color: var(--text); max-width: 68ch; margin: 0 0 8px; }
.course .links { display: flex; gap: 14px; flex-wrap: wrap; }
.course .links a { font-family: var(--font-mono); font-size: var(--text-sm); letter-spacing: .03em; }
@media (max-width:560px) { .course { grid-template-columns: 1fr; gap: 6px; } }

/* ---------- FOOTER (SHARED) ---------- */
footer { border-top: 1px solid var(--line); padding: 28px 0 40px; font-size: var(--text-sm); color: var(--text-soft); }
footer .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

/* ---------- INDIVIDUAL COURSE PAGES ---------- */
.course-subnav {
  display: flex; flex-wrap: wrap; gap: 2px 4px;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: 8px;
}
.course-subnav a {
  display: inline-block; padding: 12px 14px; font-family: var(--font-mono); font-size: var(--text-sm);
  letter-spacing: .06em; text-transform: uppercase; color: var(--text-soft); text-decoration: none;
  border-bottom: 2px solid transparent;
}
.course-subnav a:hover { color: var(--ink); border-bottom-color: var(--brass); text-decoration: none; }

.prose { max-width: 68ch; }
.prose p { font-size: var(--text-base); color: var(--text); margin: 0 0 14px; }
.prose p:last-child { margin-bottom: 0; }
.prose ol, .prose ul { font-size: var(--text-base); color: var(--text); margin: 0 0 14px; padding-left: 1.4em; }
.prose li { margin-bottom: 10px; line-height: 1.6; }
.prose li:last-child { margin-bottom: 0; }
.prose a { border-bottom: 1px solid var(--line); }
.prose a:hover { border-color: var(--brass); }
.prose .label {
  display: block; font-family: var(--font-mono); font-size: var(--text-sm); letter-spacing: .1em; text-transform: uppercase;
  color: var(--brass); margin: 28px 0 10px;
}
.prose .label:first-child { margin-top: 0; }
.course-meta { font-size: var(--text-base); color: var(--text-soft); margin: 0 0 4px; }
.course-meta a { border-bottom: 1px solid var(--line); }

/* ---------- DARK MODE ---------- */
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #f0f6fc;
    --paper: #0d1117;
    --paper-2: #161b22;
    --verdigris: #58a6ff;
    --verdigris-dim: #388bfd;
    --brass: #f85149;
    --text: #c9d1d9;
    --text-soft: #8b949e;
    --line: #30363d;
  }

  .institution-badges .logo-box img {
    filter: invert(0.9) hue-rotate(180deg) opacity(0.85);
  }
}
