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

:root {
  --primary:      #0f172a;
  --accent:       #2563eb;
  --accent-light: #eff6ff;
  --accent-mid:   #bfdbfe;
  --text:         #1e293b;
  --muted:        #64748b;
  --border:       #e2e8f0;
  --bg:           #ffffff;
  --bg-alt:       #f8fafc;
}

html.dark {
  --primary:      #f1f5f9;
  --accent:       #60a5fa;
  --accent-light: #1e3a5f;
  --accent-mid:   #1e40af;
  --text:         #e2e8f0;
  --muted:        #94a3b8;
  --border:       #334155;
  --bg:           #0f172a;
  --bg-alt:       #1e293b;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ── */
.container { max-width: 860px; margin: 0 auto; padding: 0 28px; }

/* ── Header ── */
header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
html.dark header { background: rgba(15,23,42,0.92); }

header .inner {
  max-width: 860px; margin: 0 auto; padding: 0 28px;
  height: 56px; display: flex; align-items: center;
  justify-content: space-between;
}

.site-name {
  font-weight: 700; font-size: 0.95rem;
  color: var(--primary); letter-spacing: -0.01em;
  text-decoration: none; display: flex; align-items: center; gap: 10px;
}
.site-name img { height: 28px; width: 28px; object-fit: contain; }
.site-name:hover { text-decoration: none; }

.header-right { display: flex; align-items: center; gap: 20px; }

nav { display: flex; gap: 24px; }

nav a {
  font-size: 0.875rem; font-weight: 500;
  color: var(--muted); transition: color 0.15s;
}
nav a:hover, nav a.active { color: var(--accent); text-decoration: none; }

#dark-toggle {
  background: none; border: 1px solid var(--border);
  border-radius: 6px; padding: 5px 7px; cursor: pointer;
  color: var(--muted); display: flex; align-items: center;
  transition: border-color 0.15s, color 0.15s;
}
#dark-toggle:hover { border-color: var(--accent); color: var(--accent); }
#dark-toggle .icon-sun  { display: none; }
#dark-toggle .icon-moon { display: block; }
html.dark #dark-toggle .icon-sun  { display: block; }
html.dark #dark-toggle .icon-moon { display: none; }

/* ── Group Banner ── */
.group-banner {
  position: relative;
  width: 100%;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.group-banner-slides {
  position: relative;
  height: clamp(340px, 54vw, 620px);
  overflow: hidden;
  background: #111827;
}

.group-banner-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 54%;
  display: block;
  opacity: 0;
  animation: groupPhotoFade 14s infinite;
}

.group-banner-image.is-active { opacity: 1; }
.group-banner-image:nth-child(2) { animation-delay: 7s; }

.group-banner-caption {
  position: relative;
  padding: 24px max(28px, calc((100vw - 1120px) / 2 + 28px)) 28px;
  color: var(--text);
  background: var(--bg);
}

.group-eyebrow {
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 1;
  margin-bottom: 9px;
  text-transform: uppercase;
  color: var(--accent);
}

.group-banner-caption h1 {
  max-width: 940px;
  font-size: clamp(1.55rem, 2.9vw, 2.75rem);
  font-weight: 700;
  line-height: 1.12;
  margin-bottom: 10px;
  color: var(--primary);
}

.group-lead {
  font-size: clamp(0.95rem, 1.4vw, 1.12rem);
  font-weight: 500;
  color: var(--muted);
}

.group-banner-dots {
  position: absolute;
  right: 28px;
  bottom: 30px;
  display: flex;
  gap: 8px;
}

.group-banner-dots span {
  width: 28px;
  height: 3px;
  border-radius: 999px;
  background: var(--border);
  animation: groupDotFade 14s infinite;
}

.group-banner-dots span:nth-child(2) { animation-delay: 7s; }

@keyframes groupPhotoFade {
  0%, 45% { opacity: 1; }
  50%, 95% { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes groupDotFade {
  0%, 45% { background: var(--accent); }
  50%, 95% { background: var(--border); }
  100% { background: var(--accent); }
}

@media (max-width: 620px) {
  .group-banner {
    overflow: visible;
  }

  .group-banner-slides {
    aspect-ratio: 2.05 / 1;
    height: auto;
  }

  .group-banner-image {
    object-position: center center;
  }

  .group-banner-caption {
    padding: 20px 16px 22px;
  }

  .group-banner-caption h1 { font-size: 1.55rem; }
  .group-banner-dots {
    position: static;
    margin-top: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .group-banner-image,
  .group-banner-dots span {
    animation: none;
  }

  .group-banner-image:first-child,
  .group-banner-dots span:first-child {
    opacity: 1;
    background: var(--accent);
  }
}

/* ── Profile ── */
.profile { padding: 56px 0 48px; }

.profile-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 48px; align-items: start;
}

.profile-photo img {
  width: 260px; height: 260px; border-radius: 50%;
  object-fit: cover; object-position: top center;
  border: 3px solid var(--border); display: block;
}

.profile-name {
  font-size: 2rem; font-weight: 700; color: var(--primary);
  letter-spacing: -0.03em; line-height: 1.2; margin-bottom: 6px;
}

.profile-position { font-size: 0.95rem; color: var(--muted); margin-bottom: 2px; }
.profile-affil    { font-size: 0.875rem; color: var(--muted); margin-bottom: 22px; }

.profile-links { display: flex; flex-direction: column; gap: 7px; margin-top: 16px; }
.profile-links a {
  display: flex; align-items: center; gap: 7px; font-size: 0.8rem;
  font-weight: 500; color: var(--accent);
  border: 1px solid var(--accent-mid); background: var(--accent-light);
  padding: 5px 10px; border-radius: 6px;
  transition: background 0.15s; text-decoration: none;
}
.profile-links a:hover { background: var(--accent-mid); }
.profile-links svg { flex-shrink: 0; }

.bio p { font-size: 0.95rem; color: var(--text); line-height: 1.75; margin-bottom: 12px; }
.bio p:last-child { margin-bottom: 0; }

/* ── Sections ── */
section { padding: 40px 0; border-top: 1px solid var(--border); }

.section-heading {
  font-size: 1.1rem; font-weight: 700; color: var(--primary);
  letter-spacing: -0.01em; margin-bottom: 22px;
  display: flex; align-items: center; gap: 12px;
}
.section-heading::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── News ── */
.news-scroll {
  max-height: 220px; overflow-y: auto;
  display: flex; flex-direction: column;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg-alt);
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.news-scroll::-webkit-scrollbar { width: 5px; }
.news-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.news-item {
  display: flex; gap: 16px; align-items: baseline;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  font-size: 0.875rem; line-height: 1.55;
}
.news-item:last-child { border-bottom: none; }

.news-date {
  flex-shrink: 0; font-size: 0.78rem; font-weight: 600;
  color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.04em; min-width: 72px;
}
.news-text { color: var(--text); }

/* ── Research list (research.html) ── */
.research-list { display: flex; flex-direction: column; gap: 32px; }

.research-item { display: grid; grid-template-columns: auto 1fr; gap: 0 16px; }

.research-num {
  padding-top: 2px; min-width: 24px; text-align: right;
  font-size: 0.75rem; font-weight: 600; color: var(--muted);
  letter-spacing: 0.04em; text-transform: uppercase; line-height: 1.6;
}

.research-title {
  font-size: 0.95rem; font-weight: 600; color: var(--primary);
  line-height: 1.45; margin-bottom: 6px;
}

.research-desc {
  font-size: 0.875rem; color: var(--muted); line-height: 1.6;
}

/* ── Members (members.html) ── */

/* Full profile row — faculty/postdoc */
.member-row {
  display: grid; grid-template-columns: 166px 1fr;
  gap: 24px; align-items: start;
  padding: 24px 0; border-bottom: 1px solid var(--border);
}
.member-row:last-child { border-bottom: none; }

.member-row img {
  width: 150px; height: 150px; border-radius: 50%;
  object-fit: cover; object-position: top center;
  border: 2px solid var(--border);
}

.member-name { font-size: 0.95rem; font-weight: 600; color: var(--primary); margin-bottom: 2px; }
.member-role { font-size: 0.85rem; color: var(--muted); margin-bottom: 8px; }
.member-bio  { font-size: 0.85rem; color: var(--muted); line-height: 1.6; margin-bottom: 10px; }

.member-links { display: flex; gap: 8px; flex-wrap: wrap; }
.member-links a {
  font-size: 0.75rem; font-weight: 500; color: var(--muted);
  border: 1px solid var(--border); padding: 3px 9px; border-radius: 4px;
  transition: color 0.15s, border-color 0.15s; text-decoration: none;
}
.member-links a:hover { color: var(--accent); border-color: var(--accent); }

/* PhD / compact member rows */
.member-compact-list { display: flex; flex-direction: column; }
.member-compact {
  display: grid; grid-template-columns: 166px 1fr;
  gap: 20px; align-items: start;
  padding: 20px 0; border-bottom: 1px solid var(--border);
}
.member-compact:last-child { border-bottom: none; }
.member-compact.no-photo { grid-template-columns: 1fr; }
.member-compact img {
  width: 150px; height: 150px; border-radius: 50%;
  object-fit: cover; object-position: top center;
  border: 2px solid var(--border);
}
.member-compact .member-name  { font-size: 0.9rem; }
.member-compact .member-role  { font-size: 0.8rem; margin-bottom: 6px; }
.member-compact .member-bio   { font-size: 0.82rem; margin-bottom: 8px; }
.member-compact .member-links a { font-size: 0.72rem; }

/* Member icon links */
.member-icons { display: flex; gap: 6px; margin-top: 8px; }
.member-icons a {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 6px;
  border: 1px solid var(--border); color: var(--muted);
  transition: color 0.15s, border-color 0.15s; text-decoration: none;
}
.member-icons a:hover { color: var(--accent); border-color: var(--accent); }
.member-icons a[href=""] { display: none; }

/* Simple text list (interns, alumni) */
.text-list { display: flex; flex-direction: column; gap: 8px; }
.text-list p { font-size: 0.875rem; color: var(--text); margin: 0; }

/* ── Publications ── */
.publication-list {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.publication-year {
  padding: 0;
  border-top: none;
}

.publication-year > h2 {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  color: var(--primary);
  font-size: 1.1rem;
  line-height: 1.3;
}

.publication-item {
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}

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

.publication-item h3 {
  margin: 8px 0;
  color: var(--primary);
  font-size: 0.98rem;
  line-height: 1.45;
}

.publication-citation {
  color: var(--text) !important;
  font-size: 0.9rem !important;
}

.publication-item p {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.6;
}

.publication-meta,
.publication-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.publication-meta span {
  padding: 3px 9px;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted);
  background: var(--bg-alt);
  font-size: 0.74rem;
  font-weight: 600;
}

.publication-authors {
  color: var(--text) !important;
  font-weight: 500;
}

.publication-venue,
.publication-keywords {
  font-style: italic;
}

.publication-links {
  margin-top: 12px;
}

.publication-links a {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 3px 9px;
  border-radius: 4px;
  text-decoration: none;
}

.publication-links a:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* ── Exp list (join-us) ── */
.exp-list { display: flex; flex-direction: column; gap: 28px; }
.exp-role { font-size: 0.95rem; font-weight: 600; color: var(--primary); margin-bottom: 4px; }
.exp-desc { font-size: 0.875rem; color: var(--muted); line-height: 1.65; }

/* ── Funding list ── */
.funding-list { display: flex; flex-direction: column; gap: 16px; }
.funding-item { font-size: 0.875rem; color: var(--muted); line-height: 1.65; }
.funding-item strong { color: var(--text); font-weight: 600; }

/* ── Highlight banner ── */
.highlight {
  border-left: 3px solid var(--accent);
  padding: 10px 16px;
  background: var(--accent-light);
  border-radius: 0 6px 6px 0;
  font-size: 0.875rem;
  color: var(--text);
  line-height: 1.6;
  margin-bottom: 32px;
}
.highlight a { font-weight: 500; }

/* ── Page heading ── */
.page-heading {
  padding: 52px 0 40px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}
.page-heading h1 {
  font-size: 2rem; font-weight: 700; color: var(--primary);
  letter-spacing: -0.03em; line-height: 1.2; margin-bottom: 8px;
}
.page-heading p { font-size: 0.95rem; color: var(--muted); margin: 0; }

/* ── Footer ── */
footer {
  border-top: 1px solid var(--border);
  padding: 24px 0; margin-top: 8px;
}
footer .inner {
  max-width: 860px; margin: 0 auto; padding: 0 28px;
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.825rem; color: var(--muted);
}
footer a { color: var(--muted); }
footer a:hover { color: var(--accent); text-decoration: none; }

/* ── Pill links (social on profile) ── */
.pill-link {
  font-size: 0.78rem; font-weight: 500; color: var(--muted);
  border: 1px solid var(--border); padding: 3px 10px; border-radius: 4px;
  transition: color 0.15s, border-color 0.15s; text-decoration: none;
  display: inline-flex; align-items: center; gap: 4px;
}
.pill-link:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }

/* ── Mobile nav toggle ── */
#nav-toggle {
  display: none; background: none;
  border: 1px solid var(--border); border-radius: 6px;
  padding: 5px 7px; cursor: pointer; color: var(--muted);
  align-items: center;
}

/* ── Admin ── */
.admin-page button,
.admin-page input,
.admin-page select,
.admin-page textarea {
  font: inherit;
}

.admin-container { max-width: 920px; }

.admin-login {
  max-width: 420px;
  margin: 0 auto;
  padding-top: 72px;
}

.admin-login-form,
.admin-member-grid {
  display: grid;
  gap: 14px;
}

.admin-page label {
  display: grid;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
}

.admin-page input,
.admin-page select,
.admin-page textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 9px 10px;
  color: var(--text);
  background: var(--bg);
}

.admin-page textarea { resize: vertical; }

.admin-tabs {
  display: flex;
  gap: 8px;
  padding: 18px 0 0;
}

.admin-tabs button {
  color: var(--muted);
  border-color: var(--border);
  background: var(--bg);
}

.admin-tabs button.active {
  color: #ffffff;
  border-color: var(--accent);
  background: var(--accent);
}

.admin-panel {
  display: none;
  padding-top: 0;
}

.admin-panel.active {
  display: block;
}

.admin-page button,
.admin-link-button {
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 7px 11px;
  color: #ffffff;
  background: var(--accent);
  cursor: pointer;
  font-weight: 600;
  line-height: 1.2;
}

.admin-page button.secondary,
.admin-page button.danger,
.admin-link-button {
  color: var(--muted);
  border-color: var(--border);
  background: var(--bg);
}

.admin-page button.danger:hover {
  color: #b91c1c;
  border-color: #fecaca;
}

.admin-page button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.admin-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding: 16px 0;
}

.admin-status {
  font-size: 0.82rem;
  color: var(--muted);
}

.admin-status.success { color: #15803d; }
.admin-status.error,
.admin-message.error { color: #b91c1c; }

.admin-section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 10px;
}

.admin-section-head .section-heading {
  flex: 1;
  margin-bottom: 0;
}

.admin-section {
  padding: 24px 0;
}

.admin-member {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
  background: var(--bg-alt);
  overflow: hidden;
}

.admin-member summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 54px;
  padding: 8px 12px;
  cursor: pointer;
  color: var(--primary);
  font-weight: 700;
  list-style: none;
}

.admin-member summary::-webkit-details-marker {
  display: none;
}

.admin-member-summary-main {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}

.admin-member-summary-main img,
.admin-photo-placeholder {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.admin-member-summary-main img {
  border: 1px solid var(--border);
  object-fit: cover;
  object-position: top center;
}

.admin-photo-placeholder {
  border: 1px dashed var(--border);
  background: var(--bg);
}

.admin-member-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-member summary small {
  color: var(--muted);
  display: block;
  font-size: 0.76rem;
  font-weight: 500;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-member-tools {
  color: var(--muted);
  flex: 0 0 auto;
  font-size: 0.74rem;
  font-weight: 600;
}

.admin-member[open] .admin-member-tools {
  color: var(--accent);
}

.admin-publication .admin-member-summary-main {
  max-width: calc(100% - 48px);
}

.admin-member-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.admin-wide,
.admin-actions {
  grid-column: 1 / -1;
}

.admin-photo-box {
  width: 74px;
  height: 74px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.78rem;
  overflow: hidden;
  background: var(--bg);
}

.admin-photo-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.admin-photo-tools {
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 10px;
  align-items: start;
}

.admin-file-label input {
  margin-top: 4px;
  padding: 7px;
}

.admin-photo-controls {
  display: grid;
  gap: 8px;
}

.admin-photo-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-check {
  align-self: center;
  display: flex;
  gap: 8px;
  align-items: center;
}

.admin-check input {
  width: auto;
}

.admin-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-self: center;
}

/* ── Responsive ── */
@media (max-width: 680px) {
  nav { gap: 14px; }
  nav a { font-size: 0.8rem; }
}

@media (max-width: 580px) {
  #nav-toggle { display: flex; }
  nav {
    display: none; position: absolute; top: 56px; left: 0; right: 0;
    background: var(--bg); border-bottom: 1px solid var(--border);
    flex-direction: column; gap: 0; padding: 8px 16px 16px;
  }
  nav.open { display: flex; }
  nav a { padding: 8px 4px; font-size: 0.875rem; }
  .header-right { gap: 10px; }
}

@media (max-width: 620px) {
  .profile-grid { grid-template-columns: 1fr; gap: 24px; }
  .profile-photo { display: flex; flex-direction: column; align-items: center; }
  .profile-photo img { width: 210px; height: 210px; }
  .profile-name { font-size: 1.6rem; }
  .member-compact { grid-template-columns: 92px 1fr; gap: 14px; }
  .member-compact img { width: 84px; height: 84px; }
  .research-item { grid-template-columns: 1fr; gap: 0; }
  .research-num { text-align: left; margin-bottom: 4px; }
  .admin-member-grid { grid-template-columns: 1fr; }
  .admin-member summary { flex-direction: column; gap: 2px; }
  .admin-member summary small { text-align: left; }
  footer .inner { flex-direction: column; gap: 6px; text-align: center; }
}

@media (max-width: 480px) {
  header .inner { padding: 0 16px; }
  .container { padding: 0 16px; }
  .page-heading { padding: 36px 0 28px; }
  .page-heading h1 { font-size: 1.6rem; }
}
