/* ========== CSS 变量 ========== */
:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-card: #ffffff;
  --text-primary: #1a1a2e;
  --text-secondary: #555;
  --text-muted: #888;
  --accent: #6C63FF;
  --accent-light: #8B85FF;
  --accent-dark: #4A42E0;
  --border: #e8e8ee;
  --shadow: 0 4px 20px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.12);
  --glass: rgba(255,255,255,0.8);
  --navbar-bg: rgba(255,255,255,0.9);
  --gradient-1: linear-gradient(135deg, #6C63FF 0%, #8B85FF 50%, #A78BFA 100%);
  --gradient-2: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

[data-theme="dark"] {
  --bg-primary: #0f0f1a;
  --bg-secondary: #1a1a2e;
  --bg-card: #1e1e36;
  --text-primary: #e8e8ee;
  --text-secondary: #b0b0c0;
  --text-muted: #707088;
  --accent: #8B85FF;
  --accent-light: #A78BFA;
  --accent-dark: #6C63FF;
  --border: #2a2a44;
  --shadow: 0 4px 20px rgba(0,0,0,0.3);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.5);
  --glass: rgba(30,30,54,0.8);
  --navbar-bg: rgba(15,15,26,0.9);
}

/* ========== 基础重置 ========== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background 0.3s, color 0.3s;
  overflow-x: hidden;
}

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

ul {
  list-style: none;
}

img {
  max-width: 100%;
}

/* ========== 导航栏 ========== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--navbar-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  transition: all 0.3s;
}

.navbar.scrolled {
  box-shadow: var(--shadow);
}

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

.nav-logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
}

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

.nav-link {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.3s;
}

.nav-link:hover,
.nav-link.active {
  color: var(--accent);
  background: var(--accent);
  background: rgba(108, 99, 255, 0.1);
}

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.3s;
}

.theme-toggle:hover {
  border-color: var(--accent);
}

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

.menu-btn span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  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;
  padding: 100px 24px 60px;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(108,99,255,0.1) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 80%, rgba(108,99,255,0.06) 0%, transparent 50%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 650px;
}

.hero-avatar {
  font-size: 5rem;
  margin-bottom: 20px;
  animation: float 3s ease-in-out infinite;
}

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

.hero-greeting {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.hero-name {
  font-size: 3.2rem;
  font-weight: 800;
  background: var(--gradient-1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
}

.hero-typing {
  font-size: 1.3rem;
  color: var(--accent);
  margin-bottom: 24px;
  font-weight: 500;
  min-height: 2em;
}

.typing-cursor {
  animation: blink 0.8s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.hero-desc {
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 36px;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  padding: 12px 28px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-primary {
  background: var(--gradient-1);
  color: #fff;
  box-shadow: 0 4px 15px rgba(108, 99, 255, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(108, 99, 255, 0.5);
}

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 2px solid var(--border);
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.85rem;
  border-radius: 8px;
}

.hero-scroll {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.scroll-indicator {
  width: 24px;
  height: 40px;
  border: 2px solid var(--text-muted);
  border-radius: 12px;
  margin: 8px auto 0;
  position: relative;
}

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

@keyframes scrollWheel {
  0% { opacity: 1; top: 6px; }
  100% { opacity: 0; top: 24px; }
}

/* ========== Section 通用 ========== */
.section-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

section {
  padding: 100px 0;
}

.section-title {
  font-size: 2.2rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 12px;
}

.section-subtitle {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 48px;
  font-size: 1rem;
}

/* ========== 关于我 ========== */
.about {
  background: var(--bg-secondary);
}

.about-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 48px;
}

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

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

.about-icon {
  font-size: 2.2rem;
  margin-bottom: 12px;
}

.about-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--accent);
}

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

.about-sub {
  font-size: 0.8rem !important;
  color: var(--text-muted) !important;
  margin-top: 4px;
}

.about-bio {
  max-width: 750px;
  margin: 0 auto;
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.9;
}

.about-bio p {
  margin-bottom: 16px;
}

/* ========== 技能栈 ========== */
.skill-category {
  margin-bottom: 40px;
}

.skill-category h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--text-primary);
}

.skill-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 16px;
}

.skill-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 12px;
  text-align: center;
  transition: all 0.3s;
}

.skill-item:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.skill-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
}

.skill-icon img {
  width: 48px;
  height: 48px;
}

.skill-item span {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

/* ========== 项目 ========== */
.projects {
  background: var(--bg-secondary);
}

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

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

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

.project-card-empty {
  border-style: dashed;
  opacity: 0.7;
}

.project-img {
  height: 140px;
  background: linear-gradient(135deg, rgba(108,99,255,0.08) 0%, rgba(108,99,255,0.02) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.project-emoji {
  font-size: 3.5rem;
}

.project-info {
  padding: 24px 20px;
}

.project-info h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.project-info p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 14px;
}

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

.project-tags span {
  background: rgba(108,99,255,0.1);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
}

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

/* ========== 联系 ========== */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.contact-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 20px;
  text-align: center;
  transition: all 0.3s;
}

.contact-item:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

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

.contact-item h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--accent);
}

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

/* ========== Footer ========== */
.footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 40px 0;
  text-align: center;
}

.footer p {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.footer-sub {
  margin-top: 6px;
}

.footer-icp {
  margin-top: 12px;
}

.footer-icp a {
  color: var(--text-muted);
  font-size: 0.8rem;
  transition: color 0.3s;
}

.footer-icp a:hover {
  color: var(--accent);
}

/* ========== 响应式设计 ========== */
@media (max-width: 1024px) {
  .about-grid { grid-template-columns: repeat(2, 1fr); }
  .project-grid { grid-template-columns: repeat(2, 1fr); }
  .contact-grid { grid-template-columns: repeat(2, 1fr); }
  .skill-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
  .hero-name { font-size: 2.4rem; }
  .hero-typing { font-size: 1.05rem; }
  .section-title { font-size: 1.7rem; }

  .nav-links {
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--navbar-bg);
    backdrop-filter: blur(20px);
    flex-direction: column;
    padding: 16px;
    border-bottom: 1px solid var(--border);
    transform: translateY(-110%);
    opacity: 0;
    transition: all 0.3s;
    pointer-events: none;
  }

  .nav-links.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .menu-btn { display: flex; }

  .about-grid { grid-template-columns: 1fr 1fr; }
  .project-grid { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr 1fr; }
  .skill-grid { grid-template-columns: repeat(3, 1fr); }

  .project-card:last-child { display: none; }
}

@media (max-width: 480px) {
  .hero-name { font-size: 2rem; }
  .hero-avatar { font-size: 3.5rem; }
  .hero-btns { flex-direction: column; align-items: center; }
  .about-grid { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
  .skill-grid { grid-template-columns: repeat(2, 1fr); }
  section { padding: 60px 0; }
}
