:root {
  --bg: #fafaf9;
  --bg-alt: #f2f1ee;
  --surface: #ffffff;
  --text: #1c1917;
  --muted: #6b6560;
  --border: #e4e1dc;
  --accent: #2f6fde;
  --accent-soft: rgba(47, 111, 222, 0.1);
  --code-bg: #14161b;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06);
  --radius: 14px;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1115;
    --bg-alt: #14171c;
    --surface: #181b21;
    --text: #e8e6e3;
    --muted: #9a958f;
    --border: #262a31;
    --accent: #6ea0ff;
    --accent-soft: rgba(110, 160, 255, 0.12);
    --code-bg: #0b0d10;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.3);
  }
}
:root[data-theme="dark"] {
  --bg: #0f1115;
  --bg-alt: #14171c;
  --surface: #181b21;
  --text: #e8e6e3;
  --muted: #9a958f;
  --border: #262a31;
  --accent: #6ea0ff;
  --accent-soft: rgba(110, 160, 255, 0.12);
  --code-bg: #0b0d10;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  font-family: "Inter", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
.container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }
.accent { color: var(--accent); }
.muted { color: var(--muted); }

/* NAV */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.nav.scrolled { border-bottom-color: var(--border); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { font-family: var(--mono); font-weight: 500; font-size: 15px; }
.brand span { color: var(--accent); }
.nav-links { display: flex; gap: 28px; font-size: 14px; color: var(--muted); }
.nav-links a:hover, .nav-links a.active { color: var(--text); }
.nav-actions { display: flex; gap: 8px; }
.icon-btn {
  display: grid; place-items: center; width: 36px; height: 36px;
  border-radius: 10px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); cursor: pointer;
}
.icon-btn:hover { border-color: var(--accent); }
.menu-btn { display: none; }
.lang-btn { font: 600 13px/1 "Inter", system-ui, sans-serif; }
:root[lang="zh"] body { font-family: "Inter", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif; }
.i-moon { display: none; }
:root[data-theme="dark"] .i-sun { display: none; }
:root[data-theme="dark"] .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: none; }
  :root:not([data-theme="light"]) .i-moon { display: block; }
}

/* HERO */
.hero { padding: 88px 0 56px; }
.hero-inner { display: grid; grid-template-columns: 1.1fr 1fr; gap: 48px; align-items: center; }
.status {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--muted);
  padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 4px rgba(34,197,94,.18); }
h1 { font-size: clamp(36px, 5.5vw, 60px); line-height: 1.08; letter-spacing: -0.03em; margin: 22px 0 8px; font-weight: 800; }
.aka { color: var(--muted); font-size: 15px; margin-bottom: 14px; }
.role { font-family: var(--mono); font-size: 14px; color: var(--accent); margin-bottom: 18px; }
.lead { font-size: 18px; color: var(--muted); max-width: 560px; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.cta.center { justify-content: center; }
.btn {
  padding: 11px 20px; border-radius: 10px; font-size: 14px; font-weight: 600;
  border: 1px solid var(--border); background: var(--surface);
  transition: transform .15s, border-color .15s, background .15s;
}
.btn:hover { transform: translateY(-1px); border-color: var(--accent); }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.ghost { background: transparent; }

.term { background: var(--code-bg); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; border: 1px solid #262a31; }
.term-bar { display: flex; align-items: center; gap: 6px; padding: 12px 14px; border-bottom: 1px solid #23262d; }
.term-bar i { width: 11px; height: 11px; border-radius: 50%; background: #3a3e46; }
.term-bar i:nth-child(1) { background: #ff5f57; }
.term-bar i:nth-child(2) { background: #febc2e; }
.term-bar i:nth-child(3) { background: #28c840; }
.term-bar span { margin-left: 10px; font-family: var(--mono); font-size: 12px; color: #7d828c; }
.term pre { padding: 20px; font-family: var(--mono); font-size: 13px; line-height: 1.7; color: #d4d7dd; overflow-x: auto; }
.c-k { color: #c792ea; }
.c-s { color: #a5d6a7; }

.stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
  margin-top: 64px; background: var(--border); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.stats div { background: var(--surface); padding: 22px; }
.stats strong { display: block; font-size: 28px; letter-spacing: -0.02em; }
.stats span { font-size: 13px; color: var(--muted); }

/* SECTIONS */
.section { padding: 96px 0; }
.section.alt { background: var(--bg-alt); }
.eyebrow { font-family: var(--mono); font-size: 13px; color: var(--accent); margin-bottom: 10px; }
h2 { font-size: clamp(28px, 3.6vw, 40px); line-height: 1.15; letter-spacing: -0.02em; margin-bottom: 36px; }
h3 { font-size: 19px; letter-spacing: -0.01em; line-height: 1.35; }
.two-col { display: grid; grid-template-columns: 1fr 1.4fr; gap: 56px; }
.two-col p { margin-bottom: 16px; color: var(--muted); }
.two-col p strong { color: var(--text); font-weight: 600; }

.skills { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 30px; }
.skills h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 10px; font-weight: 600; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tags li {
  font-size: 13px; padding: 4px 10px; border-radius: 7px;
  background: var(--surface); border: 1px solid var(--border);
}
.tags.small li { font-size: 12px; padding: 3px 8px; font-family: var(--mono); background: var(--accent-soft); border-color: transparent; color: var(--accent); }

/* TIMELINE */
.timeline { border-left: 2px solid var(--border); margin-left: 6px; }
.timeline > li { position: relative; padding: 0 0 8px 32px; display: grid; grid-template-columns: 200px 1fr; gap: 24px; }
.timeline > li::before {
  content: ""; position: absolute; left: -8px; top: 6px; width: 14px; height: 14px;
  border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 5px var(--accent-soft);
}
.tl-meta { display: flex; flex-direction: column; font-size: 14px; }
.date { font-family: var(--mono); font-size: 13px; color: var(--accent); }
.place { color: var(--muted); font-size: 13px; }
.tl-body { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); }
.tl-body h3 { margin-bottom: 14px; }
.at { color: var(--muted); font-weight: 500; }
.badge { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); vertical-align: middle; margin-left: 6px; }
.tl-body > ul:not(.tags) { margin-bottom: 18px; }
.tl-body > ul:not(.tags) li { position: relative; padding-left: 18px; margin-bottom: 8px; color: var(--muted); font-size: 15px; }
.tl-body > ul:not(.tags) li::before { content: "▹"; position: absolute; left: 0; color: var(--accent); }

/* PROJECTS */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: -12px 0 28px; }
.chip {
  font: inherit; font-size: 13px; padding: 6px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
}
.chip.active, .chip:hover { color: var(--text); border-color: var(--accent); }
.chip.active { background: var(--accent-soft); color: var(--accent); }
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.card {
  display: flex; flex-direction: column; gap: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 26px; transition: transform .2s, border-color .2s, box-shadow .2s;
}
.card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow); }
.card.featured { grid-column: 1 / -1; background: linear-gradient(135deg, var(--accent-soft), transparent 60%), var(--surface); }
.card.hidden { display: none; }
.card p { color: var(--muted); font-size: 15px; }
.card-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 12px; }
.kind { font-family: var(--mono); color: var(--muted); }
.score { font-weight: 600; color: var(--accent); }
.date-sm { font-family: var(--mono); color: var(--muted); }
.card .foot { font-size: 13px; margin-top: auto; }
.pipeline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; }
.pipeline span { padding: 6px 10px; border: 1px dashed var(--border); border-radius: 8px; background: var(--bg); }
.pipeline b { color: var(--accent); font-weight: 400; }
.arch li { font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.arch code { font-family: var(--mono); font-size: 12px; color: var(--text); background: var(--bg-alt); padding: 1px 6px; border-radius: 5px; margin-right: 6px; }
.links { margin-top: auto; }
.links a { font-size: 14px; font-weight: 600; color: var(--accent); }
.links a:hover { text-decoration: underline; }

/* EDUCATION */
.edu-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.edu { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.edu h3 { margin: 6px 0 4px; }
.edu-grid.two { grid-template-columns: repeat(2, 1fr); }
.sub { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; margin: 0 0 14px; }
.edu-grid + .sub { margin-top: 36px; }
.edu p { font-size: 14px; color: var(--muted); }

/* QUOTES */
.quotes { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.quote { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; display: flex; flex-direction: column; gap: 20px; }
.quote blockquote { font-size: 16px; line-height: 1.7; }
.quote figcaption { margin-top: auto; display: flex; flex-direction: column; font-size: 14px; }
.quote figcaption span { color: var(--muted); font-size: 13px; }

/* CONTACT */
.contact { text-align: center; }
.contact .lead { margin: 0 auto; }
.footer { border-top: 1px solid var(--border); padding: 28px 0; font-size: 13px; color: var(--muted); text-align: center; }

/* REVEAL */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* RESPONSIVE */
@media (max-width: 900px) {
  .hero-inner, .two-col { grid-template-columns: 1fr; }
  .two-col { gap: 8px; }
  .edu-grid { grid-template-columns: 1fr 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .timeline > li { grid-template-columns: 1fr; gap: 10px; }
}
@media (max-width: 720px) {
  .container { padding: 0 16px; }
  .menu-btn { display: grid; }
  .nav-links {
    position: absolute; top: 64px; left: 0; right: 0;
    flex-direction: column; gap: 0; background: var(--bg);
    border-bottom: 1px solid var(--border); display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 14px 16px; border-top: 1px solid var(--border); }
  .hero { padding-top: 56px; }
  .section { padding: 72px 0; }
  .grid, .quotes, .edu-grid, .edu-grid.two, .skills { grid-template-columns: 1fr; }
  .timeline > li { padding-left: 22px; }
  .term pre { font-size: 12px; }
}
