/* ============================================
   攀岩 - 资讯风格样式表
   www.anquandingwei.cn
   提供全面的攀岩资讯，包括装备推荐、技巧教学
   ============================================ */

/* CSS 变量 */
:root {
  --accent-color: #d63384;
  --accent-light: #f8d7e8;
  --accent-dark: #a01e63;
  --text-primary: #333;
  --text-secondary: #666;
  --text-muted: #999;
  --bg-primary: #fff;
  --bg-secondary: #f8f9fa;
  --bg-dark: #212529;
  --border-color: #e9ecef;
  --shadow: 0 2px 8px rgba(0,0,0,0.1);
  --shadow-hover: 0 4px 16px rgba(0,0,0,0.15);
  --radius: 8px;
  --radius-sm: 4px;
  --max-width: 1200px;
  --header-height: 60px;
}

/* 重置 */
*, *::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-secondary);
}

a {
  color: var(--text-primary);
  text-decoration: none;
  transition: color 0.2s;
}

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

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

ul {
  list-style: none;
}

/* ============================================
   布局
   ============================================ */

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* 三栏布局 */
.layout {
  display: grid;
  grid-template-columns: 200px 1fr 200px;
  gap: 24px;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 24px 20px;
}

/* ============================================
   页头
   ============================================ */

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

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

.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;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
}

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

.search-box {
  display: flex;
  align-items: center;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  width: 200px;
}

.search-box input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.9rem;
  width: 100%;
}

.search-box button {
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-muted);
}

/* ============================================
   侧边栏
   ============================================ */

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.sidebar-section {
  background: var(--bg-primary);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.sidebar-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 2px solid var(--accent-color);
}

.sidebar-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-list a {
  font-size: 0.9rem;
  color: var(--text-secondary);
  padding: 4px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

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

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

.tag {
  font-size: 0.8rem;
  padding: 4px 10px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
}

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

/* ============================================
   主内容区
   ============================================ */

.main {
  min-width: 0;
}

/* Hero 区域 */
.hero {
  background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-dark) 100%);
  color: #fff;
  padding: 48px 32px;
  border-radius: var(--radius);
  margin-bottom: 24px;
  text-align: center;
}

.hero h1 {
  font-size: 2rem;
  margin-bottom: 12px;
}

.hero p {
  font-size: 1.1rem;
  opacity: 0.9;
}

/* 卡片 */
.card {
  background: var(--bg-primary);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s;
}

.card:hover {
  box-shadow: var(--shadow-hover);
}

.card-image {
  width: 100%;
  height: 180px;
  object-fit: cover;
  background: var(--bg-secondary);
}

.card-body {
  padding: 16px;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 8px;
  line-height: 1.4;
}

.card-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  gap: 16px;
}

/* 特色内容网格 */
.featured-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.featured-main {
  grid-column: span 2;
}

.featured-main .card-image {
  height: 240px;
}

.featured-main .card-title {
  font-size: 1.2rem;
}

/* 内容列表 */
.content-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.list-item {
  display: flex;
  gap: 16px;
  background: var(--bg-primary);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.list-item-image {
  width: 120px;
  height: 80px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  background: var(--bg-secondary);
}

.list-item-content {
  flex: 1;
  min-width: 0;
}

.list-item-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 6px;
  line-height: 1.4;
}

.list-item-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.list-item-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

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

.pagination a,
.pagination span {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}

.pagination a {
  background: var(--bg-primary);
  box-shadow: var(--shadow);
}

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

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

/* ============================================
   文章页
   ============================================ */

.breadcrumb {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

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

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

.breadcrumb span {
  margin: 0 8px;
}

.article {
  background: var(--bg-primary);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
}

.article-header {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
}

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

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

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

.article-image {
  width: 100%;
  height: 320px;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: 24px;
  background: var(--bg-secondary);
}

.article-content {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--text-primary);
}

.article-content p {
  margin-bottom: 16px;
}

.article-content h2 {
  font-size: 1.4rem;
  margin: 32px 0 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border-color);
}

.article-content h3 {
  font-size: 1.2rem;
  margin: 24px 0 12px;
}

.article-content ul,
.article-content ol {
  margin: 0 0 16px 24px;
}

.article-content ul {
  list-style: disc;
}

.article-content ol {
  list-style: decimal;
}

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

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

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

.article-content code {
  background: var(--bg-secondary);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-family: monospace;
  font-size: 0.9em;
}

.article-content pre {
  background: var(--bg-dark);
  color: #fff;
  padding: 16px;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 16px 0;
}

.article-content pre code {
  background: none;
  padding: 0;
}

/* 作者卡片 */
.author-card {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 20px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  margin-top: 32px;
}

.author-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent-light);
}

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

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

/* 目录 */
.toc {
  position: sticky;
  top: 80px;
}

.toc-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.toc-list a {
  font-size: 0.85rem;
  color: var(--text-secondary);
  padding: 6px 0;
  padding-left: 12px;
  border-left: 2px solid var(--border-color);
}

.toc-list a:hover {
  color: var(--accent-color);
  border-left-color: var(--accent-color);
}

/* ============================================
   分类页
   ============================================ */

.category-header {
  background: var(--bg-primary);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

.category-title {
  font-size: 1.5rem;
  margin-bottom: 8px;
}

.category-desc {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.filter-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 6px 14px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-btn:hover,
.filter-btn.active {
  background: var(--accent-color);
  border-color: var(--accent-color);
  color: #fff;
}

/* ============================================
   404 页面
   ============================================ */

.error-page {
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px;
}

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

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

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

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

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

/* ============================================
   页脚
   ============================================ */

.footer {
  background: var(--bg-dark);
  color: #fff;
  padding: 40px 0 20px;
  margin-top: 40px;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 32px;
  margin-bottom: 32px;
}

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

.footer-section ul {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

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

.footer-bottom {
  border-top: 1px solid #495057;
  padding-top: 20px;
  text-align: center;
  font-size: 0.85rem;
  color: #adb5bd;
}

/* ============================================
   响应式设计
   ============================================ */

@media (max-width: 1024px) {
  .layout {
    grid-template-columns: 180px 1fr;
  }

  .sidebar-right {
    display: none;
  }
}

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

  .nav {
    order: 3;
    width: 100%;
    gap: 20px;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .search-box {
    width: 150px;
  }

  .layout {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .sidebar-left {
    display: none;
  }

  .hero {
    padding: 32px 20px;
  }

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

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

  .featured-main {
    grid-column: span 1;
  }

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

  .list-item-image {
    width: 100%;
    height: 160px;
  }

  .article {
    padding: 20px;
  }

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

  .article-image {
    height: 200px;
  }

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

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

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

  .pagination {
    flex-wrap: wrap;
  }
}
