/* ===== 基础变量 ===== */
:root {
  --accent-color: #e91e63;
  --accent-dark: #c2185b;
  --text-primary: #1a1a1a;
  --text-secondary: #666;
  --text-muted: #999;
  --bg-primary: #fff;
  --bg-secondary: #f8f9fa;
  --border-color: #e5e5e5;
  --shadow: 0 2px 8px rgba(0,0,0,0.1);
  --shadow-hover: 0 4px 16px rgba(0,0,0,0.15);
  --radius: 4px;
  --max-width: 1200px;
  --gap: 24px;
}

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

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

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 {
  color: inherit;
  text-decoration: none;
}

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

ul {
  list-style: none;
}

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

/* ===== 头部 ===== */
.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);
}

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

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

.nav a {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color 0.2s;
}

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

/* ===== 面包屑 ===== */
.breadcrumb {
  background: var(--bg-secondary);
  padding: 12px 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

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

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

.breadcrumb span {
  margin: 0 8px;
}

/* ===== 主内容区 ===== */
.main {
  padding: var(--gap) 0;
}

/* ===== 网格布局 ===== */
.grid {
  display: grid;
  gap: var(--gap);
}

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

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

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

/* ===== 卡片组件 ===== */
.card {
  background: var(--bg-primary);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow 0.3s, transform 0.3s;
}

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

.card-image {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16/10;
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.card:hover .card-image img {
  transform: scale(1.05);
}

.card-tag {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--accent-color);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 2px;
  text-transform: uppercase;
}

.card-content {
  padding: 16px;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

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

.card-excerpt {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ===== 特色文章 ===== */
.featured-hero {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 21/9;
}

.featured-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.featured-hero .overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 40px;
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
  color: #fff;
}

.featured-hero .card-tag {
  position: static;
  display: inline-block;
  margin-bottom: 12px;
}

.featured-hero h2 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 12px;
  line-height: 1.3;
}

.featured-hero p {
  font-size: 1rem;
  opacity: 0.9;
  max-width: 600px;
}

/* ===== 侧边栏 ===== */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.widget {
  background: var(--bg-secondary);
  padding: 20px;
  border-radius: var(--radius);
}

.widget-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--accent-color);
}

.widget-list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--border-color);
}

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

.widget-list a {
  font-size: 0.9rem;
  color: var(--text-secondary);
  display: block;
  transition: color 0.2s;
}

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

.widget-list .number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: var(--accent-color);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 50%;
  margin-right: 10px;
}

/* ===== 作者卡片 ===== */
.author-card {
  display: flex;
  align-items: center;
  gap: 16px;
}

.author-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
}

.author-info h4 {
  font-size: 1rem;
  margin-bottom: 4px;
}

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

/* ===== 标签云 ===== */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  display: inline-block;
  padding: 6px 14px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.tag:hover {
  background: var(--accent-color);
  border-color: var(--accent-color);
  color: #fff;
}

/* ===== 区块标题 ===== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  position: relative;
  padding-left: 12px;
}

.section-title::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 4px;
  background: var(--accent-color);
  border-radius: 2px;
}

.section-more {
  font-size: 0.9rem;
  color: var(--accent-color);
  font-weight: 500;
}

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

/* ===== 三栏推荐区 ===== */
.recommend-section {
  background: var(--bg-secondary);
  padding: 40px 0;
  margin-top: 40px;
}

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

.recommend-list li {
  padding: 10px 0;
  border-bottom: 1px dashed var(--border-color);
}

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

.recommend-list a {
  font-size: 0.95rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.recommend-list a::before {
  content: '•';
  color: var(--accent-color);
}

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

/* ===== 分类页头部 ===== */
.category-hero {
  background: var(--bg-secondary);
  padding: 40px 0;
  margin-bottom: var(--gap);
}

.category-hero-content {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--gap);
  align-items: center;
}

.category-info h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.category-info p {
  font-size: 1.1rem;
  color: var(--text-secondary);
}

.category-stats {
  display: flex;
  gap: 32px;
}

.stat-item {
  text-align: center;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent-color);
}

.stat-label {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* ===== 文章详情页 ===== */
.article-header {
  margin-bottom: var(--gap);
}

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

.article-meta {
  display: flex;
  align-items: center;
  gap: 20px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

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

.article-meta .author img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

.article-featured-image {
  width: 100%;
  aspect-ratio: 21/9;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: var(--gap);
}

.article-content {
  font-size: 1.05rem;
  line-height: 1.8;
}

.article-content h2,
.article-content h3 {
  margin: 32px 0 16px;
  font-weight: 700;
}

.article-content h2 {
  font-size: 1.5rem;
}

.article-content h3 {
  font-size: 1.25rem;
}

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

.article-content img {
  width: 100%;
  border-radius: var(--radius);
  margin: 24px 0;
}

.article-content blockquote {
  border-left: 4px solid var(--accent-color);
  padding-left: 20px;
  margin: 24px 0;
  font-style: italic;
  color: var(--text-secondary);
}

.article-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 40px;
}

/* ===== 404页面 ===== */
.error-page {
  text-align: center;
  padding: 80px 0;
}

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

.error-title {
  font-size: 1.75rem;
  margin-bottom: 12px;
}

.error-desc {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.btn {
  display: inline-block;
  padding: 12px 32px;
  background: var(--accent-color);
  color: #fff;
  font-weight: 600;
  border-radius: var(--radius);
  transition: background 0.2s;
}

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

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

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 40px;
}

.footer-brand .logo {
  margin-bottom: 16px;
}

.footer-brand p {
  font-size: 0.9rem;
  color: #aaa;
  line-height: 1.6;
}

.footer-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.footer-links li {
  margin-bottom: 10px;
}

.footer-links a {
  font-size: 0.9rem;
  color: #aaa;
  transition: color 0.2s;
}

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

.footer-bottom {
  border-top: 1px solid #333;
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: #666;
}

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

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

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

  .category-hero-content {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .category-stats {
    justify-content: center;
  }

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

@media (max-width: 768px) {
  :root {
    --gap: 16px;
  }

  .header .container {
    height: 56px;
  }

  .nav {
    display: none;
  }

  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .featured-hero {
    aspect-ratio: 16/10;
  }

  .featured-hero .overlay {
    padding: 20px;
  }

  .featured-hero h2 {
    font-size: 1.25rem;
  }

  .featured-hero p {
    display: none;
  }

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

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

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

  .footer-bottom {
    flex-direction: column;
    gap: 12px;
  }
}
