:root {
  --accent: #54729e; --accent-strong: #344f78; --tint: #e2e8f2;
  --line: #e8ecf3; --line-strong: #cdd7e6;
  --ink: #0d0d10; --body: #46464a; --muted: #6b6b70; --faint: #a8a8ae;
  --bg: #fff; --panel: #fafbfe; --blue-100: #e5ebf5; --blue-300: #b3c2dc; --blue-400: #8ba1c4;
  --font: Merriweather, Georgia, "Times New Roman", "Songti SC", serif;
  --mono: "Fira Mono", ui-monospace, monospace;
  --shadow-sm: 0 2px 8px #344f780f, 0 1px 2px #344f780a;
  --shadow-md: 0 8px 24px #344f7814, 0 2px 6px #344f780a;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--body); font: 16px/1.6 var(--font); transition: background .3s, color .3s; }
a { color: var(--accent); text-decoration: none; }
button { font: inherit; cursor: pointer; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
header { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(16px); border-bottom: 1px solid var(--line); }
nav { max-width: 1240px; height: 64px; padding: 1px 48px 0; margin: auto; display: flex; align-items: center; gap: 8px; }
.nav-left { flex: 0 0 220px; display: flex; align-items: center; gap: 12px; }
.brand { flex: 0 0 40px; height: 44px; display: inline-flex; align-items: center; justify-content: center; color: var(--accent); }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; font: italic 600 25px/1 var(--font); transition: transform .3s; }
.brand:hover .brand-mark { transform: scale(1.08) rotate(-4deg); }
.nav-items { display: flex; align-items: center; height: 34px; gap: 2px; margin-left: auto; position: relative; white-space: nowrap; }
.nav-items a { position: relative; display: inline-flex; align-items: center; height: 34px; padding: 0 14px; font: 14px/1 var(--font); color: var(--body); border-radius: 999px; z-index: 1; transition: color .2s; }
.nav-items a:hover, .nav-items a.active { color: var(--accent-strong); }
.nav-pill { position: absolute; top: 50%; left: 0; height: 34px; margin-top: -17px; background: var(--tint); border-radius: 999px; opacity: 0; pointer-events: none; transition: transform .45s cubic-bezier(.5,.05,.15,1), width .45s cubic-bezier(.5,.05,.15,1), opacity .25s; }
.nav-actions { display: flex; gap: 6px; margin-left: 10px; padding-left: 10px; border-left: 1px solid var(--line); }
#theme, #language { display: grid; place-items: center; height: 34px; border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--body); transition: .2s; }
#theme { width: 34px; padding: 0; }
#theme svg { width: 16px; height: 16px; }
#language { font: 13px/1 var(--mono); padding: 0 10px; white-space: nowrap; }
#theme:hover, #language:hover { background: var(--tint); color: var(--accent-strong); }
.sun { display: none; }
.layout { max-width: 1240px; margin: 0 auto; padding: 0 48px 100px; display: grid; grid-template-columns: 220px minmax(0,1fr); gap: 64px; align-items: start; }
aside { position: sticky; top: 80px; padding-top: 48px; }
.sidebar-inner { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; }
.portrait-wrap { position: relative; width: 200px; height: 200px; margin-bottom: 28px; }
.portrait { width: 200px; height: 200px; border-radius: 22px; overflow: hidden; position: relative; display: grid; place-items: center; background: linear-gradient(135deg,var(--blue-100),var(--blue-300)); box-shadow: var(--shadow-md), inset 0 1px 0 #ffffff66; color: var(--accent-strong); font: 11px var(--mono); transition: transform .3s cubic-bezier(.2,.7,.2,1); }
.portrait img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 48%; display: block; }
.portrait:hover { transform: translateY(-2px) rotate(-1deg); }
h1 { color: var(--ink); font: 600 24px/1.1 var(--font); margin: 0; }
.handle { font: 12.5px/1.6 var(--mono); color: var(--muted); margin: 5px 0 0; }
.tagline { font: 13px/1.55 var(--font); margin: 8px 0 0; }
.contacts { display: flex; flex-direction: column; align-items: center; gap: 6px; padding-top: 6px; margin-top: 4px; font-size: 13px; color: var(--muted); width: 100%; }
.contacts > div { display: flex; align-items: center; gap: 8px; min-width: 0; }
.contacts svg { width: 13px; height: 13px; flex-shrink: 0; opacity: .7; }
.contacts a { color: var(--body); }
.contacts a:hover { color: var(--accent); }
.socials { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 10px; }
.social { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; font-size: 12px; color: var(--body); transition: .2s; }
.social:hover { border-color: var(--accent); color: var(--accent-strong); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.social svg { width: 13px; height: 13px; stroke-width: 2; }
main { min-width: 0; padding-top: 48px; }
section { padding: 32px 0 8px; scroll-margin-top: 80px; }
#about { padding-top: 0; max-width: 760px; }
#about .section-head { display: none; }
#about p { font-size: 16px; line-height: 1.8; margin: 0; }
html[lang="zh-CN"] #about p.zh ~ p.zh, html[lang="en"] #about p.en ~ p.en { margin-top: 1.1em; }
.highlight { color: var(--ink); font-weight: 600; background: transparent; box-shadow: inset 0 -.32em 0 var(--tint); padding: 0 2px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.section-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 22px; padding-bottom: 12px; border-bottom: 1px solid var(--line); position: relative; }
h2 { font: 600 22px/1.6 var(--font); color: var(--ink); letter-spacing: -.015em; margin: 0; }
.section-head::after { content: ""; position: absolute; bottom: -1px; left: 0; width: 40px; height: 2px; background: var(--accent); border-radius: 2px; }
p { margin: 0 0 10px; }
.entry { margin: 0 0 24px; }
.entry:last-child { margin-bottom: 0; }
.entry h3 { font: 600 18px/1.35 var(--font); letter-spacing: -.005em; color: var(--ink); margin: 0 0 6px; }
#education .entry h3, #experience .entry h3 { font-size: 19px; line-height: 1.6; letter-spacing: normal; }
.entry p { font-size: 14px; line-height: 1.5; margin: 0 0 10px; }
.placeholder { font-size: 12px; color: var(--muted); }
.article-row { display: grid; grid-template-columns: 138px minmax(0,1fr); gap: 20px; align-items: center; padding-bottom: 10px; margin-bottom: 6px; }
.thumb { width: 138px; aspect-ratio: 4/3; border-radius: 10px; border: 1px solid var(--line); background: linear-gradient(135deg,var(--blue-100),var(--blue-300)); display: grid; place-items: center; color: var(--accent-strong); font: 11px/1.6 var(--mono); }
.thumb > span { opacity: .6; }
.article-body { min-width: 0; }
.venue { font: 11px/1.6 var(--mono); color: var(--accent); text-transform: uppercase; margin-bottom: 6px; }
ul { padding-left: 20px; }
li { margin: 10px 0; }
footer { font: 11px/1.6 var(--mono); color: var(--muted); padding: 24px 0 0; margin-top: 32px; border-top: 1px solid var(--line); }
.en { display: none !important; }
html[lang=en] .zh { display: none !important; }
html[lang=en] .en { display: revert !important; }
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .7s cubic-bezier(.2,.7,.2,1), transform .7s cubic-bezier(.2,.7,.2,1); }
.reveal.in { opacity: 1; transform: none; }
html[data-theme=dark] { --bg:#292e38; --panel:#171f30; --ink:#f1f3f8; --body:#c4c9d1; --muted:#919ba9; --line:#28374a; --line-strong:#38506b; --tint:#233e58; --accent:#8cbae4; --accent-strong:#c2ddf6; --blue-100:#243a52; --blue-300:#2a5279; --blue-400:#7098c3; }
html[data-theme=dark] header { background: color-mix(in srgb,#141a27 90%,transparent); }
html[data-theme=dark] .moon { display: none; }
html[data-theme=dark] .sun { display: block; }
@media(max-width:1080px) { .nav-left { flex-basis: 160px; } nav { padding-left: 24px; padding-right: 24px; } }
@media(max-width:960px) {
  .layout { grid-template-columns: 1fr; gap: 28px; padding: 0 24px 80px; }
  aside { position: static; padding-top: 40px; }
  .sidebar-inner { max-width: 520px; margin: 0 auto; }
  main { padding-top: 20px; }
  .nav-left { flex: 0 0 auto; gap: 0; }
  .brand { display: none; }
  nav { padding: 0 16px; }
  .nav-items { min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .nav-items a { flex-shrink: 0; font-size: 13px; }
  .nav-actions { margin-left: 0; padding-left: 6px; gap: 2px; }
}
@media(max-width:540px) {
  .article-row { grid-template-columns: 100px minmax(0,1fr); gap: 14px; }
  .thumb { width: 100px; font-size: 9px; }
  .entry h3 { font-size: 16px; }
  .entry p { font-size: 13px; }
  .venue { font-size: 10px; }
  #theme { width: 30px; }
  #language { padding: 0 5px; }
}
@media(prefers-reduced-motion:reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}
/* CV entries use the reference site's logo-and-timeline layout. */
.timeline { display: grid; grid-template-columns: 72px minmax(0,1fr); gap: 20px; align-items: start; margin-bottom: 30px; }
.institution-logo { width: 72px; height: 72px; display: grid; place-items: center; overflow: hidden; border-radius: 8px; background: #fff; }
.institution-logo img { display: block; width: 100%; height: 100%; object-fit: contain; }
.institution-logo.zju-seal { background: #003f88; border-radius: 50%; }
.institution-logo.zju-seal img { width: 260.56px; height: 72px; max-width: none; object-fit: fill; justify-self: start; }
.institution-logo.wordmark { width: 86px; margin-left: -7px; border-radius: 0; }
.institution-logo.wordmark img { height: auto; }
.date { font: 12px/1.6 var(--mono); color: var(--muted); margin-bottom: 4px; }
.timeline .role { color: var(--accent-strong); font-size: 15px; }
.coursework { margin: 8px 0 0 92px; font-size: 13px; }
.coursework summary { color: var(--accent-strong); cursor: pointer; }
.coursework p { margin-top: 10px; }
.subsection-title { font: 600 16px/1.6 var(--font); color: var(--muted); margin: 26px 0 22px; }
.research-entry { margin-bottom: 28px; }
.research-status { color: var(--muted); font-style: italic; }
.paper-link { display: inline-block; padding: 4px 10px; border: 1px solid var(--line); background: var(--panel); border-radius: 6px; font: 11px/1.6 var(--mono); }
.paper-link:hover { border-color: var(--accent); }
.award-row { display: grid; grid-template-columns: 68px minmax(0,1fr); gap: 16px; margin: 0 0 18px; }
.award-row h3 { margin: 0; color: var(--ink); font: 600 15px/1.6 var(--font); }
.skills { margin-top: 28px; font-size: 14px; }
.skills h3 { font: 600 16px/1.6 var(--font); color: var(--ink); }
@media(max-width:540px) {
 .timeline { grid-template-columns: 56px minmax(0,1fr); gap: 16px; }
 .institution-logo { width: 56px; height: 56px; }
 .institution-logo.zju-seal img { width: 202.66px; height: 56px; }
 .institution-logo.wordmark { width: 62px; margin-left: -3px; }
 .coursework { margin-left: 72px; }
 #education .entry h3, #experience .entry h3 { font-size: 17px; }
}

.high-school { margin-top: 28px; }

/* One stable photo slot per event, ready for user-supplied images. */
.activity-row { display: grid; grid-template-columns: 220px minmax(0,1fr); gap: 24px; align-items: start; min-height: 150px; margin-bottom: 28px; }
.activity-photo { width: 100%; aspect-ratio: 16 / 9; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--panel); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px; overflow: hidden; color: var(--muted); font: 11px/1.5 var(--mono); text-align: center; }
.activity-photo svg { width: 25px; height: 25px; color: var(--blue-400); }
.activity-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.activity-copy { min-width: 0; }
.activity-role { color: var(--accent-strong); font-size: 12px; margin-top: 10px; }
@media(max-width:600px) {
 .activity-row { grid-template-columns: 104px minmax(0,1fr); gap: 14px; }
 .activity-photo { font-size: 9px; gap: 5px; }
 .activity-photo svg { width: 20px; height: 20px; }
 .activity-copy .date { font-size: 10px; }
}

.activity-photo.has-photo { position: relative; display: block; background: transparent; }
.activity-photo.has-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: var(--photo-position, 50% 50%); }
.activity-photo[data-event="zhenfund-shenzhen"] { --photo-position: 50% 65%; }
.activity-photo[data-event="talentry"] { --photo-position: 50% 40%; }
.activity-photo[data-event="waic"] { --photo-position: 50% 65%; }
@media(max-width:600px) { .activity-row { min-height: 0; } }

.activity-photo[data-event="aus"] { --photo-position: 50% 30%; }
