:root {
  --bg: #f7f8fa;
  --bg-alt: #ffffff;
  --text: #1f2933;
  --text-muted: #6b7280;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --border: #e5e7eb;
  --radius: 12px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 40px rgba(79, 70, 229, 0.12);
}

* {
  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;
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
}

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

img {
  max-width: 100%;
  display: block;
}

/* ===== Navigation ===== */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(247, 248, 250, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s;
}

.nav.scrolled {
  border-color: var(--border);
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

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

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

.nav-links a {
  font-size: 0.95rem;
  color: var(--text-muted);
  transition: color 0.2s;
}

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

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

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

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

.hero::before {
  content: "";
  position: absolute;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(79, 70, 229, 0.12), transparent 70%);
  top: -120px;
  right: -120px;
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 1;
}

.hero-avatar {
  width: 120px;
  height: 120px;
  margin: 0 auto 28px;
  border-radius: 50%;
  overflow: hidden;
  border: 4px solid #fff;
  box-shadow: var(--shadow-lg);
}

.hero h1 {
  font-size: clamp(2.2rem, 6vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -0.5px;
}

.hero h1 .accent {
  color: var(--accent);
}

.hero-sub {
  margin: 16px auto 36px;
  max-width: 520px;
  color: var(--text-muted);
  font-size: 1.1rem;
}

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

.btn {
  padding: 12px 28px;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 600;
  transition: all 0.25s;
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
}

.btn-ghost {
  background: transparent;
  color: var(--accent);
  border: 2px solid var(--accent);
}

.btn-ghost:hover {
  background: var(--accent);
  color: #fff;
  transform: translateY(-2px);
}

.hero-scroll {
  margin-top: 64px;
  display: flex;
  justify-content: center;
}

.mouse {
  width: 24px;
  height: 40px;
  border: 2px solid var(--text-muted);
  border-radius: 12px;
  position: relative;
}

.mouse::after {
  content: "";
  position: absolute;
  width: 4px;
  height: 8px;
  background: var(--accent);
  border-radius: 2px;
  left: 50%;
  top: 6px;
  transform: translateX(-50%);
  animation: scroll 1.6s infinite;
}

@keyframes scroll {
  0% {
    opacity: 1;
    transform: translate(-50%, 0);
  }
  70% {
    opacity: 0;
    transform: translate(-50%, 12px);
  }
  100% {
    opacity: 0;
  }
}

/* ===== Sections ===== */
.section {
  padding: 96px 24px;
}

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

.container {
  max-width: 1100px;
  margin: 0 auto;
}

.section-title {
  font-size: 2rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 16px;
  position: relative;
}

.section-title::after {
  content: "";
  display: block;
  width: 48px;
  height: 4px;
  border-radius: 2px;
  background: var(--accent);
  margin: 14px auto 0;
}

/* ===== About ===== */
.about-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 48px;
  align-items: start;
  margin-top: 48px;
}

.about-text p {
  color: var(--text-muted);
  margin-bottom: 16px;
}

.about-facts {
  list-style: none;
  margin-top: 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.about-facts li {
  font-size: 0.95rem;
}

.about-facts span {
  color: var(--text-muted);
  margin-right: 8px;
  font-size: 0.85rem;
}

.about-card {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
}

.about-card h3 {
  margin-bottom: 16px;
  font-size: 1.1rem;
}

.about-card ul {
  list-style: none;
}

.about-card li {
  padding: 8px 0;
  color: var(--text-muted);
  font-size: 0.95rem;
  position: relative;
  padding-left: 24px;
}

.about-card li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 700;
}

/* ===== Skills ===== */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
  margin-top: 48px;
}

.skill-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: all 0.3s;
}

.skill-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
}

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

.skill-card h3 {
  font-size: 1.05rem;
  margin-bottom: 8px;
}

.skill-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.skill-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  margin-top: 16px;
  overflow: hidden;
}

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

/* ===== Projects ===== */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
  margin-top: 48px;
}

.project-card {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all 0.3s;
  cursor: pointer;
}

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

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

.project-body {
  padding: 24px;
}

.project-body h3 {
  margin-bottom: 8px;
}

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

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

.tags span {
  background: rgba(79, 70, 229, 0.1);
  color: var(--accent);
  font-size: 0.8rem;
  padding: 4px 12px;
  border-radius: 999px;
}

/* ===== Contact ===== */
.contact-sub {
  text-align: center;
  color: var(--text-muted);
  margin-top: 24px;
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-top: 40px;
}

.contact-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
  transition: all 0.3s;
  display: block;
}

.contact-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
}

.contact-card .icon {
  font-size: 2rem;
  margin-bottom: 12px;
}

.contact-card h3 {
  font-size: 1rem;
  margin-bottom: 4px;
}

.contact-card p {
  color: var(--text-muted);
  font-size: 0.85rem;
  word-break: break-all;
}

/* ===== Footer ===== */
.footer {
  text-align: center;
  padding: 32px 24px;
  color: var(--text-muted);
  font-size: 0.9rem;
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
  position: relative;
}

.back-top {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s;
  z-index: 90;
}

.back-top.show {
  opacity: 1;
  pointer-events: auto;
}

.back-top:hover {
  background: var(--accent-hover);
}

/* ===== Animations ===== */
.fade-in {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .nav-links {
    position: fixed;
    top: 64px;
    right: 0;
    flex-direction: column;
    background: var(--bg-alt);
    width: 200px;
    padding: 24px;
    gap: 20px;
    box-shadow: var(--shadow);
    border-radius: 0 0 0 var(--radius);
    transform: translateX(100%);
    transition: transform 0.3s;
  }

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

  .nav-toggle {
    display: flex;
  }

  .about-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

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

  .section {
    padding: 72px 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
