/* ========================================
   人体工学椅 - 全局样式
   www.renxingyi.cn
   ======================================== */

/* CSS 变量 */
:root {
  --accent-color: #0066cc;
  --accent-hover: #0052a3;
  --text-primary: #333;
  --text-secondary: #666;
  --text-muted: #999;
  --bg-primary: #fff;
  --bg-secondary: #f8f9fa;
  --border-color: #e5e5e5;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-hover: 0 4px 16px rgba(0,0,0,0.12);
  --radius: 8px;
  --max-width: 1200px;
  --sidebar-width: 280px;
  --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-secondary);
}

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

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

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);
}

.main-layout {
  display: grid;
  grid-template-columns: 1fr var(--sidebar-width);
  gap: var(--gap);
  padding: var(--gap) 0;
}

/* ========================================
   Header
   ======================================== */

.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: 64px;
}

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

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

.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);
}

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

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

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

/* ========================================
   Hero Section
   ======================================== */

.hero {
  background: linear-gradient(135deg, var(--accent-color) 0%, #004499 100%);
  color: #fff;
  padding: 60px 0;
  text-align: center;
}

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

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

.hero-cta {
  display: inline-flex;
  gap: 12px;
}

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

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

.btn-primary:hover {
  background: rgba(255,255,255,0.9);
  color: var(--accent-color);
}

.btn-secondary {
  background: rgba(255,255,255,0.2);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.3);
}

.btn-secondary:hover {
  background: rgba(255,255,255,0.3);
  color: #fff;
}

/* ========================================
   文章卡片
   ======================================== */

.section-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--accent-color);
  display: inline-block;
}

.article-card {
  background: var(--bg-primary);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s;
  margin-bottom: 20px;
}

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

.article-card.featured {
  display: grid;
  grid-template-columns: 280px 1fr;
}

.article-card-image {
  height: 180px;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.article-card.featured .article-card-image {
  height: 100%;
}

.article-card-content {
  padding: 20px;
}

.article-card-category {
  font-size: 0.75rem;
  color: var(--accent-color);
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.article-card-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 12px;
  line-height: 1.4;
}

.article-card-title a {
  color: var(--text-primary);
}

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

.article-card-excerpt {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

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

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

/* 文章列表 */
.article-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.article-list-thumb {
  width: 120px;
  height: 80px;
  background: var(--bg-secondary);
  border-radius: 4px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.75rem;
}

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

.article-list-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 8px;
}

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

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

.article-list-excerpt {
  font-size: 0.875rem;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

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

.sidebar-widget {
  background: var(--bg-primary);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.widget-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-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 {
  color: var(--text-primary);
  font-size: 0.875rem;
  display: block;
}

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

.widget-list .meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ========================================
   面包屑
   ======================================== */

.breadcrumb {
  background: var(--bg-primary);
  padding: 16px 0;
  border-bottom: 1px solid var(--border-color);
}

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

.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-primary);
  font-weight: 500;
}

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

.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
}

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

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

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

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

.pagination .disabled {
  color: var(--text-muted);
  cursor: not-allowed;
}

/* ========================================
   分类页头部
   ======================================== */

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

.category-header h1 {
  font-size: 1.75rem;
  margin-bottom: 12px;
}

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

.category-stats {
  display: flex;
  gap: 24px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* ========================================
   文章详情页
   ======================================== */

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

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

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

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

.article-featured-image {
  background: var(--bg-secondary);
  height: 400px;
  border-radius: var(--radius);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  overflow: hidden;
}

.article-content {
  background: var(--bg-primary);
  padding: 32px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: 1.0625rem;
  line-height: 1.8;
}

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

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

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

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

.article-content ul li {
  list-style: disc;
  margin-bottom: 8px;
}

.article-content ol li {
  list-style: decimal;
  margin-bottom: 8px;
}

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

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

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

.error-page {
  text-align: center;
  padding: 80px 20px;
}

.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-message {
  color: var(--text-secondary);
  margin-bottom: 32px;
}

/* ========================================
   Footer
   ======================================== */

.footer {
  background: var(--bg-primary);
  border-top: 1px solid var(--border-color);
  padding: 40px 0 20px;
  margin-top: 40px;
}

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

.footer-brand p {
  color: var(--text-secondary);
  margin-top: 12px;
  font-size: 0.875rem;
}

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

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

.footer-links a {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

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

.footer-bottom {
  border-top: 1px solid var(--border-color);
  padding-top: 20px;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-muted);
}

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

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

  .sidebar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--gap);
  }

  .sidebar-widget {
    margin-bottom: 0;
  }

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

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

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

  .search-box {
    width: 150px;
  }

  .hero {
    padding: 40px 0;
  }

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

  .hero-cta {
    flex-direction: column;
  }

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

  .article-card.featured .article-card-image {
    height: 180px;
  }

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

  .article-list-thumb {
    width: 100%;
    height: 160px;
  }

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

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

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

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

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

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

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

  .category-header,
  .article-header,
  .article-content {
    padding: 20px;
  }

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