/* ==========================================================================
   W. Shao Laboratory — Global Stylesheet
   Design tokens live as CSS custom properties on :root and are overridden
   by [data-theme="dark"]. assets/js/theme.js sets data-theme on <html>.
   ========================================================================== */

/* ---------------------------------------------------------------------- */
/* Reset                                                                    */
/* ---------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
}

html, body, h1, h2, h3, h4, p, ul, ol, figure {
  margin: 0;
}

ul, ol {
  padding: 0;
  list-style: none;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  cursor: pointer;
}

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

/* ---------------------------------------------------------------------- */
/* Design tokens                                                           */
/* ---------------------------------------------------------------------- */
:root {
  --color-bg: #ffffff;
  --color-surface: #f7f8fa;
  --color-text: #1a1f2b;
  --color-text-muted: #6a7078;
  --color-accent: #1f3a5f;
  --color-border: #e3e6ea;

  --font-sans: 'Manrope', ui-sans-serif, system-ui, sans-serif;

  --container-width: 1200px;
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2.5rem;
  --space-5: 4rem;
}

[data-theme="dark"] {
  --color-bg: #14181f;
  --color-surface: #1c222c;
  --color-text: #e8eaed;
  --color-text-muted: #9aa0a6;
  --color-accent: #5b8def;
  --color-border: #2a3038;
}

/* ---------------------------------------------------------------------- */
/* Base                                                                     */
/* ---------------------------------------------------------------------- */
html {
  font-size: 100%;
  height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.2s ease, color 0.2s ease;
}

main {
  flex: 1 0 auto;
}

/* ---------------------------------------------------------------------- */
/* Typography scale                                                        */
/* ---------------------------------------------------------------------- */
h1 {
  font-size: 2.25rem; /* 36px */
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

h2 {
  font-size: 1.5rem; /* 24px */
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

h3 {
  font-size: 1.125rem; /* 18px */
  font-weight: 700;
  line-height: 1.3;
}

.text-display {
  font-size: clamp(2rem, 1.5rem + 2.5vw, 3rem); /* 32-48px */
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.text-lead {
  font-size: 1.25rem; /* 20px */
  font-weight: 500;
  line-height: 1.4;
}

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

.text-label {
  font-size: 0.8125rem; /* 13px */
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

p {
  max-width: 65ch;
  text-wrap: pretty;
}

/* ---------------------------------------------------------------------- */
/* Layout                                                                   */
/* ---------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 var(--space-3);
}

main section {
  padding: var(--space-5) 0;
}

/* ---------------------------------------------------------------------- */
/* Buttons & links                                                          */
/* ---------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.6em 1.4em;
  border: 1px solid var(--color-accent);
  border-radius: 999px;
  background: transparent;
  color: var(--color-accent);
  font-weight: 600;
  font-size: 0.9rem;
  transition: background 0.15s ease, color 0.15s ease;
}

.btn:hover {
  background: var(--color-accent);
  color: var(--color-bg);
}

.btn-primary {
  background: var(--color-accent);
  color: var(--color-bg);
}

.btn-primary:hover {
  opacity: 0.85;
  background: var(--color-accent);
  color: var(--color-bg);
}

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--color-accent);
  white-space: nowrap;
  border: none;
  background: none;
  padding: 0;
}

/* ==========================================================================
   Navigation
   ========================================================================== */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}

.site-nav .container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: 72px;
  flex-wrap: wrap;
}

.site-nav__brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.125rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.site-nav__logo {
  height: 32px;
  width: 32px;
  object-fit: contain;
}

.site-nav__links {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  list-style: none;
  margin: 0 auto;
  padding: 0;
}

.site-nav__links a {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  padding: 0.5em 0;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.site-nav__links a:hover,
.site-nav__links a.active {
  color: var(--color-text);
  border-bottom-color: var(--color-accent);
}

.theme-toggle {
  border: none;
  background: none;
  padding: 0.4em;
  display: inline-flex;
  border-radius: 50%;
  color: var(--color-text);
}

.theme-toggle:hover {
  background: var(--color-surface);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
}

.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* Swap an image per color theme: give the light-mode version
   class="theme-img theme-img--light" and the dark-mode version
   class="theme-img theme-img--dark". */
.theme-img--dark { display: none; }
[data-theme="dark"] .theme-img--light { display: none; }
[data-theme="dark"] .theme-img--dark { display: block; }

.nav-toggle {
  display: none;
  border: none;
  background: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--color-text);
  padding: 0.25em 0.5em;
}

@media (max-width: 860px) {
  .theme-toggle {
    order: 2;
  }

  .site-nav__links {
    order: 3;
    flex: 1 1 100%;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-3);
  }
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  border-top: 1px solid var(--color-border);
  margin-top: var(--space-5);
}

.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding-top: var(--space-3);
  padding-bottom: var(--space-3);
}

.site-footer__credit {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  line-height: 1.6;
}

.site-footer__credit a {
  color: var(--color-text-muted);
  text-decoration: underline;
}

.site-footer__links {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.site-footer__icons {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.site-footer__icons img {
  width: 28px;
  height: 28px;
  opacity: 0.7;
  transition: opacity 0.15s ease;
}

.site-footer__icons img:hover {
  opacity: 1;
}

/* ==========================================================================
   Modal (Leave a message, person bio, etc.)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 24, 33, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: var(--space-2);
}

.modal-content {
  background: var(--color-bg);
  color: var(--color-text);
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  min-width: 320px;
  max-width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
}

.close-modal {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  font-size: 1.75rem;
  line-height: 1;
  color: var(--color-text-muted);
  cursor: pointer;
  font-weight: bold;
  background: none;
  border: none;
  padding: 0;
}

.close-modal:hover {
  color: var(--color-text);
}

.modal-content input,
.modal-content textarea {
  width: 100%;
  margin-bottom: 1rem;
  padding: 0.6em 0.8em;
  border-radius: 6px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 1rem;
}

.modal-content label {
  font-size: 0.8125rem;
  font-weight: 600;
  display: block;
  margin-bottom: 0.25rem;
}

.modal-content button[type="submit"] {
  background: var(--color-accent);
  color: var(--color-bg);
  border: none;
  padding: 0.7em 2em;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.9rem;
}

.modal-content button[type="submit"]:hover {
  opacity: 0.85;
}

/* ==========================================================================
   Image Lightbox (click a news image to view it full-size)
   ========================================================================== */
.image-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(20, 24, 33, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: var(--space-3);
  cursor: zoom-out;
}

.image-lightbox__img {
  max-width: 90vw;
  max-height: 90vh;
  width: auto;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  cursor: default;
}

.image-lightbox__close {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  font-size: 2rem;
  line-height: 1;
  color: #ffffff;
  cursor: pointer;
  font-weight: bold;
  background: none;
  border: none;
  padding: 0;
}

.image-lightbox__close:hover {
  opacity: 0.8;
}

/* ==========================================================================
   Responsive base
   ========================================================================== */
@media (max-width: 600px) {
  :root {
    --space-5: 2.5rem;
  }
}

/* ==========================================================================
   Shared Section Header
   ========================================================================== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

/* ==========================================================================
   Home: Intro Layout
   ========================================================================== */
.home-title {
  margin-top: var(--space-5);
}

.home-intro {
  display: grid;
  grid-template-columns: 2fr 3fr;
  gap: var(--space-4);
  align-items: start;
  margin-top: var(--space-3);
  margin-bottom: var(--space-3);
}

@media (max-width: 760px) {
  .home-intro {
    grid-template-columns: 1fr;
  }

  .home-intro__news .news-more {
    display: none;
  }
}

/* ==========================================================================
   Home: Latest News
   ========================================================================== */
.home-news__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  align-items: start;
}

.news-featured {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
}

.news-card {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 1.5s ease;
}

.news-card.active {
  opacity: 1;
  visibility: visible;
  z-index: 1;
}

.news-card__media {
  position: absolute;
  inset: 0;
  opacity: 0.65;
  filter: saturate(0.7);
}

.news-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: zoom-in;
}

.news-card__dots {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  display: flex;
  gap: 0.4rem;
  z-index: 2;
}

.news-card__dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
}

.news-card__dot.active {
  background: #ffffff;
}

.news-card__body {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  background: linear-gradient(to bottom, transparent, rgba(20, 24, 33, 0.85) 70%);
  color: #ffffff;
}

.news-card__tag,
.news-card__title {
  color: #ffffff;
}

.news-card__excerpt {
  margin: 0;
  color: rgba(255, 255, 255, 0.85);
}

.news-card__body .link-arrow {
  color: #ffffff;
}

.news-more h3 {
  margin-bottom: var(--space-2);
}

.news-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.news-list a {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: var(--space-2);
  border: 1px solid var(--color-border);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.news-list a:hover {
  border-color: var(--color-accent);
  background: var(--color-surface);
}

.news-list__date {
  font-size: 0.8125rem;
}

.news-list__title {
  font-weight: 700;
}

@media (max-width: 760px) {
  .home-news__grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   News Feed (/news/)
   ========================================================================== */
.news-feed {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.news-feed__item {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: var(--space-3);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-border);
  scroll-margin-top: 88px;
}

.news-feed__item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.news-feed__media img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  cursor: zoom-in;
}

.news-feed__date {
  display: block;
  margin-bottom: 0.25rem;
}

.news-feed__content p {
  margin-top: var(--space-1);
}

.news-feed__content p:first-child {
  margin-top: 0;
}

/* ==========================================================================
   News Timeline (/news/)
   ========================================================================== */
.news-layout {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: var(--space-3);
  align-items: start;
}

.news-timeline {
  position: sticky;
  top: calc(72px + var(--space-3));
  align-self: start;
  max-height: calc(100vh - 72px - var(--space-4));
  overflow-y: auto;
  padding-right: var(--space-2);
}

.news-timeline__list {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0 0 0 20px;
}

.news-timeline__list::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 6px;
  bottom: 6px;
  width: 1px;
  background: var(--color-border);
}

.news-timeline__year {
  margin-bottom: var(--space-2);
  position: relative;
}

.news-timeline__year-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-text-muted);
  letter-spacing: -0.01em;
  transition: color 0.2s ease;
}

.news-timeline__year-btn::before {
  content: "";
  position: absolute;
  left: -20px;
  top: 4px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-border);
  transition: background 0.2s ease, transform 0.2s ease;
}

.news-timeline__year.is-active .news-timeline__year-btn {
  color: var(--color-text);
}

.news-timeline__year.is-active .news-timeline__year-btn::before {
  background: var(--color-accent);
  transform: scale(1.3);
}

.news-timeline__months-wrap {
  display: grid;
  grid-template-rows: 0fr;
  overflow: hidden;
  transition: grid-template-rows 0.35s ease;
}

.news-timeline__year.is-active .news-timeline__months-wrap {
  grid-template-rows: 1fr;
}

.news-timeline__months {
  list-style: none;
  margin: 0;
  padding: var(--space-1) 0 0 0;
  min-height: 0;
}

.news-timeline__month-btn {
  display: block;
  background: none;
  border: none;
  padding: 3px 0;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
  position: relative;
  transition: color 0.2s ease;
}

.news-timeline__month-btn::before {
  content: "";
  position: absolute;
  left: -20px;
  top: 9px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--color-border);
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.news-timeline__month.is-active .news-timeline__month-btn {
  color: var(--color-accent);
  font-weight: 700;
}

.news-timeline__month.is-active .news-timeline__month-btn::before {
  background: var(--color-accent);
  transform: scale(1.5);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-accent) 25%, transparent);
}

.news-timeline__year-btn:focus-visible,
.news-timeline__month-btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .news-timeline__months-wrap,
  .news-timeline__year-btn::before,
  .news-timeline__month-btn::before {
    transition: none;
  }
}

@media (max-width: 700px) {
  .news-feed__item {
    grid-template-columns: 1fr;
  }

  .news-layout {
    grid-template-columns: 76px 1fr;
    gap: 0;
  }

  .news-timeline {
    padding-right: 0;
  }

  .news-timeline__list {
    padding-left: 14px;
  }

  .news-timeline__list::before {
    left: 4px;
  }

  .news-timeline__year-btn {
    font-size: 0.78rem;
  }

  .news-timeline__year-btn::before {
    left: -14px;
  }

  .news-timeline__month-btn {
    font-size: 0.68rem;
  }

  .news-timeline__month-btn::before {
    left: -14px;
  }

  .news-feed__media {
    width: 110px;
  }

  .news-feed__item h2 {
    font-size: 1rem;
  }

  .news-feed__date {
    font-size: 0.75rem;
  }

  .news-feed__content {
    font-size: 0.85rem;
  }
}

/* ==========================================================================
   Home: Gallery Mosaic
   ========================================================================== */
.gallery-mosaic {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 200px;
  grid-auto-flow: dense;
  gap: var(--space-2);
}

.tile {
  position: relative;
  display: block;
  overflow: hidden;
  background-size: cover;
  background-position: center;
}

.tile--clickable {
  cursor: zoom-in;
}

.tile__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 50%, rgba(20, 24, 33, 0.82) 100%);
  display: flex;
  align-items: flex-end;
  padding: var(--space-2);
}

.tile__title {
  color: #ffffff;
  font-weight: 700;
  font-size: 0.9375rem;
  line-height: 1.3;
}

@media (max-width: 760px) {
  .gallery-mosaic {
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
  }

  .tile {
    aspect-ratio: 4 / 3;
    grid-column: span 1 !important;
    grid-row: span 1 !important;
  }
}

/* ==========================================================================
   Hero (Home)
   ========================================================================== */
.hero {
  text-align: left;
  padding-top: var(--space-4);
}

.hero > * + * {
  margin-top: var(--space-1);
}

.hero__subtitle {
  color: var(--color-accent);
}

.hero__tagline {
  margin-top: var(--space-3) !important;
}

/* ==========================================================================
   About: Person Cards
   ========================================================================== */
.section-heading {
  margin-top: var(--space-3);
  margin-bottom: var(--space-3);
}

.section-heading--spaced {
  margin-top: var(--space-4);
}

/* ==========================================================================
   About: PI Bio
   ========================================================================== */
.about-pi {
  display: flex;
  gap: var(--space-4);
  align-items: flex-start;
  margin-bottom: var(--space-5);
}

.about-pi__photo {
  flex: 0 0 280px;
}

.about-pi__photo img {
  width: 100%;
  border-radius: 8px;
}

.about-pi__text {
  flex: 1;
}

.about-pi__text h2 {
  margin-bottom: 0.25rem;
}

.about-pi__blurb {
  margin-top: var(--space-2);
  color: var(--color-accent);
}

.about-pi__bio p {
  margin-top: var(--space-2);
  max-width: 80ch;
  text-align: justify;
}

.about-pi__email {
  margin-top: var(--space-2);
}

.about-pi__actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-3);
  flex-wrap: wrap;
}

@media (max-width: 760px) {
  .about-pi {
    flex-direction: column;
  }

  .about-pi__photo {
    flex: none;
    max-width: 280px;
  }
}

.people-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-3);
}

.person-card {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  overflow: hidden;
  padding: 0;
  margin: 0;
  color: inherit;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.person-card:hover {
  border-color: var(--color-accent);
  transform: translateY(-2px);
}

.person-card__photo {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
}

.person-card__body {
  padding: var(--space-2);
}

.person-card__title {
  margin-top: 0.25rem;
}

@media (max-width: 760px) {
  .people-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Alumni name list */
.alumni-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-width: 360px;
}

.alumni-list li {
  border-bottom: 1px solid var(--color-border);
}

.alumni-list li:last-child {
  border-bottom: none;
}

.alumni-list__name {
  display: block;
  width: 100%;
  padding: 0.6rem 0;
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  font-size: 1rem;
  text-align: left;
  cursor: pointer;
  transition: color 0.15s ease;
}

.alumni-list__name:hover {
  color: var(--color-accent);
}

/* ==========================================================================
   About: Person Modal
   ========================================================================== */
.person-modal__header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.person-modal__photo {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}

.person-modal__bio p {
  margin-top: var(--space-2);
}

.person-modal__bio p:first-child {
  margin-top: 0;
}

.person-modal__email {
  margin-top: var(--space-2);
}

.person-modal__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

/* ==========================================================================
   Publications: Featured (auto-pack grid)
   ========================================================================== */
.featured-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 250px;
  grid-auto-flow: dense;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

.pub-highlight {
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  overflow: hidden;
  transition: border-color 0.15s ease;
}

.pub-highlight:hover {
  border-color: var(--color-accent);
}

.pub-highlight__media {
  width: 100%;
  flex: 1;
  min-height: 0;
  object-fit: cover;
  display: block;
}

.pub-highlight__body {
  padding: 0.5rem var(--space-2);
}

.pub-highlight__tag {
  display: block;
  font-size: 0.75rem;
}

.pub-highlight__title {
  margin-top: 0.125rem;
  font-size: 0.9375rem;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pub-highlight__desc {
  margin-top: var(--space-1);
  font-size: 0.875rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pub-highlight.size-2x2 .pub-highlight__title {
  font-size: 1.25rem;
  -webkit-line-clamp: 3;
}

/* ---------- Media roller (In the Media) ---------- */
.media-roller {
  position: relative;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  overflow: hidden;
  transition: border-color 0.15s ease;
  grid-column: 3;
  grid-row: 1;
}

.media-roller:hover {
  border-color: var(--color-accent);
}

.media-roller__label {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  background: var(--color-accent);
  color: #fff;
  font-size: 0.5625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  z-index: 2;
}

.media-roller__slide {
  display: flex;
  flex-direction: column;
  height: 100%;
  opacity: 0;
  position: absolute;
  inset: 0;
  transition: opacity 0.6s ease;
  pointer-events: none;
}

.media-roller__slide.active {
  opacity: 1;
  position: relative;
  pointer-events: auto;
}

.media-roller__img {
  width: 100%;
  flex: 1;
  min-height: 0;
  object-fit: cover;
  display: block;
}

.media-roller__body {
  padding: 0.5rem var(--space-2);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.media-roller__source {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-accent);
}

.media-roller__headline {
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.media-roller__ref {
  font-size: 0.6875rem;
  color: var(--color-text-muted);
}

.media-roller__dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 0.375rem 0;
}

.media-roller__dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--color-border);
  border: none;
  padding: 0;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.media-roller__dot.active {
  background: var(--color-accent);
  transform: scale(1.4);
}

@media (max-width: 760px) {
  .featured-grid {
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
  }
  .featured-grid > * {
    grid-column: span 1 !important;
    grid-row: span 1 !important;
  }
  .featured-grid .pub-highlight__media {
    aspect-ratio: 16 / 9;
    flex: none;
  }
  .media-roller {
    grid-column: auto !important;
    grid-row: auto !important;
  }
  .media-roller__img {
    aspect-ratio: 16 / 9;
    flex: none;
  }
}

/* ==========================================================================
   Publications: List
   ========================================================================== */
.pub-filter {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin-bottom: var(--space-3);
}

.pub-filter select {
  font: inherit;
  font-size: 0.9375rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-surface);
  color: var(--color-text);
}

.pub-legend {
  margin-bottom: var(--space-3);
}

.pub-list {
  list-style-position: outside;
  padding-left: 1.5em;
}

.pub-list li {
  margin-bottom: var(--space-3);
  line-height: 1.6;
}

.pub-list li::marker {
  color: var(--color-text-muted);
}

.pub-list li > a:first-child {
  text-decoration: underline;
}

.pub-authors {
  color: var(--color-text-muted);
}

.pub-journal {
  color: var(--color-accent);
  font-weight: 600;
}

.pub-news {
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

.mentee {
  color: #00795f;
  text-decoration: underline;
}

[data-theme="dark"] .mentee {
  color: #5fd9b9;
}

/* ==========================================================================
   Research: Intro
   ========================================================================== */
.research-intro__heading-line {
  display: block;
}

.research-intro__heading-line--1 {
  color: var(--color-accent);
}

.research-intro__heading-line--2 {
  color: #33363c;
}

[data-theme="dark"] .research-intro__heading-line--2 {
  color: #aab0b8;
}

.research-intro__lede {
  margin-top: var(--space-2);
}

.research-intro__subtitle {
  margin-top: var(--space-2);
  color: var(--color-accent);
  font-weight: 400;
}

.research-intro__layout {
  display: grid;
  grid-template-columns: 5fr 6fr;
  gap: var(--space-2);
  align-items: center;
  margin-top: var(--space-2);
  margin-bottom: var(--space-4);
}

.research-intro__layout p {
  max-width: none;
  text-align: justify;
}

.research-intro__img {
  width: 100%;
  border-radius: 12px;
  display: block;
}

@media (max-width: 760px) {
  .research-intro__layout {
    grid-template-columns: 1fr;
  }

  .research-intro__img {
    order: -1;
  }

  .research-intro__heading-line {
    text-align: left;
  }
}

/* ==========================================================================
   Research: Project Grid & Detail
   ========================================================================== */
.project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
}

.project-card {
  display: block;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  overflow: hidden;
  color: inherit;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.project-card:hover {
  border-color: var(--color-accent);
  transform: translateY(-2px);
}

.project-card__img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}

.project-card__body {
  padding: var(--space-3);
}

.project-card__title {
  margin-top: var(--space-1);
}

.project-card__summary {
  margin-top: var(--space-1);
  color: var(--color-text-muted);
}

.project-fig {
  display: block;
  width: auto;
  height: auto;
  max-width: min(1000px, 100%);
  max-height: 500px;
  border-radius: 12px;
}

.project-body > * {
  margin-top: var(--space-3);
}

.project-body > *:first-child {
  margin-top: 0;
}

.project-body > .project-fig + p {
  margin-top: var(--space-1);
}

.project-body p {
  text-align: justify;
  max-width: 1000px;
}

.project-pub-ref {
  display: block;
  margin-bottom: 0.5rem;
}

.project-pub-ref a {
  text-decoration: underline;
}

.project-pub-ref .text-muted {
  font-size: 0.9rem;
}

@media (max-width: 760px) {
  .project-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Hiring
   ========================================================================== */
.hiring-list {
  list-style: disc;
  list-style-position: outside;
  max-width: 700px;
  padding-left: 1.5em;
}

.hiring-list li {
  line-height: 2;
}

.hiring-list li::marker {
  color: var(--color-text-muted);
}

/* ==========================================================================
   Facility
   ========================================================================== */
.facility-neighbors {
  margin-top: var(--space-4);
}

.facility-links {
  list-style: none;
  padding: 0;
}

.facility-links li {
  padding: var(--space-1) 0;
  border-bottom: 1px solid var(--color-border);
  line-height: 1.6;
}

.facility-links li:last-child {
  border-bottom: none;
}

.facility-links a {
  font-weight: 600;
}
