/* ============================================
   个人主页样式 - 简约现代风格
   ============================================ */

/* ---------- 变量与重置 ---------- */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --text: #1f2937;
  --text-light: #6b7280;
  --bg: #ffffff;
  --bg-alt: #f8fafc;
  --border: #e5e7eb;
  --radius: 12px;
  --shadow: 0 4px 20px rgba(31, 41, 55, 0.08);
  --shadow-hover: 0 8px 30px rgba(37, 99, 235, 0.15);
  --nav-h: 68px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--nav-h);
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

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

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

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

/* ---------- 导航栏 ---------- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-h);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  z-index: 100;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.nav.scrolled {
  border-color: var(--border);
  box-shadow: 0 2px 12px rgba(31, 41, 55, 0.06);
}

.nav-inner {
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text);
}

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

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

.nav-links a {
  font-size: 15px;
  color: var(--text-light);
  transition: color 0.2s;
  position: relative;
}

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

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

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

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

.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s;
}

/* ---------- Hero ---------- */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: linear-gradient(180deg, #eff6ff 0%, var(--bg) 100%);
  padding-top: var(--nav-h);
}

.hero-inner {
  max-width: 720px;
  animation: fadeUp 0.8s ease both;
}

.hero-avatar {
  display: inline-block;
  margin-bottom: 24px;
}

.avatar {
  width: 108px;
  height: 108px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: #fff;
  font-size: 46px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-hover);
  border: 4px solid #fff;
}

.hero-greeting {
  color: var(--text-light);
  font-size: 18px;
  letter-spacing: 2px;
  margin-bottom: 8px;
}

.hero-name {
  font-size: clamp(40px, 6vw, 64px);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: 2px;
}

.hero-role {
  font-size: clamp(20px, 3vw, 28px);
  font-weight: 600;
  color: var(--primary);
  min-height: 1.6em;
  margin: 12px 0 20px;
}

.hero-desc {
  color: var(--text-light);
  font-size: 17px;
  max-width: 560px;
  margin: 0 auto 36px;
}

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

.btn {
  display: inline-block;
  padding: 12px 28px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}

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

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.45);
}

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

.btn-outline:hover {
  background: rgba(37, 99, 235, 0.08);
}

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

.hero-scroll::after {
  content: "";
  position: absolute;
  top: 8px;
  left: 50%;
  width: 4px;
  height: 8px;
  background: var(--primary);
  border-radius: 2px;
  transform: translateX(-50%);
  animation: scrollHint 1.6s ease-in-out infinite;
}

/* ---------- 通用区块 ---------- */
.section {
  padding: 96px 0;
}

.section-title {
  text-align: center;
  font-size: clamp(28px, 4vw, 36px);
  font-weight: 800;
  letter-spacing: 1px;
}

.section-sub {
  text-align: center;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 4px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 48px;
}

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

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

.about-card {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 32px 28px;
  box-shadow: var(--shadow);
  transition: transform 0.3s, box-shadow 0.3s;
}

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

.about-icon {
  font-size: 32px;
  margin-bottom: 16px;
}

.about-card h3 {
  font-size: 18px;
  margin-bottom: 12px;
}

.about-card p {
  color: var(--text-light);
  font-size: 15px;
}

/* ---------- 技能 ---------- */
.skills-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px 48px;
  max-width: 820px;
  margin: 0 auto;
}

.skill-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 15px;
  font-weight: 600;
}

.skill-num {
  color: var(--primary);
  font-weight: 700;
}

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

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

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

.project-card {
  background: var(--bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.3s, box-shadow 0.3s;
  border: 1px solid var(--border);
}

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

.project-cover {
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 52px;
  color: #fff;
}

.cover-1 {
  background: linear-gradient(135deg, #2563eb, #06b6d4);
}

.cover-2 {
  background: linear-gradient(135deg, #7c3aed, #ec4899);
}

.cover-3 {
  background: linear-gradient(135deg, #059669, #f59e0b);
}

.project-body {
  padding: 24px;
}

.project-body h3 {
  font-size: 18px;
  margin-bottom: 10px;
}

.project-body p {
  color: var(--text-light);
  font-size: 14.5px;
  margin-bottom: 16px;
  min-height: 60px;
}

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

.project-tags span {
  font-size: 12.5px;
  background: var(--bg-alt);
  color: var(--primary);
  border: 1px solid var(--border);
  padding: 4px 12px;
  border-radius: 999px;
}

/* ---------- 经历 ---------- */
.timeline {
  background: var(--bg-alt);
}

.timeline-list {
  max-width: 640px;
  margin: 0 auto;
  position: relative;
}

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

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

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

.timeline-dot {
  position: absolute;
  left: 0;
  top: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--primary);
}

.timeline-content {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.timeline-date {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  background: rgba(37, 99, 235, 0.08);
  padding: 4px 14px;
  border-radius: 999px;
  margin-bottom: 10px;
}

.timeline-content h3 {
  font-size: 17px;
  margin-bottom: 4px;
}

.timeline-org {
  font-size: 14px;
  color: var(--text-light);
  margin-bottom: 8px;
}

.timeline-content > p:last-child {
  font-size: 14.5px;
  color: var(--text-light);
}

/* ---------- 联系 ---------- */
.contact-inner {
  text-align: center;
}

.contact-text {
  color: var(--text-light);
  font-size: 16px;
  margin-bottom: 28px;
}

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

.contact-links a {
  color: var(--text-light);
  font-size: 15px;
  border: 1px solid var(--border);
  padding: 10px 20px;
  border-radius: 999px;
  transition: color 0.2s, border-color 0.2s, transform 0.2s;
}

.contact-links a:hover {
  color: var(--primary);
  border-color: var(--primary);
  transform: translateY(-2px);
}

/* ---------- 页脚 ---------- */
.footer {
  background: var(--text);
  color: #9ca3af;
  text-align: center;
  padding: 28px 0;
  font-size: 14px;
}

/* ---------- 回到顶部 ---------- */
.back-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  box-shadow: var(--shadow-hover);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.3s, transform 0.3s, visibility 0.3s;
  z-index: 90;
}

.back-top.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

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

/* ---------- 动画 ---------- */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scrollHint {
  0%,
  100% {
    opacity: 0.4;
    transform: translateX(-50%) translateY(0);
  }
  50% {
    opacity: 1;
    transform: translateX(-50%) translateY(8px);
  }
}

/* 滚动出现动画 */
.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: 900px) {
  .about-grid,
  .projects-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .section {
    padding: 72px 0;
  }

  .about-grid,
  .projects-grid,
  .skills-grid {
    grid-template-columns: 1fr;
  }

  .nav-toggle {
    display: flex;
    z-index: 110;
  }

  .nav-links {
    position: fixed;
    inset: 0;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 32px;
    background: var(--bg);
    font-size: 20px;
    transform: translateX(100%);
    transition: transform 0.35s ease;
  }

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

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

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

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

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