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

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #a5b4fc;
  --bg: #0f0f1a;
  --bg-alt: #1a1a2e;
  --bg-card: #1e1e36;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --border: #2d2d4a;
  --radius: 12px;
  --radius-lg: 20px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  --transition: 0.3s ease;
  --navbar-bg: rgba(15, 15, 26, 0.92);
}

:root.light {
  --bg: #f8fafc;
  --bg-alt: #f1f5f9;
  --bg-card: #ffffff;
  --text: #1e293b;
  --text-muted: #475569;
  --text-dim: #94a3b8;
  --border: #e2e8f0;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  --navbar-bg: rgba(255, 255, 255, 0.92);
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 70px;
}

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

a {
  text-decoration: none;
  color: inherit;
  transition: color var(--transition);
}

ul {
  list-style: none;
}

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

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

.section {
  padding: 100px 0;
}

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

.section-title {
  font-size: 2.2rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 4px;
  background: linear-gradient(135deg, var(--primary-light), #f472b6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.section-subtitle {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.95rem;
  margin-bottom: 50px;
  letter-spacing: 4px;
  text-transform: uppercase;
}

.text-center {
  text-align: center;
}

/* ==================== 按钮 ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: 50px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all var(--transition);
}

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

.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(99, 102, 241, 0.35);
}

.btn-outline {
  background: transparent;
  color: var(--primary-light);
  border-color: var(--primary-light);
}

.light .btn-outline {
  color: var(--primary);
  border-color: var(--primary);
}

.btn-outline:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  transform: translateY(-2px);
}

.btn-block {
  width: 100%;
  justify-content: center;
}

/* ==================== 导航栏 ==================== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  padding: 16px 0;
  transition: all var(--transition);
}

.navbar.scrolled {
  background: var(--navbar-bg);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
  padding: 10px 0;
}

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

.nav-logo {
  font-size: 1.4rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary-light), #f472b6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  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%;
}

/* 汉堡菜单 */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 4px;
}

.nav-toggle span {
  display: block;
  width: 26px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all var(--transition);
}

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

/* ==================== 主题切换按钮 ==================== */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  transition: all var(--transition);
  margin-right: 8px;
  flex-shrink: 0;
}

.theme-toggle:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  transform: rotate(45deg);
}
.nav-toggle.active span:nth-child(2) {
  opacity: 0;
}
.nav-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

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

.hero-bg {
  position: absolute;
  inset: 0;
  background: 
    radial-gradient(ellipse at 20% 50%, rgba(99, 102, 241, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(244, 114, 182, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(99, 102, 241, 0.06) 0%, transparent 50%);
}

.hero-content {
  text-align: center;
  position: relative;
  z-index: 1;
}

.hero-avatar {
  width: 130px;
  height: 130px;
  margin: 0 auto 24px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--primary);
  box-shadow: 0 0 40px rgba(99, 102, 241, 0.3);
  animation: float 6s ease-in-out infinite;
}

.hero-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

.hero-name {
  font-size: 3.2rem;
  font-weight: 800;
  margin-bottom: 8px;
  letter-spacing: 2px;
}

.hero-title {
  font-size: 1.2rem;
  color: var(--primary-light);
  margin-bottom: 12px;
  font-weight: 500;
}

.light .hero-title {
  color: var(--primary);
}

.hero-tagline {
  font-size: 1rem;
  color: var(--text-muted);
  max-width: 500px;
  margin: 0 auto 32px;
}

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

.hero-social {
  display: flex;
  gap: 20px;
  justify-content: center;
}

.hero-social a {
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 1.3rem;
  transition: all var(--transition);
}

.hero-social a:hover {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
  transform: translateY(-3px);
}

.scroll-hint {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--text-dim);
  font-size: 0.75rem;
  letter-spacing: 2px;
  animation: bounce 2s infinite;
}

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

/* ==================== 关于我 ==================== */
.about-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 50px;
  align-items: start;
}

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

.about-text strong {
  color: var(--text);
}

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

.about-info div {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.about-info i {
  color: var(--primary-light);
  width: 18px;
  text-align: center;
}

/* 统计卡片 */
.about-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

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

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

.stat-number {
  display: block;
  font-size: 2.6rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary-light), #f472b6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}

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

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

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

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

.skill-category h3 {
  font-size: 1.05rem;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--primary-light);
}

.light .skill-category h3 {
  color: var(--primary);
}

.skill-item {
  margin-bottom: 14px;
}

.skill-item span {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

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

.skill-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--primary), #8b5cf6);
  transition: width 1.2s ease;
}

/* 标签云 */
.tags-cloud {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 10px;
}

.tags-cloud span {
  display: inline-block;
  padding: 6px 18px;
  border-radius: 50px;
  font-size: 0.82rem;
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary-light);
  border: 1px solid rgba(99, 102, 241, 0.2);
  transition: all var(--transition);
  cursor: default;
}

.light .tags-cloud span {
  color: var(--primary);
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.35);
}

.tags-cloud span:hover {
  background: var(--primary);
  color: #fff;
  transform: translateY(-2px);
}

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

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

.project-card:hover {
  transform: translateY(-6px);
  border-color: var(--primary);
  box-shadow: 0 12px 40px rgba(99, 102, 241, 0.15);
}

.project-img {
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: rgba(255, 255, 255, 0.7);
}

.project-body {
  padding: 24px;
}

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

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

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

.project-tags span {
  padding: 3px 12px;
  font-size: 0.75rem;
  border-radius: 50px;
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary-light);
  border: 1px solid rgba(99, 102, 241, 0.2);
}

.light .project-tags span {
  color: var(--primary);
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.35);
}

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

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

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

/* ==================== 时间线 (经历) ==================== */
.timeline {
  position: relative;
  max-width: 700px;
  margin: 0 auto;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 24px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

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

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

.timeline-dot {
  position: absolute;
  left: 16px;
  top: 6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  border: 4px solid var(--bg-alt);
  box-shadow: 0 0 0 2px var(--primary);
}

.timeline-date {
  font-size: 0.8rem;
  color: var(--primary-light);
  font-weight: 600;
  margin-bottom: 6px;
  letter-spacing: 1px;
}

.light .timeline-date {
  color: var(--primary);
}

.timeline-content h3 {
  font-size: 1.1rem;
  margin-bottom: 2px;
}

.timeline-company {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.timeline-content p:last-child {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ==================== 博客 ==================== */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

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

.blog-card:hover {
  transform: translateY(-6px);
  border-color: var(--primary);
  box-shadow: 0 12px 40px rgba(99, 102, 241, 0.15);
}

.blog-img {
  height: 140px;
  display: flex;
  align-items: flex-end;
  padding: 16px;
  position: relative;
}

.blog-category {
  display: inline-block;
  padding: 3px 14px;
  border-radius: 50px;
  font-size: 0.7rem;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.blog-body {
  padding: 20px;
}

.blog-date {
  font-size: 0.78rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.blog-body h3 {
  font-size: 1rem;
  margin-bottom: 8px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog-body p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog-readmore {
  font-size: 0.82rem;
  color: var(--primary-light);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: gap var(--transition);
}

.blog-readmore:hover {
  gap: 10px;
}

/* ==================== 联系 ==================== */
.contact-grid {
  display: grid;
  /* grid-template-columns: 1fr 1.2fr; */
  gap: 40px;
  grid-template-columns: 1fr;
}

.contact-info {
  display: flex;
  flex-direction: row;
  justify-content: center;
  gap: 20px;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition);
  width: 50%;
}

.contact-item:hover {
  border-color: var(--primary);
  transform: translateX(4px);
}

.contact-item i {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 1.1rem;
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary-light);
  flex-shrink: 0;
}

.contact-item h4 {
  font-size: 0.85rem;
  margin-bottom: 2px;
}

.contact-item p {
  font-size: 0.82rem;
  color: var(--text-dim);
}

/* 联系表单 */
.contact-form {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
}

.form-group {
  margin-bottom: 16px;
}

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

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

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-dim);
}

/* ==================== 页脚 ==================== */
.footer {
  padding: 40px 0;
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
}

.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.footer-social {
  display: flex;
  gap: 16px;
}

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

.footer-social a:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  transform: translateY(-3px);
}

.footer-text {
  font-size: 0.82rem;
  color: var(--text-dim);
}

/* ==================== 回到顶部 ==================== */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition);
  z-index: 999;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}

.back-to-top.show {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  background: var(--primary-dark);
  transform: translateY(-3px);
}

/* ==================== 响应式 ==================== */
@media (max-width: 968px) {
  .about-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .skills-grid {
    grid-template-columns: 1fr;
  }
  .projects-grid {
    grid-template-columns: 1fr;
  }
  .blog-grid {
    grid-template-columns: 1fr;
  }
  .contact-grid {
    grid-template-columns: 1fr;
  }
  .contact-item {
    width: 100%;
  }
  .contact-info {
    display: flex;
    flex-direction: column;
    gap: 20px;
  }
}

@media (max-width: 768px) {
  .nav-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 240px;
    height: 100vh;
    flex-direction: column;
    background: var(--bg-alt);
    padding: 80px 28px 28px;
    gap: 0;
    transition: right 0.35s ease;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.4);
    border-left: 1px solid var(--border);
  }
  .nav-menu.active {
    right: 0;
  }
  .nav-link {
    display: block;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
  }
  .nav-toggle {
    display: flex;
  }
  .hero-name {
    font-size: 2.2rem;
  }
  .hero-title {
    font-size: 1rem;
  }
  .hero-tagline {
    font-size: 0.88rem;
  }
  .section {
    padding: 60px 0;
  }
  .section-title {
    font-size: 1.7rem;
  }
  .about-info {
    grid-template-columns: 1fr;
  }
  .about-stats {
    gap: 12px;
  }
  .stat-number {
    font-size: 2rem;
  }
  .contact-form {
    padding: 20px;
  }
  .timeline::before {
    left: 18px;
  }
  .timeline-item {
    padding-left: 48px;
  }
  .timeline-dot {
    left: 10px;
  }
}
