/* ===== 主题变量 ===== */
:root {
  --bg: #0b1020;
  --bg-glow-1: rgba(20, 40, 90, .35);
  --bg-glow-2: rgba(46, 24, 96, .22);
  --card: rgba(16, 26, 52, .66);
  --card-border: rgba(56, 189, 248, .16);
  --accent: #38bdf8;
  --accent-2: #6366f1;
  --text: #e8f1ff;
  --text-dim: #93b4e8;
  --text-faint: #6d8cc0;
  --chip-bg: rgba(56, 189, 248, .10);
  --chip-text: #7dd3fc;
  --radius: 14px;
  --nav-h: 60px;
  --font: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, sans-serif;
}

/* ===== 基础 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background:
    radial-gradient(ellipse 80% 55% at 50% -10%, var(--bg-glow-1), transparent),
    radial-gradient(ellipse 60% 45% at 85% 110%, var(--bg-glow-2), transparent),
    var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* ===== WebGL 降级：纯 CSS 星点背景 ===== */
body.no-webgl::before {
  content: "";
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    radial-gradient(1px 1px at 30px 40px, rgba(255,255,255,.75), transparent),
    radial-gradient(1.5px 1.5px at 160px 100px, rgba(125,211,252,.65), transparent),
    radial-gradient(1px 1px at 250px 210px, rgba(255,255,255,.5), transparent),
    radial-gradient(1.5px 1.5px at 90px 300px, rgba(159,195,255,.55), transparent),
    radial-gradient(1px 1px at 330px 150px, rgba(255,255,255,.45), transparent);
  background-size: 360px 340px;
}

#bg-canvas { position: fixed; inset: 0; z-index: -1; display: block; }
body.no-webgl #bg-canvas { display: none; }

/* ===== 顶部导航 ===== */
.topnav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--nav-h);
  background: rgba(11, 16, 32, .72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--card-border);
}
.nav-inner {
  max-width: 1080px; margin: 0 auto; padding: 0 20px;
  height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { color: var(--text); text-decoration: none; font-weight: 800; font-size: 1.05rem; white-space: nowrap; }
.brand-sub { color: var(--accent); }
.nav-links { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.nav-links::-webkit-scrollbar { display: none; }
.nav-links a {
  color: var(--text-dim); text-decoration: none; font-size: .9rem;
  padding: 6px 12px; border-radius: 999px; white-space: nowrap;
  transition: color .2s, background .2s;
}
.nav-links a:hover { color: var(--text); }
.nav-links a.active { color: var(--text); background: var(--chip-bg); }

/* ===== Hero ===== */
.hero {
  min-height: 100vh; display: flex; flex-direction: column;
  justify-content: center; align-items: center; text-align: center;
  padding: calc(var(--nav-h) + 40px) 20px 60px;
  position: relative;
}
.hero h1 {
  font-size: clamp(2.6rem, 7vw, 4.4rem);
  letter-spacing: .06em;
  background: linear-gradient(120deg, #fff 15%, var(--accent) 40%, var(--accent-2) 62%, #fff 88%);
  background-size: 220% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: hero-shimmer 7s linear infinite;
}
@keyframes hero-shimmer {
  from { background-position: 100% 50%; }
  to { background-position: -100% 50%; }
}
.hero .role { margin-top: 14px; color: var(--text-dim); font-size: clamp(1rem, 2.4vw, 1.25rem); }
.tags { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 22px; }
.tags li {
  font-size: .82rem; color: var(--chip-text);
  border: 1px solid rgba(56,189,248,.35); background: var(--chip-bg);
  padding: 4px 14px; border-radius: 999px;
}
.contact { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 22px; margin-top: 24px; }
.contact a { color: var(--text); text-decoration: none; font-size: .95rem; border-bottom: 1px dashed rgba(56,189,248,.45); padding-bottom: 2px; transition: color .2s; }
.contact a:hover { color: var(--accent); }
.hero-actions { display: flex; gap: 14px; margin-top: 34px; flex-wrap: wrap; justify-content: center; }
.btn {
  display: inline-block; padding: 11px 26px; border-radius: 999px;
  font-size: .95rem; font-weight: 600; cursor: pointer;
  text-decoration: none; border: 1px solid transparent;
  transition: transform .15s, box-shadow .2s, background .2s;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: #fff; box-shadow: 0 4px 20px rgba(56, 189, 248, .35);
  border: none;
}
.btn-primary:hover { box-shadow: 0 6px 26px rgba(56, 189, 248, .5); }
.btn-ghost { color: var(--text); border-color: rgba(56,189,248,.5); background: rgba(56,189,248,.06); }
.btn-ghost:hover { background: rgba(56,189,248,.14); }

/* ===== 区块通用 ===== */
main { max-width: 1080px; margin: 0 auto; padding: 30px 20px 80px; }
.section { padding: 56px 0 0; scroll-margin-top: calc(var(--nav-h) + 16px); }
.sec-title {
  font-size: clamp(1.3rem, 3vw, 1.7rem); margin-bottom: 26px;
  display: flex; align-items: center; gap: 12px;
}
.sec-title::before {
  content: ""; width: 5px; height: 1.3em; border-radius: 3px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
}

/* ===== 卡片 ===== */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 22px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  html.js .card.reveal:hover {
    transform: translateY(-4px);
    border-color: rgba(56, 189, 248, .55);
    box-shadow: 0 8px 30px rgba(56, 189, 248, .18), 0 0 0 1px rgba(56, 189, 248, .12);
    transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
  }
}
.card h3 { font-size: 1.05rem; margin-bottom: 14px; }
.card p { color: var(--text-dim); font-size: .92rem; }

/* ===== 技能 ===== */
.skill-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-size: .78rem; color: var(--chip-text);
  background: var(--chip-bg); border: 1px solid rgba(56,189,248,.18);
  padding: 3px 11px; border-radius: 999px;
}
.chip.hot { color: #fff; background: linear-gradient(120deg, rgba(56,189,248,.35), rgba(99,102,241,.35)); border-color: rgba(56,189,248,.5); }

/* ===== 竞争力 ===== */
.strength-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.strength-grid .card h3 { color: var(--accent); }

/* ===== 时间轴 ===== */
.timeline { list-style: none; position: relative; padding-left: 22px; }
.timeline::before {
  content: ""; position: absolute; left: 5px; top: 6px; bottom: 6px;
  width: 2px; background: linear-gradient(180deg, var(--accent), var(--accent-2), transparent);
}
.tl-item { position: relative; padding: 0 0 30px 18px; }
.tl-item::before {
  content: ""; position: absolute; left: -22px; top: 8px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--bg); border: 3px solid var(--accent);
  box-shadow: 0 0 10px rgba(56,189,248,.6);
}
.tl-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; }
.tl-head h3 { font-size: 1.02rem; }
.tl-role { color: var(--accent); font-size: .86rem; }
.tl-date { margin-left: auto; color: var(--text-faint); font-size: .82rem; }
.tl-points { margin-top: 10px; padding-left: 1.1em; display: flex; flex-direction: column; gap: 6px; }
.tl-points li { color: var(--text-dim); font-size: .9rem; }

/* ===== 项目卡片 ===== */
.project-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 16px; }
.project-grid .card h3 { display: flex; align-items: center; gap: 6px; }
.proj-points { margin-top: 12px; padding-left: 1.1em; display: flex; flex-direction: column; gap: 5px; }
.proj-points li { color: var(--text-dim); font-size: .8rem; line-height: 1.65; overflow-wrap: anywhere; }
.scale {
  margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--card-border);
  color: var(--chip-text); font-size: .78rem; font-weight: 600;
}

/* ===== 教育 ===== */
.edu-card { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; max-width: 560px; }
.edu-card p { color: var(--text-dim); }

/* ===== 页脚 ===== */
.footer { text-align: center; padding: 30px 20px 40px; color: var(--text-faint); font-size: .82rem; }
.footer a { color: var(--text-dim); text-decoration: none; }
.footer a:hover { color: var(--accent); }

/* ===== 顶部滚动进度条 ===== */
#scroll-progress {
  position: fixed; top: 0; left: 0; width: 100%; height: 3px; z-index: 60;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transform: scaleX(0); transform-origin: 0 0;
  pointer-events: none;
}

/* ===== 鼠标跟随光斑 ===== */
#glow {
  display: none;
  position: fixed; left: 0; top: 0; width: 480px; height: 480px;
  border-radius: 50%; pointer-events: none; z-index: 0;
  background: radial-gradient(circle, rgba(56, 189, 248, .13), rgba(99, 102, 241, .09) 45%, transparent 70%);
}

/* ===== 返回顶部 ===== */
#back-top {
  position: fixed; right: 18px; bottom: 24px; width: 44px; height: 44px;
  border-radius: 50%; border: 1px solid var(--card-border);
  background: rgba(16, 26, 52, .85); color: var(--text-dim);
  font-size: 1.1rem; line-height: 1; cursor: pointer;
  opacity: 0; pointer-events: none; transform: translateY(10px);
  transition: opacity .3s ease, transform .3s ease, color .3s ease, border-color .3s ease;
  z-index: 40;
}
#back-top.show { opacity: 1; pointer-events: auto; transform: none; }
#back-top:hover { color: var(--accent); border-color: var(--accent); }

/* ===== 滚动淡入 ===== */
html.js .reveal { opacity: 0; transform: translateY(24px); transition: opacity .6s ease, transform .6s ease; }
html.js .reveal.in { opacity: 1; transform: none; }

/* ===== 响应式 ===== */
@media (max-width: 900px) {
  .project-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .nav-inner { padding: 0 12px; }
  .brand-sub { display: none; }
  .tl-head h3 { width: 100%; }
  .tl-date { margin-left: 0; }
  .skill-grid, .strength-grid { grid-template-columns: 1fr; }
  .hero { padding-top: calc(var(--nav-h) + 30px); }
}

/* ===== 减弱动态 ===== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  html.js .reveal { opacity: 1; transform: none; transition: none; }
  .hero h1 { animation: none; }
}

/* ===== 打印 ===== */
@media print {
  :root { --bg: #fff; --text: #000; --text-dim: #222; --text-faint: #444; }
  body { background: #fff !important; color: #000; }
  body::before { display: none !important; }
  #bg-canvas, .topnav, .hero-actions, .footer, #back-top, #scroll-progress, #glow { display: none !important; }
  .hero { min-height: 0; padding: 12px 0 8px; text-align: left; align-items: flex-start; }
  .hero h1 { background: none; -webkit-text-fill-color: #000; color: #000; }
  .tags, .contact { justify-content: flex-start; }
  .section { padding-top: 26px; }
  .card { background: #fff; border: 1px solid #999; backdrop-filter: none; }
  .chip { color: #000; background: #fff; border: 1px solid #666; }
  .chip.hot { color: #000; background: #fff; border: 1px solid #000; }
  .tags li { color: #000; background: #fff; border-color: #666; }
  .tl-points li, .proj-points li, .card p, .edu-card p { color: #222; }
  .tl-role, .sec-title::before, .tl-item::before, .scale { color: #000; }
  .tl-item::before { background: #fff; border-color: #000; box-shadow: none; }
  .scale { border-top-color: #999; color: #000; }
  html.js .reveal { opacity: 1; transform: none; }
  .tl-item, .card { break-inside: avoid; }
}
