/* ─── Variables ─────────────────────────────────────────── */
:root {
  --accent:      #3B4FBF;
  --accent-light:#EEEDFE;
  --text:        #1a1a1a;
  --text-secondary: #555;
  --text-tertiary: #6e6e6e;   /* 5:1 on white, AA for small text */
  --bg-band:     #f6f6f3;
  --border:      #e5e5e5;
  --bg:          #fff;
  --bg-secondary:#f7f7f5;
  --radius:      8px;
  --radius-sm:   5px;
  --font-sans:   'DM Sans', system-ui, sans-serif;
  --font-serif:  'DM Serif Display', Georgia, serif;
  --max-width:   1400px;
}

/* ─── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

::selection { background: var(--accent-light); color: var(--accent); }

a:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

[id] { scroll-margin-top: 72px; }

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

/* ─── Nav ────────────────────────────────────────────────── */
.site-nav {
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(8px);
  z-index: 100;
}
.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 32px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-brand {
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.nav-brand span { color: var(--accent); }
.nav-links {
  display: flex;
  gap: 28px;
  list-style: none;
}
.nav-links a {
  font-size: 14px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.15s;
}
.nav-links a:hover,
.nav-links a.active { color: var(--text); }
.nav-links a.active { font-weight: 500; }

/* ─── Home Hero ──────────────────────────────────────────── */
.hero-band {
  background: var(--bg-band);
  border-bottom: 1px solid var(--border);
}
.hero {
  padding: 72px 0 64px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 620px);
  gap: 56px;
  align-items: center;
}
.hero-media { margin: 0; }
.hero-media img { width: 100%; height: auto; }
/* Hero slideshow: stacked slides crossfade inside one fixed frame */
.rotator-frame {
  display: grid;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 8px 24px rgba(0,0,0,0.06);
}
.slide {
  grid-area: 1 / 1;
  margin: 0;
  opacity: 0;
  transition: opacity 1s ease;
  display: flex;
  min-height: 0;
}
.slide.is-active { opacity: 1; }
.slide img { width: 100%; height: 100%; padding: 14px; }
.rotator-captions { display: grid; margin-top: 14px; }
.slide-caption {
  grid-area: 1 / 1;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.6s ease, visibility 0.6s;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
}
.slide-caption.is-active { opacity: 1; visibility: visible; }
.slide-theme {
  display: block;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 2px;
}
.slide-caption a { white-space: nowrap; }
.rotator-controls { display: none; align-items: center; gap: 14px; margin-top: 10px; }
.hero-rotator.is-ready .rotator-controls { display: flex; }
.rotator-pause {
  font: 500 12px/1 var(--font-sans);
  color: var(--text-secondary);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 5px 11px;
  cursor: pointer;
}
.rotator-pause:hover { border-color: #aaa; color: var(--text); }
.rotator-dots { display: flex; gap: 2px; }
.rotator-dot {
  width: 24px;
  height: 24px;
  border: none;
  background: none;
  cursor: pointer;
  position: relative;
  padding: 0;
}
.rotator-dot::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 8px; height: 8px;
  margin: -4px 0 0 -4px;
  border-radius: 50%;
  background: #c8c8c4;
  transition: background 0.2s, transform 0.2s;
}
.rotator-dot:hover::after { background: #8a8a86; }
.rotator-dot.is-active::after { background: var(--accent); transform: scale(1.25); }
.hero-tag {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 16px;
}
.hero h1 {
  font-family: var(--font-serif);
  font-size: 46px;
  font-weight: 400;
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin-bottom: 14px;
  max-width: 640px;
  color: var(--text);
}
.hero-sub {
  font-size: 15px;
  color: var(--text-tertiary);
  margin-bottom: 20px;
}
.hero-sub a { color: var(--text); font-weight: 500; }
.hero-metrics {
  margin-top: 22px;
  font-size: 13px;
  color: var(--text-tertiary);
}
.hero-metrics a { margin-left: 6px; white-space: nowrap; }
.hero-desc {
  font-size: 17px;
  line-height: 1.75;
  color: var(--text-secondary);
  max-width: 560px;
}
.hero-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}
.btn {
  font-size: 14px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-sans);
  transition: all 0.15s;
  text-decoration: none;
  display: inline-block;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
}
.btn-primary:hover { opacity: 0.9; text-decoration: none; }
.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: #aaa; text-decoration: none; }

/* ─── News ───────────────────────────────────────────────── */
.news-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 28px;
}
.news-grid .news-entry { border-top: 2px solid var(--text); padding-top: 14px; }
.news-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--text-tertiary);
}
.news-body {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-secondary);
}
.news-link { white-space: nowrap; }
.news-timeline .news-entry {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 24px;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}
.news-timeline .news-meta { flex-direction: column; align-items: flex-start; gap: 6px; margin: 2px 0 0; }
.news-timeline .news-body { font-size: 16px; line-height: 1.7; margin: 0; }
.badge {
  display: inline-block;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 99px;
  background: var(--accent-light);
  color: var(--accent);
}

/* ─── Research Cards ─────────────────────────────────────── */
.section {
  padding: 52px 0;
  border-bottom: 1px solid var(--border);
}
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 28px;
}
.section-title {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 400;
  letter-spacing: -0.02em;
}
.section-link {
  font-size: 14px;
  color: var(--accent);
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.card:hover {
  border-color: #aaa;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
  text-decoration: none;
}
.card { overflow: hidden; }
.card-media {
  margin: -20px -20px 16px;
  height: 170px;
  background: #000;
  border-bottom: 1px solid var(--border);
}
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.card-media--contain { background: #fff; }
.card-media--pasta img { object-position: 50% 56%; }
.card-media--contain img { object-fit: contain; }
.card-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}
.card h3 {
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 8px;
  line-height: 1.4;
}
.card p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ─── Cross-cutting block under the research cards ──────── */
.crosscut {
  margin-top: 16px;
  padding: 20px 24px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.crosscut-label {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 6px;
}
.crosscut h3 {
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 6px;
}
.crosscut p {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-secondary);
  max-width: 900px;
  margin-bottom: 10px;
}

/* ─── Journal Covers ─────────────────────────────────────── */
.cover-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 260px));
  gap: 20px;
}
.cover { margin: 0; }
.cover img {
  width: 100%;
  height: auto;
  aspect-ratio: 427 / 560;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.cover figcaption {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-tertiary);
}
.cover-journal { color: var(--text); font-style: italic; }

/* ─── People Grid ────────────────────────────────────────── */
.people-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.person-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 16px;
  text-align: center;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.person-card:hover {
  border-color: #aaa;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}
.avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  margin: 0 auto 12px;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  font-weight: 500;
  color: var(--accent);
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.person-name { font-size: 15px; font-weight: 500; margin-bottom: 3px; }
.person-role { font-size: 13px; color: var(--text-secondary); }

/* ─── Publication List ───────────────────────────────────── */
.pub-list { display: flex; flex-direction: column; gap: 12px; }
.pub-item {
  display: flex;
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s;
}
.pub-item:hover { border-color: #aaa; }
.pub-year {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary);
  min-width: 36px;
  padding-top: 3px;
}
.pub-body { flex: 1; }
.pub-title { font-size: 14px; font-weight: 500; line-height: 1.5; margin-bottom: 3px; }
.pub-authors { font-size: 13px; color: var(--text-secondary); margin-bottom: 3px; line-height: 1.5; }
.pub-journal { font-size: 13px; color: var(--accent); font-style: italic; }
.pub-tag {
  display: inline-block;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 99px;
  background: #FEF3C7;
  color: #92400E;
  margin-left: 6px;
  vertical-align: middle;
}

/* ─── Page Content ───────────────────────────────────────── */
/* Inner pages share one 760px reading column: text, rules and figures
   line up on both edges (the People page opts out for its grids). */
.page-content {
  padding: 52px 0;
  max-width: 760px;
}
.page-content h1 {
  font-family: var(--font-serif);
  font-size: 32px;
  font-weight: 400;
  letter-spacing: -0.02em;
  margin-bottom: 24px;
}
.page-content h2 {
  font-family: var(--font-serif);
  font-size: 25px;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-top: 40px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.page-content h3 {
  font-size: 16px;
  font-weight: 500;
  margin-top: 28px;
  margin-bottom: 8px;
}
.page-content p {
  font-size: 16px;
  line-height: 1.8;
  color: var(--text-secondary);
  margin-bottom: 16px;
}
.page-content ul {
  padding-left: 20px;
  margin-bottom: 16px;
}
.page-content li {
  font-size: 16px;
  line-height: 1.8;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.page-content em.journal { color: var(--accent); font-style: italic; }
.page-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 36px 0;
}
.page-content strong { color: var(--text); font-weight: 600; }
.page-content a { color: var(--accent); }

/* Figures in page content (fig shortcode) */
.fig { margin: 24px 0 28px; }
.fig img {
  width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
}
.fig figcaption {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-tertiary);
}

/* Small uppercase section label (eyebrow shortcode) */
.page-content .eyebrow {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 8px;
}

/* Outreach gallery */
.gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-top: 20px;
}
.gallery-item { margin: 0; }
.gallery-item img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius-sm);
}
.gallery-item figcaption {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-tertiary);
}


/* Alumni table */
.alumni-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin-top: 16px;
}
.alumni-table th {
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  padding: 6px 12px 8px;
  border-bottom: 1px solid var(--border);
}
.alumni-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: top;
}
.alumni-table tr:last-child td { border-bottom: none; }

/* ─── Footer ─────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-band);
}
.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 36px 32px 24px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 32px;
}
.footer-name { font-size: 15px; font-weight: 500; margin-bottom: 6px; }
.footer-name span { color: var(--accent); }
.footer-id address {
  font-style: normal;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-tertiary);
}
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 22px; padding-top: 2px; }
.footer-links a { font-size: 13px; color: var(--text-secondary); }
.footer-links a:hover { color: var(--text); }
.footer-base {
  /* aligns with the content edge at every width */
  margin: 0 max(32px, calc((100% - var(--max-width)) / 2 + 32px));
  padding: 14px 0 28px;
  font-size: 12px;
  color: var(--text-tertiary);
  border-top: 1px solid var(--border);
}

/* ─── Publication list on the Publications page ─────────── */
.pub-list--plain { gap: 0; margin-bottom: 8px; }
.pub-list--plain .pub-item {
  border: none;
  border-radius: 0;
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
}
.pub-list--plain .pub-item:last-child { border-bottom: none; }
.pub-title a { color: var(--text); }
.pub-title a:hover { color: var(--accent); text-decoration: underline; }

/* ─── Join card (people grids) ──────────────────────────── */
.join-card {
  border-style: dashed;
  color: inherit;
  text-decoration: none;
}
.join-card:hover { text-decoration: none; border-color: var(--accent); }
.join-avatar { background: var(--accent-light); font-size: 26px; font-weight: 400; }
.join-card .person-role { color: var(--accent); }

/* ─── Research page: contents list and key papers ───────── */
.with-toc { display: block; }
/* a divider (or label) already separates the section: no second rule under the heading */
.page-content hr + h2,
.page-content .eyebrow + h2 { border-bottom: 0; padding-bottom: 0; margin-top: 0; }
.page-content hr { clear: both; }
.fig-right { float: right; width: 300px; margin: 6px 0 16px 32px; }
@media (max-width: 640px) {
  .fig-right { float: none; width: auto; margin: 24px 0 28px; }
}
.toc { display: none; }
.keypapers {
  font-size: 14px !important;
  color: var(--text-secondary);
  margin-top: 4px;
}
.keypapers-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-right: 8px;
}
@media (min-width: 1120px) {
  .with-toc {
    display: grid;
    grid-template-columns: minmax(0, 760px) 200px;
    gap: 72px;
    align-items: start;
  }
  .toc {
    display: block;
    position: sticky;
    top: 88px;
    margin-top: 52px;
    padding-left: 16px;
    border-left: 1px solid var(--border);
  }
  .toc-label {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-tertiary);
    margin-bottom: 10px;
  }
  .toc ul { list-style: none; }
  .toc li { margin-bottom: 8px; line-height: 1.4; }
  .toc a { font-size: 13px; color: var(--text-secondary); }
  .toc a:hover { color: var(--accent); }
}

/* ─── Pub page year headers ──────────────────────────────── */
.pub-year-header {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 400;
  letter-spacing: -0.02em;
  margin: 40px 0 16px;
  color: var(--text);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.pub-year-header:first-child { margin-top: 0; }

/* ─── Mobile nav toggle (hidden on desktop) ──────────────── */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text);
  padding: 4px;
  line-height: 1;
}

/* ─── Narrow desktop: image below hero text ──────────────── */
@media (max-width: 1200px) {
  .hero { grid-template-columns: minmax(0, 1fr) minmax(0, 460px); gap: 40px; }
  .hero h1 { font-size: 40px; }
  .news-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ─── Tablet breakpoint ──────────────────────────────────── */
@media (max-width: 1024px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 32px;
    padding: 48px 0 44px;
  }
  .hero-media { max-width: 560px; }
  .hero-desc { max-width: 100%; }
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .people-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ─── Mobile breakpoint ──────────────────────────────────── */
@media (max-width: 768px) {
  .container,
  .nav-inner,
  .footer-inner { padding: 0 20px; }

  .hero { padding: 36px 0 32px; }
  .hero h1 { font-size: 30px; }
  .hero-sub { font-size: 14px; }
  .hero-desc { font-size: 15px; }

  .news-grid { grid-template-columns: 1fr; gap: 20px; }
  .news-timeline .news-entry { grid-template-columns: 1fr; gap: 6px; }
  .news-timeline .news-meta { flex-direction: row; align-items: center; }
  .news-timeline .news-body { font-size: 15px; }

  .footer-inner { flex-direction: column; gap: 16px; padding: 28px 20px 18px; }
  .footer-base { margin: 0 20px; padding: 12px 0 24px; }

  .card-grid { grid-template-columns: 1fr; }
  .people-grid { grid-template-columns: repeat(2, 1fr); }
  .cover-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
  .gallery { grid-template-columns: 1fr; }

  .section { padding: 36px 0; }
  .section-title { font-size: 20px; }

  .page-content { padding: 32px 0; }
  .page-content h1 { font-size: 24px; }

  /* Hamburger nav */
  .nav-toggle { display: block; }
  .nav-links {
    display: none;
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    background: rgba(255,255,255,0.98);
    backdrop-filter: blur(8px);
    flex-direction: column;
    padding: 8px 20px;
    border-bottom: 1px solid var(--border);
    gap: 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    z-index: 99;
  }
  .nav-links.open { display: flex; }
  .nav-links li {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
  }
  .nav-links li:last-child { border-bottom: none; }
  .nav-links a { font-size: 14px; }
}

/* ─── Reduced motion ─────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
  .card:hover, .person-card:hover { transform: none; box-shadow: none; }
}

/* ─── Publications page: legend and year index ──────────── */
.page-content .pub-legend { font-size: 13px; line-height: 1.6; color: var(--text-tertiary); margin-bottom: 8px; }
.page-content .pub-legend--last { margin-bottom: 32px; }
.toc-years {
  display: grid;
  grid-template-columns: repeat(3, auto);
  justify-content: start;
  gap: 4px 16px;
}
.toc .toc-years li { margin-bottom: 4px; }
.pub-year-header[id] { scroll-margin-top: 80px; }

/* ─── Covers link to their papers ───────────────────────── */
.cover a { display: block; border-radius: var(--radius-sm); }
.cover a:hover img { box-shadow: 0 6px 18px rgba(0,0,0,0.14); }
.cover img { transition: box-shadow 0.15s; }

.footer-base a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.anchor-target { display: block; position: relative; top: -80px; }
