/* === Colors === */
:root {
  --bg: #fff;
  --fg: #222;
  --muted: #5c5c5c;
  --muted-2: #777;
  --rule: #ddd;
  --rule-2: #e5e5e5;
  --link: #1f4e8c;
  --award: #8b1a1a;
  --frame: #fafafa;
  --figure-opacity: 1;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17191d;
    --fg: #e4e4e4;
    --muted: #a3a8ae;
    --muted-2: #8b9096;
    --rule: #33373d;
    --rule-2: #2b2f34;
    --link: #8fb4ef;
    --award: #f0908a;
    --frame: #1f2227;
    --figure-opacity: 0.92;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #17191d;
  --fg: #e4e4e4;
  --muted: #a3a8ae;
  --muted-2: #8b9096;
  --rule: #33373d;
  --rule-2: #2b2f34;
  --link: #8fb4ef;
  --award: #f0908a;
  --frame: #1f2227;
  --figure-opacity: 0.92;
  color-scheme: dark;
}

/* === Base === */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 19px;
}

body {
  font-family: 'Alegreya Sans', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Helvetica, Arial, sans-serif;
  line-height: 1.55;
  color: var(--fg);
  background: var(--bg);
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* === Header === */
.site-header {
  padding: 2.75rem 0 1.4rem;
}

.site-header h1 {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 0.3rem;
}

.site-header .logo {
  display: block;
  height: 4.2rem;
  width: auto;
  max-width: 100%;
}

.site-header .logo-dark {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .site-header .logo-light { display: none; }
  :root:not([data-theme="light"]) .site-header .logo-dark { display: block; }
}

:root[data-theme="dark"] .site-header .logo-light { display: none; }
:root[data-theme="dark"] .site-header .logo-dark { display: block; }

.site-header .tagline {
  font-size: 1.15rem;
  margin-bottom: 0.2rem;
}

.site-header .affiliation {
  font-size: 1rem;
  color: var(--muted);
}

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

.site-nav a {
  color: var(--fg);
  font-size: 1rem;
  margin: 0 1.6rem 0 0;
}

.site-nav a:hover {
  color: var(--link);
}

/* === Sections === */
section {
  padding: 2.5rem 0;
}

section + section {
  border-top: 1px solid var(--rule-2);
}

section[id] {
  scroll-margin-top: 3rem;
}

section h2 {
  font-size: 1.55rem;
  font-weight: 700;
  margin-bottom: 1.1rem;
}

section h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-top: 1.6rem;
  margin-bottom: 0.7rem;
}

section h3:first-child {
  margin-top: 0;
}

/* === About === */
.about-photo {
  margin-bottom: 1.6rem;
}

.about-text + .about-photo {
  margin-top: 0.8rem;
}

.about-photo:last-child {
  margin-bottom: 0;
}

.about-photo img {
  width: 100%;
  display: block;
  border: 1px solid var(--rule);
  border-radius: 6px;
}

.about-text p {
  margin-bottom: 0.8em;
  max-width: 44rem;
}

/* === Research === */
.research-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 2rem 1.75rem;
  align-items: start;
}

.research-card {
  display: flex;
  flex-direction: column;
}

.research-image {
  height: 200px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--frame);
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.8rem;
}

.research-image img {
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
  border-radius: 3px;
  opacity: var(--figure-opacity);
}

.research-card h3 {
  margin: 0 0 0.3rem;
  font-size: 1.1rem;
}

.research-card p {
  font-size: 1rem;
  margin-bottom: 0.4rem;
}

.research-papers summary {
  cursor: pointer;
  font-size: 1rem;
  color: var(--link);
  padding: 0.15rem 0;
}

.research-papers summary:hover {
  text-decoration: underline;
}

.research-card ul {
  list-style: none;
  padding: 0;
  margin: 0.3rem 0 0;
}

.research-card li {
  font-size: 1rem;
  line-height: 1.4;
  padding: 0.3rem 0;
  border-top: 1px solid var(--rule-2);
}

.research-card .venue {
  color: var(--muted);
  font-size: 1rem;
  white-space: nowrap;
}

/* === News === */
.news-item {
  display: flex;
  gap: 1.25rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--rule-2);
}

.news-item:last-child {
  border-bottom: none;
}

.news-date {
  flex-shrink: 0;
  width: 130px;
  color: var(--muted);
  font-size: 1rem;
}

.news-text {
  font-size: 1rem;
}

/* === People === */
.people-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1.5rem 1rem;
  margin-bottom: 0.5rem;
}

.person-card a {
  display: block;
  color: inherit;
  text-decoration: none;
  text-align: center;
}

.person-card a:hover h4 {
  text-decoration: underline;
}

.photo-container {
  width: 120px;
  height: 120px;
  overflow: hidden;
  margin: 0 auto 0.5rem;
  background: var(--frame);
  border: 1px solid var(--rule);
  border-radius: 6px;
}

.photo-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-placeholder {
  display: none;
  width: 100%;
  height: 100%;
  background: var(--link);
  color: var(--bg);
  font-size: 2rem;
  font-weight: 700;
  align-items: center;
  justify-content: center;
}

.person-info h4 {
  margin: 0 0 0.1rem;
  font-size: 1rem;
  font-weight: 700;
}

.person-info .role {
  font-size: 1rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.3;
}

.person-info .note {
  font-size: 1rem;
  color: var(--muted-2);
  margin: 0.1rem 0 0;
  line-height: 1.3;
  font-style: italic;
}

/* === Join === */
.join-text p {
  margin-bottom: 0.8em;
  max-width: 44rem;
}

/* === Publications === */
.pub-meta {
  margin-bottom: 1.2rem;
  color: var(--muted);
  font-size: 1rem;
}

.publication-list {
  list-style: none;
  padding: 0;
}

.publication-list h3 {
  margin-top: 1.6rem;
  margin-bottom: 0.5rem;
  padding-bottom: 0.2rem;
  border-bottom: 1px solid var(--rule);
  font-size: 1.1rem;
}

.publication-list h3:first-child {
  margin-top: 0;
}

.publication-list li {
  margin-bottom: 0.75rem;
  line-height: 1.45;
  font-size: 1rem;
}

.publication-list li a:first-child {
  font-weight: 700;
  color: var(--fg);
}

.publication-list li a:first-child:hover {
  color: var(--link);
}

.publication-list li strong {
  color: var(--award);
  font-weight: 700;
  font-size: 1rem;
}

/* === Footer === */
.site-footer {
  padding: 1.5rem 0 2rem;
  color: var(--muted-2);
  font-size: 1rem;
  border-top: 1px solid var(--rule);
}

/* === Responsive === */
@media (max-width: 768px) {
  html {
    font-size: 17.5px;
  }

  .site-header {
    padding: 2rem 0 1.1rem;
  }

  .site-header h1 {
    font-size: 2rem;
  }

  .site-nav a {
    margin: 0 1rem 0 0;
    font-size: 1rem;
  }

  section {
    padding: 1.8rem 0;
  }

  .people-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }

  .photo-container {
    width: 100px;
    height: 100px;
  }

  .news-item {
    flex-direction: column;
    gap: 0.1rem;
  }

  .news-date {
    width: auto;
    font-size: 1rem;
  }

  .research-grid {
    grid-template-columns: 1fr;
  }
}
