/* 0. 字体引入 */
@font-face { font-family: 'Lato'; font-style: normal; font-weight: 400; src: local('Lato Regular'), url(https://fonts.gstatic.com/s/lato/v15/S6uyw4BMUTPHjxAwXiWtFCfQ7A.woff2) format('woff2'); }
@font-face { font-family: 'Lato'; font-style: normal; font-weight: 700; src: local('Lato Bold'), url(https://fonts.gstatic.com/s/lato/v15/S6u9w4BMUTPHh6UVSwaPGQ3q5d0N7w.woff2) format('woff2'); }
@font-face { font-family: 'Lato'; font-style: italic; font-weight: 400; src: local('Lato Italic'), url(https://fonts.gstatic.com/s/lato/v15/S6u8w4BMUTPHjxsAUi-qNiXg7eU0.woff2) format('woff2'); }
@font-face { font-family: 'Lato'; font-style: italic; font-weight: 700; src: local('Lato Bold Italic'), url(https://fonts.gstatic.com/s/lato/v15/S6u_w4BMUTPHjxsI5wq_FQftx9897sxZ.woff2) format('woff2'); }

/* 1. 颜色与变量定义 */
:root {
  --bg-color: #f8f3ea;
  --surface-color: #fffaf2;
  --surface-hover: #efe5d6;
  --text-primary: #2f2a24;
  --text-secondary: #70675d;
  --heading-color: #9b6a3f;
  --pub-title-color: #5f3f25;
  --name-color: #2b251f;
  --pub-link-color: #9a5f2f;
  --link-color: #9a5f2f;
  --link-hover: #7a4522;
  --highlight-name: #9a5f2f;
  --highlight-pub: #9a5f2f;
  --venue-tag-bg: #9a5837;
  --hero-gradient-center: #fffaf2;
  --sticky-bg: rgba(248, 243, 234, 0.88);
  --shadow-color: rgba(80, 55, 32, 0.16);
  --border-muted: rgba(47, 42, 36, 0.14);
  --border-soft: rgba(47, 42, 36, 0.08);
  --font-main: 'Aptos', 'Lato', Verdana, Helvetica, sans-serif;
  --font-serif: 'Noto Serif', 'Lato', Verdana, Helvetica, sans-serif;
}

[data-theme="dark"] {
  --bg-color: #1f1b16;
  --surface-color: #28231d;
  --surface-hover: #332d25;
  --text-primary: #f4efe7;
  --text-secondary: #b8afa4;
  --heading-color: #d8b78f;
  --pub-title-color: #f0d7b6;
  --name-color: #f7f0e6;
  --pub-link-color: #d49a64;
  --link-color: #d49a64;
  --link-hover: #f0c28a;
  --highlight-name: #f0c28a;
  --highlight-pub: #f0c28a;
  --venue-tag-bg: #8f4f2f;
  --hero-gradient-center: #332b22;
  --sticky-bg: rgba(31, 27, 22, 0.88);
  --shadow-color: rgba(0, 0, 0, 0.34);
  --border-muted: rgba(244, 239, 231, 0.14);
  --border-soft: rgba(244, 239, 231, 0.08);
}

/* 2. 全局重置与基础设置 */
* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 16px; 
  line-height: 1.5;
  transition: background-color 0.25s ease, color 0.25s ease;
}

.container {
  width: 90%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 40px 0;
}

a {
  color: inherit; 
  text-decoration: none;
  background-image:
    linear-gradient(color-mix(in srgb, var(--text-secondary) 42%, transparent), color-mix(in srgb, var(--text-secondary) 42%, transparent)),
    linear-gradient(var(--link-hover), var(--link-hover));
  background-position: 0 100%, 0 100%;
  background-repeat: repeat-x, no-repeat;
  background-size: 100% 1px, 0 1.5px;
  transition: color 0.3s ease, background-size 0.3s ease;
}

a:hover { color: var(--link-hover); }
a:hover { background-size: 100% 1px, 100% 1.5px; }
a:has(img) { background-image: none; }
a.color-a { color: var(--pub-link-color); }
img, video { border-radius: 15px; }

/* 3. Section 与高级下划线 */
section {
  scroll-margin-top: 80px;
  margin-bottom: 50px;
}

.intro-section {
  display: flex;
  align-items: center;
  gap: 40px;
  margin-bottom: 50px;
  line-height: 1.8;
}

.profile-img {
  height: 180px;
  max-width: 100%;
}

.name {
  font-family: var(--font-main);
  font-size: 32px;
  color: var(--name-color);
  margin-bottom: 10px;
}


.section-title {
  font-family: var(--font-serif);
  font-size: 26px;
  color: var(--heading-color);
  position: relative; 
  padding-bottom: 12px; 
  margin-bottom: 30px; 
}

.section-title::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 50px; 
  height: 3px; 
  background: var(--heading-color); 
  border-radius: 2px;
}

.section-subtitle {
  font-size: 14px;
  color: var(--text-primary);
  margin-top: -15px;
  margin-bottom: 25px;
}

.content-block p { margin-bottom: 15px; }

.subsection-title {
  font-family: var(--font-serif);
  font-size: 20px;
  color: var(--heading-color);
  margin: 26px 0 14px;
}

.news-list {
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
}

.news-list li {
  display: flex;
  gap: 12px;
  margin-bottom: 10px;
  line-height: 1.6;
}

.news-date {
  color: var(--text-secondary);
  flex: 0 0 76px;
  white-space: nowrap;
}

/* 4. 列表项 (Education / Internship) */
.list-item { display: flex; align-items: center; gap: 20px; margin-bottom: 25px; }
.list-item .logo {
  width: 74px;
  height: 70px;
  max-width: 74px;
  object-fit: contain;
  border-radius: 8px;
  flex: 0 0 74px;
}
.list-content { flex: 1; }
.item-title { font-family: var(--font-serif); font-size: 16px; font-weight: 600; color: var(--pub-title-color); }
.list-date { font-weight: bold; font-size: 15px; }

/* 5. Publications 核心 */
.pub-item { display: flex; gap: 30px; margin-bottom: 10px; padding: 15px; border-radius: 12px; transition: background-color 0.2s; }
.pub-item:hover { background-color: var(--surface-hover); }

.pub-img {
  flex: 0 0 25%;
  aspect-ratio: 16 / 9;
  background: transparent;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center; 
  overflow: hidden;
}

.img-wrapper { position: relative; display: flex; max-width: 100%; max-height: 100%; }
.img-wrapper img { display: block; max-width: 100%; max-height: 100%; border-radius: 6px; }

.img-static { position: relative; z-index: 1; transition: opacity 0.3s ease; }
.img-hover { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 2; opacity: 0; object-fit: contain; transition: opacity 0.3s ease; }
.pub-item:hover .img-static { opacity: 0; }
.pub-item:hover .img-hover { opacity: 1; }

.venue-tag {
  position: absolute; top: 6px; left: 6px; z-index: 10; display: inline-block; font-size: 11px;
  font-weight: normal; color: #fff; background-color: var(--venue-tag-bg);
  padding: 1px 5px 2px 5px; border-radius: 4px; box-shadow: 2px 2px 1px var(--shadow-color); pointer-events: none;
}

.pub-info { flex: 1; }
.pub-title { font-family: var(--font-serif); font-size: 17px; font-weight: 700; color: var(--pub-title-color); margin: 4px 0; display: block; }
.pub-authors { font-size: 15px; color: var(--text-secondary); margin-bottom: 8px; }
.highlight-me { color: var(--highlight-name); text-decoration: underline; text-underline-offset: 3px; }
.highlight-pub { color: var(--highlight-pub); font-weight: normal; }
.pub-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin-top: 12px;
  margin-bottom: 8px;
}

.pub-venue { font-size: 15px; margin: 0; white-space: nowrap; }

.pub-desc {
  font-size: 14px; font-style: italic; color: var(--text-secondary);
  margin-top: 16px; padding-left: 10px; border-left: 2px solid var(--border-muted); line-height: 1.2;
}
.pub-item:hover .pub-desc { border-left-color: var(--link-hover); }

.pub-links { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 0; }
.pub-links a { color: var(--pub-link-color); text-decoration: none; }

.pub-stat {
  font-size: 13px;
  color: var(--text-secondary);
  font-family: var(--font-main);
  transition: color 0.3s ease;
  font-weight: normal;
}

.stat-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border: 1px solid var(--border-muted);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-color) 70%, transparent);
  color: var(--text-secondary);
  line-height: 1;
  white-space: nowrap;
}

.stat-badge[hidden] {
  display: none;
}

.stat-badge.is-loaded {
  color: var(--text-primary);
}

/* 6. 过滤气泡 */
.filter-controls { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 30px; }
.filter-btn {
  background: color-mix(in srgb, var(--surface-color) 58%, transparent); color: var(--text-secondary); border: 1px solid var(--border-muted);
  padding: 6px 16px; border-radius: 20px; font-size: 14px; cursor: pointer; transition: all 0.3s ease; font-family: var(--font-main);
}
.filter-btn:hover { background: var(--surface-hover); color: var(--text-primary); }
.filter-btn.active { background: var(--link-hover); color: var(--bg-color); border-color: var(--link-hover); font-weight: bold; }
.pub-item { transition: opacity 0.4s ease, transform 0.4s ease; }
.pub-item.hidden { display: none; }

/* 7. Footer */
footer { text-align: right; font-size: 14px; padding-top: 20px; margin-top: 40px; }


/* =========================================
   8. 全屏首屏 (Hero Screen)
========================================= */
.hero-screen {
  height: 100vh; 
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: radial-gradient(circle at center, var(--hero-gradient-center) 0%, var(--bg-color) 72%);
}

.hero-content {
  text-align: center;
  animation: fadeInUp 1s ease-out forwards; 
}

.hero-avatar {
  width: 130px; height: 130px; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--border-muted); margin-bottom: 20px; box-shadow: 0 10px 30px var(--shadow-color);
}

.hero-name { font-family: var(--font-serif); font-size: 36px; color: var(--name-color); margin-bottom: 8px; letter-spacing: 1px; }
.hero-title { font-size: 16px; color: var(--text-secondary); margin-bottom: 30px; }
.hero-subtitle, .hero-contact { font-size: 15px; color: var(--text-secondary); margin-bottom: 6px; }
.hero-contact { margin-bottom: 30px; }

.hero-nav { display: flex; flex-direction: column; gap: 12px; margin-bottom: 40px; }
.hero-nav a { font-family: var(--font-serif); font-size: 17px; color: var(--text-primary); text-decoration: none; font-weight: bold; transition: color 0.3s ease; background-image: none; }
.hero-nav a:hover { color: var(--link-hover); }

.hero-socials { display: flex; justify-content: center; align-items: center; gap: 20px; margin-bottom: 28px; }
.hero-socials a,
.hero-socials .social-trigger {
  font-size: 14px;
  color: var(--text-secondary);
  text-decoration: none;
  background-image: none;
}

.hero-socials a:hover,
.hero-socials .social-trigger:hover {
  color: var(--link-hover);
}

.social-menu {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.social-trigger {
  border: 0;
  padding: 0;
  background-color: transparent;
  cursor: pointer;
  font-family: inherit;
  line-height: inherit;
}

.social-dropdown {
  position: absolute;
  left: 50%;
  top: calc(100% + 10px);
  z-index: 20;
  min-width: 138px;
  padding: 6px;
  border: 1px solid var(--border-muted);
  border-radius: 8px;
  background: var(--surface-color);
  box-shadow: 0 12px 30px var(--shadow-color);
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, -4px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
}

.social-menu:hover .social-dropdown,
.social-menu:focus-within .social-dropdown,
.social-menu.is-open .social-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

.hero-socials .social-menu:last-child .social-dropdown {
  left: auto;
  right: 0;
  transform: translateY(-4px);
}

.hero-socials .social-menu:last-child:hover .social-dropdown,
.hero-socials .social-menu:last-child:focus-within .social-dropdown,
.hero-socials .social-menu:last-child.is-open .social-dropdown {
  transform: translateY(0);
}

.social-dropdown a,
.social-dropdown button {
  display: block;
  width: 100%;
  padding: 7px 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 13px;
  line-height: 1.2;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  background-image: none;
}

.social-dropdown a:hover,
.social-dropdown button:hover,
.social-dropdown a:focus,
.social-dropdown button:focus {
  outline: none;
  background: var(--surface-hover);
  color: var(--link-hover);
}

.hero-scroll-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--border-muted);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-color) 70%, transparent);
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1;
  text-decoration: none;
  transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
  background-image: none;
}

.hero-scroll-cta:hover {
  background: var(--surface-hover);
  border-color: var(--link-hover);
  color: var(--link-hover);
  transform: translateY(2px);
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* =========================================
   9. 吸顶导航栏 (Sticky Nav)
========================================= */
.sticky-nav {
  position: sticky; top: 0; z-index: 1000;
  background: var(--sticky-bg); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-soft);
}

.nav-container { width: 90%; max-width: 1080px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; height: 60px; }

.nav-brand {
  font-family: var(--font-serif); font-weight: 700; font-size: 15px; color: var(--name-color);
  letter-spacing: 1px; text-decoration: none; transition: color 0.3s ease; background-image: none;
}
.nav-brand:hover { color: var(--link-hover); }

.nav-actions { display: flex; align-items: center; gap: 20px; }

.nav-links { display: flex; gap: 24px; }
.nav-links a { font-family: var(--font-main); font-size: 14px; color: var(--text-secondary); text-decoration: none; transition: color 0.3s ease; background-image: none; }
.nav-links a:hover { color: var(--link-hover); }

.nav-overflow {
  position: relative;
  display: none;
}

.nav-more {
  display: inline-flex;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border-muted);
  border-radius: 999px;
  background: var(--surface-color);
  color: var(--text-secondary);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

.nav-more:hover,
.nav-more[aria-expanded="true"] {
  background: var(--surface-hover);
  color: var(--link-hover);
  border-color: var(--link-hover);
}

.nav-more svg {
  width: 17px;
  height: 17px;
  display: block;
}

.nav-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 140px;
  padding: 8px;
  border: 1px solid var(--border-muted);
  border-radius: 8px;
  background: var(--surface-color);
  box-shadow: 0 12px 30px var(--shadow-color);
  display: none;
  z-index: 1100;
}

.nav-dropdown a {
  display: block;
  padding: 7px 10px;
  border-radius: 6px;
  color: var(--text-secondary);
  font-family: var(--font-main);
  font-size: 14px;
  text-decoration: none;
  background-image: none;
  white-space: nowrap;
}

.nav-dropdown a:hover {
  color: var(--link-hover);
  background: var(--surface-hover);
}

.nav-overflow.is-open .nav-dropdown {
  display: block;
}

.theme-toggle {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border-muted);
  border-radius: 999px;
  background: var(--surface-color);
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

.theme-toggle:hover {
  background: var(--surface-hover);
  color: var(--link-hover);
  border-color: var(--link-hover);
}

.theme-toggle svg {
  width: 17px;
  height: 17px;
  display: block;
}

.theme-toggle .icon-moon {
  display: none;
}

[data-theme="dark"] .theme-toggle .icon-sun {
  display: none;
}

[data-theme="dark"] .theme-toggle .icon-moon {
  display: block;
}


/* 2. 新增通用的吸顶表头容器 (核心) */
.sticky-header {
  position: sticky;
  top: 61px; /* 刚好卡在顶部导航栏(60px + 1px边框)的下方 */
  z-index: 900; /* 保证在正文上方，且在顶部导航(1000)的下方 */
  background-color: var(--bg-color); /* 必须使用背景色，防止下方滚动内容透字 */
  padding-top: 15px; /* 顶部呼吸空间 */
  padding-bottom: 10px; /* 底部呼吸空间 */
  margin-bottom: 20px;
}

/* 3. 清除包裹在吸顶容器内元素的默认外边距，防止背景色断层 */
.sticky-header .section-title {
  margin-bottom: 0 !important;
}

.sticky-header .section-subtitle {
  margin-top: 15px;
  margin-bottom: 15px;
}

.sticky-header .filter-controls {
  margin-bottom: 0;
}

.sticky-filters {
  position: sticky;
  top: 61px; /* 卡在顶部导航栏下方 */
  z-index: 900;
  background-color: var(--bg-color); /* 纯色背景防止透字 */
  padding-top: 15px; 
  padding-bottom: 10px;
  margin-bottom: 20px;
  
  /* 核心：为 JS 滚动预留偏移量，刚好是顶部导航栏的高度 */
  scroll-margin-top: 61px; 
}

.quote {
  color: var(--text-secondary);
  font-style: italic;
}

.plain-list {
  margin-left: 20px;
}

.plain-list li {
  margin-bottom: 8px;
}

@media (max-width: 760px) {
  body {
    font-size: 15px;
  }

  .container {
    width: 92%;
    padding: 28px 0;
  }

  .hero-screen {
    min-height: 100vh;
    height: auto;
    padding: 60px 18px;
  }

  .hero-name {
    font-size: 30px;
  }

  .hero-nav {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px 16px;
  }

  .hero-socials {
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px 18px;
  }

  .social-dropdown {
    left: 50%;
    max-width: calc(100vw - 32px);
  }

  .nav-container {
    min-height: 60px;
    height: 60px;
    align-items: center;
    gap: 10px;
  }

  .nav-actions {
    width: auto;
    flex: 0 0 auto;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
  }

  .nav-brand {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .nav-links {
    display: none;
  }

  .nav-overflow {
    display: block;
    flex: 0 0 auto;
    margin-left: auto;
  }

  .nav-more {
    flex: 0 0 auto;
  }

  .intro-section,
  .list-item,
  .pub-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .profile-img {
    height: 150px;
  }

  .list-date {
    align-self: flex-start;
  }

  .pub-img {
    width: 100%;
    flex-basis: auto;
  }

  .sticky-filters {
    top: 61px;
  }
}
