/* ===== 基础变量 ===== */
:root {
  --accent-color: #3f51b5;
  --accent-light: #5c6bc0;
  --accent-dark: #283593;
  --text-primary: #333;
  --text-secondary: #666;
  --text-muted: #999;
  --bg-primary: #fff;
  --bg-secondary: #f5f5f5;
  --bg-dark: #1a1a2e;
  --border-color: #e0e0e0;
  --timeline-width: 4px;
  --timeline-dot: 16px;
  --max-width: 1200px;
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 1.5rem;
  --spacing-lg: 2rem;
  --spacing-xl: 3rem;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
}

/* ===== 重置样式 ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
}

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

a:hover {
  color: var(--accent-dark);
}

ul {
  list-style: none;
}

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

/* ===== 布局容器 ===== */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--spacing-md);
}

/* ===== 页头 ===== */
.header {
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-color);
}

.nav ul {
  display: flex;
  gap: var(--spacing-lg);
}

.nav a {
  color: var(--text-primary);
  font-weight: 500;
  padding: 0.5rem 0;
  border-bottom: 2px solid transparent;
}

.nav a:hover,
.nav a.active {
  color: var(--accent-color);
  border-bottom-color: var(--accent-color);
}

/* ===== 页脚 ===== */
.footer {
  background: var(--bg-dark);
  color: #fff;
  padding: var(--spacing-xl) 0 var(--spacing-md);
  margin-top: var(--spacing-xl);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
}

.footer h4 {
  font-size: 1rem;
  margin-bottom: var(--spacing-sm);
  color: var(--accent-light);
}

.footer li {
  margin-bottom: var(--spacing-xs);
}

.footer a {
  color: #aaa;
  font-size: 0.9rem;
}

.footer a:hover {
  color: #fff;
}

.footer-bottom {
  border-top: 1px solid #333;
  padding-top: var(--spacing-md);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ===== Hero区域 ===== */
.hero {
  background: linear-gradient(135deg, var(--accent-dark) 0%, var(--accent-color) 100%);
  color: #fff;
  padding: var(--spacing-xl) 0;
  text-align: center;
}

.hero h1 {
  font-size: 2.5rem;
  margin-bottom: var(--spacing-sm);
}

.hero p {
  font-size: 1.1rem;
  opacity: 0.9;
  max-width: 600px;
  margin: 0 auto;
}

/* ===== 面包屑 ===== */
.breadcrumb {
  background: var(--bg-secondary);
  padding: var(--spacing-sm) 0;
  font-size: 0.9rem;
}

.breadcrumb ol {
  display: flex;
  align-items: center;
}

.breadcrumb li:not(:last-child)::after {
  content: ">";
  margin: 0 var(--spacing-xs);
  color: var(--text-muted);
}

.breadcrumb a {
  color: var(--text-secondary);
}

.breadcrumb li:last-child {
  color: var(--text-muted);
}

/* ===== 时间线 ===== */
.timeline {
  position: relative;
  padding: var(--spacing-xl) 0;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: var(--timeline-width);
  height: 100%;
  background: var(--border-color);
  top: 0;
}

.timeline-item {
  position: relative;
  margin-bottom: var(--spacing-xl);
  display: flex;
  align-items: flex-start;
}

.timeline-item:nth-child(odd) {
  flex-direction: row-reverse;
}

.timeline-item:nth-child(odd) .timeline-content {
  text-align: right;
  padding-right: var(--spacing-xl);
  padding-left: 0;
}

.timeline-item:nth-child(even) .timeline-content {
  padding-left: var(--spacing-xl);
}

.timeline-content {
  width: 50%;
  padding: var(--spacing-md);
}

.timeline-dot {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: var(--timeline-dot);
  height: var(--timeline-dot);
  background: var(--accent-color);
  border-radius: 50%;
  border: 3px solid var(--bg-primary);
  box-shadow: 0 0 0 3px var(--accent-color);
}

.timeline-date {
  display: inline-block;
  background: var(--accent-color);
  color: #fff;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: var(--spacing-xs);
}

.timeline-title {
  font-size: 1.25rem;
  margin-bottom: var(--spacing-xs);
  color: var(--text-primary);
}

.timeline-title a {
  color: inherit;
}

.timeline-title a:hover {
  color: var(--accent-color);
}

.timeline-desc {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.7;
}

.timeline-image {
  margin-top: var(--spacing-sm);
  border-radius: var(--radius-md);
  overflow: hidden;
}

/* ===== 内容区域 ===== */
.section {
  padding: var(--spacing-xl) 0;
}

.section-title {
  font-size: 1.5rem;
  margin-bottom: var(--spacing-lg);
  text-align: center;
  position: relative;
}

.section-title::after {
  content: "";
  display: block;
  width: 60px;
  height: 3px;
  background: var(--accent-color);
  margin: var(--spacing-sm) auto 0;
}

/* ===== 文章网格 ===== */
.article-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--spacing-lg);
}

.article-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--spacing-lg);
}

.article-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--spacing-md);
  transition: box-shadow 0.3s;
}

.article-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.article-card h3 {
  font-size: 1.1rem;
  margin-bottom: var(--spacing-xs);
  color: var(--text-primary);
}

.article-card a {
  color: inherit;
}

.article-card a:hover {
  color: var(--accent-color);
}

.article-card .meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: var(--spacing-xs);
}

.article-card p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.article-list li {
  padding: var(--spacing-xs) 0;
  border-bottom: 1px dashed var(--border-color);
}

.article-list li:last-child {
  border-bottom: none;
}

.article-list a {
  color: var(--text-primary);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.article-list a:hover {
  color: var(--accent-color);
}

.article-list .date {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ===== 文章详情 ===== */
.article-header {
  text-align: center;
  padding: var(--spacing-xl) 0;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: var(--spacing-lg);
}

.article-header h1 {
  font-size: 2rem;
  margin-bottom: var(--spacing-sm);
}

.article-meta {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.article-meta span {
  margin: 0 var(--spacing-sm);
}

.article-body {
  max-width: 800px;
  margin: 0 auto;
  font-size: 1.05rem;
  line-height: 1.8;
}

.article-body h2 {
  font-size: 1.5rem;
  margin: var(--spacing-lg) 0 var(--spacing-sm);
  color: var(--accent-color);
}

.article-body h3 {
  font-size: 1.25rem;
  margin: var(--spacing-md) 0 var(--spacing-xs);
}

.article-body p {
  margin-bottom: var(--spacing-md);
  color: var(--text-secondary);
}

.article-body img {
  border-radius: var(--radius-md);
  margin: var(--spacing-md) 0;
}

.article-body ul,
.article-body ol {
  margin-bottom: var(--spacing-md);
  padding-left: var(--spacing-lg);
}

.article-body li {
  margin-bottom: var(--spacing-xs);
  color: var(--text-secondary);
}

.article-nav {
  display: flex;
  justify-content: space-between;
  margin-top: var(--spacing-xl);
  padding-top: var(--spacing-lg);
  border-top: 1px solid var(--border-color);
}

.article-nav a {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.article-nav a:hover {
  color: var(--accent-color);
}

.article-nav strong {
  display: block;
  color: var(--text-primary);
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

/* ===== 分类页标题 ===== */
.category-header {
  text-align: center;
  padding: var(--spacing-xl) 0 var(--spacing-lg);
}

.category-header h1 {
  font-size: 2rem;
  margin-bottom: var(--spacing-sm);
}

.category-header p {
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

/* ===== 404页面 ===== */
.error-page {
  text-align: center;
  padding: var(--spacing-xl) 0;
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.error-content h1 {
  font-size: 6rem;
  color: var(--accent-color);
  line-height: 1;
  margin-bottom: var(--spacing-sm);
}

.error-content h2 {
  font-size: 1.5rem;
  margin-bottom: var(--spacing-md);
  color: var(--text-secondary);
}

.error-content p {
  color: var(--text-muted);
  margin-bottom: var(--spacing-lg);
}

.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: var(--accent-color);
  color: #fff;
  border-radius: var(--radius-sm);
  font-weight: 500;
  transition: background 0.3s;
}

.btn:hover {
  background: var(--accent-dark);
  color: #fff;
}

/* ===== 侧边栏 ===== */
.sidebar-section {
  background: var(--bg-secondary);
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  margin-bottom: var(--spacing-md);
}

.sidebar-section h3 {
  font-size: 1rem;
  margin-bottom: var(--spacing-sm);
  padding-bottom: var(--spacing-xs);
  border-bottom: 2px solid var(--accent-color);
}

/* ===== 响应式设计 ===== */
@media (max-width: 768px) {
  :root {
    --spacing-xl: 2rem;
  }

  .header .container {
    flex-wrap: wrap;
    height: auto;
    padding: var(--spacing-sm) var(--spacing-md);
  }

  .nav ul {
    gap: var(--spacing-sm);
    font-size: 0.9rem;
  }

  .hero h1 {
    font-size: 1.75rem;
  }

  .timeline::before {
    left: 20px;
  }

  .timeline-item,
  .timeline-item:nth-child(odd) {
    flex-direction: column;
    padding-left: 50px;
  }

  .timeline-item:nth-child(odd) .timeline-content,
  .timeline-item:nth-child(even) .timeline-content {
    width: 100%;
    text-align: left;
    padding: 0;
  }

  .timeline-dot {
    left: 20px;
  }

  .article-grid,
  .article-grid-2 {
    grid-template-columns: 1fr;
  }

  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .article-body {
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }

  .nav ul {
    flex-wrap: wrap;
    justify-content: center;
  }
}
