/* ===== 基础重置 ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0d1117;
  --bg-alt: #131a22;
  --card: #1a2330;
  --card-hover: #212d3d;
  --text: #e6edf3;
  --text-dim: #9aa7b8;
  --primary: #58a6ff;
  --primary-2: #7ee787;
  --accent: #d2a8ff;
  --border: rgba(255,255,255,0.08);
  --radius: 16px;
  --maxw: 1080px;
}

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  overflow-x: hidden;
}

#bg-canvas {
  position: fixed; inset: 0; z-index: -1;
  width: 100%; height: 100%;
  pointer-events: none;
}

a { color: inherit; text-decoration: none; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* ===== 导航栏 ===== */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  transition: background .3s ease, backdrop-filter .3s ease, box-shadow .3s ease;
}
.navbar.scrolled {
  background: rgba(13,17,23,.85);
  backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 var(--border);
}
.nav-container {
  max-width: var(--maxw); margin: 0 auto; padding: 16px 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.nav-logo { font-weight: 700; font-size: 1.15rem; letter-spacing: .5px; }
.nav-menu { display: flex; gap: 8px; list-style: none; }
.nav-link {
  padding: 8px 14px; border-radius: 999px; font-size: .95rem;
  color: var(--text-dim); transition: all .25s ease;
}
.nav-link:hover { color: var(--text); background: rgba(255,255,255,.06); }
.nav-link.active { color: var(--primary); background: rgba(88,166,255,.12); }
.nav-toggle { display: none; background: none; border: none; cursor: pointer; }
.nav-toggle span {
  display: block; width: 22px; height: 2px; margin: 5px 0;
  background: var(--text); border-radius: 2px; transition: transform .3s ease;
}
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ===== 首屏 ===== */
.hero {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
  padding: 100px 24px 60px; position: relative;
}
.hero-avatar {
  width: 112px; height: 112px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.6rem; font-weight: 700; color: var(--bg);
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: 0 0 0 6px rgba(88,166,255,.15), 0 12px 40px rgba(0,0,0,.4);
  margin-bottom: 24px; animation: float 4s ease-in-out infinite;
}
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
.hero-greeting { font-size: 1.05rem; color: var(--text-dim); }
.hero-name {
  font-size: clamp(2.4rem, 7vw, 4.2rem); font-weight: 800; line-height: 1.15;
  margin: 8px 0;
  background: linear-gradient(90deg, var(--primary), var(--primary-2), var(--accent));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-title { font-size: clamp(1.1rem, 3vw, 1.6rem); color: var(--text); min-height: 1.6em; }
.cursor { display: inline-block; color: var(--primary); animation: blink 1s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }
.hero-desc { color: var(--text-dim); max-width: 520px; margin: 12px auto 28px; }
.hero-buttons { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.btn {
  padding: 12px 26px; border-radius: 999px; font-size: 1rem; font-weight: 600;
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}
.btn:hover { transform: translateY(-3px); }
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--accent)); color: #0b0f14;
  box-shadow: 0 8px 24px rgba(88,166,255,.3);
}
.btn-ghost { border: 1px solid var(--border); background: rgba(255,255,255,.03); }
.btn-ghost:hover { background: rgba(255,255,255,.08); }
.scroll-hint {
  position: absolute; bottom: 26px; left: 50%; transform: translateX(-50%);
  width: 26px; height: 42px; border: 2px solid var(--border); border-radius: 999px;
}
.scroll-hint span {
  display: block; width: 4px; height: 8px; margin: 7px auto 0;
  background: var(--primary); border-radius: 2px;
  animation: scrollDown 1.6s ease-in-out infinite;
}
@keyframes scrollDown { 0% { opacity: 0; transform: translateY(-6px); } 50% { opacity: 1; } 100% { opacity: 0; transform: translateY(10px); } }

/* ===== 通用区块 ===== */
.section { padding: 100px 0; }
.section-alt { background: var(--bg-alt); }
.section-title {
  text-align: center; font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 800;
  margin-bottom: 52px; position: relative;
}
.section-title::after {
  content: ""; display: block; width: 56px; height: 4px; border-radius: 2px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  margin: 14px auto 0;
}

/* ===== 关于 ===== */
.about-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; }
.about-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 28px 22px; text-align: center; transition: transform .25s ease, background .25s ease;
}
.about-card:hover { transform: translateY(-6px); background: var(--card-hover); }
.about-icon { font-size: 2.4rem; margin-bottom: 12px; }
.about-card h3 { font-size: 1.15rem; margin-bottom: 8px; }
.about-card p { color: var(--text-dim); font-size: .92rem; }

/* ===== 技能 ===== */
.skills-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 22px 32px; }
.skill-head { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: .95rem; }
.skill-pct { color: var(--primary); font-weight: 600; }
.skill-bar { height: 8px; background: rgba(255,255,255,.07); border-radius: 999px; overflow: hidden; }
.skill-fill {
  height: 100%; width: 0; border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  transition: width 1.2s cubic-bezier(.16,1,.3,1);
}

/* ===== 项目 ===== */
.projects-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 22px; }
.project-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 26px; transition: transform .25s ease, background .25s ease, border-color .25s ease;
}
.project-card:hover { transform: translateY(-6px); background: var(--card-hover); border-color: rgba(88,166,255,.35); }
.project-thumb { font-size: 2.2rem; margin-bottom: 12px; }
.project-card h3 { font-size: 1.2rem; margin-bottom: 8px; }
.project-card > p { color: var(--text-dim); font-size: .92rem; margin-bottom: 14px; }
.project-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.project-tags span {
  font-size: .78rem; padding: 4px 10px; border-radius: 999px;
  background: rgba(88,166,255,.12); color: var(--primary);
}
.project-link { font-weight: 600; color: var(--primary); font-size: .92rem; }
.project-link:hover { text-decoration: underline; }

/* ===== 联系 ===== */
.contact-desc { text-align: center; color: var(--text-dim); margin-bottom: 36px; }
.contact-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
.contact-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; display: flex; flex-direction: column; align-items: center; gap: 6px;
  transition: transform .25s ease, background .25s ease;
}
.contact-card:hover { transform: translateY(-6px); background: var(--card-hover); }
.contact-icon { font-size: 2rem; }
.contact-value { color: var(--text-dim); font-size: .88rem; }

/* ===== 页脚 ===== */
.footer { padding: 36px 24px; text-align: center; color: var(--text-dim); font-size: .9rem; }

/* ===== 滚动出现动画 ===== */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity .7s ease, transform .7s ease; }
.reveal.visible { opacity: 1; transform: translateY(0); }

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .nav-toggle { display: block; }
  .nav-menu {
    position: absolute; top: 100%; left: 0; right: 0; flex-direction: column;
    background: rgba(13,17,23,.97); backdrop-filter: blur(12px);
    padding: 12px 24px 20px; gap: 4px;
    border-bottom: 1px solid var(--border);
    display: none;
  }
  .nav-menu.open { display: flex; }
  .section { padding: 72px 0; }
}
