/* ============ 基础变量 ============ */
:root {
  --accent: #6e40c9;
  --accent-2: #b14cd9;
  --accent-3: #d94c8a;
  --bg: #0d1117;
  --card-bg: #161b22;
  --card-border: #30363d;
  --text: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;
  --tag-bg: rgba(110,64,201,0.15);
  --tag-border: rgba(110,64,201,0.3);
  --tag-text: #d2c4f0;
}

/* ============ 重置 ============ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text-secondary);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ============ 弥散光背景 ============ */
.aurora {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 0; overflow: hidden;
}
.aurora-blob {
  position: absolute; border-radius: 50%;
  filter: blur(90px); opacity: 0.18;
  animation: aurora-drift 20s ease-in-out infinite alternate;
}
.aurora-blob:nth-child(1) { width: 600px; height: 600px; background: var(--accent); top: -15%; left: -8%; animation-duration: 22s; }
.aurora-blob:nth-child(2) { width: 500px; height: 500px; background: var(--accent-2); top: 25%; right: -12%; animation-duration: 18s; }
.aurora-blob:nth-child(3) { width: 450px; height: 450px; background: var(--accent-3); bottom: 5%; left: 15%; animation-duration: 25s; }
@keyframes aurora-drift {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(30px, -20px) scale(1.05); }
}

/* 全局网格纹理，填充两侧空白 */
body::before {
  content: '';
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background-image: radial-gradient(circle at 1px 1px, rgba(230, 237, 243, 0.04) 1px, transparent 0);
  background-size: 44px 44px;
  pointer-events: none; z-index: 0;
}

/* ============ 进度条 ============ */
.progress-bar {
  position: fixed; top: 0; left: 0; height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent-3));
  width: 0%; z-index: 1000;
  transition: width 0.15s ease;
}

/* ============ 顶部导航 ============ */
.topnav {
  position: fixed; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.7rem 2rem;
  background: rgba(13,17,23,0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--card-border);
  z-index: 999;
  transition: transform 0.3s ease;
}
.topnav-brand {
  font-size: 15px; font-weight: 600; color: var(--text);
  text-decoration: none; display: flex; align-items: center; gap: 6px;
}
.topnav-brand-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.topnav-links { display: flex; gap: 1.2rem; }
.topnav-link {
  font-size: 13px; color: var(--text-muted); text-decoration: none;
  transition: color 0.2s;
}
.topnav-link:hover { color: var(--accent-2); }

/* ============ 返回顶部 ============ */
.back-top {
  position: fixed; bottom: 2rem; right: 2rem;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--accent); color: white; border: none;
  font-size: 18px; cursor: pointer;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 998;
}
.back-top.visible { opacity: 1; pointer-events: auto; }

/* ============ 封面 ============ */
.hero {
  min-height: 100vh;
  display: flex; flex-direction: column;
  justify-content: center; align-items: center;
  padding: 6rem 2rem 3rem 2rem;
  position: relative; z-index: 1;
}
.hero-container {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 1rem;
  align-items: center;
  width: 100%;
  max-width: 900px; margin: 0 auto;
}
.hero-main { width: 100%; text-align: left; padding-left: 1.6rem; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--tag-bg); color: var(--tag-text);
  font-size: 12px; font-weight: 500;
  padding: 4px 14px; border-radius: 20px;
  border: 1px solid var(--tag-border);
  margin-bottom: 1.5rem;
}
.hero-badge-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--tag-text); }
.hero-greeting { font-size: 38px; font-weight: 700; color: var(--text); margin-bottom: 0.3rem; }
.hero-name {
  font-size: 22px; font-weight: 700; color: #c9d1d9;
  margin-bottom: 0.5rem; letter-spacing: 2px;
}
.hero-en { font-size: 14px; color: #58a6ff; margin-bottom: 1rem; letter-spacing: 4px; }
.hero-tagline {
  font-size: 15px; color: var(--text-secondary); line-height: 1.8;
  margin-bottom: 1.5rem;
}
.hero-tagline strong { color: var(--accent-2); }
.hero-contact {
  display: flex; flex-wrap: wrap; gap: 0.8rem;
  margin-bottom: 1.5rem;
}
.hero-contact-item {
  font-size: 13px; color: var(--text-secondary);
  background: var(--card-bg); border: 1px solid var(--card-border);
  padding: 5px 12px; border-radius: 6px;
  text-decoration: none; transition: border-color 0.2s, color 0.2s;
}
.hero-contact-item:hover {
  border-color: var(--accent-2); color: var(--accent-2);
}
.hero-portrait {
  width: 240px; height: 240px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--card-border);
  box-shadow: 0 8px 30px rgba(110, 64, 201, 0.2);
  justify-self: center;
}
.hero-portrait-img {
  width: 100%; height: 100%;
  object-fit: cover; object-position: center top;
}
.hero-stats {
  display: flex; gap: 1rem; margin-bottom: 2.5rem;
}
.hero-stat {
  background: var(--tag-bg);
  border-radius: 10px; padding: 1rem 1.5rem;
  text-align: center; min-width: 100px;
  border: 1px solid var(--tag-border);
}
.hero-stat-num { font-size: 24px; font-weight: 700; color: var(--tag-text); }
.hero-stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.hero-cta {
  display: inline-block;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white; text-decoration: none;
  font-size: 14px; font-weight: 500;
  padding: 10px 28px; border-radius: 8px;
  transition: opacity 0.2s;
}
.hero-cta:hover { opacity: 0.85; }
.hero-deco {
  position: absolute; top: 50%;
  display: flex; flex-direction: column; gap: 1rem;
  transform: translateY(-50%);
  pointer-events: none; z-index: 0;
  opacity: 0.55;
}
.hero-deco-left { left: -7rem; align-items: flex-start; }
.hero-deco-right { right: -7rem; align-items: flex-end; }
.hero-deco-item {
  font-size: 11px; font-weight: 500; letter-spacing: 1.5px;
  color: var(--text-muted);
  padding: 6px 12px; border-radius: 20px;
  background: rgba(110, 64, 201, 0.08);
  border: 1px solid rgba(110, 64, 201, 0.18);
  white-space: nowrap;
  animation: hero-deco-float 6s ease-in-out infinite;
}
.hero-deco-right .hero-deco-item { animation-delay: -3s; }
.hero-deco-item:nth-child(2) { animation-delay: -2s; }
.hero-deco-item:nth-child(3) { animation-delay: -4s; }
@keyframes hero-deco-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.hero-divider {
  width: 100%; max-width: 900px; margin: 3rem auto 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(177, 76, 217, 0.45), transparent);
  position: relative; z-index: 1;
}

/* ============ 通用段落 + 两侧装饰 ============ */
.section {
  max-width: 900px; margin: 0 auto;
  padding: 3rem 2rem;
  position: relative; z-index: 1;
  background: rgba(15, 19, 26, 0.55);
}
.section-deco {
  position: absolute; top: 50%;
  display: flex; flex-direction: column; gap: 0.8rem;
  transform: translateY(-50%);
  pointer-events: none; z-index: 0;
  opacity: 0.6;
}
.section-deco-left { left: -7rem; align-items: flex-start; }
.section-deco-right { right: -7rem; align-items: flex-end; }
.section-deco-item {
  font-size: 11px; font-weight: 500; letter-spacing: 1.2px;
  color: var(--text-muted);
  padding: 5px 10px; border-radius: 20px;
  background: rgba(110, 64, 201, 0.12);
  border: 1px solid rgba(110, 64, 201, 0.28);
  white-space: nowrap;
}
.section-header { margin-bottom: 2.5rem; }
.section-label {
  font-size: 12px; color: var(--accent-2);
  font-weight: 500; letter-spacing: 2px;
  display: block; margin-bottom: 0.5rem;
}
.section-title {
  font-size: 26px; font-weight: 700; color: var(--text);
  margin-bottom: 0.5rem;
}
.section-subtitle { font-size: 14px; color: var(--text-muted); }

/* ============ 关于我 ============ */
.about-grid {
  display: grid; grid-template-columns: 1.6fr 1fr; gap: 1rem;
  align-items: stretch;
}
.about-text {
  background: var(--card-bg);
  border-radius: 12px; border: 1px solid var(--card-border);
  padding: 1.6rem; line-height: 1.75;
}
.about-text p { margin-bottom: 0.8rem; }
.about-text p:last-child { margin-bottom: 0; }
.highlight { color: var(--accent-2); font-weight: 500; }
.about-photo {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--card-border);
  width: 100%;
  height: 100%;
  display: flex;
}
.about-photo-img {
  width: 100%; height: 100%;
  object-fit: cover; object-position: center;
  display: block;
}
.about-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.8rem;
  margin-top: 1.2rem;
}
.about-card {
  background: var(--card-bg);
  border-radius: 10px; border: 1px solid var(--card-border);
  padding: 1rem; border-top: 3px solid var(--accent);
  text-align: center;
}
.about-card:nth-child(2) { border-top-color: var(--accent-2); }
.about-card:nth-child(3) { border-top-color: var(--accent-3); }
.about-card-num { font-size: 22px; font-weight: 700; color: var(--tag-text); }
.about-card-label { font-size: 12px; font-weight: 500; color: var(--text); margin-top: 4px; }
.about-card-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ============ 项目展示 ============ */
.project-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.project-showcase {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.project-showcase:hover {
  border-color: var(--accent);
  box-shadow: 0 12px 40px rgba(110, 64, 201, 0.12);
}
.project-media {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #0d1117;
  border-right: 1px solid var(--card-border);
}
.project-media img {
  width: 100%; height: 100%;
  object-fit: cover; object-position: top;
  transition: transform 0.4s ease;
}
.project-showcase:hover .project-media img {
  transform: scale(1.03);
}
.project-info {
  padding: 1.8rem;
  display: flex; flex-direction: column; justify-content: center;
}
.project-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem; gap: 0.8rem; flex-wrap: wrap;
}
.project-title { font-size: 18px; font-weight: 600; color: var(--text); }
.project-version {
  font-size: 11px; color: var(--text-muted);
  background: var(--tag-bg); border: 1px solid var(--card-border);
  padding: 2px 8px; border-radius: 4px; flex-shrink: 0;
}
.project-desc {
  font-size: 13px; color: var(--text-secondary);
  line-height: 1.7; margin-bottom: 1rem;
}
.project-tags {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.project-tag {
  font-size: 11px; color: var(--tag-text);
  background: var(--tag-bg);
  border: 1px solid var(--card-border);
  padding: 3px 9px; border-radius: 4px;
}

/* ============ 其他技术探索 ============ */
.mini-projects { margin-top: 1rem; }
.mini-projects-title {
  font-size: 14px; color: var(--text-muted); margin-bottom: 0.8rem;
}
.mini-projects-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.8rem;
}
.mini-project {
  background: var(--card-bg);
  border-radius: 10px; border: 1px solid var(--card-border);
  padding: 1rem 1.2rem;
}
.mini-project-name { font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 4px; }
.mini-project-desc { font-size: 12px; color: var(--text-muted); line-height: 1.5; }

/* ============ 技能 ============ */
.skills-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 2rem;
}
.skill-group-title { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 1rem; }
.skill-tags {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.skill-tag {
  font-size: 12px; color: var(--tag-text);
  background: var(--tag-bg);
  border: 1px solid var(--card-border);
  padding: 5px 12px; border-radius: 6px;
}

/* ============ 经历卡片 ============ */
.entry-list { display: flex; flex-direction: column; gap: 1.2rem; }
.entry-card {
  background: var(--card-bg);
  border-radius: 12px; border: 1px solid var(--card-border);
  padding: 1.5rem 1.8rem;
  border-left: 4px solid var(--accent);
}
.entry-card:nth-child(2) { border-left-color: var(--accent-2); }
.entry-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; margin-bottom: 0.5rem; }
.entry-title { font-size: 16px; font-weight: 600; color: var(--text); }
.entry-date { font-size: 13px; color: var(--text-muted); }
.entry-org { font-size: 13px; color: var(--text-muted); margin-bottom: 0.8rem; }
.entry-body { padding-left: 1.2rem; margin-bottom: 0.8rem; }
.entry-body li { font-size: 13px; color: var(--text-secondary); line-height: 1.7; margin-bottom: 4px; }
.entry-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.entry-tag {
  font-size: 11px; color: var(--tag-text);
  background: var(--tag-bg);
  border: 1px solid var(--tag-border);
  padding: 2px 8px; border-radius: 4px;
}

/* ============ 联系 ============ */
.contact-section { text-align: center; }
.contact-intro { margin-bottom: 2rem; }
.contact-cards { display: flex; justify-content: center; gap: 1.5rem; flex-wrap: wrap; }
.contact-card {
  background: var(--card-bg);
  border-radius: 12px; border: 1px solid var(--card-border);
  padding: 1.5rem 2rem; min-width: 180px; text-align: center;
  text-decoration: none; color: inherit;
  transition: border-color 0.2s;
}
.contact-card:hover { border-color: var(--accent); }
.contact-card-icon { font-size: 24px; margin-bottom: 0.5rem; }
.contact-card-label { font-size: 11px; color: var(--text-muted); letter-spacing: 1px; }
.contact-card-value { font-size: 13px; color: var(--text); margin-top: 4px; }
.contact-footer { font-size: 12px; color: var(--text-muted); margin-top: 3rem; }

/* ============ 滚动动画 ============ */
.reveal, .reveal-stagger {
  opacity: 0; transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.reveal.in-view, .reveal-stagger.in-view {
  opacity: 1; transform: translateY(0);
}
.reveal-stagger > * {
  opacity: 0; transform: translateY(15px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.reveal-stagger.in-view > *:nth-child(1) { opacity: 1; transform: translateY(0); transition-delay: 0.1s; }
.reveal-stagger.in-view > *:nth-child(2) { opacity: 1; transform: translateY(0); transition-delay: 0.2s; }
.reveal-stagger.in-view > *:nth-child(3) { opacity: 1; transform: translateY(0); transition-delay: 0.3s; }
.reveal-stagger.in-view > *:nth-child(4) { opacity: 1; transform: translateY(0); transition-delay: 0.4s; }

/* ============ 响应式 ============ */
@media (max-width: 768px) {
  .topnav { padding: 0.6rem 1rem; }
  .topnav-links { gap: 0.8rem; }
  .topnav-link { font-size: 12px; }
  .hero { padding: 5rem 1.5rem 3rem 1.5rem; }
  .hero-deco { display: none; }
  .hero-container { grid-template-columns: 1fr; gap: 2rem; text-align: center; }
  .hero-main { text-align: center; padding-left: 0; }
  .hero-name { font-size: 32px; }
  .hero-portrait { width: 180px; height: 180px; margin: 0 auto; }
  .hero-contact { justify-content: center; }
  .hero-stats { flex-wrap: wrap; justify-content: center; }
  .hero-stat { min-width: 80px; padding: 0.8rem 1rem; }
  .section { padding: 2.5rem 1.5rem; }
  .section-deco { display: none; }
  .about-grid { grid-template-columns: 1fr; }
  .about-photo { width: 100%; height: auto; aspect-ratio: 4 / 3; }
  .about-cards { grid-template-columns: repeat(3, 1fr); }
  .project-showcase { grid-template-columns: 1fr; }
  .project-media { border-right: none; border-bottom: 1px solid var(--card-border); }
  .project-info { padding: 1.5rem; }
  .mini-projects-grid { grid-template-columns: 1fr; }
  .skills-grid { grid-template-columns: 1fr; }
  .entry-head { flex-direction: column; }
  .contact-cards { flex-direction: column; align-items: center; gap: 1rem; }
  .contact-card { width: 100%; max-width: 320px; }
}
