/* ==========================================================================
   Design tokens
   ========================================================================== */
:root {
  --paper:        #FFFFFF;
  --paper-raised: #FFFFFF;
  --ink:          #191B1D;
  --ink-soft:     #52585C;
  --ink-faint:    #868C8A;
  --line:         #DADCD6;
  --line-strong:  #BFC3BC;
  --accent:       #1F6F5C;   /* pine — links, primary actions   */
  --accent-ink:   #0E4438;   /* hover state for accent          */
  --accent-warm:  #B9541F;   /* brick — sparing emphasis        */
  --code-bg:      #14171A;
  --code-ink:     #ECE9E0;
  --tag-bg:       #E9EBE5;

  --font-display: "Fraunces", Georgia, serif;
  --font-body:    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono:    "JetBrains Mono", "SFMono-Regular", Consolas, monospace;

  --max: 1080px;
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --radius: 3px;
}

@media (prefers-color-scheme: dark) {
  /* Intentionally not offering an auto dark mode — a single considered
     light "paper" mode keeps the figure/caption system legible. */
}

/* ==========================================================================
   Reset
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; font-size: 112.5%; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-ink); }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; margin: 0 0 0.5em; color: var(--ink); }
p { margin: 0 0 1em; }
ul, ol { margin: 0; padding: 0; }
li { list-style: none; }
button { font-family: inherit; }

:focus-visible {
  outline: 2px solid var(--accent-warm);
  outline-offset: 3px;
}

/* ==========================================================================
   Layout helpers
   ========================================================================== */
.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}
.section {
  padding-top: clamp(2.5rem, 6vw, 4.5rem);
  padding-bottom: clamp(2.5rem, 6vw, 4.5rem);
}
.section + .section { border-top: 1px solid var(--line); }

.eyebrow {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 0.9rem;
}
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.9rem;
  margin-bottom: 2rem;
}
.section-head h2 { margin: 0; font-size: clamp(1.5rem, 2.4vw, 2rem); }
.section-head .count { font-family: var(--font-mono); font-size: 0.85rem; color: var(--ink-faint); white-space: nowrap; }

/* ==========================================================================
   Header / nav
   ========================================================================== */
.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 40;
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: 0.02em;
}
.brand:hover { color: var(--accent); }
.brand .dot { color: var(--accent-warm); }

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  width: 40px;
  height: 36px;
  cursor: pointer;
  position: relative;
}
.nav-toggle span, .nav-toggle span::before, .nav-toggle span::after {
  content: "";
  position: absolute;
  left: 9px; right: 9px;
  height: 1.5px;
  background: var(--ink);
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-toggle span { top: 17px; }
.nav-toggle span::before { top: -6px; }
.nav-toggle span::after { top: 6px; }
.nav-toggle[aria-expanded="true"] span { background: transparent; }
.nav-toggle[aria-expanded="true"] span::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span::after { transform: translateY(-6px) rotate(-45deg); }

.site-nav ul { display: flex; gap: 1.75rem; }
.site-nav a {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-decoration: none;
  padding-bottom: 4px;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.site-nav a:hover { color: var(--ink); border-color: var(--line-strong); }
.site-nav a[aria-current="page"] { color: var(--ink); border-color: var(--accent-warm); }

@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .site-nav {
    position: fixed;
    inset: 64px 0 auto 0;
    background: var(--paper-raised);
    border-bottom: 1px solid var(--line);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
  }
  .site-nav.open { max-height: 320px; }
  .site-nav ul { flex-direction: column; gap: 0; padding: 0.5rem var(--gutter) 1.25rem; }
  .site-nav li { border-bottom: 1px solid var(--line); }
  .site-nav a { display: block; padding: 0.9rem 0; border-bottom: none; }
}

/* ==========================================================================
   Figure / caption system — the signature motif used everywhere an image
   appears: profile photo, publication thumbnails, course art. Every image
   is captioned like a figure in a paper.
   ========================================================================== */
.figure { margin: 0; }
.figure-frame {
  border: 1px solid var(--line-strong);
  background: var(--paper-raised);
  padding: 6px;
}
.figure-frame img, .figure-placeholder { display: block; width: 100%; }
.figure-placeholder {
  aspect-ratio: 4 / 5;
  background:
    repeating-linear-gradient(135deg, #EEF0EB 0 2px, transparent 2px 14px);
  border: 1px dashed var(--line-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.25rem;
}
.figure-placeholder.wide { aspect-ratio: 16 / 10; }
.figure-placeholder .ph-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-faint);
  letter-spacing: 0.04em;
  line-height: 1.5;
}
.figure figcaption {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--ink-soft);
  margin-top: 0.55rem;
  line-height: 1.5;
}
.figure figcaption b { color: var(--ink); font-weight: 600; }

/* ==========================================================================
   Buttons / pills
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  padding: 0.6rem 1rem;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  color: var(--ink);
  text-decoration: none;
  background: transparent;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn-accent { border-color: var(--accent); color: var(--accent); }
.btn-accent:hover { background: var(--accent); color: #fff; }
.btn-ghost { border-color: var(--line-strong); color: var(--ink-soft); }
.btn-ghost:hover { background: var(--tag-bg); color: var(--ink); border-color: var(--line-strong); }

.tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  padding: 0.28rem 0.6rem;
  background: var(--tag-bg);
  color: var(--ink-soft);
  border-radius: var(--radius);
}

/* ==========================================================================
   Home / hero
   ========================================================================== */
.hero { padding-top: clamp(2.5rem, 7vw, 5rem); }
.hero .wrap {
  display: grid;
  grid-template-columns: 1.35fr 0.85fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
}
.hero-name {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  margin-bottom: 0.15em;
}
.hero-role {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--ink-soft);
  margin-bottom: 1.6rem;
}
.hero-role .sep { color: var(--line-strong); margin: 0 0.5em; }
.hero-lede { font-size: 1.08rem; color: var(--ink-soft); max-width: 52ch; margin-bottom: 1.75rem; }

.contact-list { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 0.5rem; }
.contact-list a {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--ink);
  text-decoration: none;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 0.5rem 0.8rem;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.contact-list a:hover { border-color: var(--accent); background: var(--paper-raised); }
.contact-list svg { width: 15px; height: 15px; flex: none; }

.hero-figure { position: sticky; top: 90px; }

@media (max-width: 760px) {
  .hero .wrap { grid-template-columns: 1fr; }
  .hero-figure { position: static; max-width: 280px; }
}

.prose { max-width: 68ch; color: var(--ink-soft); }
.prose p { margin-bottom: 1em; }

/* ==========================================================================
   Research page
   ========================================================================== */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
}
.filter-btn {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.02em;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.15s ease;
}
.filter-btn:hover { border-color: var(--accent); color: var(--ink); }
.filter-btn.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.pub-list { display: flex; flex-direction: column; }
.pub-card {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 1.5rem;
  padding: 1.75rem 0;
  border-bottom: 1px solid var(--line);
}
.pub-card:first-child { padding-top: 0; }
.pub-meta { font-family: var(--font-mono); font-size: 0.76rem; color: var(--ink-faint); margin-bottom: 0.4rem; letter-spacing: 0.02em; }
.pub-title { font-size: 1.15rem; margin-bottom: 0.35rem; }
.pub-authors { color: var(--ink-soft); font-size: 0.92rem; margin-bottom: 0.7rem; }
.pub-authors .self { color: var(--ink); font-weight: 600; }
.pub-tags { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.9rem; }
.pub-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }

@media (max-width: 640px) {
  .pub-card { grid-template-columns: 1fr; }
  .pub-card .figure { max-width: 160px; }
}

/* ==========================================================================
   Teaching page
   ========================================================================== */
.exp-list { border-top: 1px solid var(--line); }
.exp-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 1.5rem;
  padding: 1.4rem 0;
  border-bottom: 1px solid var(--line);
}
.exp-row .years { font-family: var(--font-mono); font-size: 0.82rem; color: var(--ink-faint); padding-top: 0.15rem; }
.exp-row h3 { font-size: 1.05rem; margin-bottom: 0.2rem; }
.exp-row .org { color: var(--ink-soft); font-size: 0.92rem; }

.course-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
.course-card {
  background: var(--paper-raised);
  padding: 1.6rem;
}
.course-code { font-family: var(--font-mono); font-size: 0.76rem; color: var(--accent); letter-spacing: 0.04em; margin-bottom: 0.5rem; }
.course-card h3 { font-size: 1.1rem; margin-bottom: 0.4rem; }
.course-card .desc { color: var(--ink-soft); font-size: 0.92rem; margin-bottom: 0.9rem; }
.course-card .meta { font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink-faint); display: flex; gap: 0.9rem; flex-wrap: wrap; }

@media (max-width: 640px) {
  .course-grid { grid-template-columns: 1fr; }
  .exp-row { grid-template-columns: 1fr; gap: 0.3rem; }
}

/* ==========================================================================
   Students page
   ========================================================================== */
.student-group + .student-group { margin-top: 3rem; }
.student-table { width: 100%; border-collapse: collapse; }
.student-table th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 500;
  padding: 0 0 0.7rem;
  border-bottom: 1px solid var(--line-strong);
}
.student-table td {
  padding: 0.9rem 0.8rem 0.9rem 0;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  font-size: 0.95rem;
}
.student-table td:first-child, .student-table th:first-child { padding-left: 0; }
.student-table .name { font-weight: 600; }
.student-table .program { font-family: var(--font-mono); font-size: 0.78rem; color: var(--ink-soft); white-space: nowrap; }
.student-table .status {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.03em;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--tag-bg);
  color: var(--ink-soft);
  white-space: nowrap;
}
.student-table .status.current { background: #E4EFE9; color: var(--accent-ink); }

@media (max-width: 700px) {
  .student-table thead { display: none; }
  .student-table, .student-table tbody, .student-table tr, .student-table td { display: block; width: 100%; }
  .student-table tr { border-bottom: 1px solid var(--line-strong); padding: 1rem 0; }
  .student-table td { border-bottom: none; padding: 0.15rem 0; }
  .student-table td::before {
    content: attr(data-label);
    display: block;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--ink-faint);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.4rem;
  }
}

/* ==========================================================================
   Service page
   ========================================================================== */
.service-year { margin-bottom: 2.5rem; }
.service-year:last-child { margin-bottom: 0; }
.service-year h3 {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.9rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line-strong);
}
.service-items li {
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.98rem;
  color: var(--ink-soft);
  line-height: 1.55;
}
.service-items li:last-child { border-bottom: none; }
.service-items .role { color: var(--ink); font-weight: 600; }

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 2rem;
}
.site-footer .wrap {
  padding-top: 2rem;
  padding-bottom: 2.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}
.site-footer p {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--ink-faint);
  margin: 0;
}
.site-footer .foot-links { display: flex; gap: 1.2rem; }
.site-footer .foot-links a { color: var(--ink-soft); font-size: 0.8rem; }

/* ==========================================================================
   Page intro (used on research/teaching/students pages)
   ========================================================================== */
.page-intro { padding-top: clamp(2.5rem, 6vw, 4rem); padding-bottom: 1rem; }
.page-intro h1 { font-size: clamp(2rem, 4vw, 2.7rem); margin-bottom: 0.5rem; }
.page-intro .lede { color: var(--ink-soft); max-width: 60ch; font-size: 1.05rem; }
