:root {
  --bg: #ffffff;
  --bg-alt: #f8fafc;
  --bg-card: #ffffff;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --accent: #2563eb;
  --accent-light: #dbeafe;
  --accent-hover: #1d4ed8;
  --green: #059669;
  --green-light: #d1fae5;
  --amber: #d97706;
  --amber-light: #fef3c7;
  --purple: #7c3aed;
  --purple-light: #ede9fe;
  --rose: #e11d48;
  --rose-light: #ffe4e6;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.06), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
  --transition: 0.2s ease;
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  font-size: 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

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

img { max-width: 100%; height: auto; }

/* ── Container ── */
.container {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 24px;
  width: 100%;
}

/* ── Header / Nav ── */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.nav-brand {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}

.nav-brand span { color: var(--accent); }

.nav-links {
  display: flex;
  gap: 28px;
  list-style: none;
}

.nav-links a {
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 500;
  position: relative;
  padding: 4px 0;
  transition: color var(--transition);
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1.5px;
  background: var(--accent);
  transition: width var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
}

.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}

/* ── Main ── */
main {
  flex: 1;
  padding: 56px 0 80px;
}

/* ── Section headings ── */
.section-title {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 6px;
  color: var(--text);
}

.section-subtitle {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-bottom: 44px;
}

.section-intro-card {
  margin-bottom: 18px;
  padding: 16px 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border: 1px solid var(--accent-light);
  border-radius: var(--radius-lg);
  color: var(--text-secondary);
  font-size: 0.92rem;
  box-shadow: var(--shadow-sm);
}

/* ── Footer ── */
footer {
  border-top: 1px solid var(--border);
  padding: 28px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* ── Hero / About (index) ── */
.hero {
  display: grid;
  grid-template-columns: 1fr 200px;
  gap: 44px;
  align-items: start;
  margin-bottom: 48px;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 22px;
}

.metric-card {
  padding: 14px 16px;
  background: var(--bg-alt);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.metric-card strong {
  display: block;
  font-size: 0.83rem;
  color: var(--text);
  margin-bottom: 4px;
}

.metric-card span {
  display: block;
  font-size: 0.78rem;
  line-height: 1.55;
  color: var(--text-muted);
}

.hero-text h1 {
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  margin-bottom: 2px;
}

.hero-text h1 .accent { color: var(--accent); }

.hero-tagline {
  font-family: var(--font-mono);
  color: var(--text-muted);
  font-size: 0.82rem;
  margin-bottom: 20px;
  letter-spacing: 0.01em;
}

.hero-text p {
  color: var(--text-secondary);
  text-align: justify;
  margin-bottom: 16px;
  font-size: 0.95rem;
}

.hero-text p strong { color: var(--text); font-weight: 600; }

.hero-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.keyword {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: var(--bg);
  transition: all var(--transition);
}

.keyword:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

.hero-photo {
  display: flex;
  justify-content: center;
  padding-top: 16px;
}

.hero-photo img {
  width: 180px;
  height: 180px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid var(--border);
  transition: border-color var(--transition);
}

.hero-photo img:hover { border-color: var(--accent); }

.hero-extra {
  grid-column: 1 / -1;
  color: var(--text-secondary);
  text-align: justify;
  font-size: 0.95rem;
}

.hero-extra p { margin-bottom: 12px; }

.hero-text > p:last-of-type { margin-bottom: 0; }

/* ── Social links bar ── */
.social-links {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 36px 0;
  font-size: 0.85rem;
}

.social-links a {
  color: var(--text-secondary);
  padding: 8px 18px;
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: all var(--transition);
  font-weight: 500;
}

.social-links a:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-light);
}

/* ── Logo bar ── */
.logo-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 32px;
  flex-wrap: wrap;
  margin: 44px 0 16px;
  padding: 24px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  background: var(--bg-alt);
}

.logo-bar img {
  height: 52px;
  opacity: 0.65;
  transition: opacity var(--transition);
  filter: grayscale(30%);
}

.logo-bar img:hover {
  opacity: 1;
  filter: none;
}

/* ── Project cards (research) ── */
.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 24px;
  transition: all var(--transition);
  cursor: pointer;
}

.project-card:hover {
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

.project-card-header {
  padding: 24px 28px 0;
}

.project-card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  margin-bottom: 16px;
  line-height: 1.5;
}

.project-card-image {
  width: 100%;
  display: block;
  padding: 0 24px;
}

.project-card-image img {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
}

.project-card-body {
  padding: 0 28px 28px;
  display: none;
}

.project-card-body.open { display: block; }

.project-card-body p {
  color: var(--text-secondary);
  text-align: justify;
  margin-top: 16px;
  font-size: 0.92rem;
}

.project-card-body h4 {
  font-size: 0.9rem;
  color: var(--accent);
  margin-top: 28px;
  margin-bottom: 4px;
  font-weight: 600;
}

.project-card-body .sub-figure {
  margin: 16px 0;
  text-align: center;
}

.project-card-body .sub-figure img {
  max-width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
}

.project-card-body .sub-figure figcaption {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 8px;
  font-style: italic;
}

.paper-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--accent);
  padding: 6px 14px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  margin-top: 12px;
  transition: all var(--transition);
}

.paper-link:hover {
  background: var(--accent-light);
  color: var(--accent-hover);
}

.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-published {
  background: var(--green-light);
  color: var(--green);
}

.badge-review {
  background: var(--amber-light);
  color: var(--amber);
}

.badge-preprint {
  background: var(--purple-light);
  color: var(--purple);
}

.expand-hint {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 12px;
  transition: color var(--transition);
}

.project-card:hover .expand-hint { color: var(--accent); }

/* ── Publications ── */
.pub-list { list-style: none; }

.pub-year-group { margin-bottom: 40px; }

.pub-year {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--accent-light);
}

.pub-entry {
  padding: 18px 24px;
  margin-bottom: 10px;
  background: var(--bg-alt);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  transition: all var(--transition);
}

.pub-entry:hover {
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}

.pub-title {
  font-weight: 600;
  font-size: 0.93rem;
  margin-bottom: 6px;
  line-height: 1.5;
}

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

.pub-authors {
  font-size: 0.84rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

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

.pub-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pub-venue {
  display: inline-block;
  font-size: 0.73rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-light);
  color: var(--accent);
}

.pub-note {
  font-size: 0.73rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
}

.pub-note-senior {
  background: var(--purple-light);
  color: var(--purple);
}

/* ── Skills page ── */
.skills-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.skills-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.skills-summary-card {
  padding: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.skills-summary-card strong {
  display: block;
  margin-bottom: 6px;
  font-size: 0.88rem;
  color: var(--text);
}

.skills-summary-card span {
  display: block;
  color: var(--text-secondary);
  font-size: 0.82rem;
  line-height: 1.6;
}

.skill-card {
  background: var(--bg-alt);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 28px;
  transition: all var(--transition);
}

.skill-card:hover {
  border-color: var(--border);
  box-shadow: var(--shadow);
}

.skill-card h3 {
  font-size: 0.92rem;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.skill-card h3 .icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.skill-tag {
  font-size: 0.76rem;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: 999px;
  transition: all var(--transition);
}

/* Color themes for skill cards */
.skill-card.theme-blue h3 { color: var(--accent); }
.skill-card.theme-blue .icon { background: var(--accent-light); color: var(--accent); }
.skill-card.theme-blue .skill-tag { background: var(--accent-light); color: #1e40af; }
.skill-card.theme-blue:hover { border-color: #93c5fd; }

.skill-card.theme-purple h3 { color: var(--purple); }
.skill-card.theme-purple .icon { background: var(--purple-light); color: var(--purple); }
.skill-card.theme-purple .skill-tag { background: var(--purple-light); color: #5b21b6; }
.skill-card.theme-purple:hover { border-color: #c4b5fd; }

.skill-card.theme-green h3 { color: var(--green); }
.skill-card.theme-green .icon { background: var(--green-light); color: var(--green); }
.skill-card.theme-green .skill-tag { background: var(--green-light); color: #065f46; }
.skill-card.theme-green:hover { border-color: #86efac; }

.skill-card.theme-amber h3 { color: var(--amber); }
.skill-card.theme-amber .icon { background: var(--amber-light); color: var(--amber); }
.skill-card.theme-amber .skill-tag { background: var(--amber-light); color: #92400e; }
.skill-card.theme-amber:hover { border-color: #fcd34d; }

.skill-card.theme-rose h3 { color: var(--rose); }
.skill-card.theme-rose .icon { background: var(--rose-light); color: var(--rose); }
.skill-card.theme-rose .skill-tag { background: var(--rose-light); color: #9f1239; }
.skill-card.theme-rose:hover { border-color: #fda4af; }

.skill-card.full-width {
  grid-column: 1 / -1;
}

/* ── Languages bar (skills page bottom) ── */
.lang-bar {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 20px 0;
  margin-top: 8px;
}

.lang-item {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.lang-item strong { color: var(--text); }

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

/* ── Home sections ── */
.home-section {
  margin-bottom: 40px;
}

.home-heading {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}

/* ── Focus cards (index) ── */
.focus-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.focus-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px 22px;
  background: var(--bg-alt);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  transition: all var(--transition);
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.6;
}

.focus-card:hover {
  border-color: var(--border);
  box-shadow: var(--shadow);
  color: var(--text-secondary);
}

.focus-card strong {
  color: var(--text);
  font-size: 0.92rem;
}

.focus-icon {
  font-size: 1.3rem;
  margin-bottom: 2px;
}

/* ── Timeline (index) ── */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.timeline-item {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 20px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-light);
  align-items: baseline;
}

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

.timeline-date {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  padding-top: 1px;
}

.timeline-content {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.timeline-content strong {
  color: var(--text);
  font-weight: 600;
}

.timeline-detail {
  display: block;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 24px;
    text-align: center;
  }

  .hero-photo { order: -1; }
  .hero-text p { text-align: left; }
  .hero-metrics { grid-template-columns: 1fr; text-align: left; }
  .hero-keywords { justify-content: center; }
  .focus-grid { grid-template-columns: 1fr; }
  .skills-grid { grid-template-columns: 1fr; }
  .skills-summary { grid-template-columns: 1fr; }
  .timeline-item { grid-template-columns: 1fr; gap: 2px; }
  .nav-links { gap: 16px; }
  .nav-links a { font-size: 0.82rem; }
}

@media (max-width: 480px) {
  nav { flex-direction: column; height: auto; padding: 12px 0; gap: 8px; }
  .social-links { gap: 8px; }
  .social-links a { padding: 6px 12px; font-size: 0.78rem; }
  .logo-bar { gap: 20px; }
  .logo-bar img { height: 40px; }
  .section-title { font-size: 1.4rem; }
}
