/* =========================================================
   个人学术主页样式表
   配色、字体、间距都集中在 :root 变量里，改主题色只需改这里
   ========================================================= */

:root {
  --accent: #2f9e6f;          /* 主题强调色：清新的绿松石色，可自行替换 */
  --accent-soft: #e6f5ee;     /* 强调色的浅色背景版本 */
  --bg: #fbfbfa;
  --bg-elevated: #ffffff;
  --text: #24292f;
  --text-muted: #5b6570;
  --border: #e7e7e4;
  --shadow: 0 1px 2px rgba(16, 24, 32, 0.04), 0 6px 20px rgba(16, 24, 32, 0.06);
  --radius: 14px;
  --sidebar-width: 300px;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-heading: "Poppins", var(--font-body);
}

[data-theme="dark"] {
  --accent: #4cc38a;
  --accent-soft: rgba(76, 195, 138, 0.14);
  --bg: #14171a;
  --bg-elevated: #1c2024;
  --text: #eef1f3;
  --text-muted: #9aa4ad;
  --border: #2a2f34;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 24px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

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

h1, h2, h3 { font-family: var(--font-heading); color: var(--text); }

img { max-width: 100%; display: block; }

ul { padding: 0; margin: 0; list-style: none; }

/* ---------- 整体布局：左侧栏 + 右侧内容 ---------- */

.layout {
  display: flex;
  align-items: flex-start;
  max-width: 1180px;
  margin: 0 auto;
  padding: 56px 24px;
  gap: 56px;
}

.sidebar {
  position: sticky;
  top: 56px;
  width: var(--sidebar-width);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.content {
  flex: 1;
  min-width: 0;
}

/* ---------- 侧边栏内容 ---------- */

.avatar {
  width: 128px;
  height: 128px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.avatar--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent), #6fd3a8);
  color: #fff;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 42px;
  letter-spacing: 1px;
}

.sidebar__name {
  font-size: 24px;
  font-weight: 600;
  margin: 0 0 4px;
}

.sidebar__name-zh {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-muted);
}

.sidebar__title {
  margin: 0;
  color: var(--text);
  font-weight: 500;
  font-size: 15px;
}

.sidebar__org {
  margin: 2px 0 16px;
  color: var(--text-muted);
  font-size: 14px;
}

.sidebar__bio {
  font-size: 14.5px;
  color: var(--text-muted);
  margin: 0 0 20px;
}

.cv-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  margin-bottom: 20px;
  font-size: 13.5px;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  transition: all 0.2s ease;
}
.cv-button svg { width: 14px; height: 14px; fill: currentColor; }
.cv-button:hover {
  background: transparent;
  color: var(--accent);
  text-decoration: none;
  transform: translateY(-1px);
}

.sidebar__socials {
  display: flex;
  gap: 10px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.sidebar__socials a {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.sidebar__socials a svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.sidebar__socials a:hover {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
  transform: translateY(-2px);
}

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.nav-link {
  color: var(--text-muted);
  font-size: 14.5px;
  font-weight: 500;
  padding: 7px 10px;
  border-radius: 8px;
  transition: all 0.15s ease;
}

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

.nav-link.is-active {
  background: var(--accent-soft);
  color: var(--accent);
}

.theme-toggle {
  margin-top: 24px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }

.theme-toggle svg { width: 18px; height: 18px; fill: currentColor; }
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

/* ---------- 内容区块通用样式 ---------- */

.section {
  padding-bottom: 44px;
  margin-bottom: 44px;
  border-bottom: 1px solid var(--border);
  scroll-margin-top: 24px;
}

.section:last-child {
  border-bottom: none;
}

.section__title {
  font-size: 21px;
  font-weight: 600;
  margin: 0 0 20px;
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.section__title-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.section__note {
  color: var(--text-muted);
  font-size: 13.5px;
  margin-top: -12px;
}

.section p { margin: 0 0 14px; color: var(--text); }
.section p:last-child { margin-bottom: 0; }

.hiring-note {
  padding: 12px 16px;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  color: var(--text);
}

/* ---------- Recent Highlights ---------- */

.news-list li {
  position: relative;
  padding: 8px 0 8px 18px;
  border-bottom: 1px dashed var(--border);
  font-size: 15px;
}
.news-list li:last-child { border-bottom: none; }
.news-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 17px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}
.news-date {
  color: var(--text-muted);
  font-weight: 500;
  margin-right: 4px;
}

/* ---------- Education ---------- */

.edu-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.edu-item:last-child { border-bottom: none; }
.edu-item__main { display: flex; flex-direction: column; }
.edu-item__degree { font-weight: 600; }
.edu-item__school { color: var(--text-muted); font-size: 14px; }
.edu-item__advisor { color: var(--text-muted); font-size: 14px; margin-top: 2px; }
.edu-item__time {
  flex-shrink: 0;
  color: var(--text-muted);
  font-size: 13.5px;
  white-space: nowrap;
}

/* ---------- Experience：时间轴 ---------- */

.timeline {
  position: relative;
  padding-left: 0;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 6px;
  bottom: 6px;
  width: 2px;
  margin-left: -1px;
  background: var(--border);
}

.timeline__item {
  position: relative;
  width: 50%;
  padding: 10px 32px;
  margin-bottom: 4px;
}

.timeline__item--left { left: 0; text-align: right; }
.timeline__item--right { left: 50%; text-align: left; }

.timeline__item::before {
  content: "";
  position: absolute;
  top: 20px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
  z-index: 1;
}
.timeline__item--left::before { right: -6px; }
.timeline__item--right::before { left: -6px; }

.timeline__card {
  display: inline-block;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  box-shadow: var(--shadow);
  max-width: 100%;
}

.timeline__row {
  display: flex;
  gap: 10px;
  align-items: baseline;
  flex-wrap: wrap;
}
.timeline__item--left .timeline__row { justify-content: flex-end; }

.timeline__org {
  font-weight: 600;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.timeline__time { color: var(--accent); font-size: 12.5px; font-weight: 500; }

.timeline__tag {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--border);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.timeline__tag--fulltime {
  background: var(--accent-soft);
  color: var(--accent);
}
.timeline__desc {
  color: var(--text-muted);
  font-size: 13.5px;
  font-style: italic;
  margin-top: 4px;
  line-height: 1.6;
}
.timeline__desc a { font-style: normal; }

.timeline__logo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 24px;
  max-width: 100px;
  padding: 3px 9px;
  border-radius: 6px;
  background: #ffffff;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.timeline__logo-badge img {
  height: 100%;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  display: block;
}

.timeline__papers {
  margin-top: 10px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.timeline__item--left .timeline__papers { justify-content: flex-end; }

/* ---------- Publications ---------- */

.pub {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.pub:last-child { border-bottom: none; padding-bottom: 0; }

.pub__title { font-size: 16.5px; font-weight: 600; margin: 0 0 6px; }
.pub__authors { margin: 0 0 6px; font-size: 14.5px; color: var(--text-muted); }
.pub__authors strong { color: var(--text); }
.pub__venue { margin: 0 0 10px; }
.pub__note { margin: 8px 0 0; font-size: 13px; color: var(--text-muted); font-style: italic; }

.badge {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
}

.badge--award {
  background: rgba(220, 38, 38, 0.1);
  color: #dc2626;
}

.text-award {
  color: #dc2626;
  font-weight: 700;
}

.pill--award {
  color: #dc2626;
  border-color: rgba(220, 38, 38, 0.4);
}
.pill--award:hover {
  background: #dc2626;
  border-color: #dc2626;
}

.pub__links { margin: 0; display: flex; gap: 8px; flex-wrap: wrap; }

.pill {
  display: inline-block;
  font-size: 12.5px;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: all 0.15s ease;
}
.pill:hover {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
  text-decoration: none;
}

/* ---------- Projects ---------- */

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
}

.project-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.project-card:hover {
  transform: translateY(-3px);
}

.project-card__title { font-size: 16px; font-weight: 600; margin: 0 0 8px; }
.project-card__desc { font-size: 14px; color: var(--text-muted); margin: 0 0 12px; flex: 1; }
.project-card__tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }

.tag {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--accent-soft);
  padding: 2px 9px;
  border-radius: 6px;
}

.project-card__links { display: flex; gap: 8px; }

/* ---------- 简单列表：Awards / Talks ---------- */

.simple-list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
}
.simple-list li:last-child { border-bottom: none; }

/* ---------- Visitors / Footer ---------- */

.section--visitors { border-bottom: none; margin-bottom: 0; }

.visitors-map {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 8px 0 16px;
  padding: 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.visitors-map a {
  display: block;
  line-height: 0;
}

.visitors-map img {
  display: block;
  max-width: 100%;
  width: min(720px, 100%);
  height: auto;
  margin: 0 auto;
  border-radius: 8px;
}

.visitors-stats {
  margin: 0 0 8px;
  text-align: center;
  font-size: 13.5px;
  color: var(--text-muted);
}

.footer-note {
  margin-top: 24px;
  font-size: 12.5px;
  color: var(--text-muted);
}

/* ---------- 移动端顶部导航条（宽屏隐藏） ---------- */

.mobile-topbar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 20;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

.mobile-topbar__name {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 16px;
  color: var(--text);
}

.mobile-topbar__toggle {
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
}
.mobile-topbar__toggle span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
}

/* ---------- 响应式 ---------- */

@media (max-width: 900px) {
  .mobile-topbar { display: flex; }

  .layout {
    flex-direction: column;
    padding: 24px 20px 56px;
    gap: 0;
  }

  .sidebar {
    position: static;
    width: 100%;
    align-items: center;
    text-align: center;
    padding-bottom: 24px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
  }

  .sidebar__socials { justify-content: center; }

  .sidebar__nav {
    display: none;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    border-top: none;
    padding-top: 12px;
  }

  .sidebar__nav.is-open { display: flex; }

  .theme-toggle { position: absolute; top: 14px; right: 20px; margin-top: 0; }

  .timeline::before { left: 6px; }
  .timeline__item,
  .timeline__item--left,
  .timeline__item--right {
    width: 100%;
    left: 0;
    text-align: left;
    padding: 10px 0 10px 28px;
  }
  .timeline__item--left::before,
  .timeline__item--right::before { left: 0; right: auto; }
  .timeline__item--left .timeline__row { justify-content: flex-start; }
}

@media (max-width: 480px) {
  .layout { padding: 20px 14px 40px; }
  .avatar { width: 100px; height: 100px; }
  .avatar--placeholder { font-size: 34px; }
}

/* ---------- 滚动淡入动画 ---------- */

.section {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.section.is-visible {
  opacity: 1;
  transform: translateY(0);
}
