/* =============================================
   Academic Personal Homepage — style.css
   Light / Dark theme with toggle
   ============================================= */

/* ---- Light theme (default) ---- */
:root {
  --text:        #1a1a1a;
  --text-muted:  #555;
  --text-light:  #888;
  --accent:      #2563eb;
  --accent-hover:#1d4ed8;
  --bg:          #f8f8f6;
  --border:      #e0e0e0;
  --chip-bg:     #f0f0ee;
  --chip-hover:  #e4e4e2;
  --pub-hover:   #f2f4ff;
  --font-body:   'Inter', system-ui, -apple-system, sans-serif;
  --font-serif:  'Crimson Pro', Georgia, serif;
  --radius:      6px;
  --max-width:   820px;
}

/* ---- Dark theme override ---- */
[data-theme="dark"] {
  --text:        #e8e8e2;
  --text-muted:  #999;
  --text-light:  #666;
  --accent:      #6a9fe8;
  --accent-hover:#90bbff;
  --bg:          #0e0e0e;
  --border:      #2a2a2a;
  --chip-bg:     #1e1e1e;
  --chip-hover:  #2a2a2a;
  --pub-hover:   #1a1a1a;
}

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

/* ---- Base ---- */
html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  transition: background 0.2s, color 0.2s;
}

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

/* ---- Layout ---- */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 44px 24px 72px;
}

/* ---- Theme toggle button ---- */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 24px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--chip-bg);
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
  z-index: 100;
}
.theme-toggle:hover {
  background: var(--chip-hover);
  transform: scale(1.1);
}

/* ---- Header / Profile ---- */
.profile {
  display: flex;
  gap: 32px;
  align-items: flex-start;
  margin-bottom: 52px;
}

.profile-photo {
  flex-shrink: 0;
  position: relative;
  width: 108px;
  height: 108px;
}

.profile-photo img {
  width: 108px;
  height: 108px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  display: block;
}

.photo-placeholder {
  width: 108px;
  height: 108px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1a4fa8 0%, #4b7bec 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: 1px;
}

/* hide placeholder when image loads successfully */
.profile-photo img + .photo-placeholder { display: none; }

.profile-info h1 {
  font-size: 1.65rem;
  font-weight: 600;
  letter-spacing: -0.3px;
  line-height: 1.2;
  margin-bottom: 5px;
}

.name-cn {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 6px;
}

/* ---- Position row ---- */
.profile-position {
  font-size: 0.84rem;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 9px;
}

/* ---- Header contact chips ---- */
.header-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.link-chip {
  display: inline-block;
  padding: 3px 10px;
  background: var(--chip-bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: background 0.15s;
  text-decoration: none;
}
.link-chip:hover {
  background: var(--chip-hover);
  color: var(--accent);
  text-decoration: none;
}

/* email chip: light / dark variants */
.link-chip.email {
  color: #1d4ed8;
  border-color: #bdd7ff;
  background: #f0f7ff;
}
[data-theme="dark"] .link-chip.email {
  color: #7ab0f0;
  border-color: #1e3060;
  background: #0f1a2e;
}

/* ---- Section titles ---- */
section {
  margin-bottom: 44px;
}

section h2 {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--text);
  padding-bottom: 7px;
  border-bottom: 2px solid var(--accent);
  margin-bottom: 18px;
  width: fit-content;
}

/* ---- About Me ---- */
.research-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  max-width: 680px;
  margin-bottom: 12px;
}

/* ---- Research tags ---- */
.tag-section-label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: #aaa;
  margin-bottom: 6px;
  margin-top: 11px;
}

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

/* light */
.tag {
  padding: 2px 9px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 500;
  background: #eef2ff;
  color: #3730a3;
  border: 1px solid #c7d2fe;
}
/* dark override */
[data-theme="dark"] .tag {
  background: #1a2540;
  color: #7ab0f0;
  border-color: #1e3060;
}

/* ---- Publications ---- */
.section-note {
  font-size: 0.78rem;
  color: var(--text-light);
  margin-bottom: 18px;
}

.venue-group {
  margin-bottom: 24px;
}

.venue-label {
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}

.pub-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pub-item {
  padding: 5px 12px 5px 24px;
  border-radius: var(--radius);
  border-left: 3px solid transparent;
  font-size: 0.875rem;
  color: var(--text);
  position: relative;
  transition: background 0.15s, border-color 0.15s;
}
.pub-item::before {
  content: '▸';
  position: absolute;
  left: 9px;
  color: var(--accent);
  font-size: 0.7rem;
  top: 9px;
}
.pub-item:hover {
  background: var(--pub-hover);
  border-left-color: var(--accent);
}

/* ---- Author role badges ---- */
.badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 0.64rem;
  font-weight: 600;
  margin-left: 4px;
  vertical-align: middle;
  letter-spacing: 0.3px;
  line-height: 1.6;
}

/* 共一作者：红色 — light */
.badge-co  { background: #fff0f0; color: #b91c1c; border: 1px solid #fca5a5; }
/* 通信作者：橙色 — light */
.badge-cor { background: #fff7ed; color: #c2410c; border: 1px solid #fed7aa; }

/* dark overrides */
[data-theme="dark"] .badge-co  { background: #2d0a0a; color: #f87171; border-color: #7f1d1d; }
[data-theme="dark"] .badge-cor { background: #2a1500; color: #fb923c; border-color: #7c2d12; }

.full-list-link, .full-paper-list-link {
  margin-top: 14px;
  font-size: 0.84rem;
}

/* ---- Timeline (Experience) ---- */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.timeline-item {
  display: flex;
  gap: 22px;
  align-items: flex-start;
}

.timeline-left {
  flex-shrink: 0;
  width: 106px;
  padding-top: 2px;
}

.tl-year {
  font-size: 0.76rem;
  color: var(--text-light);
  font-weight: 500;
  white-space: nowrap;
}

.timeline-right {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.timeline-right strong {
  font-size: 0.875rem;
}

.institution {
  font-size: 0.83rem;
  color: var(--text-muted);
}

/* ---- Footer ---- */
footer {
  margin-top: 60px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  font-size: 0.74rem;
  color: var(--text-light);
  text-align: center;
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
  .profile {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 18px;
  }

  .header-links {
    justify-content: center;
  }

  .timeline-item {
    flex-direction: column;
    gap: 4px;
  }

  .timeline-left {
    width: auto;
  }

  .container { padding: 28px 16px 56px; }

  .theme-toggle {
    top: 14px;
    right: 14px;
  }
}
