/* ==================== 基础与变量 ==================== */
:root {
  --bg-start: #FFF8F0;
  --bg-mid: #FFE8E0;
  --bg-end: #FFF0F5;
  --glass-bg: rgba(255, 255, 255, 0.45);
  --glass-border: rgba(255, 255, 255, 0.55);
  --text-primary: #4A3F35;
  --text-secondary: #7A6A5A;
  --accent: #E8A0A0;
  --accent-soft: #F5D0D0;
  --card-shadow: 0 8px 32px rgba(180, 140, 120, 0.12);
  --radius: 20px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  color: var(--text-primary);
  background: linear-gradient(135deg, var(--bg-start), var(--bg-mid), var(--bg-end));
  background-size: 300% 300%;
  animation: gradientShift 18s ease infinite;
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.7;
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ==================== 粒子画布 ==================== */
#particles-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ==================== 布局容器 ==================== */
.container {
  position: relative;
  z-index: 1;
  max-width: 980px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

/* ==================== 磨砂玻璃通用 ==================== */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
}

/* ==================== 顶部导航 ==================== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 18px 0;
  margin-bottom: 40px;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  max-width: 980px;
  margin: 0 auto;
}

.logo {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  text-decoration: none;
  transition: opacity 0.25s;
}

.logo:hover {
  opacity: 0.7;
}

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

.nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.95rem;
  padding: 8px 16px;
  border-radius: 999px;
  transition: all 0.25s ease;
}

.nav a:hover,
.nav a.active {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.5);
}

/* ==================== Hero ==================== */
.hero {
  text-align: center;
  padding: 60px 20px 50px;
  margin-bottom: 40px;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 2.8rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.hero p {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 480px;
  margin: 0 auto;
}

/* ==================== 搜索与筛选栏 ==================== */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  margin-bottom: 32px;
}

.search-box {
  flex: 1;
  min-width: 200px;
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 12px 18px 12px 44px;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.6);
  font-size: 0.95rem;
  color: var(--text-primary);
  outline: none;
  transition: background 0.25s, box-shadow 0.25s;
  font-family: inherit;
}

.search-box input::placeholder {
  color: var(--text-secondary);
  opacity: 0.7;
}

.search-box input:focus {
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 0 3px rgba(232, 160, 160, 0.25);
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  pointer-events: none;
  font-size: 1rem;
}

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

.cat-btn {
  padding: 8px 18px;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.4);
  color: var(--text-secondary);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.25s ease;
  font-family: inherit;
}

.cat-btn:hover {
  background: rgba(255, 255, 255, 0.7);
  color: var(--text-primary);
}

.cat-btn.active {
  background: var(--accent-soft);
  color: var(--text-primary);
  font-weight: 500;
}

/* ==================== 文章列表 ==================== */
.article-list {
  display: grid;
  gap: 24px;
}

.article-card {
  display: block;
  padding: 28px 32px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
}

.article-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(180, 140, 120, 0.18);
}

.article-card .date {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.article-card h2 {
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.article-card .summary {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.tag {
  font-size: 0.8rem;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  color: var(--text-secondary);
}

.tag.category {
  background: var(--accent-soft);
  color: var(--text-primary);
}

/* ==================== 文章详情页 ==================== */
.article-detail {
  display: none;
  padding: 40px 40px 50px;
  margin-bottom: 40px;
}

.article-detail.visible {
  display: block;
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 28px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.25s;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.back-btn:hover {
  color: var(--text-primary);
}

.article-detail .date {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.article-detail h1 {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  margin-bottom: 20px;
  line-height: 1.3;
}

.article-detail .content {
  font-size: 1.05rem;
  color: var(--text-primary);
  line-height: 1.85;
}

.article-detail .content p {
  margin-bottom: 1.2em;
}

.article-detail .content p:last-child {
  margin-bottom: 0;
}

/* ==================== 关于页 ==================== */
.about-section {
  display: none;
  padding: 40px 40px 50px;
  margin-bottom: 40px;
}

.about-section.visible {
  display: block;
  animation: fadeIn 0.4s ease;
}

.about-section h1 {
  font-size: 1.8rem;
  font-weight: 600;
  margin-bottom: 20px;
}

.about-section p {
  font-size: 1.05rem;
  color: var(--text-secondary);
  margin-bottom: 1em;
  line-height: 1.8;
}

/* ==================== 空状态 ==================== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
  font-size: 1.05rem;
}

/* ==================== 页脚 ==================== */
.footer {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  position: relative;
  z-index: 1;
}

.footer a {
  color: var(--text-secondary);
  text-decoration: none;
}

.footer a:hover {
  color: var(--text-primary);
}

/* ==================== 响应式 ==================== */
@media (max-width: 640px) {
  .header-inner {
    padding: 12px 18px;
  }

  .nav a {
    padding: 6px 12px;
    font-size: 0.9rem;
  }

  .hero {
    padding: 40px 10px 30px;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .article-card {
    padding: 22px 20px;
  }

  .article-detail,
  .about-section {
    padding: 28px 22px 36px;
  }
}

/* 减少动效（尊重系统设置） */
@media (prefers-reduced-motion: reduce) {
  body {
    animation: none;
  }
  .article-card,
  .nav a,
  .cat-btn {
    transition: none;
  }
}
