:root {
  --bg: #0f1117;
  --bg-alt: #151824;
  --card: #1a1e2e;
  --text: #e8eaf0;
  --text-dim: #9aa1b5;
  --primary: #6366f1;
  --primary-2: #8b5cf6;
  --accent: #22d3ee;
  --radius: 16px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
}

* {
  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;
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

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

img {
  max-width: 100%;
}

/* ---------- 导航栏 ---------- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 18px 0;
  transition: all 0.3s ease;
}

.nav.scrolled {
  background: rgba(15, 17, 23, 0.85);
  backdrop-filter: blur(12px);
  padding: 12px 0;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06);
}

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

.logo {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 1px;
}

.logo-dot {
  color: var(--primary);
}

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

.nav-links a {
  color: var(--text-dim);
  font-size: 0.95rem;
  transition: color 0.25s;
  position: relative;
}

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

.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -6px;
  width: 0;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.3s;
}

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

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}

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

/* ---------- Hero ---------- */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(60% 50% at 20% 20%, rgba(99, 102, 241, 0.25), transparent 60%),
    radial-gradient(50% 40% at 80% 30%, rgba(34, 211, 238, 0.18), transparent 60%),
    radial-gradient(60% 50% at 50% 90%, rgba(139, 92, 246, 0.2), transparent 60%);
  animation: heroFloat 14s ease-in-out infinite alternate;
}

@keyframes heroFloat {
  from { transform: translate3d(-2%, -2%, 0) scale(1); }
  to { transform: translate3d(2%, 3%, 0) scale(1.08); }
}

.hero-inner {
  position: relative;
  z-index: 1;
  padding: 120px 24px 60px;
}

.hero-avatar {
  width: 120px;
  height: 120px;
  margin: 0 auto 24px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 0 0 6px rgba(99, 102, 241, 0.15), 0 10px 40px rgba(0, 0, 0, 0.4);
  animation: avatarIn 0.8s ease both;
}

.hero-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: var(--card);
}

@keyframes avatarIn {
  from { opacity: 0; transform: translateY(24px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.hero-greet {
  color: var(--text-dim);
  font-size: 1.1rem;
  letter-spacing: 4px;
  margin-bottom: 8px;
  animation: fadeUp 0.8s 0.15s ease both;
}

.hero-name {
  font-size: clamp(2.8rem, 8vw, 4.5rem);
  font-weight: 800;
  letter-spacing: 4px;
  background: linear-gradient(120deg, #fff, var(--primary-2), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: fadeUp 0.8s 0.3s ease both;
}

.hero-typed {
  font-size: 1.3rem;
  color: var(--text-dim);
  margin: 12px 0;
  min-height: 2.2em;
  animation: fadeUp 0.8s 0.45s ease both;
}

.cursor {
  display: inline-block;
  color: var(--primary);
  animation: blink 1s step-end infinite;
}

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

.hero-desc {
  max-width: 520px;
  margin: 8px auto 32px;
  color: var(--text-dim);
  animation: fadeUp 0.8s 0.6s ease both;
}

.hero-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  animation: fadeUp 0.8s 0.75s ease both;
}

.btn {
  display: inline-block;
  padding: 13px 34px;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 600;
  transition: all 0.3s ease;
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 34px rgba(99, 102, 241, 0.5);
}

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

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-3px);
}

.btn-lg {
  padding: 16px 44px;
  font-size: 1.05rem;
}

.hero-social {
  display: flex;
  gap: 18px;
  justify-content: center;
  margin-top: 40px;
  animation: fadeUp 0.8s 0.9s ease both;
}

.hero-social a {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-dim);
  transition: all 0.3s;
}

.hero-social a:hover {
  color: #fff;
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.15);
  transform: translateY(-4px);
}

.hero-social svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.scroll-down {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  width: 26px;
  height: 42px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: 20px;
  display: flex;
  justify-content: center;
  padding-top: 8px;
}

.scroll-down span {
  width: 4px;
  height: 8px;
  border-radius: 4px;
  background: var(--primary);
  animation: scrollHint 1.6s infinite;
}

@keyframes scrollHint {
  0% { transform: translateY(0); opacity: 1; }
  70% { transform: translateY(12px); opacity: 0; }
  100% { opacity: 0; }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- 通用 section ---------- */
.section {
  padding: 100px 0;
}

.section-alt {
  background: var(--bg-alt);
}

.section-title {
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 800;
  text-align: center;
}

.section-sub {
  text-align: center;
  color: var(--primary);
  font-size: 0.95rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 56px;
}

/* ---------- 关于 ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 56px;
  align-items: center;
}

.about-text p {
  color: var(--text-dim);
  margin-bottom: 16px;
  font-size: 1.02rem;
}

.about-meta {
  margin-top: 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.about-meta div {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 0.92rem;
  color: var(--text-dim);
}

.about-meta span {
  margin-right: 6px;
}

.about-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.stat {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius);
  padding: 32px 20px;
  text-align: center;
  transition: all 0.3s;
}

.stat:hover {
  transform: translateY(-6px);
  border-color: var(--primary);
  box-shadow: var(--shadow);
}

.stat-num {
  display: block;
  font-size: 2.6rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

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

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

.skill-card {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius);
  padding: 32px 28px;
  transition: all 0.3s;
}

.skill-card:hover {
  transform: translateY(-6px);
  border-color: var(--primary);
  box-shadow: var(--shadow);
}

.skill-icon {
  font-size: 2rem;
  margin-bottom: 14px;
}

.skill-card h3 {
  font-size: 1.15rem;
  margin-bottom: 6px;
}

.skill-card p {
  color: var(--text-dim);
  font-size: 0.9rem;
  margin-bottom: 18px;
}

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

.skill-bar span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 1.2s ease;
}

/* ---------- 作品 ---------- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.project-card {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all 0.3s;
}

.project-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow);
  border-color: rgba(255, 255, 255, 0.12);
}

.project-thumb {
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.2rem;
}

.project-body {
  padding: 24px;
}

.project-body h3 {
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.project-body p {
  color: var(--text-dim);
  font-size: 0.9rem;
  margin-bottom: 16px;
}

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

.project-tags span {
  font-size: 0.78rem;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
}

/* ---------- 经历 ---------- */
.timeline {
  max-width: 720px;
  margin: 0 auto;
  position: relative;
  padding-left: 32px;
}

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

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

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-dot {
  position: absolute;
  left: -32px;
  top: 6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--primary);
  box-shadow: 0 0 0 5px rgba(99, 102, 241, 0.15);
}

.timeline-date {
  display: inline-block;
  font-size: 0.8rem;
  color: var(--accent);
  background: rgba(34, 211, 238, 0.1);
  padding: 4px 14px;
  border-radius: 999px;
  margin-bottom: 10px;
  letter-spacing: 1px;
}

.timeline-content h3 {
  font-size: 1.12rem;
  margin-bottom: 6px;
}

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

/* ---------- 联系 ---------- */
.contact-inner {
  text-align: center;
}

.contact-desc {
  max-width: 480px;
  margin: 0 auto 36px;
  color: var(--text-dim);
}

.contact-social {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-top: 32px;
  flex-wrap: wrap;
}

.contact-social a {
  color: var(--text-dim);
  font-size: 0.92rem;
  padding: 8px 22px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  transition: all 0.3s;
}

.contact-social a:hover {
  color: #fff;
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.15);
}

/* ---------- 页脚 ---------- */
.footer {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding: 28px 0;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.9rem;
}

/* ---------- 滚动显现 ---------- */
.reveal {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .about-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .skills-grid,
  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .section {
    padding: 70px 0;
  }

  .nav-links {
    position: fixed;
    top: 0;
    right: -260px;
    width: 240px;
    height: 100vh;
    flex-direction: column;
    background: rgba(21, 24, 36, 0.98);
    backdrop-filter: blur(12px);
    padding: 80px 32px;
    gap: 28px;
    transition: right 0.3s ease;
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.4);
  }

  .nav-links.open {
    right: 0;
  }

  .nav-toggle {
    display: flex;
  }

  .nav-toggle.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .nav-toggle.active span:nth-child(2) {
    opacity: 0;
  }

  .nav-toggle.active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  .skills-grid,
  .projects-grid,
  .about-meta,
  .about-stats {
    grid-template-columns: 1fr;
  }

  .about-meta {
    grid-template-columns: 1fr 1fr;
  }
}
