/* =====================================================
   Academic homepage stylesheet
   颜色主题:改 :root 里的变量即可全站生效
   ===================================================== */
:root {
  --text: #1a1a1a;
  --muted: #6b6b6b;
  --link: #1a56a7;
  --link-hover: #0d3d7c;
  --rule: #e5e5e5;
  --highlight: #fff8e1;
  --nav-bg: rgba(255, 255, 255, 0.92);
  --page-bg: #ffffff;
  --ambient: rgba(48, 118, 181, 0.075);
  --nav-hover: #f2f2f2;
  --max-width: 880px;   /* 加宽以容纳更大的头像,不压缩文字宽度 */
  --nav-height: 56px;
}

html[data-theme="dark"] {
  --text: #e8edf3;
  --muted: #a6b0bc;
  --link: #82b8f4;
  --link-hover: #b5d7ff;
  --rule: #303a47;
  --highlight: rgba(165, 118, 18, 0.15);
  --nav-bg: rgba(15, 20, 27, 0.9);
  --page-bg: #0f141b;
  --ambient: rgba(50, 132, 203, 0.14);
  --nav-hover: #202a36;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: Georgia, "Times New Roman", serif;
  color: var(--text);
  background:
    radial-gradient(circle at 80% 30%, var(--ambient), transparent 34rem),
    var(--page-bg);
  line-height: 1.6;
  font-size: 15.5px;   /* 参考 jonbarron.info,整体字号收小一档 */
  transition: color 220ms ease, background-color 220ms ease;
}

#mobius-background {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: block;
  pointer-events: none;
  opacity: 0.78;
  transition: opacity 220ms ease, filter 220ms ease;
}

html[data-theme="dark"] #mobius-background {
  opacity: 0.92;
  filter: saturate(1.15) brightness(1.12);
}

body > main {
  position: relative;
  z-index: 1;
}

body.mobius-can-drag { cursor: grab; }
body.mobius-dragging {
  cursor: grabbing;
  user-select: none;
}
body.mobius-dragging * { cursor: grabbing !important; }

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 24px; }

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

/* 锚点跳转时留出导航栏高度 */
section { scroll-margin-top: calc(var(--nav-height) + 16px); }

/* ===================== 顶部导航栏 ===================== */
.navbar {
  position: sticky; top: 0; z-index: 100;
  height: var(--nav-height);
  background: var(--nav-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}
.navbar .container {
  height: 100%;
  display: flex; align-items: center; justify-content: space-between;
}
.nav-name {
  font-weight: bold; font-size: 1.05em; color: var(--text);
  margin-right: auto;
}
.nav-name:hover { text-decoration: none; color: var(--link); }
.nav-links { display: flex; gap: 4px; list-style: none; }
.nav-links a {
  display: block; padding: 6px 12px; border-radius: 6px;
  color: var(--muted); font-size: 0.92em;
  font-family: Helvetica, Arial, sans-serif;
}
.nav-links a:hover { color: var(--text); background: var(--nav-hover); text-decoration: none; }
.nav-links a.active { color: var(--link); font-weight: bold; }

.nav-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
}
.theme-toggle {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: 1px solid var(--rule); border-radius: 50%;
  background: transparent; color: var(--text);
  font-size: 1.05em; line-height: 1;
  cursor: pointer;
  transition: color 180ms ease, background 180ms ease, border-color 180ms ease;
}
.theme-toggle:hover { background: var(--nav-hover); }
.theme-toggle:focus-visible,
.nav-toggle:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

/* 移动端汉堡按钮 */
.nav-toggle {
  display: none; background: none; border: none; cursor: pointer;
  font-size: 1.4em; color: var(--text); padding: 4px 8px;
}

/* ===================== 页面主体 ===================== */
main.container { padding-top: 48px; padding-bottom: 80px; }

/* ---- Header / About:照片在文字旁边 ----
   垂直位置由 js/main.js 计算:相对"折叠状态"的 Bio 高度居中,
   展开 More about me 后头像位置保持不变 */
.profile {
  display: flex; gap: 40px; align-items: flex-start;
  flex-wrap: nowrap;               /* 桌面端不换行,照片始终在旁边 */
}
.profile-photo-col { flex-shrink: 0; text-align: center; }
.headshot {
  width: 220px; height: 220px; border-radius: 50%;  /* 圆形头像 */
  object-fit: cover; background: var(--nav-hover); display: block;
}
.intro { flex: 1; min-width: 0; }
.intro h1 { font-size: 2.1em; font-weight: normal; margin-bottom: 4px; }
.intro .affiliation { color: var(--muted); margin-bottom: 14px; }
.intro p { margin-bottom: 10px; }

.links { margin-top: 10px; font-size: 0.95em; }
.links a { margin-right: 4px; }
.links .sep { color: var(--rule); margin-right: 4px; }

/* ---- 折叠的更多介绍 ---- */
details.bio-more { margin-top: 6px; }
details.bio-more summary {
  cursor: pointer; color: var(--link); font-size: 0.95em;
  list-style: none; user-select: none;
}
details.bio-more summary::-webkit-details-marker { display: none; }
details.bio-more summary::before { content: "\25B8  "; }
details.bio-more[open] summary::before { content: "\25BE  "; }
details.bio-more summary:hover { color: var(--link-hover); text-decoration: underline; }
details.bio-more .bio-more-content {
  margin-top: 10px; padding-left: 14px;
  border-left: 2px solid var(--rule);
}
details.bio-more .bio-more-content p { margin-bottom: 8px; }

/* ---- 通用 Section ---- */
section { margin-top: 56px; }
h2 {
  font-size: 1.35em; font-weight: normal;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 8px; margin-bottom: 20px;
}

/* ---- Education ---- */
.edu-list { list-style: none; }
.edu-list li { display: flex; gap: 16px; margin-bottom: 14px; }
.edu-date {
  color: var(--muted); white-space: nowrap;
  width: 150px; min-width: 150px;   /* 固定宽度,保证多行日期对齐 */
  font-size: 0.92em; padding-top: 2px;
}
.edu-detail { color: var(--muted); font-size: 0.95em; }

/* ---- News ---- */
.news-list { list-style: none; }
.news-list li { display: flex; gap: 16px; margin-bottom: 8px; }
.news-date {
  color: var(--muted); white-space: nowrap; min-width: 84px;
  font-size: 0.92em; padding-top: 2px;
}

.news-toggle {
  margin-top: 6px; padding: 4px 0;
  background: none; border: none; cursor: pointer;
  font-family: inherit; font-size: 0.92em; color: var(--link);
}
.news-toggle:hover { color: var(--link-hover); text-decoration: underline; }

/* ---- Publications ---- */
/* 媒体列参考 jonbarron.info:约 1/4 宽、垂直居中、无边框、保持原始长宽比 */
.pub { display: flex; gap: 24px; margin-bottom: 30px; align-items: center; }
.pub-media { width: 180px; flex-shrink: 0; }
.pub-media img, .pub-media video {
  width: 100%; height: auto; display: block;
  border: none; outline: none; background: transparent;
}
/* 层级:标题(最重) > 我的名字(正文色+半粗) > 合作者(次要灰) > 会议(斜体灰) */
.pub-title {
  font-size: 1.08em; font-weight: 700; line-height: 1.35;
  letter-spacing: -0.005em; color: var(--text);
}
.pub-authors {
  font-size: 0.92em; color: var(--muted);
  margin-top: 5px; line-height: 1.55;
}
.pub-authors a { color: inherit; text-decoration: none; }
.pub-authors a:hover { color: var(--link); text-decoration: underline; }
.pub-authors .me {
  font-weight: 600; color: var(--text);
  text-decoration: underline; text-decoration-thickness: 1px;
  text-underline-offset: 2px; text-decoration-color: var(--muted);
}
.pub-authors .author { white-space: nowrap; }  /* 人名不在中间断行 */
.pub-venue {
  font-size: 0.88em; color: var(--muted); font-style: italic;
  margin-top: 5px; letter-spacing: 0.01em;
}
.pub-links { font-size: 0.88em; margin-top: 7px; }
.pub-links a { margin-right: 8px; }
.pub-links .sep { color: var(--rule); margin-right: 8px; user-select: none; }
.pub-desc { font-size: 0.9em; color: var(--muted); margin-top: 7px; line-height: 1.6; }
.pub.selected {
  background: var(--highlight); padding: 12px;
  margin-left: -12px; margin-right: -12px; border-radius: 8px;
}
.badge {
  font-size: 0.78em; color: #b3261e; border: 1px solid #b3261e;
  border-radius: 3px; padding: 0 5px; margin-left: 6px; white-space: nowrap;
}

/* ---- Research ---- */
.research-topics li { margin-bottom: 10px; margin-left: 20px; }

/* ---- Talks / Service ---- */
.simple-list li { margin-bottom: 8px; margin-left: 20px; }

/* ---- Footer ---- */
footer {
  margin-top: 72px; padding-top: 16px;
  border-top: 1px solid var(--rule);
  color: var(--muted); font-size: 0.85em;
  text-align: center;
}

/* ===================== 移动端适配 ===================== */
@media (max-width: 720px) {
  #mobius-background { opacity: 0.5; }

  .nav-toggle { display: block; }
  .nav-links {
    display: none;
    position: absolute; top: var(--nav-height); left: 0; right: 0;
    flex-direction: column; gap: 0;
    background: var(--page-bg); border-bottom: 1px solid var(--rule);
    padding: 8px 16px;
  }
  .nav-links.open { display: flex; }

  .profile { flex-direction: column; align-items: center; text-align: center; }
  .headshot { width: 150px; height: 150px; }

  .pub { flex-direction: column; align-items: stretch; }
  .pub-media { width: 100%; }
  .edu-list li, .news-list li { flex-direction: column; gap: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
