*,
*::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.dark header {
  background: rgba(15, 23, 42, 0.92);
}

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;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1;
}

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

a:hover {
  text-decoration: underline;
}

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

/* ── Sticky 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);
}

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: 600;
  font-size: 0.95rem;
  color: var(--primary);
  letter-spacing: -0.01em;
  text-decoration: none;
}

.site-name:hover {
  text-decoration: none;
  color: var(--primary);
}

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

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

nav a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  transition: color 0.15s;
}

nav a:hover,
nav a.nav-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; }

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

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

.profile-photo img {
  width: 152px;
  height: 152px;
  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-advisor {
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 22px;
}

.profile-advisor a {
  color: var(--muted);
  font-weight: 500;
}

.profile-advisor a:hover {
  color: var(--accent);
}

/* icon links column (under photo) */
.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, border-color 0.15s;
}

.profile-links a:hover {
  background: var(--accent-mid);
  text-decoration: none;
}

.profile-links svg {
  flex-shrink: 0;
}

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

.bio p:last-child {
  margin-bottom: 0;
}

/* ── Section shell ── */
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;
  gap: 0;
  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-track {
  background: transparent;
}

.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: 68px;
}

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

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

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

.pub-year-col {
  padding-top: 2px;
  min-width: 44px;
  text-align: right;
}

.pub-year {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.6;
}

.pub-venue-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #fff;
  background: var(--accent);
  padding: 2px 7px;
  border-radius: 4px;
  margin-bottom: 6px;
}

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

.pub-title a {
  color: inherit;
}

.pub-title a:hover {
  color: var(--accent);
}

.pub-authors {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.pub-authors strong {
  color: var(--text);
  font-weight: 600;
}

.pub-desc {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 10px;
}

.pub-links {
  display: flex;
  gap: 8px;
}

.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;
}

.pill-link:hover {
  color: var(--accent);
  border-color: var(--accent);
  text-decoration: none;
}

/* ── Research experience ── */
.exp-list {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.exp-role {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 2px;
}

.exp-meta {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 6px;
}

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

.placeholder-note {
  font-size: 0.85rem;
  color: var(--muted);
  font-style: italic;
  padding: 16px;
  background: var(--bg-alt);
  border: 1px dashed var(--border);
  border-radius: 8px;
}

/* ── Teaching cards ── */
.teach-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.teach-card {
  display: flex;
  gap: 20px;
  padding: 20px 22px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: var(--bg-alt);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.teach-card:hover {
  box-shadow: 0 2px 12px rgba(37, 99, 235, 0.08);
}

.teach-code {
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  background: var(--accent-light);
  border: 1px solid var(--accent-mid);
  padding: 4px 9px;
  border-radius: 5px;
  height: fit-content;
  margin-top: 2px;
  white-space: nowrap;
}

.teach-body {
  flex: 1;
  min-width: 0;
}

.teach-title {
  font-size: 0.975rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 5px;
  line-height: 1.3;
}

.teach-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.825rem;
  color: var(--muted);
  margin-bottom: 10px;
}

.teach-role {
  font-weight: 500;
  color: var(--text);
}

.teach-sep {
  color: var(--border);
}

.teach-term {
  font-variant-numeric: tabular-nums;
}

.teach-desc {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.6;
  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);
}

/* ── Responsive ── */
@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: 120px;
    height: 120px;
  }

  .profile-name {
    font-size: 1.6rem;
  }

  nav {
    gap: 18px;
  }

  .pub {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .pub-year-col {
    text-align: left;
    margin-bottom: 6px;
  }

  footer .inner {
    flex-direction: column;
    gap: 6px;
    text-align: center;
  }
}
