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

:root {
  --bg:           #f8f9fa;
  --surface:      #ffffff;
  --border:       #e5e7eb;
  --text:         #1a1a2e;
  --muted:        #6b7280;
  --accent:       #2563eb;
  --accent-light: #dbeafe;
  --tag-bg:       #f0f4ff;
  --tag-text:     #3b5bdb;
  --radius:       12px;
  --shadow:       0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.04);
  /* CUHK brand colors */
  --cuhk-purple:  #4a1c5c;
  --cuhk-gold:    #c9a84c;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

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

/* ===========================
   Sticky Nav / TOC
=========================== */
.toc-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: linear-gradient(135deg, var(--cuhk-purple) 0%, #2d1040 60%, #1a0a2e 100%);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 2px 12px rgba(74,28,92,0.3);
}

.toc-logo {
  height: 44px;
  width: 44px;
  object-fit: contain;
  border-radius: 50%;
  background: white;
  padding: 4px;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.2);
}

.toc-inner {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 24px;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.toc-name {
  font-size: 1rem;
  font-weight: 600;
  color: rgba(255,255,255,0.92);
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.toc-links {
  display: flex;
  gap: 2px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 28px;
  padding: 4px;
}

.toc-links a {
  font-size: 0.875rem;
  font-weight: 500;
  color: rgba(255,255,255,0.75);
  padding: 7px 18px;
  border-radius: 22px;
  transition: color .2s, background .2s;
  text-decoration: none;
  white-space: nowrap;
}

.toc-links a:hover {
  color: #fff;
  background: rgba(255,255,255,0.15);
  text-decoration: none;
}

.toc-links a.active {
  color: var(--cuhk-purple);
  background: #fff;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* ===========================
   Layout
=========================== */
.container {
  max-width: 820px;
  margin: 0 auto;
  padding: 40px 24px 64px;
}

/* ===========================
   Profile Header
=========================== */
.profile {
  display: flex;
  gap: 36px;
  align-items: flex-start;
  margin-bottom: 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 36px;
  box-shadow: var(--shadow);
}

.profile-photo {
  flex-shrink: 0;
}

.profile-photo img {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  object-position: 35% 65%;
  border: 3px solid var(--border);
  box-shadow: var(--shadow);
}

.profile-info h1 {
  font-size: 1.9rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 6px;
}

.chinese-name {
  font-family: 'Crimson Text', Georgia, serif;
  font-weight: 400;
  font-size: 1.4rem;
  color: var(--muted);
  margin-left: 6px;
}

.affiliation {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.95rem;
}

.supervisor {
  margin-top: 4px;
  font-size: 0.92rem;
  color: var(--muted);
}

.research-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--tag-bg);
  color: var(--tag-text);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: 20px;
}

.tag-icon {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 16px;
}

.link-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--muted);
  transition: color .15s;
}

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

.link-item svg,
.link-item i {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.github-cat-icon {
  width: 16px;
  height: 16px;
}

/* ===========================
   Cards
=========================== */
.main-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
  box-shadow: var(--shadow);
}

.section-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.section-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--accent);
}

.inline-icon {
  width: 13px;
  height: 13px;
  vertical-align: middle;
  margin-right: 3px;
  color: var(--accent);
  flex-shrink: 0;
}

/* ===========================
   About
=========================== */
.card p + p {
  margin-top: 10px;
}

/* ===========================
   Publications
=========================== */
.pub-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.pub-item {
  padding-left: 14px;
  border-left: 3px solid var(--accent-light);
}

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

.pub-venue {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pub-meta-icon { width: 12px; height: 12px; }

.pub-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  background: #fef3c7;
  color: #92400e;
  padding: 2px 8px;
  border-radius: 10px;
}

.badge-icon { width: 11px; height: 11px; }

.pub-title {
  font-family: 'Crimson Text', Georgia, serif;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 4px;
}

.pub-title a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text);
}
.pub-title a:hover { color: var(--accent); }

.ext-icon {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  opacity: 0.5;
}

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

.pub-citation {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.82rem;
  color: #9ca3af;
  font-style: italic;
}

.cite-icon { width: 11px; height: 11px; flex-shrink: 0; }

/* ===========================
   Timeline (Education)
=========================== */
.timeline {
  list-style: none;
  position: relative;
  padding-left: 28px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 12px;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding-left: 24px;
  padding-bottom: 24px;
}

.timeline-item:last-child { padding-bottom: 0; }

.timeline-dot {
  position: absolute;
  left: -20px;
  top: 3px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-light);
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.dot-icon { width: 13px; height: 13px; color: var(--accent); }

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px;
}

.inst { font-weight: 600; font-size: 0.95rem; }

.period {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.82rem;
  color: var(--muted);
  white-space: nowrap;
}

.cal-icon { width: 12px; height: 12px; }

.degree { font-size: 0.92rem; color: var(--text); margin-top: 2px; }

.detail { font-size: 0.86rem; color: var(--muted); margin-top: 2px; }

/* ===========================
   Teaching
=========================== */
.teaching-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.course-code {
  font-family: 'Courier New', monospace;
  font-size: 0.82rem;
  font-weight: 700;
  background: var(--tag-bg);
  color: var(--tag-text);
  padding: 2px 8px;
  border-radius: 6px;
  white-space: nowrap;
}

.teaching-intro {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 14px;
}

.teaching-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  flex-wrap: wrap;
}

.course-name {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 1;
  min-width: 200px;
}

.course-icon { width: 13px; height: 13px; color: var(--accent); flex-shrink: 0; }

.course-period { font-size: 0.82rem; color: var(--muted); white-space: nowrap; }

/* ===========================
   Blogs
=========================== */
.blogs-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 32px 0;
}

.blogs-empty-icon { width: 36px; height: 36px; color: var(--border); }

.blogs-empty p { font-size: 0.9rem; color: var(--muted); text-align: center; }

/* ===========================
   Footer
=========================== */
footer {
  text-align: center;
  margin-top: 40px;
  font-size: 0.82rem;
  color: #9ca3af;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

/* ===========================
   Responsive
=========================== */
@media (max-width: 640px) {
  .toc-inner { height: 54px; }
  .toc-name { display: none; }
  .toc-links { gap: 1px; }
  .toc-links a { padding: 5px 10px; font-size: 0.78rem; }

  .profile {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 20px;
    padding: 24px 20px;
  }
  .profile-photo img { width: 110px; height: 110px; }
  .contact-links { justify-content: center; }
  .research-tags { justify-content: center; }
  .card { padding: 20px 18px; }
  .timeline-header { flex-direction: column; }
}
