/* ========================================
   精品咖啡 - 杂志风格样式
   www.kafeishequ.cn
   ======================================== */

/* CSS 变量 */
:root {
  --accent-color: #8B4513;
  --accent-light: #D2691E;
  --text-primary: #333;
  --text-secondary: #666;
  --text-muted: #999;
  --bg-primary: #fff;
  --bg-secondary: #f8f5f2;
  --bg-dark: #2c2416;
  --border-color: #e8e4e0;
  --font-heading: 'Georgia', 'Times New Roman', serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --max-width: 1200px;
  --gap: 24px;
}

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

body {
  font-family: var(--font-body);
  color: var(--text-primary);
  line-height: 1.6;
  background: var(--bg-primary);
}

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

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

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

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

/* ========================================
   Header 页头
   ======================================== */
.header {
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: bold;
  color: var(--accent-color);
}

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

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

.nav a {
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 500;
}

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

.header-actions {
  display: flex;
  gap: 16px;
  align-items: center;
}

.btn {
  padding: 10px 20px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

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

.btn-primary:hover {
  background: var(--accent-light);
  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;
}

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

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

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

.breadcrumb span {
  margin: 0 8px;
  color: var(--text-muted);
}

/* ========================================
   Hero 头条区域
   ======================================== */
.hero-section {
  padding: 40px 0;
}

.hero-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--gap);
}

.hero-main {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
}

.hero-main img {
  width: 100%;
  height: 400px;
  object-fit: cover;
}

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

.hero-content .tag {
  display: inline-block;
  background: var(--accent-color);
  color: #fff;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 12px;
  margin-bottom: 12px;
}

.hero-content h1 {
  font-family: var(--font-heading);
  font-size: 32px;
  line-height: 1.3;
  margin-bottom: 12px;
}

.hero-content p {
  font-size: 15px;
  opacity: 0.9;
}

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

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

.widget-title {
  font-family: var(--font-heading);
  font-size: 18px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--accent-color);
}

.widget-list {
  list-style: none;
}

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

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

/* ========================================
   文章卡片
   ======================================== */
.card-grid {
  display: grid;
  gap: var(--gap);
}

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

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

.card {
  background: var(--bg-primary);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  transition: box-shadow 0.2s;
}

.card:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.card-image {
  position: relative;
}

.card-image img {
  width: 100%;
  height: 180px;
  object-fit: cover;
}

.card-image .tag {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--accent-color);
  color: #fff;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
}

.card-body {
  padding: 16px;
}

.card-title {
  font-family: var(--font-heading);
  font-size: 16px;
  line-height: 1.4;
  margin-bottom: 8px;
}

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

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

.card-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.card-large .card-image img {
  height: 280px;
}

.card-large .card-title {
  font-size: 20px;
}

/* ========================================
   内容区块
   ======================================== */
.section {
  padding: 40px 0;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.section-title {
  font-family: var(--font-heading);
  font-size: 24px;
  position: relative;
  padding-left: 16px;
}

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

.section-more {
  font-size: 14px;
  color: var(--text-secondary);
}

/* Feature Grid */
.feature-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: auto auto;
  gap: var(--gap);
}

.feature-large {
  grid-row: span 2;
}

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

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

.col-title {
  font-family: var(--font-heading);
  font-size: 18px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--accent-color);
}

.col-list {
  list-style: none;
}

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

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

.col-list a {
  color: var(--text-primary);
  font-size: 14px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.col-list .num {
  color: var(--accent-color);
  font-weight: bold;
  font-size: 16px;
  min-width: 24px;
}

/* ========================================
   订阅框
   ======================================== */
.subscribe-box {
  background: var(--bg-dark);
  color: #fff;
  padding: 48px;
  border-radius: 8px;
  text-align: center;
  margin: 40px 0;
}

.subscribe-box h3 {
  font-family: var(--font-heading);
  font-size: 28px;
  margin-bottom: 12px;
}

.subscribe-box p {
  opacity: 0.8;
  margin-bottom: 24px;
}

.subscribe-form {
  display: flex;
  gap: 12px;
  max-width: 480px;
  margin: 0 auto;
}

.subscribe-form input {
  flex: 1;
  padding: 14px 20px;
  border: none;
  border-radius: 4px;
  font-size: 15px;
}

.subscribe-form .btn {
  padding: 14px 32px;
}

/* ========================================
   分类页特定样式
   ======================================== */
.category-hero {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--gap);
  margin-bottom: 32px;
}

.category-info {
  background: var(--bg-secondary);
  padding: 32px;
  border-radius: 8px;
}

.category-info h1 {
  font-family: var(--font-heading);
  font-size: 32px;
  margin-bottom: 12px;
}

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

.category-stats {
  display: flex;
  gap: 24px;
  font-size: 14px;
  color: var(--text-muted);
}

/* ========================================
   文章页特定样式
   ======================================== */
.article-header {
  max-width: 800px;
  margin: 0 auto 32px;
  text-align: center;
}

.article-header .tag {
  display: inline-block;
  background: var(--accent-color);
  color: #fff;
  padding: 6px 16px;
  border-radius: 4px;
  font-size: 12px;
  margin-bottom: 16px;
}

.article-header h1 {
  font-family: var(--font-heading);
  font-size: 36px;
  line-height: 1.3;
  margin-bottom: 20px;
}

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

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

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

.article-main-image {
  max-width: 1000px;
  margin: 0 auto 40px;
}

.article-main-image img {
  width: 100%;
  height: 500px;
  object-fit: cover;
  border-radius: 8px;
}

.article-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 48px;
  max-width: 1000px;
  margin: 0 auto;
}

.article-content {
  font-size: 17px;
  line-height: 1.8;
}

.article-content h2 {
  font-family: var(--font-heading);
  font-size: 24px;
  margin: 32px 0 16px;
}

.article-content h3 {
  font-family: var(--font-heading);
  font-size: 20px;
  margin: 24px 0 12px;
}

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

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

.article-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
}

.tag-item {
  background: var(--bg-secondary);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  color: var(--text-secondary);
}

/* 侧边栏作者 */
.author-card {
  background: var(--bg-secondary);
  padding: 24px;
  border-radius: 8px;
  text-align: center;
}

.author-card .avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--accent-color);
  margin: 0 auto 16px;
}

.author-card h4 {
  font-family: var(--font-heading);
  font-size: 18px;
  margin-bottom: 8px;
}

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

/* 相关文章 */
.related-list {
  list-style: none;
}

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

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

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

/* ========================================
   404 页面
   ======================================== */
.error-page {
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 0;
}

.error-content h1 {
  font-family: var(--font-heading);
  font-size: 120px;
  color: var(--accent-color);
  line-height: 1;
}

.error-content h2 {
  font-family: var(--font-heading);
  font-size: 32px;
  margin-bottom: 16px;
}

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

/* ========================================
   Footer 页脚
   ======================================== */
.footer {
  background: var(--bg-dark);
  color: #fff;
  padding: 48px 0 24px;
}

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

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

.footer-brand p {
  opacity: 0.7;
  font-size: 14px;
  line-height: 1.6;
}

.footer-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.footer-links {
  list-style: none;
}

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

.footer-links a {
  color: rgba(255,255,255,0.7);
  font-size: 14px;
}

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

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  opacity: 0.6;
}

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

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

  .feature-large {
    grid-row: span 1;
  }

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

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

@media (max-width: 768px) {
  .header .container {
    flex-wrap: wrap;
  }

  .nav {
    order: 3;
    width: 100%;
    margin-top: 16px;
    gap: 20px;
    overflow-x: auto;
  }

  .hero-content h1 {
    font-size: 24px;
  }

  .hero-main img {
    height: 280px;
  }

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

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

  .subscribe-form {
    flex-direction: column;
  }

  .article-header h1 {
    font-size: 26px;
  }

  .article-main-image img {
    height: 240px;
  }

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

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