/* ============================================================
   个人网站通用样式
   深色背景图 + 玻璃拟态卡片 + 响应式布局
   提示：想换主题色，改各页面 <body> 上的 --accent / --accent-soft
   ============================================================ */

/* ---------- 设计变量 ---------- */
:root {
  --bg-overlay: rgba(6, 8, 14, 0.72);
  --text: #f2f5fa;
  --text-muted: rgba(226, 232, 240, 0.62);
  --glass-bg: rgba(255, 255, 255, 0.06);
  --glass-bg-hover: rgba(255, 255, 255, 0.1);
  --border: rgba(255, 255, 255, 0.12);
  --radius: 1rem;
  --radius-lg: 1.5rem;
  --max-width: 72rem;
  --nav-height: 4.5rem;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* 各页面主题色（在页面 body 上覆盖） */
.page-home     { --accent: #5b8cff; --accent-soft: rgba(91, 140, 255, 0.18); }
.page-about    { --accent: #34d399; --accent-soft: rgba(52, 211, 153, 0.18); }
.page-projects { --accent: #f87171; --accent-soft: rgba(248, 113, 113, 0.18); }
.page-blog     { --accent: #2dd4bf; --accent-soft: rgba(45, 212, 191, 0.18); }
.page-contact  { --accent: #a78bfa; --accent-soft: rgba(167, 139, 250, 0.18); }

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

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  background-color: #06080e;
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

/* 背景遮罩，保证文字可读性 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  z-index: -1;
}

/* 每页背景图（相对路径，GitHub Pages 可直接访问） */
.page-home     { background-image: url("../images/bg-home.jpg"); }
.page-about    { background-image: url("../images/bg-about.jpg"); }
.page-projects { background-image: url("../images/bg-projects.jpg"); }
.page-blog     { background-image: url("../images/bg-blog.jpg"); }
.page-contact  { background-image: url("../images/bg-contact.jpg"); }

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

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

ul {
  list-style: none;
}

/* ---------- 布局容器 ---------- */
.container {
  width: min(100% - 3rem, var(--max-width));
  margin-inline: auto;
}

.section {
  padding: 5rem 0;
}

.section-title {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 700;
  margin-bottom: 0.75rem;
  letter-spacing: 0.02em;
}

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

/* ---------- 导航栏 ---------- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  z-index: 100;
  background: rgba(6, 8, 14, 0.55);
  backdrop-filter: blur(1rem);
  -webkit-backdrop-filter: blur(1rem);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

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

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

.nav-links a {
  position: relative;
  font-size: 0.95rem;
  color: var(--text-muted);
  padding: 0.35rem 0;
  transition: color 0.25s var(--ease);
}

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

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

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

/* 汉堡按钮（移动端） */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 0.35rem;
  width: 2.5rem;
  height: 2.5rem;
  background: none;
  border: none;
  cursor: pointer;
}

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

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

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

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

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.8rem 1.8rem;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.25s var(--ease), background 0.25s var(--ease),
    border-color 0.25s var(--ease);
}

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

.btn-primary:hover {
  transform: translateY(-2px);
  background: color-mix(in srgb, var(--accent) 88%, white);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

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

/* ---------- 玻璃卡片 ---------- */
.glass-card {
  background: var(--glass-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(0.85rem);
  -webkit-backdrop-filter: blur(0.85rem);
  padding: 2rem;
  transition: transform 0.3s var(--ease), background 0.3s var(--ease),
    border-color 0.3s var(--ease);
}

.glass-card:hover {
  transform: translateY(-4px);
  background: var(--glass-bg-hover);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
}

/* ---------- 首页 Hero ---------- */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding-top: var(--nav-height);
}

.hero-badge {
  display: inline-block;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  margin-bottom: 1.5rem;
}

.hero h1 {
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: 0.01em;
  margin-bottom: 1.25rem;
}

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

.hero p {
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: var(--text-muted);
  max-width: 36rem;
  margin-bottom: 2.5rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

/* 首页信息卡片区 */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1.5rem;
}

.info-card .icon {
  font-size: 1.6rem;
  margin-bottom: 1rem;
}

.info-card h3 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

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

/* ---------- 内页页头 ---------- */
.page-header {
  padding: calc(var(--nav-height) + 4.5rem) 0 3rem;
  text-align: center;
}

.page-header h1 {
  font-size: clamp(2rem, 4.5vw, 3rem);
  font-weight: 800;
  margin-bottom: 0.75rem;
}

.page-header p {
  color: var(--text-muted);
  max-width: 40rem;
  margin-inline: auto;
}

/* ---------- 关于页 ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 2.5rem;
  align-items: start;
}

.avatar-placeholder {
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-lg);
  border: 1px dashed var(--border);
  background: var(--glass-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 1.5rem;
}

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

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.tag {
  padding: 0.45rem 1rem;
  border-radius: 999px;
  font-size: 0.85rem;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  color: var(--text);
}

/* 时间线占位 */
.timeline {
  position: relative;
  margin-top: 2rem;
  padding-left: 1.75rem;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 0.4rem;
  top: 0.5rem;
  bottom: 0.5rem;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding-bottom: 2rem;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -1.55rem;
  top: 0.55rem;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.timeline-item h4 {
  font-size: 1.02rem;
  margin-bottom: 0.25rem;
}

.timeline-item span {
  font-size: 0.85rem;
  color: var(--accent);
}

.timeline-item p {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-top: 0.35rem;
}

/* ---------- 项目卡片网格 ---------- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 1.5rem;
}

.project-thumb {
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  border: 1px dashed var(--border);
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 1.25rem;
}

.project-card h3 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.project-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}

.project-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.project-meta .tag {
  font-size: 0.78rem;
  padding: 0.3rem 0.75rem;
}

/* ---------- 博客列表 ---------- */
.post-list {
  display: grid;
  gap: 1.25rem;
  max-width: 50rem;
}

.post-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.post-date {
  font-size: 0.82rem;
  color: var(--accent);
  letter-spacing: 0.05em;
}

.post-card h3 {
  font-size: 1.2rem;
}

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

.read-more {
  font-size: 0.88rem;
  color: var(--accent);
  margin-top: 0.5rem;
}

.read-more:hover {
  text-decoration: underline;
}

/* ---------- 联系页 ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 2.5rem;
  align-items: start;
}

.contact-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1.5rem;
}

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

.contact-item strong {
  font-size: 1rem;
  font-weight: 600;
}

.social-links {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.88rem;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-group textarea {
  min-height: 8rem;
  resize: vertical;
}

.form-note {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
}

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

/* ---------- 滚动进入动画 ---------- */
.reveal {
  opacity: 0;
  transform: translateY(1.75rem);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

@keyframes heroIn {
  from {
    opacity: 0;
    transform: translateY(2rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-content {
  animation: heroIn 0.9s var(--ease) both;
}

/* ---------- 响应式 ---------- */
@media (max-width: 56em) {
  .about-grid,
  .contact-grid {
    grid-template-columns: 1fr;
  }

  .avatar-placeholder {
    max-width: 18rem;
  }
}

@media (max-width: 48em) {
  .nav-toggle {
    display: flex;
  }

  .nav-links {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: rgba(6, 8, 14, 0.92);
    backdrop-filter: blur(1rem);
    -webkit-backdrop-filter: blur(1rem);
    border-bottom: 1px solid var(--border);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s var(--ease);
  }

  .nav-links.open {
    max-height: 26rem;
  }

  .nav-links a {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
  }

  .nav-links a::after {
    display: none;
  }

  body {
    background-attachment: scroll;
  }

  .section {
    padding: 3.5rem 0;
  }
}
