/* ===== 变量与基础 ===== */
:root {
  --bg: #0d1117;            /* 主背景，GitHub 暗色风 */
  --bg-alt: #161b22;        /* 交替区块背景 */
  --card: #161b22;
  --border: #30363d;
  --text: #c9d1d9;
  --text-bright: #f0f6fc;
  --text-dim: #8b949e;
  --accent: #58a6ff;        /* 蓝色强调 */
  --accent-2: #d2a8ff;      /* 紫色点缀 */
  --green: #3fb950;
  --mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
  --sans: 'Inter', -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --radius: 10px;
  --max-w: 1080px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== 导航 ===== */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  background: rgba(13, 17, 23, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}
.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo {
  font-family: var(--mono);
  color: var(--text-bright);
  font-weight: 700;
  font-size: 1.05rem;
}
.cursor {
  color: var(--green);
  animation: blink 1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.nav-links {
  display: flex;
  gap: 28px;
  list-style: none;
  align-items: center;
}
.nav-links a {
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 500;
  transition: color .2s;
}
.nav-links a:hover { color: var(--accent); text-decoration: none; }
.nav-cta {
  color: var(--green) !important;
  border: 1px solid var(--green);
  padding: 6px 14px;
  border-radius: 6px;
}
.nav-cta:hover { background: rgba(63, 185, 80, 0.1); }

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 1.2rem;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
}

/* ===== Hero ===== */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 120px 24px 80px;
}
.hero-inner { max-width: var(--max-w); width: 100%; }
.hero-greeting {
  font-family: var(--mono);
  color: var(--green);
  font-size: 1.05rem;
  margin-bottom: 12px;
}
.hero-name {
  font-size: clamp(2.6rem, 7vw, 4.5rem);
  font-weight: 800;
  color: var(--text-bright);
  line-height: 1.1;
}
.hero-title {
  font-size: clamp(1.4rem, 3.5vw, 2.2rem);
  font-weight: 600;
  color: var(--text-dim);
  margin: 12px 0 20px;
}
.hero-title .typed { color: var(--accent); }
.hero-desc {
  max-width: 560px;
  font-size: 1.1rem;
  color: var(--text);
  margin-bottom: 32px;
}
.hero-actions { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 36px; }

.btn {
  display: inline-block;
  padding: 12px 26px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.98rem;
  transition: all .2s;
}
.btn:hover { text-decoration: none; transform: translateY(-2px); }
.btn-primary { background: var(--accent); color: #0d1117; }
.btn-primary:hover { background: #79b8ff; }
.btn-ghost { border: 1px solid var(--border); color: var(--text-bright); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.hero-social { display: flex; gap: 22px; font-family: var(--mono); font-size: 0.92rem; }
.hero-social a { color: var(--text-dim); }
.hero-social a:hover { color: var(--accent); text-decoration: none; }

.hero-scroll {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--mono);
  color: var(--text-dim);
  font-size: 0.9rem;
  animation: float 2s ease-in-out infinite;
}
@keyframes float { 50% { transform: translate(-50%, 8px); } }

/* ===== 区块通用 ===== */
.section { padding: 90px 24px; }
.section-alt { background: var(--bg-alt); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-inner { max-width: var(--max-w); margin: 0 auto; }
.section-title {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  color: var(--text-bright);
  margin-bottom: 40px;
  font-weight: 700;
}
.hash { color: var(--accent); font-family: var(--mono); }

/* ===== 关于 ===== */
.about-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 48px; align-items: start; }
.about-text p { margin-bottom: 16px; font-size: 1.02rem; }
.about-text strong { color: var(--text-bright); }
.about-text em { color: var(--accent-2); font-style: normal; }
.about-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.fact {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
}
.fact-num {
  display: block;
  font-family: var(--mono);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--accent);
}
.fact-label { color: var(--text-dim); font-size: 0.9rem; }

/* ===== 技能 ===== */
.skills-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 20px; }
.skill-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  transition: border-color .2s, transform .2s;
}
.skill-card:hover { border-color: var(--accent); transform: translateY(-4px); }
.skill-card h3 {
  font-family: var(--mono);
  color: var(--accent-2);
  margin-bottom: 14px;
  font-size: 1.05rem;
}
.skill-card ul { list-style: none; }
.skill-card li {
  color: var(--text);
  font-size: 0.95rem;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
}
.skill-card li:last-child { border-bottom: none; }

/* ===== 项目 ===== */
.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.project-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  display: flex;
  flex-direction: column;
  transition: border-color .2s, transform .2s;
}
.project-card:hover { border-color: var(--accent); transform: translateY(-4px); }
.project-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.project-folder { font-size: 2rem; }
.project-links { display: flex; gap: 14px; font-family: var(--mono); font-size: 0.85rem; }
.project-name { color: var(--text-bright); font-size: 1.25rem; margin-bottom: 10px; }
.project-desc { color: var(--text-dim); font-size: 0.95rem; flex-grow: 1; margin-bottom: 18px; }
.project-tech { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; }
.project-tech li {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-dim);
  background: rgba(88, 166, 255, 0.08);
  padding: 4px 10px;
  border-radius: 20px;
}
.project-more { justify-content: center; text-align: center; }
.project-more h3 { color: var(--accent); }
.project-more p { color: var(--text-dim); }

/* ===== 联系 ===== */
.contact-intro { font-size: 1.05rem; margin-bottom: 28px; }
.contact-links { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.contact-mail { font-family: var(--mono); color: var(--text-dim); }

/* ===== 页脚 ===== */
.footer {
  border-top: 1px solid var(--border);
  padding: 30px 24px;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.9rem;
}
.footer p { font-family: var(--mono); }

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .nav-links {
    position: fixed;
    top: 64px; right: 0;
    flex-direction: column;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 0 0 0 10px;
    padding: 20px 28px;
    gap: 18px;
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-toggle { display: block; }
  .about-grid { grid-template-columns: 1fr; gap: 32px; }
  .hero { padding-top: 100px; }
}

/* ===== 进入视口动画 ===== */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .6s ease, transform .6s ease;
}
.reveal.visible { opacity: 1; transform: none; }
