/* ===== CSS 变量 ===== */
:root {
  --accent-color: #9c27b0;
  --accent-light: #e1bee7;
  --accent-dark: #7b1fa2;
  --text-primary: #212121;
  --text-secondary: #757575;
  --bg-primary: #ffffff;
  --bg-secondary: #f5f5f5;
  --border-color: #e0e0e0;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.15);
  --radius: 8px;
  --max-width: 1200px;
  --gap: 24px;
}

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

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

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

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

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

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

/* ===== 页头 ===== */
.header {
  background: var(--bg-primary);
  box-shadow: var(--shadow);
  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);
}

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

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

.nav a {
  color: var(--text-primary);
  font-weight: 500;
  padding: 8px 0;
  border-bottom: 2px solid transparent;
  transition: all 0.3s;
}

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

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

.search input {
  padding: 8px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  width: 200px;
  outline: none;
}

.search input:focus {
  border-color: var(--accent-color);
}

.search button {
  padding: 8px 16px;
  background: var(--accent-color);
  color: white;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
}

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

.hero h1 {
  font-size: 2.5rem;
  margin-bottom: 16px;
}

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

/* ===== 面包屑 ===== */
.breadcrumb {
  background: var(--bg-primary);
  padding: 16px 0;
  border-bottom: 1px solid var(--border-color);
}

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

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

.breadcrumb span {
  color: var(--text-secondary);
  margin: 0 8px;
}

.breadcrumb strong {
  color: var(--text-primary);
  font-weight: 500;
}

/* ===== 主题卡片 ===== */
.topics-section {
  padding: 48px 0;
}

.section-title {
  font-size: 1.5rem;
  margin-bottom: 24px;
  color: var(--text-primary);
}

.topics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap);
}

.topic-card {
  background: var(--bg-primary);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: all 0.3s;
}

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

.topic-icon {
  width: 64px;
  height: 64px;
  background: var(--accent-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 1.75rem;
}

.topic-card h3 {
  font-size: 1.125rem;
  margin-bottom: 8px;
}

.topic-card p {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* ===== 内容列表 ===== */
.content-section {
  padding: 48px 0;
  background: var(--bg-primary);
}

.content-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.content-item {
  display: flex;
  gap: 16px;
  padding: 16px;
  border-radius: var(--radius);
  transition: background 0.3s;
}

.content-item:hover {
  background: var(--bg-secondary);
}

.content-thumb {
  width: 160px;
  height: 100px;
  background: var(--accent-light);
  border-radius: var(--radius);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-dark);
  font-size: 2rem;
}

.content-info {
  flex: 1;
}

.content-info h3 {
  font-size: 1.125rem;
  margin-bottom: 8px;
}

.content-info p {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.content-meta {
  display: flex;
  gap: 16px;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.content-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ===== 三栏布局 ===== */
.three-columns {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap);
  padding: 48px 0;
}

.column h3 {
  font-size: 1rem;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--accent-color);
}

.column ul {
  list-style: none;
}

.column li {
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
}

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

.column a {
  color: var(--text-primary);
  display: block;
}

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

/* ===== 分类页特定样式 ===== */
.topic-header {
  background: var(--bg-primary);
  padding: 48px 0;
  text-align: center;
}

.topic-header .topic-icon {
  width: 80px;
  height: 80px;
  font-size: 2.5rem;
}

.topic-header h1 {
  font-size: 2rem;
  margin: 16px 0 8px;
}

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

.topic-stats {
  display: flex;
  justify-content: center;
  gap: 32px;
}

.topic-stats span {
  color: var(--text-secondary);
}

.topic-stats strong {
  color: var(--accent-color);
  font-size: 1.25rem;
}

.sub-topics {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 24px 0;
}

.sub-topic-tag {
  padding: 8px 16px;
  background: var(--bg-secondary);
  border-radius: 20px;
  font-size: 0.875rem;
  color: var(--text-primary);
  transition: all 0.3s;
}

.sub-topic-tag:hover {
  background: var(--accent-color);
  color: white;
}

/* ===== 分页 ===== */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 32px;
}

.pagination a,
.pagination span {
  padding: 8px 16px;
  border-radius: var(--radius);
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.pagination a:hover {
  background: var(--accent-color);
  color: white;
}

.pagination .current {
  background: var(--accent-color);
  color: white;
}

/* ===== 文章页特定样式 ===== */
.article-header {
  background: var(--bg-primary);
  padding: 48px 0;
}

.article-title {
  font-size: 2rem;
  margin-bottom: 16px;
  line-height: 1.3;
}

.article-meta {
  display: flex;
  gap: 16px;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.article-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.article-topics {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.topic-tag {
  padding: 4px 12px;
  background: var(--accent-light);
  color: var(--accent-dark);
  border-radius: 12px;
  font-size: 0.75rem;
}

.article-featured {
  margin: 24px 0;
  border-radius: var(--radius);
  overflow: hidden;
}

.article-featured img {
  width: 100%;
  height: 400px;
  object-fit: cover;
}

.article-content {
  background: var(--bg-primary);
  padding: 48px 0;
}

.article-body {
  max-width: 800px;
  margin: 0 auto;
}

.article-body h2 {
  font-size: 1.5rem;
  margin: 32px 0 16px;
  color: var(--text-primary);
}

.article-body h3 {
  font-size: 1.25rem;
  margin: 24px 0 12px;
  color: var(--text-primary);
}

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

.article-body ul,
.article-body ol {
  margin-bottom: 16px;
  padding-left: 24px;
  color: var(--text-secondary);
}

.article-body li {
  margin-bottom: 8px;
}

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

/* ===== 相关文章 ===== */
.related-section {
  background: var(--bg-secondary);
  padding: 48px 0;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--gap);
}

.related-card {
  background: var(--bg-primary);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.related-card .thumb {
  height: 120px;
  background: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-dark);
  font-size: 2rem;
}

.related-card .info {
  padding: 16px;
}

.related-card h4 {
  font-size: 0.875rem;
  margin-bottom: 8px;
}

.related-card span {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* ===== 推荐区域 ===== */
.recommended-section {
  padding: 48px 0;
}

.recommended-list {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}

.recommended-list a {
  color: var(--text-primary);
}

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

/* ===== 页脚 ===== */
.footer {
  background: var(--text-primary);
  color: white;
  padding: 48px 0 24px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--gap);
  margin-bottom: 32px;
}

.footer-brand p {
  color: rgba(255, 255, 255, 0.7);
  margin-top: 16px;
}

.footer h4 {
  font-size: 1rem;
  margin-bottom: 16px;
}

.footer ul {
  list-style: none;
}

.footer li {
  margin-bottom: 8px;
}

.footer a {
  color: rgba(255, 255, 255, 0.7);
}

.footer a:hover {
  color: white;
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 24px;
  text-align: center;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.875rem;
}

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

.error-code {
  font-size: 8rem;
  font-weight: 700;
  color: var(--accent-color);
  line-height: 1;
}

.error-page h1 {
  font-size: 2rem;
  margin-bottom: 16px;
}

.error-page p {
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.btn {
  display: inline-block;
  padding: 12px 32px;
  background: var(--accent-color);
  color: white;
  border-radius: var(--radius);
  font-weight: 500;
  transition: background 0.3s;
}

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

/* ===== 响应式设计 ===== */
@media (max-width: 1024px) {
  .topics-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

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

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

@media (max-width: 768px) {
  .header .container {
    flex-wrap: wrap;
    height: auto;
    padding: 16px var(--gap);
  }

  .nav {
    order: 3;
    width: 100%;
    margin-top: 16px;
    gap: 16px;
    overflow-x: auto;
  }

  .search {
    display: none;
  }

  .hero {
    padding: 48px 0;
  }

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

  .topics-grid {
    grid-template-columns: 1fr;
  }

  .content-item {
    flex-direction: column;
  }

  .content-thumb {
    width: 100%;
    height: 180px;
  }

  .three-columns {
    grid-template-columns: 1fr;
  }

  .footer-grid {
    grid-template-columns: 1fr;
  }

  .related-grid {
    grid-template-columns: 1fr;
  }

  .article-title {
    font-size: 1.5rem;
  }

  .article-featured img {
    height: 200px;
  }

  .error-code {
    font-size: 5rem;
  }
}
