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

:root {
  --primary: #1a1a2e;
  --primary-light: #16213e;
  --accent: #e94560;
  --accent-hover: #d63851;
  --gold: #f5a623;
  --bg: #f8f9fa;
  --card-bg: #ffffff;
  --text: #2d3436;
  --text-light: #636e72;
  --text-muted: #b2bec3;
  --border: #eef1f5;
  --shadow: 0 2px 20px rgba(0,0,0,0.06);
  --shadow-hover: 0 8px 30px rgba(0,0,0,0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: all 0.3s ease;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-serif: "Noto Serif SC", "Source Han Serif SC", "STSong", serif;
  --max-width: 1100px;
  --content-width: 740px;
}

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

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

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

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

/* ===== 顶部导航 ===== */
.site-header {
  background: var(--primary);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo a {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.35rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 1px;
}
.logo a:hover {
  color: var(--gold);
}
.logo-icon {
  width: 36px;
  height: 36px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: #fff;
  flex-shrink: 0;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}
.main-nav a {
  color: rgba(255,255,255,0.8);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
}
.main-nav a:hover,
.main-nav a.active {
  color: #fff;
  background: rgba(255,255,255,0.1);
}
.main-nav a.active {
  color: var(--gold);
}

/* 移动端菜单按钮 */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}
.menu-toggle:hover {
  background: rgba(255,255,255,0.1);
}

/* ===== 主容器 ===== */
.main-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 40px 24px;
  min-height: calc(100vh - 64px - 200px);
}

/* ===== Hero 区域 ===== */
.hero {
  text-align: center;
  padding: 60px 0 50px;
  position: relative;
}
.hero::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  border-radius: 2px;
}
.hero h1 {
  font-size: 2.6rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 16px;
  line-height: 1.3;
}
.hero h1 span {
  background: linear-gradient(135deg, var(--accent), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero p {
  font-size: 1.1rem;
  color: var(--text-light);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.8;
}

/* ===== 博客文章列表 ===== */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 30px;
  margin-top: 40px;
}

.post-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}
.post-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

.post-card-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 2.5rem;
}

.post-card-body {
  padding: 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.post-card-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.post-card-meta .tag {
  background: var(--bg);
  color: var(--accent);
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
}

.post-card-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
  line-height: 1.4;
}
.post-card-title a {
  color: inherit;
}
.post-card-title a:hover {
  color: var(--accent);
}

.post-card-excerpt {
  color: var(--text-light);
  font-size: 0.92rem;
  line-height: 1.7;
  flex: 1;
  margin-bottom: 16px;
}

.post-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.read-more {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.read-more:hover {
  gap: 10px;
}

/* ===== 文章详情页 ===== */
.article-container {
  max-width: var(--content-width);
  margin: 0 auto;
}

.article-header {
  text-align: center;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}

.article-header .article-meta {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}
.article-header .article-meta .tag {
  background: var(--bg);
  color: var(--accent);
  padding: 3px 14px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 500;
}

.article-header h1 {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.35;
  margin-bottom: 8px;
}

.article-content {
  font-size: 1.02rem;
  line-height: 1.9;
  color: var(--text);
}
.article-content p {
  margin-bottom: 1.5em;
}
.article-content h2 {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--primary);
  margin: 2em 0 0.8em;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
}
.article-content h3 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary);
  margin: 1.6em 0 0.6em;
}
.article-content ul,
.article-content ol {
  margin-bottom: 1.5em;
  padding-left: 1.5em;
}
.article-content li {
  margin-bottom: 0.5em;
}
.article-content blockquote {
  border-left: 4px solid var(--accent);
  background: var(--bg);
  padding: 16px 20px;
  margin: 1.5em 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
  color: var(--text-light);
}
.article-content strong {
  color: var(--primary);
  font-weight: 700;
}

.article-footer {
  margin-top: 50px;
  padding-top: 30px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}
.article-footer .share-label {
  font-size: 0.9rem;
  color: var(--text-light);
}
.article-footer .nav-links {
  display: flex;
  gap: 12px;
}
.article-footer .nav-links a {
  font-size: 0.9rem;
  padding: 8px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  transition: var(--transition);
}
.article-footer .nav-links a:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(233, 69, 96, 0.05);
}

/* ===== 关于页面 ===== */
.about-page {
  max-width: var(--content-width);
  margin: 0 auto;
}

.about-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 40px;
  box-shadow: var(--shadow);
}

.about-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--gold));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.8rem;
  color: #fff;
  margin: 0 auto 24px;
}

.about-card h1 {
  text-align: center;
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 8px;
}
.about-card .about-subtitle {
  text-align: center;
  color: var(--text-light);
  font-size: 1rem;
  margin-bottom: 32px;
}

.about-card .about-section {
  margin-bottom: 28px;
}
.about-card .about-section h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.about-card .about-section p {
  color: var(--text-light);
  line-height: 1.8;
  font-size: 0.95rem;
}

/* ===== 页脚 ===== */
.site-footer {
  background: var(--primary);
  color: rgba(255,255,255,0.7);
  padding: 32px 24px;
  text-align: center;
  font-size: 0.85rem;
  line-height: 1.8;
}
.site-footer .footer-links {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.site-footer .footer-links a {
  color: rgba(255,255,255,0.7);
  font-size: 0.85rem;
}
.site-footer .footer-links a:hover {
  color: var(--gold);
}
.site-footer .icp {
  color: rgba(255,255,255,0.5);
  font-size: 0.8rem;
}
.site-footer .icp a {
  color: rgba(255,255,255,0.5);
}
.site-footer .icp a:hover {
  color: var(--gold);
}

/* ===== 回到顶部 ===== */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 44px;
  height: 44px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
  z-index: 99;
}
.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}
.back-to-top:hover {
  background: var(--accent);
  transform: translateY(-3px);
}

/* ===== 提示消息 ===== */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--primary);
  color: #fff;
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  opacity: 0;
  visibility: hidden;
  transition: all 0.4s ease;
  z-index: 200;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  white-space: nowrap;
}
.toast.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .menu-toggle {
    display: block;
  }
  .main-nav {
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--primary);
    flex-direction: column;
    padding: 16px;
    gap: 4px;
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  }
  .main-nav.open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }
  .main-nav a {
    width: 100%;
    padding: 12px 16px;
  }

  .hero h1 {
    font-size: 1.8rem;
  }
  .hero p {
    font-size: 1rem;
  }

  .posts-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .article-header h1 {
    font-size: 1.5rem;
  }
  .article-content {
    font-size: 0.95rem;
  }

  .about-card {
    padding: 24px;
  }

  .header-inner {
    height: 56px;
  }
  .main-container {
    padding: 24px 16px;
  }

  .article-footer {
    flex-direction: column;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .hero h1 {
    font-size: 1.5rem;
  }
  .posts-grid {
    grid-template-columns: 1fr;
  }
  .post-card-image {
    height: 160px;
  }
}
