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

:root {
  --bg: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: #1a1a2e;
  --text: #e4e4eb;
  --text-muted: #8888a0;
  --primary: #6c63ff;
  --primary-light: #8b83ff;
  --accent: #00d4aa;
  --border: #2a2a3e;
  --radius: 12px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --navbar-height: 70px;
}

html {
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--primary) var(--bg);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  cursor: none;
}

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

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

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 3px; }

/* ===== 自定义光标 ===== */
.cursor {
  width: 20px;
  height: 20px;
  border: 2px solid var(--primary);
  border-radius: 50%;
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  transition: transform 0.1s ease;
  transform: translate(-50%, -50%);
}

.cursor-dot {
  width: 6px;
  height: 6px;
  background: var(--primary);
  border-radius: 50%;
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
}

.cursor.hover { transform: translate(-50%, -50%) scale(1.8); border-color: var(--accent); }
.cursor-dot.hover { transform: translate(-50%, -50%) scale(1.5); background: var(--accent); }

/* ===== 导航栏 ===== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--navbar-height);
  z-index: 1000;
  transition: all var(--transition);
  backdrop-filter: blur(10px);
}

.navbar.scrolled {
  background: rgba(10, 10, 15, 0.85);
  box-shadow: 0 1px 20px rgba(0, 0, 0, 0.3);
}

.nav-container {
  max-width: 1150px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 100%;
}

.nav-logo {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -1px;
}

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

.nav-links { display: flex; gap: 2rem; }

.nav-link {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 0.5rem 0;
  position: relative;
  transition: color var(--transition);
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--primary);
  transition: width var(--transition);
}

.nav-link:hover,
.nav-link.active { color: var(--text); }
.nav-link:hover::after,
.nav-link.active::after { width: 100%; }

.theme-toggle {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: none;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle:hover { border-color: var(--primary); transform: rotate(20deg); }

/* ===== Hero 区域 ===== */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding-top: var(--navbar-height);
}

#particleCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.hero-content {
  text-align: center;
  z-index: 1;
  max-width: 700px;
  padding: 0 2rem;
}

.hero-greeting {
  font-size: 1rem;
  color: var(--accent);
  font-weight: 500;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.hero-title {
  font-size: clamp(3rem, 8vw, 5.5rem);
  font-weight: 900;
  line-height: 1.1;
  margin-bottom: 1.5rem;
  letter-spacing: -2px;
}

.hero-name {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-role {
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  min-height: 2.5rem;
}

.typing-cursor {
  animation: blink 0.8s infinite;
  color: var(--primary);
  font-weight: 100;
}

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

.hero-desc {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 500px;
  margin: 0 auto 2.5rem;
  line-height: 1.8;
}

.hero-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1.8rem;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  transition: all var(--transition);
  font-family: inherit;
  cursor: none;
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  color: #fff;
  box-shadow: 0 4px 20px rgba(108, 99, 255, 0.3);
}

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

.btn-primary svg { transition: transform var(--transition); }
.btn-primary:hover svg { transform: translateX(4px); }

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

.btn-outline:hover {
  border-color: var(--primary);
  background: rgba(108, 99, 255, 0.05);
  transform: translateY(-3px);
}

.hero-scroll {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  letter-spacing: 2px;
  text-transform: uppercase;
}

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

.scroll-dot {
  width: 4px;
  height: 8px;
  background: var(--primary);
  border-radius: 2px;
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  animation: scrollAnim 2s ease-in-out infinite;
}

@keyframes scrollAnim {
  0%, 100% { top: 6px; opacity: 1; }
  50% { top: 20px; opacity: 0.3; }
}

/* ===== 动画入场 ===== */
[data-animate] {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-animate].visible {
  opacity: 1;
  transform: translateY(0);
}

[data-animate]:nth-child(1) { transition-delay: 0s; }
[data-animate]:nth-child(2) { transition-delay: 0.1s; }
[data-animate]:nth-child(3) { transition-delay: 0.2s; }
[data-animate]:nth-child(4) { transition-delay: 0.3s; }
[data-animate]:nth-child(5) { transition-delay: 0.4s; }

/* ===== Section 通用 ===== */
section {
  padding: 7rem 0;
  position: relative;
}

.section-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 3.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
  max-width: 300px;
}

.section-number {
  color: var(--primary);
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 1.2rem;
  font-weight: 500;
}

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

.about-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 4rem;
  align-items: center;
}

.about-text p {
  color: var(--text-muted);
  margin-bottom: 1.2rem;
  font-size: 1.05rem;
  line-height: 1.8;
}

.highlight {
  color: var(--accent);
  font-weight: 600;
}

.about-stats {
  display: flex;
  gap: 3rem;
  margin-top: 2.5rem;
}

.stat {
  display: flex;
  flex-direction: column;
}

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

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.about-image {
  display: flex;
  justify-content: center;
}

.image-wrapper {
  position: relative;
  width: 280px;
  height: 280px;
}

.image-placeholder {
  width: 100%;
  height: 100%;
  background: var(--bg-card);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
  overflow: hidden;
}

.image-placeholder svg {
  width: 60%;
  color: var(--primary);
}

.image-frame {
  position: absolute;
  top: 15px;
  left: 15px;
  width: 100%;
  height: 100%;
  border: 2px solid var(--primary);
  border-radius: 20px;
  transition: all var(--transition);
}

.image-wrapper:hover .image-frame {
  top: 10px;
  left: 10px;
}

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

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

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

.project-image {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 10;
}

.project-img-content {
  width: 100%;
  height: 100%;
}

.project-img-content svg {
  width: 100%;
  height: 100%;
}

.project-overlay {
  position: absolute;
  inset: 0;
  background: rgba(108, 99, 255, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition);
}

.project-card:hover .project-overlay { opacity: 1; }

.project-view {
  color: #fff;
  font-weight: 600;
  padding: 0.6rem 1.5rem;
  border: 2px solid #fff;
  border-radius: 50px;
  transition: all var(--transition);
}

.project-view:hover { background: #fff; color: var(--primary); }

.project-info { padding: 1.5rem; }

.project-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.project-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
  line-height: 1.7;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.2rem;
}

.project-tags span {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.25rem 0.75rem;
  background: rgba(108, 99, 255, 0.1);
  color: var(--primary-light);
  border-radius: 50px;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

.project-links {
  display: flex;
  gap: 1.5rem;
}

.project-link {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color var(--transition);
}

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

/* ===== 技能 ===== */
.skills {
  background: var(--bg-secondary);
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}

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

.skill-card:hover {
  border-color: var(--primary);
  transform: translateY(-5px);
  box-shadow: 0 15px 30px rgba(108, 99, 255, 0.1);
}

.skill-icon {
  color: var(--primary);
  margin-bottom: 1.2rem;
}

.skill-card h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

.skill-bar {
  background: var(--bg);
  border-radius: 10px;
  height: 36px;
  margin-bottom: 0.8rem;
  overflow: hidden;
  position: relative;
}

.skill-progress {
  height: 100%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 10px;
  width: 0;
  transition: width 1.5s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
}

.skill-progress.animate { /* width set by JS */ }

.skill-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.skill-pct {
  font-size: 0.75rem;
  font-weight: 700;
  color: rgba(255,255,255,0.8);
  font-family: 'SF Mono', 'Fira Code', monospace;
}

/* ===== 联系 ===== */
.contact-content {
  max-width: 600px;
  margin: 0 auto;
}

.contact-intro {
  text-align: center;
  color: var(--text-muted);
  font-size: 1.05rem;
  margin-bottom: 2.5rem;
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.form-group {
  position: relative;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 1rem 1.2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  transition: all var(--transition);
  outline: none;
}

.form-group textarea { resize: vertical; }

.form-group label {
  position: absolute;
  left: 1.2rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1rem;
  pointer-events: none;
  transition: all var(--transition);
  background: var(--bg-card);
  padding: 0 0.3rem;
}

.form-group textarea ~ label { top: 1.4rem; }

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.1);
}

.form-group input:focus ~ label,
.form-group textarea:focus ~ label,
.form-group input:not(:placeholder-shown) ~ label,
.form-group textarea:not(:placeholder-shown) ~ label {
  top: 0;
  transform: translateY(-50%);
  font-size: 0.8rem;
  color: var(--primary);
}

.submit-btn {
  width: 100%;
  justify-content: center;
  cursor: none;
  position: relative;
  overflow: hidden;
}

.btn-loading,
.btn-success { display: none; }

.submit-btn.loading .btn-text { opacity: 0; }
.submit-btn.loading .btn-loading { display: flex; gap: 0.3rem; position: absolute; }
.submit-btn.success .btn-text { opacity: 0; }
.submit-btn.success .btn-success { display: block; position: absolute; }
.submit-btn.success { background: var(--accent); }

.loading-dot {
  width: 6px;
  height: 6px;
  background: #fff;
  border-radius: 50%;
  animation: loadingBounce 0.6s infinite alternate;
}

.loading-dot:nth-child(2) { animation-delay: 0.2s; }
.loading-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes loadingBounce {
  to { transform: translateY(-6px); opacity: 0.5; }
}

/* ===== 社交链接 ===== */
.social-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 3rem;
}

.social-link {
  width: 50px;
  height: 50px;
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all var(--transition);
}

.social-link:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(108, 99, 255, 0.15);
}

/* ===== 页脚 ===== */
.footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
}

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

  .about-stats { gap: 2rem; }
  .image-wrapper { width: 220px; height: 220px; }
  .nav-links { gap: 1rem; }
  .nav-link { font-size: 0.8rem; }
}

@media (max-width: 480px) {
  .container { padding: 0 1rem; }
  .nav-links { gap: 0.7rem; }
  .nav-link { font-size: 0.7rem; }
  .hero-buttons { flex-direction: column; align-items: center; }
  .about-stats { gap: 1.5rem; }
  .stat-number { font-size: 2rem; }
  .projects-grid { grid-template-columns: 1fr; }
  .skills-grid { grid-template-columns: 1fr; }
}
