/* ============ TOKENS ============ */
:root {
  --bg: #07080d;
  --bg-soft: #0d0f17;
  --panel: rgba(255, 255, 255, 0.03);
  --panel-brd: rgba(255, 255, 255, 0.08);
  --text: #e8eaf2;
  --text-dim: #9aa0b4;
  --text-faint: #5b6075;
  --accent: #6ea8fe;
  --accent2: #b388ff;
  --accent3: #4fd1c5;
  --grad: linear-gradient(110deg, #6ea8fe, #b388ff 55%, #4fd1c5);
  --maxw: 1080px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}
[data-theme="light"] {
  --bg: #f6f7fb;
  --bg-soft: #eceef5;
  --panel: rgba(10, 12, 24, 0.025);
  --panel-brd: rgba(10, 12, 24, 0.09);
  --text: #14161f;
  --text-dim: #4a4f63;
  --text-faint: #8a90a6;
  --accent: #2563eb;
  --accent2: #7c3aed;
  --accent3: #0d9488;
}

/* ============ BASE ============ */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 90px; }
body {
  font-family: "Inter", system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background 0.5s var(--ease), color 0.5s var(--ease);
}
#bg-canvas { position: fixed; inset: 0; z-index: 0; opacity: 0.55; pointer-events: none; }
main, .nav, .foot { position: relative; z-index: 1; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--accent); color: #fff; }

/* ============ NAV ============ */
.nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 0.85rem clamp(1rem, 4vw, 2.5rem);
  backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  border-bottom: 1px solid var(--panel-brd);
}
.brand { display: flex; align-items: center; gap: 0.55rem; font-family: "Space Grotesk", sans-serif; font-weight: 700; font-size: 1.05rem; }
.brand-mark { font-family: "JetBrains Mono", monospace; color: var(--accent2); font-size: 1.15rem; }
.nav-links { display: flex; gap: 1.6rem; font-size: 0.92rem; }
.nav-links a { color: var(--text-dim); transition: color 0.25s; position: relative; }
.nav-links a::after { content: ""; position: absolute; left: 0; bottom: -4px; width: 0; height: 1.5px; background: var(--grad); transition: width 0.3s var(--ease); }
.nav-links a:hover { color: var(--text); }
.nav-links a:hover::after { width: 100%; }
.nav-actions { display: flex; gap: 0.5rem; }
.pill {
  font-family: "JetBrains Mono", monospace; font-size: 0.78rem; font-weight: 500;
  color: var(--text-dim); background: var(--panel); border: 1px solid var(--panel-brd);
  padding: 0.35rem 0.6rem; border-radius: 8px; cursor: pointer; transition: all 0.25s;
}
.pill:hover { color: var(--text); border-color: var(--accent); }
.pill.icon { width: 34px; }

/* ============ LAYOUT ============ */
main { max-width: var(--maxw); margin: 0 auto; padding: 0 clamp(1rem, 4vw, 2rem); }
.block { padding: clamp(3.5rem, 8vw, 6rem) 0; }
.block-head { display: flex; align-items: baseline; gap: 1rem; margin-bottom: 2.5rem; }
.num { font-family: "JetBrains Mono", monospace; font-size: 0.8rem; color: var(--accent); letter-spacing: 0.1em; }
.block-head h2 { font-family: "Space Grotesk", sans-serif; font-size: clamp(1.6rem, 4vw, 2.3rem); font-weight: 700; letter-spacing: -0.01em; }

/* ============ HERO ============ */
.hero { padding: clamp(4rem, 12vh, 8rem) 0 clamp(3rem, 7vw, 5rem); }
.hero-grid { display: grid; grid-template-columns: 1.25fr 0.85fr; gap: clamp(2rem, 5vw, 4rem); align-items: center; }
.hero-photo { display: flex; justify-content: center; }
.photo-frame { position: relative; width: 100%; max-width: 340px; border-radius: 20px; overflow: hidden; border: 1px solid var(--panel-brd); background: var(--panel); box-shadow: 0 30px 70px -30px rgba(0,0,0,0.6); }
.photo-frame::after { content: ""; position: absolute; inset: 0; border-radius: 20px; padding: 1px; background: var(--grad); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; opacity: 0.6; pointer-events: none; }
.photo-frame img { display: block; width: 100%; height: auto; filter: saturate(1.02) contrast(1.02); }
.photo-name { position: absolute; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; gap: 0.1rem; padding: 2.2rem 1.1rem 0.9rem; background: linear-gradient(to top, rgba(7,8,13,0.88), transparent); }
.pn-zh { font-family: "Space Grotesk", sans-serif; font-weight: 700; font-size: 1.35rem; letter-spacing: 0.12em; color: #fff; }
.pn-en { font-family: "JetBrains Mono", monospace; font-size: 0.78rem; letter-spacing: 0.1em; color: rgba(255,255,255,0.7); }
[data-theme="light"] .photo-name { background: linear-gradient(to top, rgba(8,10,18,0.78), transparent); }
@media (max-width: 820px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-photo { order: -1; }
  .photo-frame { max-width: 240px; }
}
.eyebrow {
  font-family: "JetBrains Mono", monospace; font-size: 0.82rem; letter-spacing: 0.04em;
  color: var(--accent3); margin-bottom: 1.4rem;
}
.hero-title {
  font-family: "Space Grotesk", sans-serif; font-weight: 700;
  font-size: clamp(2.4rem, 7vw, 4.6rem); line-height: 1.05; letter-spacing: -0.025em;
  margin-bottom: 1.6rem;
}
.grad { background: var(--grad); background-size: 200% auto; -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; animation: gradShift 7s ease infinite; }
@keyframes gradShift { 0%,100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
.hero-sub { max-width: 46ch; color: var(--text-dim); font-size: clamp(1rem, 2.2vw, 1.18rem); margin-bottom: 2.2rem; }
.hero-cta { display: flex; gap: 0.9rem; flex-wrap: wrap; margin-bottom: 3.2rem; }
.btn {
  font-weight: 600; font-size: 0.95rem; padding: 0.7rem 1.4rem; border-radius: 11px;
  transition: transform 0.2s var(--ease), box-shadow 0.25s, background 0.25s; border: 1px solid transparent;
}
.btn.primary { background: var(--grad); color: #07080d; box-shadow: 0 8px 30px -10px var(--accent2); }
.btn.primary:hover { transform: translateY(-2px); box-shadow: 0 14px 40px -10px var(--accent2); }
.btn.ghost { border-color: var(--panel-brd); color: var(--text); background: var(--panel); }
.btn.ghost:hover { border-color: var(--accent); transform: translateY(-2px); }
.hero-stats { display: flex; gap: clamp(1.5rem, 5vw, 3.5rem); flex-wrap: wrap; }
.hero-stats div { display: flex; flex-direction: column; }
.hero-stats strong { font-family: "Space Grotesk", sans-serif; font-size: 1.7rem; background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.hero-stats span { font-size: 0.84rem; color: var(--text-faint); }

/* ============ ABOUT ============ */
.about-grid { display: grid; gap: 1.4rem; max-width: 64ch; }
.lead { font-size: clamp(1.1rem, 2.4vw, 1.35rem); color: var(--text); font-weight: 500; }
.about-grid p:not(.lead) { color: var(--text-dim); }

/* ============ TIMELINE (four blocks) ============ */
.timeline { display: grid; gap: 1.1rem; }
.tl-item {
  display: grid; grid-template-columns: 150px 1fr; gap: 1.5rem;
  padding: 1.7rem 1.8rem; border: 1px solid var(--panel-brd); border-radius: 18px;
  background: var(--panel); position: relative; overflow: hidden;
  transition: border-color 0.3s, transform 0.3s var(--ease);
}
.tl-item::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--grad); opacity: 0; transition: opacity 0.3s; }
.tl-item:hover { border-color: var(--accent); transform: translateY(-3px); }
.tl-item:hover::before { opacity: 1; }
.tl-when { font-family: "JetBrains Mono", monospace; font-size: 0.82rem; color: var(--text-faint); padding-top: 0.2rem; display: flex; flex-direction: column; align-items: flex-start; gap: 0.6rem; }
.tl-badge { font-family: "JetBrains Mono", monospace; font-size: 0.7rem; font-weight: 500; color: var(--accent2); border: 1px solid var(--panel-brd); border-radius: 6px; padding: 0.15rem 0.5rem; }
.tl-lead { color: var(--text); font-size: 0.98rem; margin-bottom: 0.8rem; max-width: 72ch; }
.tl-role { font-family: "Space Grotesk", sans-serif; font-weight: 600; font-size: 1.15rem; margin-bottom: 0.2rem; }
.tl-org { color: var(--accent); font-size: 0.92rem; margin-bottom: 0.7rem; }
.tl-points { list-style: none; display: grid; gap: 0.4rem; }
.tl-points li { color: var(--text-dim); font-size: 0.94rem; padding-left: 1.1rem; position: relative; }
.tl-points li::before { content: "▹"; position: absolute; left: 0; color: var(--accent3); }
.tl-tag { display: inline-block; font-family: "JetBrains Mono", monospace; font-size: 0.7rem; color: var(--accent2); border: 1px solid var(--panel-brd); border-radius: 6px; padding: 0.1rem 0.45rem; margin: 0.5rem 0.4rem 0 0; }

/* ============ PUBLICATIONS ============ */
.pub-list { list-style: none; display: grid; gap: 0.4rem; counter-reset: pub; }
.pub-item {
  display: grid; grid-template-columns: 2.2rem 1fr; gap: 0.6rem; align-items: start;
  padding: 1.15rem 1.2rem; border: 1px solid var(--panel-brd); border-radius: 14px;
  background: var(--panel); transition: border-color 0.3s, transform 0.25s var(--ease);
}
.pub-item:hover { border-color: var(--accent); transform: translateX(4px); }
.pub-idx { font-family: "JetBrains Mono", monospace; color: var(--accent); font-size: 0.95rem; }
.pub-title { font-weight: 600; color: var(--text); line-height: 1.4; }
.pub-meta { color: var(--text-dim); font-size: 0.88rem; margin-top: 0.25rem; }
.pub-venue { color: var(--accent3); font-style: italic; }
.pub-badge { font-family: "JetBrains Mono", monospace; font-size: 0.68rem; color: var(--accent2); border: 1px solid var(--panel-brd); border-radius: 5px; padding: 0.05rem 0.4rem; margin-left: 0.5rem; }

/* ============ CARDS / EDUCATION ============ */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.card {
  padding: 1.5rem; border: 1px solid var(--panel-brd); border-radius: 16px; background: var(--panel);
  transition: border-color 0.3s, transform 0.25s var(--ease);
}
.card:hover { border-color: var(--accent); transform: translateY(-3px); }
.card-when { font-family: "JetBrains Mono", monospace; font-size: 0.78rem; color: var(--text-faint); }
.card-deg { font-family: "Space Grotesk", sans-serif; font-weight: 600; font-size: 1.15rem; margin: 0.4rem 0 0.2rem; }
.card-school { color: var(--accent); font-size: 0.95rem; }
.card-note { color: var(--text-dim); font-size: 0.88rem; margin-top: 0.6rem; }

.skills { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.skills .sk-label { color: var(--text-faint); font-size: 0.85rem; margin-right: 0.5rem; }
.chip {
  font-family: "JetBrains Mono", monospace; font-size: 0.8rem; color: var(--text-dim);
  border: 1px solid var(--panel-brd); border-radius: 8px; padding: 0.3rem 0.7rem; background: var(--panel);
}

/* ============ CONTACT ============ */
.contact-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin-top: 2rem; }
.contact-link {
  display: flex; flex-direction: column; gap: 0.3rem; padding: 1.3rem 1.5rem;
  border: 1px solid var(--panel-brd); border-radius: 16px; background: var(--panel); transition: all 0.3s var(--ease);
}
.contact-link:hover { border-color: var(--accent); transform: translateY(-3px); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.cl-label { font-family: "JetBrains Mono", monospace; font-size: 0.75rem; color: var(--text-faint); letter-spacing: 0.08em; }
.cl-val { font-weight: 600; font-size: 1.02rem; }

/* ============ FOOTER ============ */
.foot {
  max-width: var(--maxw); margin: 0 auto; padding: 2rem clamp(1rem, 4vw, 2rem) 3rem;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem;
  border-top: 1px solid var(--panel-brd); color: var(--text-faint); font-size: 0.85rem;
}
.foot-tag { font-family: "JetBrains Mono", monospace; }

/* ============ REVEAL ANIM ============ */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* ============ RESPONSIVE ============ */
@media (max-width: 720px) {
  .nav-links { display: none; }
  .tl-item { grid-template-columns: 1fr; gap: 0.5rem; }
  .tl-when { padding-top: 0; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}

/* ============ POLISH PASS ============ */
/* scroll progress */
#scroll-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0%;
  background: var(--grad); z-index: 100;
  box-shadow: 0 0 12px var(--accent2); transition: width 0.1s linear;
}
/* cursor spotlight */
#cursor-glow {
  position: fixed; top: 0; left: 0; width: 420px; height: 420px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 16%, transparent), transparent 65%);
  transform: translate(-50%, -50%); pointer-events: none; z-index: 0;
  opacity: 0; transition: opacity 0.4s; will-change: transform; filter: blur(6px);
}
body:hover #cursor-glow { opacity: 1; }

/* nav active state */
.nav-links a.active { color: var(--text); }
.nav-links a.active::after { width: 100%; }

/* block lead helper */
.block-lead { margin: -1.5rem 0 2.2rem; max-width: 56ch; }

/* products / work grid */
.work-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.work-card {
  position: relative; display: flex; flex-direction: column; gap: 0.6rem;
  padding: 1.4rem 1.5rem; border: 1px solid var(--panel-brd); border-radius: 16px;
  background: var(--panel); overflow: hidden; transition: border-color 0.3s, transform 0.3s var(--ease);
}
.work-card::before {
  content: ""; position: absolute; inset: 0; opacity: 0; transition: opacity 0.4s;
  background: radial-gradient(600px circle at var(--mx, 50%) var(--my, 0%), color-mix(in srgb, var(--accent) 12%, transparent), transparent 40%);
}
.work-card:hover { border-color: var(--accent); transform: translateY(-4px); }
.work-card:hover::before { opacity: 1; }
.work-top { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; position: relative; }
.work-name { font-family: "Space Grotesk", sans-serif; font-weight: 600; font-size: 1.12rem; }
.work-arrow { color: var(--text-faint); transition: transform 0.3s var(--ease), color 0.3s; }
.work-card:hover .work-arrow { transform: translate(3px, -3px); color: var(--accent); }
.work-cat { font-family: "JetBrains Mono", monospace; font-size: 0.72rem; color: var(--accent3); letter-spacing: 0.05em; position: relative; }
.work-desc { color: var(--text-dim); font-size: 0.92rem; position: relative; }
.work-host { font-family: "JetBrains Mono", monospace; font-size: 0.76rem; color: var(--text-faint); margin-top: auto; position: relative; }

/* mobile menu */
.menu-only { display: none; }
@media (max-width: 720px) {
  .menu-only { display: inline-block; }
  .nav-links {
    display: flex; flex-direction: column; gap: 0; position: fixed; top: 58px; right: 0;
    width: min(72vw, 260px); height: calc(100vh - 58px); padding: 1.2rem;
    background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(18px);
    border-left: 1px solid var(--panel-brd); transform: translateX(110%);
    transition: transform 0.35s var(--ease); z-index: 49;
  }
  .nav-links.open { transform: none; }
  .nav-links a { padding: 0.9rem 0.4rem; border-bottom: 1px solid var(--panel-brd); font-size: 1rem; }
}

/* publication links */
.pub-link { color: var(--text); transition: color 0.25s; }
.pub-link:hover { color: var(--accent); }
.pub-ext { font-size: 0.75em; color: var(--text-faint); }
.pub-link:hover .pub-ext { color: var(--accent); }

/* brand mission strip */
.mission { display: flex; align-items: center; gap: 0.8rem; margin-top: 1.4rem; flex-wrap: wrap; }
.mission-logo { font-family: "JetBrains Mono", monospace; font-weight: 700; font-size: 0.95rem; color: var(--accent2); border: 1px solid var(--panel-brd); border-radius: 9px; padding: 0.35rem 0.7rem; background: var(--panel); white-space: nowrap; }
.mission-text { color: var(--text-dim); font-size: 0.95rem; }

/* product category filter */
.work-filter { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.4rem; }
.filter-chip { font-family: "JetBrains Mono", monospace; font-size: 0.8rem; color: var(--text-dim); border: 1px solid var(--panel-brd); border-radius: 999px; padding: 0.32rem 0.85rem; background: var(--panel); cursor: pointer; transition: all 0.25s; }
.filter-chip:hover { color: var(--text); border-color: var(--accent); }
.filter-chip.active { color: var(--bg); background: var(--grad); border-color: transparent; font-weight: 600; }
.work-card.hide { display: none; }

/* hero word reveal */
.hero-title .word { display: inline-block; opacity: 0; transform: translateY(0.5em); animation: wordIn 0.7s var(--ease) forwards; }
@keyframes wordIn { to { opacity: 1; transform: none; } }

/* updates / notes */
.updates { display: grid; gap: 0.8rem; }
.update-item { display: grid; grid-template-columns: 110px 1fr; gap: 1.2rem; padding: 1rem 1.2rem; border: 1px solid var(--panel-brd); border-radius: 14px; background: var(--panel); transition: border-color 0.3s, transform 0.25s var(--ease); }
.update-item:hover { border-color: var(--accent); transform: translateX(4px); }
.update-date { font-family: "JetBrains Mono", monospace; font-size: 0.8rem; color: var(--accent3); }
.update-text { color: var(--text-dim); font-size: 0.95rem; }
.update-text strong { color: var(--text); font-weight: 600; }
@media (max-width: 600px) { .update-item { grid-template-columns: 1fr; gap: 0.3rem; } }

/* ============ PRINT (CV) ============ */
@media print {
  #scroll-progress, #bg-canvas, #cursor-glow, .nav, .foot, .hero-cta, .work-filter, .mission, #cursor-glow { display: none !important; }
  body { background: #fff; color: #000; }
  main { max-width: 100%; padding: 0 1.5cm; }
  .block { padding: 0.6cm 0; }
  .reveal { opacity: 1 !important; transform: none !important; }
  .grad, .hero-stats strong { -webkit-text-fill-color: #111; color: #111; background: none; animation: none; }
  .hero-title .word { opacity: 1; transform: none; animation: none; }
  .hero-grid { grid-template-columns: 1.4fr 0.6fr; }
  .photo-frame { max-width: 150px; box-shadow: none; }
  .photo-frame::after, .photo-name { display: none; }
  .tl-item, .pub-item, .card, .work-card, .update-item { break-inside: avoid; border-color: #ccc; }
  a { color: #000; text-decoration: none; }
  .eyebrow, .work-cat, .update-date, .tl-org, .card-school { color: #333; }
  * { box-shadow: none !important; }
}

/* ============ RESEARCH HIGHLIGHTS ============ */
.hl-list { display: grid; gap: 1.4rem; }
.hl-card {
  display: grid; grid-template-columns: 72px 1fr; gap: 1.5rem;
  padding: 1.8rem; border: 1px solid var(--panel-brd); border-radius: 20px;
  background: var(--panel); position: relative; overflow: hidden;
  transition: border-color 0.3s, transform 0.3s var(--ease);
}
.hl-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--grad);
}
.hl-card:hover { border-color: var(--accent); transform: translateY(-3px); }
.hl-side { display: flex; flex-direction: column; align-items: flex-start; gap: 0.6rem; }
.hl-num { font-family: "Space Grotesk", sans-serif; font-weight: 700; font-size: 1.8rem; background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.hl-badge { font-family: "JetBrains Mono", monospace; font-size: 0.72rem; font-weight: 500; color: var(--accent2); border: 1px solid var(--panel-brd); border-radius: 6px; padding: 0.18rem 0.5rem; }
.hl-tag { font-family: "JetBrains Mono", monospace; font-size: 0.78rem; letter-spacing: 0.04em; color: var(--accent3); }
.hl-title { font-family: "Space Grotesk", sans-serif; font-weight: 700; font-size: clamp(1.25rem, 3vw, 1.7rem); line-height: 1.2; letter-spacing: -0.01em; margin: 0.5rem 0 0.8rem; }
.hl-lead { color: var(--text); font-size: 1.02rem; margin-bottom: 1.1rem; max-width: 70ch; }
.hl-points { list-style: none; display: grid; gap: 0.7rem; margin-bottom: 1.2rem; }
.hl-points li { color: var(--text-dim); font-size: 0.95rem; line-height: 1.55; padding-left: 1.2rem; position: relative; max-width: 74ch; }
.hl-points li::before { content: "◆"; position: absolute; left: 0; color: var(--accent); font-size: 0.7rem; top: 0.3rem; }
.hl-points strong { color: var(--text); font-weight: 600; }
.hl-chips { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.hl-chip { font-family: "JetBrains Mono", monospace; font-size: 0.74rem; color: var(--text-dim); border: 1px solid var(--panel-brd); border-radius: 7px; padding: 0.25rem 0.6rem; background: color-mix(in srgb, var(--accent) 5%, transparent); }
@media (max-width: 680px) {
  .hl-card { grid-template-columns: 1fr; gap: 0.8rem; padding: 1.4rem; }
  .hl-side { flex-direction: row; align-items: center; }
}
