/* 导航右侧操作组：桌面导航、窄屏菜单按钮、最右侧的主题切换图标。 */
.nav-actions { display: flex; align-items: center; gap: 20px; }
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  color: inherit;
  border: 1px solid currentColor;
  border-color: rgb(210 194 245 / .18);
  border-radius: 50%;
  background: rgb(243 235 255 / .07);
  cursor: pointer;
  transition: background .2s ease, border-color .2s ease;
}
.theme-toggle:hover { background: rgb(215 194 255 / .16); border-color: rgb(210 194 245 / .4); }
.theme-toggle:focus-visible { outline: 2px solid #a78bce; outline-offset: 4px; }
.theme-icon-sun { display: none; }
/* 模式切换使用整页交叉淡化，渐变底色也能平滑过渡；首次加载不播放。 */
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: .4s;
  animation-timing-function: ease-in-out;
  mix-blend-mode: normal;
}
/* 快照切换期间只播放整页动画，文字、边框和背景直接采用最终主题颜色。
   只覆盖普通元素及其伪元素，不关闭 ::view-transition-* 的整页淡化。 */
html.theme-switching *,
html.theme-switching *::before,
html.theme-switching *::after {
  transition: none !important;
}
/* 不支持 View Transition 的浏览器仍保留文字/边框颜色过渡。 */
body, .site-header, .hero-section, .hero-copy h1, .hero-bio,
.hero-bio strong, .hero-highlight, .hero-interests strong,
.section-heading h2, .education-date, .education-copy p,
.publication-authors, .publication-authors strong, .publication-meta,
.research-card-content p, .empty-state, footer {
  transition: color .4s ease-in-out, border-color .4s ease-in-out, background-color .4s ease-in-out;
}
html[data-theme="night"] .theme-icon-moon { display: none; }
html[data-theme="night"] .theme-icon-sun { display: block; }
html[data-theme="night"] .theme-toggle { color: #5d536b; border-color: rgb(103 79 142 / .16); background: rgb(255 255 255 / .35); }
html[data-theme="night"] .theme-toggle:hover { border-color: rgb(103 79 142 / .35); background: rgb(255 255 255 / .75); }
@media (max-width: 767px) { .nav-actions { gap: 8px; } }
@media (prefers-reduced-motion: reduce) {
  .theme-toggle { transition: none; }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
  body, .site-header, .hero-section, .hero-copy h1, .hero-bio,
  .hero-bio strong, .hero-highlight, .hero-interests strong,
  .section-heading h2, .education-date, .education-copy p,
  .publication-authors, .publication-authors strong, .publication-meta,
  .research-card-content p, .empty-state, footer { transition: none; }
}

/* 夜间主题：浅色导航/About + 深色内容。仅在 html 的 data-theme="night" 时生效。
   配色和组件覆盖集中在本文件；普通模式继续使用原样式。 */

html[data-theme="night"] {
color-scheme:dark;
 --canvas:#0e0d18;
 --ink:#f0edf8;
 --education:linear-gradient(180deg,#1c1934 0%,#0e0d18 100%);
 --surface:rgba(36,32,57,.72);
 --surface-line:rgba(184,169,229,.16);
 --surface-shadow:0 20px 52px rgba(0,0,0,.2),inset 0 1px rgba(255,255,255,.035);
 --light-accent:#bcb1f5;
}

html[data-theme="night"] body {
color:var(--ink);background:radial-gradient(ellipse 55% 32% at 5% 60%,rgba(88,68,150,.13),transparent 80%),var(--canvas);
}

html[data-theme="night"] .education-date {
color:#938ba8;
}

html[data-theme="night"] .education-copy p,
html[data-theme="night"] .publication-authors {
color:#bbb4cd;
}

html[data-theme="night"] .education-bridge .education-item + .education-item {
border-color:rgba(184,169,229,.12);
}

html[data-theme="night"] .section-heading {
border-color:rgba(184,169,229,.17);
}

html[data-theme="night"] .publication-authors strong {
color:#f1edf9;
}

html[data-theme="night"] .publication-meta {
color:#9b94af;
}

html[data-theme="night"] .publication-card:hover,
html[data-theme="night"] .research-card:hover {
box-shadow:0 24px 60px rgba(0,0,0,.3),inset 0 1px rgba(255,255,255,.06);
}

html[data-theme="night"] .doi-link {
background:rgba(190,175,244,.07);border-color:rgba(190,175,244,.17);color:#cec6ec;
}

html[data-theme="night"] .doi-link:hover {
background:#bcb1f5;border-color:#bcb1f5;color:#17122a;
}

html[data-theme="night"] .research-card-content p {
color:#bbb4cd;
}

html[data-theme="night"] .research-card-content .research-label {
color:var(--light-accent);
}

html[data-theme="night"] .research-link:hover {
color:#e7ddff;
}

html[data-theme="night"] .research-figure {
background:#f6f6f9;border-color:rgba(184,169,229,.12);
}

html[data-theme="night"] .empty-state {
color:#a9a1bb;
}

html[data-theme="night"] footer {
border-color:rgba(184,169,229,.12);color:#928aab;
}

html[data-theme="night"] {
--hero:radial-gradient(ellipse 48% 72% at 90% 12%,rgba(174,149,231,.22),transparent 77%),radial-gradient(ellipse 42% 65% at 5% 96%,rgba(151,159,213,.13),transparent 78%),linear-gradient(138deg,#f7f5fc 0%,#efecf7 55%,#e6e1f1 100%);
 --nav:rgba(247,245,253,.76);
 --hero-text:#514965; --hero-muted:#675f79; --hero-accent:#655494;
 --hero-line:rgba(97,79,140,.21);
 --education:linear-gradient(180deg,#272137 0%,#181423 45%,#0e0d18 100%);
}

html[data-theme="night"] .site-header {
color:#30273f;border-color:rgba(100,79,140,.16);box-shadow:inset 0 1px rgba(255,255,255,.7);
}

html[data-theme="night"] .site-brand-handwritten .brand-name-en {
filter:brightness(0) saturate(100%);opacity:.8;
}

html[data-theme="night"] .site-brand-handwritten:hover .brand-name-en {
filter:brightness(0);opacity:1;
}

html[data-theme="night"] .nav-link,
html[data-theme="night"] .mobile-nav-link,
html[data-theme="night"] .menu-toggle {
color:#5d536b;
}

html[data-theme="night"] .nav-link:hover,
html[data-theme="night"] .nav-link:focus-visible {
color:#352344;
}

html[data-theme="night"] .menu-toggle:hover,
html[data-theme="night"] .mobile-nav-link:hover {
background:rgba(113,89,159,.09);color:#352344;
}

html[data-theme="night"] .mobile-menu {
background:rgba(246,243,252,.98);border-color:rgba(100,79,140,.14);
}

html[data-theme="night"] .hero-section {
color:#2c243b;
}

html[data-theme="night"] .hero-copy h1 {
color:#292035;
}

html[data-theme="night"] .hero-bio strong {
color:#31213e;
}

html[data-theme="night"] .hero-bio .hero-highlight {
color:#41334f;
}

html[data-theme="night"] .hero-interests strong {
color:#3c304c;
}

html[data-theme="night"] .hero-section .social-link,
html[data-theme="night"] .hero-section .social-link-disabled,
html[data-theme="night"] .contact-email {
background:rgba(255,255,255,.46);border-color:rgba(255,255,255,.72);box-shadow:inset 0 1px rgba(255,255,255,.85),0 8px 24px rgba(73,48,108,.06);
}

html[data-theme="night"] .hero-section .social-link,
html[data-theme="night"] .contact-email {
color:#5f4c7a;
}

html[data-theme="night"] .hero-section .social-link:hover {
background:rgba(255,255,255,.8);color:#38224f;
}

html[data-theme="night"] .hero-section .social-link-disabled {
color:#a49bb3;
}

html[data-theme="night"] .hero-portrait {
border-color:rgba(255,255,255,.75);box-shadow:0 20px 45px rgba(63,43,90,.15),0 0 0 1px rgba(100,79,140,.08);
}

/* Education：默认灰紫日期，鼠标经过整条记录时提亮为浅紫。 */
html[data-theme="night"] .education-item:hover .education-date {
  color: var(--light-accent);
}
