:root {
  --bg: #fbfaff;
  --bg-alt: #f4f1fb;
  --surface: #ffffff;
  --text: #1c1830;
  --muted: #6b6785;
  --border: #e7e3f3;
  --brand: #7c3aed;
  --brand-2: #c026d3;
  --shadow: 0 1px 2px rgba(30, 20, 60, .04), 0 8px 24px rgba(30, 20, 60, .06);
  --shadow-hover: 0 2px 4px rgba(30, 20, 60, .05), 0 18px 40px rgba(76, 29, 149, .14);
  --radius: 18px;
}
:root[data-theme="dark"] {
  --bg: #0e0c17;
  --bg-alt: #13101f;
  --surface: #181427;
  --text: #ece9f7;
  --muted: #9a95b4;
  --border: #2a2540;
  --brand: #a78bfa;
  --brand-2: #e879f9;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
  --shadow-hover: 0 2px 4px rgba(0,0,0,.3), 0 18px 40px rgba(124,58,237,.25);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0c17;
    --bg-alt: #13101f;
    --surface: #181427;
    --text: #ece9f7;
    --muted: #9a95b4;
    --border: #2a2540;
    --brand: #a78bfa;
    --brand-2: #e879f9;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
    --shadow-hover: 0 2px 4px rgba(0,0,0,.3), 0 18px 40px rgba(124,58,237,.25);
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  transition: background .3s, color .3s;
}
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
.container { width: min(1120px, 100% - 48px); margin-inline: auto; }
.muted { color: var(--muted); }

/* Nav */
.nav {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: saturate(180%) blur(14px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid var(--border);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { font-weight: 700; font-size: 18px; letter-spacing: .2px; display: flex; align-items: center; gap: 8px; }
.brand-dot { width: 10px; height: 10px; border-radius: 50%; background: linear-gradient(135deg, var(--brand), var(--brand-2)); }
.nav-links { display: flex; align-items: center; gap: 28px; font-size: 15px; }
.nav-links a { color: var(--muted); transition: color .2s; }
.nav-links a:hover { color: var(--text); }
.theme-toggle {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  width: 36px; height: 36px; border-radius: 10px; cursor: pointer;
  display: grid; place-items: center;
}
.icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: none; }
  :root:not([data-theme="light"]) .icon-moon { display: block; }
}

/* Hero */
.hero {
  position: relative; overflow: hidden;
  padding: 88px 0 56px;
}
.hero::before {
  content: ""; position: absolute; inset: -40% -10% auto auto; width: 720px; height: 720px;
  background: radial-gradient(circle, color-mix(in srgb, var(--brand) 22%, transparent), transparent 65%);
  filter: blur(20px); pointer-events: none; z-index: -1;
}
.hero::after {
  content: ""; position: absolute; left: -200px; top: 120px; width: 520px; height: 520px;
  background: radial-gradient(circle, color-mix(in srgb, var(--brand-2) 14%, transparent), transparent 65%);
  filter: blur(20px); pointer-events: none; z-index: -1;
}
.hero-inner { display: grid; grid-template-columns: 1.5fr 1fr; gap: 56px; align-items: center; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 16px; color: var(--brand); font-weight: 600;
  background: color-mix(in srgb, var(--brand) 10%, transparent);
  padding: 8px 16px; border-radius: 999px;
}
.pulse { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 0 rgba(34,197,94,.6); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }
h1 { font-size: clamp(40px, 6vw, 64px); line-height: 1.15; margin: 22px 0 18px; letter-spacing: -1px; }
.grad { background: linear-gradient(120deg, var(--brand), var(--brand-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { font-size: 18px; color: var(--muted); max-width: 620px; }
.lead b { color: var(--text); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; margin: 26px 0 30px; }
.chips li {
  font-size: 16px; padding: 8px 16px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
}
.cta { display: flex; flex-wrap: wrap; gap: 12px; }
.cta.center { justify-content: center; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px; border-radius: 12px; font-size: 16px; font-weight: 600;
  border: 1px solid transparent; transition: transform .15s, box-shadow .2s, background .2s, border-color .2s;
  cursor: pointer;
}
.btn-primary { color: #fff; background: linear-gradient(120deg, var(--brand), var(--brand-2)); box-shadow: 0 6px 18px color-mix(in srgb, var(--brand) 35%, transparent); }
.btn-primary:hover { transform: translateY(-2px); }
.btn-ghost { border-color: var(--border); background: var(--surface); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }

.hero-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 24px;
  box-shadow: var(--shadow); overflow: hidden; max-width: 360px; justify-self: end; width: 100%;
}
.avatar-wrap { aspect-ratio: 4 / 4.2; overflow: hidden; background: linear-gradient(135deg, #e9e3ff, #f6e8ff); }
.avatar { width: 100%; height: 100%; object-fit: cover; object-position: center 18%; display: block; }
.hero-card-body { padding: 20px 22px 22px; }
.hc-name { font-size: 20px; font-weight: 700; margin-bottom: 10px; }
.hc-name .muted { font-size: 14px; font-weight: 500; margin-left: 6px; }
.hc-row { font-size: 14px; padding: 6px 0; border-top: 1px dashed var(--border); display: flex; gap: 14px; }
.hc-k { color: var(--muted); width: 32px; flex-shrink: 0; }

.stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 64px;
}
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 22px; box-shadow: var(--shadow);
}
.stat-num { font-size: 32px; font-weight: 800; letter-spacing: -.5px; background: linear-gradient(120deg, var(--brand), var(--brand-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat-label { font-size: 13px; color: var(--muted); line-height: 1.55; margin-top: 4px; }

/* Sections */
.section { padding: 88px 0; }
.section.alt { background: var(--bg-alt); }
.section-head { margin-bottom: 40px; }
.section-kicker { font-size: 13px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--brand); }
h2 { font-size: clamp(28px, 4vw, 38px); letter-spacing: -.5px; margin-top: 4px; }
.section-sub { color: var(--muted); margin-top: 8px; }

/* Projects */
.projects { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.project {
  position: relative; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: 22px;
  padding: 26px 24px 22px; box-shadow: var(--shadow);
  transition: transform .25s, box-shadow .25s, border-color .25s;
}
.project::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; border-radius: 22px 22px 0 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
.project:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.project-top { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.project-icon {
  width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; flex-shrink: 0;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.project-meta { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.project-meta .dot { margin: 0 4px; }
.project h3 { font-size: 22px; line-height: 1.3; margin-bottom: 10px; }
.project h3 .sub { display: block; font-size: 15px; font-weight: 600; color: var(--accent); margin-top: 4px; }
.project-desc { font-size: 14.5px; color: var(--muted); margin-bottom: 14px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tags li {
  font-size: 12.5px; padding: 3px 10px; border-radius: 8px;
  background: var(--bg-alt); border: 1px solid var(--border); color: var(--text);
}
.project .tags { margin-bottom: 16px; }
.points { display: grid; gap: 10px; font-size: 14px; margin-bottom: 22px; flex: 1; }
.points li { position: relative; padding-left: 16px; }
.points li::before {
  content: ""; position: absolute; left: 0; top: .72em; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
}
.points b { font-weight: 650; }
.project-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 16px; border-top: 1px solid var(--border); }
.btn-demo { font-size: 14px; padding: 9px 16px; color: #fff; background: linear-gradient(120deg, var(--accent), var(--accent-2)); }
.btn-demo.is-disabled { color: var(--muted); background: var(--bg-alt); border-color: var(--border); cursor: not-allowed; }
.btn-link { font-size: 14px; padding: 9px 12px; color: var(--accent); }
.btn-link:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }

/* Timeline */
.timeline { position: relative; display: grid; gap: 22px; }
.timeline li {
  display: grid; grid-template-columns: 200px 1fr; gap: 24px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px 26px; box-shadow: var(--shadow);
}
.tl-date { font-weight: 700; color: var(--brand); font-variant-numeric: tabular-nums; }
.tl-body h4 { font-size: 19px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.badge { font-size: 12px; font-weight: 600; color: var(--brand); background: color-mix(in srgb, var(--brand) 10%, transparent); padding: 2px 10px; border-radius: 999px; }
.tl-major { font-weight: 600; margin: 4px 0 2px; }
.tl-body .muted { font-size: 14.5px; }

/* Skills */
.skills { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.skill-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow);
}
.skill-card h4 { font-size: 16px; margin-bottom: 14px; }

/* Contact */
.contact { text-align: center; background: var(--bg-alt); }
.contact-inner p { margin: 10px 0 28px; }

.footer { padding: 28px 0; text-align: center; font-size: 13px; color: var(--muted); border-top: 1px solid var(--border); }

/* Reveal */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }

/* Responsive */
@media (max-width: 980px) {
  .projects { grid-template-columns: 1fr; max-width: 680px; margin-inline: auto; }
  .stats, .skills { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .hero { padding-top: 48px; }
  .hero-inner { grid-template-columns: 1fr; gap: 36px; }
  .hero-card { justify-self: start; max-width: 100%; display: grid; grid-template-columns: 130px 1fr; }
  .avatar-wrap { aspect-ratio: auto; height: 100%; }
  .hero-card-body { padding: 16px 18px; }
  .nav-links a { display: none; }
  .timeline li { grid-template-columns: 1fr; gap: 6px; }
  .section { padding: 64px 0; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}
