/* ============================================
   机械键盘 - 白皮书简报风格样式
   域名: www.youxijiancn.cn
   关键词: 机械键盘DIY改装教程 键轴开关选择 润滑技巧 静音键盘推荐
   ============================================ */

/* CSS 变量定义 */
:root {
  --accent-color: #673ab7;
  --accent-light: #9575cd;
  --accent-dark: #512da8;
  --text-primary: #333;
  --text-secondary: #666;
  --text-muted: #999;
  --bg-primary: #fff;
  --bg-secondary: #f8f9fa;
  --bg-accent: #f3e5f5;
  --border-color: #e0e0e0;
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --max-width: 1200px;
  --header-height: 64px;
}

/* 重置样式 */
* {
  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-primary);
}

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

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

ul {
  list-style: none;
}

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

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

/* ============================================
   Header 页头
   ============================================ */
.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: var(--header-height);
}

.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-secondary);
  font-weight: 500;
  padding: 8px 0;
  border-bottom: 2px solid transparent;
}

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

.header-search {
  position: relative;
}

.header-search input {
  width: 240px;
  padding: 10px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.header-search input:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(103, 58, 183, 0.1);
}

/* ============================================
   Hero Section
   ============================================ */
.hero {
  background: linear-gradient(135deg, var(--bg-accent) 0%, var(--bg-secondary) 100%);
  padding: 60px 0;
  text-align: center;
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
}

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

.hero-search {
  max-width: 560px;
  margin: 0 auto;
}

.hero-search input {
  width: 100%;
  padding: 16px 24px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.hero-search input:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 4px rgba(103, 58, 183, 0.1);
}

/* ============================================
   分类标签
   ============================================ */
.categories {
  padding: 40px 0;
  background: var(--bg-primary);
}

.category-tags {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.category-tag {
  padding: 12px 24px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-weight: 500;
  transition: all 0.2s;
}

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

/* ============================================
   内容区块标题
   ============================================ */
.section-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--accent-color);
  display: inline-block;
}

/* ============================================
   白皮书/文章卡片
   ============================================ */
.whitepaper-list {
  padding: 40px 0;
  background: var(--bg-secondary);
}

.whitepaper-card {
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  transition: box-shadow 0.2s;
}

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

.whitepaper-card h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.whitepaper-card h3 a {
  color: inherit;
}

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

.whitepaper-meta {
  display: flex;
  gap: 16px;
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 12px;
}

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

.whitepaper-desc {
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 16px;
}

.whitepaper-actions {
  display: flex;
  gap: 12px;
}

/* ============================================
   按钮样式
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}

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

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

.btn-outline {
  background: transparent;
  color: var(--accent-color);
  border: 1px solid var(--accent-color);
}

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

.btn-sm {
  padding: 6px 16px;
  font-size: 13px;
}

/* ============================================
   三栏文章列表
   ============================================ */
.articles-grid {
  padding: 40px 0;
  background: var(--bg-primary);
}

.articles-grid .container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}

.article-column h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

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

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

.article-list a {
  color: var(--text-secondary);
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

/* ============================================
   Footer 页脚
   ============================================ */
.footer {
  background: var(--text-primary);
  color: var(--text-muted);
  padding: 40px 0;
  text-align: center;
}

.footer p {
  font-size: 14px;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 16px;
}

.footer-links a {
  color: var(--text-muted);
}

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

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

.breadcrumb ol {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.breadcrumb li:not(:last-child)::after {
  content: ">";
  margin-left: 8px;
  color: var(--text-muted);
}

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

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

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

/* ============================================
   分类页头部
   ============================================ */
.category-header {
  padding: 40px 0;
  background: linear-gradient(135deg, var(--bg-accent) 0%, var(--bg-secondary) 100%);
  text-align: center;
}

.category-header h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.category-header p {
  color: var(--text-secondary);
}

.sort-bar {
  display: flex;
  justify-content: flex-end;
  gap: 16px;
  padding: 20px 0;
  font-size: 14px;
  color: var(--text-secondary);
}

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

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

/* ============================================
   分页
   ============================================ */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 40px 0;
}

.pagination a,
.pagination span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
}

.pagination a {
  background: var(--bg-secondary);
  color: var(--text-secondary);
}

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

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

/* ============================================
   文章详情页
   ============================================ */
.article-header {
  padding: 40px 0 20px;
  text-align: center;
}

.article-header h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 16px;
  line-height: 1.3;
}

.article-meta {
  display: flex;
  justify-content: center;
  gap: 24px;
  color: var(--text-muted);
  font-size: 14px;
}

.article-cover {
  max-width: 800px;
  margin: 0 auto 40px;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.article-cover img {
  width: 100%;
  display: block;
}

.article-content {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 20px 40px;
}

/* 执行摘要 */
.executive-summary {
  background: var(--bg-accent);
  border-left: 4px solid var(--accent-color);
  padding: 24px;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin-bottom: 32px;
}

.executive-summary h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--accent-dark);
  margin-bottom: 12px;
}

.executive-summary p {
  color: var(--text-secondary);
  line-height: 1.8;
}

/* 关键点 */
.key-points {
  margin-bottom: 32px;
}

.key-points h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.key-points ul {
  list-style: disc;
  padding-left: 24px;
}

.key-points li {
  padding: 8px 0;
  color: var(--text-secondary);
  line-height: 1.7;
}

.key-points li strong {
  color: var(--text-primary);
}

/* 目录 */
.toc {
  background: var(--bg-secondary);
  padding: 24px;
  border-radius: var(--radius-md);
  margin-bottom: 32px;
}

.toc h2 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.toc ol {
  list-style: decimal;
  padding-left: 24px;
}

.toc li {
  padding: 6px 0;
  color: var(--text-secondary);
}

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

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

/* 文章正文 */
.article-body {
  line-height: 1.8;
  color: var(--text-primary);
}

.article-body h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 40px 0 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.article-body h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 32px 0 16px;
  color: var(--accent-dark);
}

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

.article-body ul,
.article-body ol {
  padding-left: 24px;
  margin-bottom: 16px;
}

.article-body li {
  padding: 4px 0;
  color: var(--text-secondary);
}

/* 下载区域 */
.download-section {
  background: var(--bg-secondary);
  padding: 24px;
  border-radius: var(--radius-md);
  text-align: center;
  margin: 32px 0;
}

.download-section h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.download-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
}

/* 相关推荐 */
.related-section {
  padding: 40px 0;
  background: var(--bg-secondary);
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.related-card {
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

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

.related-card h4 a {
  color: var(--text-primary);
}

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

.related-card p {
  font-size: 14px;
  color: var(--text-muted);
}

/* ============================================
   推荐文章横向列表
   ============================================ */
.recommended-bar {
  background: var(--bg-accent);
  padding: 20px 0;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

.recommended-bar .container {
  display: flex;
  align-items: center;
  gap: 24px;
}

.recommended-bar h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-dark);
  white-space: nowrap;
}

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

.recommended-list a {
  color: var(--text-secondary);
  font-size: 14px;
}

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

/* ============================================
   404 页面
   ============================================ */
.error-page {
  min-height: calc(100vh - var(--header-height) - 200px);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 20px;
}

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

.error-content h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 16px;
}

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

/* ============================================
   响应式设计
   ============================================ */
@media (max-width: 992px) {
  .articles-grid .container {
    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: 12px 20px;
  }

  .nav {
    order: 3;
    width: 100%;
    justify-content: center;
    gap: 16px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
  }

  .header-search {
    display: none;
  }

  .hero {
    padding: 40px 0;
  }

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

  .hero p {
    font-size: 1rem;
  }

  .articles-grid .container {
    grid-template-columns: 1fr;
  }

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

  .article-meta {
    flex-wrap: wrap;
    gap: 12px;
  }

  .download-actions {
    flex-direction: column;
  }

  .whitepaper-actions {
    flex-wrap: wrap;
  }

  .category-tags {
    gap: 8px;
  }

  .category-tag {
    padding: 8px 16px;
    font-size: 14px;
  }

  .recommended-bar .container {
    flex-direction: column;
    align-items: flex-start;
  }

  .footer-links {
    flex-wrap: wrap;
    gap: 16px;
  }
}

@media (max-width: 480px) {
  .hero h1 {
    font-size: 1.5rem;
  }

  .section-title {
    font-size: 1.25rem;
  }

  .whitepaper-card {
    padding: 16px;
  }

  .whitepaper-meta {
    flex-wrap: wrap;
    gap: 8px;
  }

  .pagination a,
  .pagination span {
    width: 36px;
    height: 36px;
  }
}
