/* ============================================
   手工面包 - 百科风格样式表
   www.jiatinghongbei.cn
   ============================================ */

/* CSS 变量定义 */
:root {
  --accent-color: #8B6F47;
  --accent-light: #D4A574;
  --accent-dark: #5D4E37;
  --bg-primary: #FDFBF7;
  --bg-secondary: #F5F0E8;
  --bg-card: #FFFFFF;
  --text-primary: #2C2416;
  --text-secondary: #6B5B4F;
  --text-muted: #9B8B7F;
  --border-color: #E5DDD3;
  --link-color: #8B6F47;
  --link-hover: #5D4E37;
  --success-color: #6B8E6B;
  --warning-color: #D4A574;
  --error-color: #B87070;
  --shadow-sm: 0 1px 2px rgba(44, 36, 22, 0.05);
  --shadow-md: 0 4px 6px rgba(44, 36, 22, 0.07);
  --shadow-lg: 0 10px 15px rgba(44, 36, 22, 0.1);
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --max-width: 1400px;
  --header-height: 64px;
}

/* 重置样式 */
*, *::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", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.7;
  color: var(--text-primary);
  background-color: var(--bg-primary);
}

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

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

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

ul, ol {
  list-style: none;
}

/* ============================================
   布局容器
   ============================================ */

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

.main-wrapper {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 32px 24px;
}

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

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

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

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  flex-shrink: 0;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent-light), var(--accent-color));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.5rem;
}

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

.nav-link {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.9375rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.nav-link:hover,
.nav-link.active {
  color: var(--accent-color);
  background-color: var(--bg-secondary);
}

.search-box {
  position: relative;
  width: 280px;
  flex-shrink: 0;
}

.search-input {
  width: 100%;
  padding: 10px 16px 10px 40px;
  border: 1px solid var(--border-color);
  border-radius: 24px;
  background-color: var(--bg-primary);
  font-size: 0.875rem;
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent-light);
  box-shadow: 0 0 0 3px rgba(139, 111, 71, 0.1);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.875rem;
}

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

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

.breadcrumb-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--text-muted);
}

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

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

.breadcrumb-separator {
  color: var(--text-muted);
}

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

/* ============================================
   Hero 区域
   ============================================ */

.hero {
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
  padding: 64px 0;
  text-align: center;
  border-bottom: 1px solid var(--border-color);
}

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

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

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 48px;
  margin-top: 32px;
}

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

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

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

/* ============================================
   特色卡片 Featured Cards
   ============================================ */

.featured-section {
  padding: 48px 0;
}

.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-light);
  display: inline-block;
}

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

.featured-card {
  background-color: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.featured-card.large {
  grid-row: span 2;
}

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

.featured-card.large .featured-image {
  height: 100%;
  min-height: 400px;
}

.featured-content {
  padding: 20px;
}

.featured-card.large .featured-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(44, 36, 22, 0.9));
  color: white;
}

.featured-tag {
  display: inline-block;
  padding: 4px 10px;
  background-color: var(--accent-light);
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 12px;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.featured-card.large .featured-tag {
  background-color: var(--accent-color);
}

.featured-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
  line-height: 1.4;
}

.featured-card.large .featured-title {
  color: white;
  font-size: 1.5rem;
}

.featured-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.featured-card.large .featured-desc {
  color: rgba(255, 255, 255, 0.8);
}

/* ============================================
   内容卡片 Content Cards
   ============================================ */

.content-section {
  padding: 32px 0;
}

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

.content-card {
  background-color: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 24px;
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.content-card:hover {
  border-color: var(--accent-light);
  box-shadow: var(--shadow-md);
}

.content-header {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
}

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

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

.content-title {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.content-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

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

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

.content-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.content-tags {
  display: flex;
  gap: 8px;
}

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

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

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

.read-more:hover {
  color: var(--accent-dark);
}

/* ============================================
   侧边栏列表 Sidebar Lists
   ============================================ */

.sidebar-section {
  padding: 32px 0;
}

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

.sidebar-block {
  background-color: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 24px;
  border: 1px solid var(--border-color);
}

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

.article-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.article-list-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
}

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

.article-number {
  width: 24px;
  height: 24px;
  background-color: var(--bg-secondary);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.article-number.top {
  background-color: var(--accent-color);
  color: white;
}

.article-list-title {
  font-size: 0.9375rem;
  color: var(--text-primary);
  line-height: 1.5;
  flex: 1;
}

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

/* ============================================
   分类页特定样式
   ============================================ */

.category-header {
  background-color: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 40px;
  margin-bottom: 32px;
  text-align: center;
  border: 1px solid var(--border-color);
}

.category-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.category-desc {
  font-size: 1rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 24px;
}

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

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

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

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

/* 分页 */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--border-color);
}

.page-link {
  min-width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  color: var(--text-secondary);
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.page-link:hover {
  border-color: var(--accent-light);
  color: var(--accent-color);
}

.page-link.active {
  background-color: var(--accent-color);
  border-color: var(--accent-color);
  color: white;
}

.page-link.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============================================
   文章页特定样式
   ============================================ */

.article-header {
  background-color: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 40px;
  margin-bottom: 32px;
  border: 1px solid var(--border-color);
}

.article-title {
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 20px;
  line-height: 1.3;
}

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

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

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

.article-body {
  background-color: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 40px;
  border: 1px solid var(--border-color);
}

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

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

.article-content h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 32px 0 16px;
}

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

.article-content ul,
.article-content ol {
  margin-bottom: 20px;
  padding-left: 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-md);
  margin: 24px 0;
}

.article-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 0.9375rem;
}

.article-content th,
.article-content td {
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  text-align: left;
}

.article-content th {
  background-color: var(--bg-secondary);
  font-weight: 600;
  color: var(--text-primary);
}

.article-content tr:nth-child(even) {
  background-color: var(--bg-primary);
}

/* 信息框 */
.info-box {
  background-color: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 24px;
  margin: 24px 0;
  border-left: 4px solid var(--accent-color);
}

.info-box-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.info-box-content {
  font-size: 0.9375rem;
  color: var(--text-secondary);
}

.info-box-list {
  margin-top: 12px;
}

.info-box-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
}

/* 参见链接 */
.see-also {
  background-color: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 24px;
  margin: 32px 0;
}

.see-also-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.see-also-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.see-also-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background-color: var(--bg-card);
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.see-also-item:hover {
  border-color: var(--accent-light);
  background-color: var(--bg-primary);
}

/* 参考文献 */
.references {
  margin-top: 40px;
  padding-top: 32px;
  border-top: 2px solid var(--border-color);
}

.references-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 20px;
}

.reference-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.reference-item {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  padding-left: 24px;
  position: relative;
}

.reference-item::before {
  content: attr(data-index);
  position: absolute;
  left: 0;
  color: var(--accent-color);
  font-weight: 600;
}

/* 文章特色图片 */
.article-featured {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 32px;
  margin-bottom: 32px;
}

.article-image {
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.article-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  min-height: 300px;
}

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

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

.error-page {
  min-height: calc(100vh - var(--header-height) - 300px);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 64px 24px;
}

.error-content {
  max-width: 480px;
}

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

.error-title {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}

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

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  font-weight: 500;
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
}

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

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

.btn-secondary {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background-color: var(--border-color);
}

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

.footer {
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 48px 0 24px;
  margin-top: 64px;
}

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

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

.footer-brand {
  max-width: 320px;
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.footer-desc {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

.footer-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-link {
  font-size: 0.9375rem;
  color: var(--text-secondary);
}

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

.footer-bottom {
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

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

.footer-nav {
  display: flex;
  gap: 24px;
}

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

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

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

@media (max-width: 1024px) {
  .featured-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .featured-card.large {
    grid-row: span 1;
    grid-column: span 2;
  }

  .featured-card.large .featured-image {
    min-height: 200px;
    position: relative;
  }

  .featured-card.large .featured-content {
    position: static;
    background: var(--bg-card);
    color: var(--text-primary);
  }

  .featured-card.large .featured-title {
    color: var(--text-primary);
  }

  .featured-card.large .featured-desc {
    color: var(--text-secondary);
  }

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

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

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

@media (max-width: 768px) {
  :root {
    --header-height: 56px;
  }

  .header-inner {
    padding: 0 16px;
  }

  .nav {
    display: none;
  }

  .search-box {
    width: 200px;
  }

  .hero {
    padding: 40px 0;
  }

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

  .hero-stats {
    gap: 24px;
  }

  .main-wrapper {
    padding: 24px 16px;
  }

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

  .featured-card.large {
    grid-column: span 1;
  }

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

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

  .article-header {
    padding: 24px;
  }

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

  .article-body {
    padding: 24px;
  }

  .article-content {
    font-size: 1rem;
  }

  .see-also-list {
    grid-template-columns: 1fr;
  }

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

  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }

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

  .category-header {
    padding: 24px;
  }

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

@media (max-width: 480px) {
  .hero-stats {
    flex-direction: column;
    gap: 16px;
  }

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

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

  .pagination {
    flex-wrap: wrap;
  }

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

/* ============================================
   打印样式
   ============================================ */

@media print {
  .header,
  .breadcrumb,
  .sidebar-section,
  .footer,
  .pagination {
    display: none;
  }

  .article-body {
    border: none;
    padding: 0;
  }

  .article-content a::after {
    content: " (" attr(href) ")";
    font-size: 0.875rem;
    color: var(--text-muted);
  }
}
