:root {
  --bg: #0f1117;
  --bg-alt: #161a24;
  --card: #1c2130;
  --text: #e8eaf0;
  --text-dim: #9aa3b5;
  --primary: #6c8cff;
  --primary-2: #9d7bff;
  --gradient: linear-gradient(135deg, var(--primary), var(--primary-2));
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --max-width: 1080px;
}

* {
  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: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ===== 导航栏 ===== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 100;
  background: rgba(15, 17, 23, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  transition: box-shadow 0.3s ease;
}

.navbar.scrolled {
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
}

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

.brand {
  font-size: 1.3rem;
  font-weight: 700;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-decoration: none;
}

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

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

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

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

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

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

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

/* ===== Hero ===== */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 110px 0 60px;
  background:
    radial-gradient(ellipse 60% 50% at 50% -10%, rgba(108, 140, 255, 0.18), transparent),
    radial-gradient(ellipse 40% 40% at 85% 90%, rgba(157, 123, 255, 0.12), transparent),
    var(--bg);
}

.hero-inner {
  text-align: center;
  max-width: 720px;
}

.avatar-wrap {
  position: relative;
  display: inline-block;
  margin-bottom: 28px;
}

.avatar {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  border: 3px solid transparent;
  background: var(--gradient) border-box;
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: float 4s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.hero-title {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 14px;
}

.gradient-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: clamp(1rem, 2.5vw, 1.3rem);
  color: var(--primary);
  font-weight: 500;
  min-height: 1.8em;
  margin-bottom: 14px;
}

.hero-subtitle::after {
  content: "▍";
  animation: blink 1s step-end infinite;
}

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

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

.hero-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 36px;
}

.btn {
  display: inline-block;
  padding: 12px 28px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.98rem;
  font-weight: 600;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

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

.btn-primary {
  background: var(--gradient);
  color: #fff;
  box-shadow: 0 8px 24px rgba(108, 140, 255, 0.35);
}

.btn-primary:hover {
  box-shadow: 0 12px 32px rgba(108, 140, 255, 0.5);
}

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

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.06);
}

.hero-meta {
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
  color: var(--text-dim);
  font-size: 0.9rem;
}

/* ===== Section ===== */
.section {
  padding: 90px 0;
}

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

.section-title {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 800;
  text-align: center;
  margin-bottom: 10px;
}

.section-subtitle {
  text-align: center;
  color: var(--text-dim);
  margin-bottom: 48px;
}

/* ===== About ===== */
.about-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
}

.about-card {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius);
  padding: 32px 26px;
  transition: transform 0.25s ease, border-color 0.25s ease;
}

.about-card:hover {
  transform: translateY(-6px);
  border-color: rgba(108, 140, 255, 0.4);
}

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

.about-card h3 {
  font-size: 1.15rem;
  margin-bottom: 10px;
}

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

/* ===== Skills ===== */
.skills-wrap {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

.skill-item {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px 24px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.skill-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.skill-name {
  font-weight: 600;
}

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

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

.skill-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--gradient);
  transition: width 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ===== Projects ===== */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.project-card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.project-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow);
}

.project-thumb {
  height: 160px;
}

.thumb-1 {
  background: linear-gradient(135deg, #6c8cff, #38bdf8);
}

.thumb-2 {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
}

.thumb-3 {
  background: linear-gradient(135deg, #10b981, #6c8cff);
}

.project-body {
  padding: 22px 24px 26px;
}

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

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

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

.project-tags span {
  font-size: 0.78rem;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(108, 140, 255, 0.14);
  color: var(--primary);
}

/* ===== Contact ===== */
.contact-inner {
  text-align: center;
}

.contact-links {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
}

.contact-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 26px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text);
  text-decoration: none;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.contact-link:hover {
  transform: translateY(-4px);
  border-color: rgba(108, 140, 255, 0.4);
}

.contact-emoji {
  font-size: 1.3rem;
}

/* ===== Footer ===== */
.footer {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding: 26px 0;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.88rem;
}

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

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

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .nav-links {
    position: fixed;
    top: 64px;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: rgba(15, 17, 23, 0.97);
    width: 220px;
    padding: 16px 0;
    border-radius: 0 0 0 var(--radius);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    box-shadow: var(--shadow);
  }

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

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

  .nav-links a::after {
    display: none;
  }

  .menu-toggle {
    display: flex;
  }

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

  .menu-toggle.open span:nth-child(2) {
    opacity: 0;
  }

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

  .hero-meta {
    gap: 10px;
  }

  .section {
    padding: 64px 0;
  }
}
