/* ============ 基础 ============ */
:root {
  --bg: #0b1220;
  --bg-soft: #111a2e;
  --card: rgba(255, 255, 255, 0.04);
  --card-border: rgba(255, 255, 255, 0.09);
  --text: #e2e8f0;
  --text-dim: #94a3b8;
  --primary: #22d3ee;
  --secondary: #818cf8;
  --gradient: linear-gradient(120deg, #22d3ee, #818cf8);
  --radius: 16px;
}

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

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;
  background: var(--bg);
}

.container {
  width: min(1080px, 90%);
  margin: 0 auto;
}

.section {
  padding: 96px 0;
}

.section-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 48px;
  position: relative;
  display: inline-block;
}

.section-title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -10px;
  width: 100%;
  height: 3px;
  border-radius: 2px;
  background: var(--gradient);
}

/* ============ 导航栏 ============ */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 16px 0;
  transition: background 0.3s, box-shadow 0.3s;
}

.navbar.scrolled {
  background: rgba(11, 18, 32, 0.85);
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  font-family: "Courier New", monospace;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text);
  text-decoration: none;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.nav-links {
  display: flex;
  gap: 32px;
}

.nav-link {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.2s;
  position: relative;
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 0;
  height: 2px;
  background: var(--gradient);
  transition: width 0.25s;
}

.nav-link:hover {
  color: var(--text);
}

.nav-link:hover::after {
  width: 100%;
}

/* 移动端菜单按钮 */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.nav-toggle span {
  width: 24px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s;
}

.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 ============ */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  text-align: center;
  padding-top: 80px;
}

.hero-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero-avatar {
  margin-bottom: 28px;
}

.avatar-ring {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  padding: 5px;
  background: var(--gradient);
  animation: avatar-glow 3s ease-in-out infinite;
}

.avatar-ring img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--bg-soft);
  display: block;
}

@keyframes avatar-glow {
  0%, 100% { box-shadow: 0 0 24px rgba(34, 211, 238, 0.35); }
  50% { box-shadow: 0 0 48px rgba(129, 140, 248, 0.55); }
}

.hero-name {
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: 4px;
  margin-bottom: 8px;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-role {
  font-size: 1.3rem;
  color: var(--primary);
  font-weight: 600;
  min-height: 2rem;
  margin-bottom: 20px;
}

.hero-role::after {
  content: "|";
  animation: blink 0.9s step-end infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

.hero-desc {
  max-width: 560px;
  color: var(--text-dim);
  font-size: 1.05rem;
  margin-bottom: 36px;
}

.hero-actions {
  display: flex;
  gap: 16px;
  margin-bottom: 56px;
}

.btn {
  padding: 12px 28px;
  border-radius: 40px;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
  border: none;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-primary {
  background: var(--gradient);
  color: #0b1220;
  box-shadow: 0 8px 24px rgba(34, 211, 238, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 12px 32px rgba(34, 211, 238, 0.45);
}

.btn-ghost {
  color: var(--text);
  border: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.03);
}

.btn-ghost:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.hero-stats {
  display: flex;
  gap: 56px;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-num {
  font-size: 2.2rem;
  font-weight: 800;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.stat-label {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-top: 4px;
}

/* ============ 关于 ============ */
.about-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.about-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 28px;
  transition: transform 0.25s, border-color 0.25s;
}

.about-card:hover {
  transform: translateY(-6px);
  border-color: rgba(34, 211, 238, 0.4);
}

.about-card h3 {
  font-size: 1.15rem;
  margin-bottom: 12px;
  color: var(--primary);
}

.about-card p {
  color: var(--text-dim);
  font-size: 0.95rem;
}

/* ============ 技能 ============ */
.skills-wrap {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px;
}

.skill-group-title {
  font-size: 1.1rem;
  margin-bottom: 20px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.skill-group-title::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--gradient);
}

.skill-item {
  margin-bottom: 18px;
}

.skill-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  margin-bottom: 6px;
}

.skill-percent {
  color: var(--primary);
  font-weight: 600;
}

.skill-bar {
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.skill-bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 3px;
  background: var(--gradient);
  transition: width 1s ease;
}

/* ============ 项目 ============ */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.project-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 28px;
  transition: transform 0.25s, border-color 0.25s, box-shadow 0.25s;
}

.project-card:hover {
  transform: translateY(-6px);
  border-color: rgba(129, 140, 248, 0.45);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.project-tags span {
  font-size: 0.75rem;
  padding: 3px 12px;
  border-radius: 20px;
  background: rgba(34, 211, 238, 0.12);
  color: var(--primary);
  border: 1px solid rgba(34, 211, 238, 0.25);
}

.project-title {
  font-size: 1.2rem;
  margin-bottom: 10px;
}

.project-desc {
  color: var(--text-dim);
  font-size: 0.92rem;
  margin-bottom: 18px;
}

.project-links {
  display: flex;
  gap: 18px;
}

.project-link {
  color: var(--secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  transition: color 0.2s;
}

.project-link:hover {
  color: var(--primary);
}

/* ============ 时间线 ============ */
.timeline {
  position: relative;
  padding-left: 32px;
  max-width: 680px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, var(--primary), var(--secondary));
}

.timeline-item {
  position: relative;
  margin-bottom: 40px;
}

.timeline-dot {
  position: absolute;
  left: -28px;
  top: 6px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--primary);
}

.timeline-date {
  font-size: 0.85rem;
  color: var(--primary);
  font-weight: 600;
}

.timeline-title {
  font-size: 1.1rem;
  margin: 6px 0 8px;
}

.timeline-text {
  color: var(--text-dim);
  font-size: 0.92rem;
}

/* ============ 联系 ============ */
.contact-sub {
  color: var(--text-dim);
  margin-bottom: 40px;
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.contact-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 32px 20px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition: transform 0.25s, border-color 0.25s;
}

.contact-card:hover {
  transform: translateY(-6px);
  border-color: rgba(34, 211, 238, 0.45);
}

.contact-icon {
  font-size: 1.8rem;
}

.contact-label {
  font-weight: 600;
  margin-top: 6px;
}

.contact-value {
  color: var(--text-dim);
  font-size: 0.9rem;
}

/* ============ 页脚 ============ */
.footer {
  padding: 32px 0;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.9rem;
  border-top: 1px solid var(--card-border);
}

/* ============ 动画 ============ */
@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.reveal {
  opacity: 0;
}

.reveal.visible {
  animation: fade-up 0.7s ease forwards;
}

/* ============ 响应式 ============ */
@media (max-width: 900px) {
  .about-grid,
  .skills-wrap,
  .contact-grid {
    grid-template-columns: 1fr;
  }

  .projects-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .nav-links {
    position: fixed;
    top: 60px;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: rgba(11, 18, 32, 0.96);
    padding: 16px 32px;
    border-radius: 0 0 0 16px;
    border-left: 1px solid var(--card-border);
    border-bottom: 1px solid var(--card-border);
    transform: translateX(110%);
    transition: transform 0.3s;
  }

  .nav-links.open {
    transform: translateX(0);
  }

  .nav-links a {
    padding: 12px 0;
  }

  .nav-toggle {
    display: flex;
  }

  .hero-name {
    font-size: 2.2rem;
  }

  .hero-stats {
    gap: 32px;
  }

  .section {
    padding: 64px 0;
  }
}
