/* ========================================
   技术小课堂 - 样式表
   www.wuhuihuaxia.cn
   ======================================== */

/* CSS 变量 */
:root {
  --accent-color: #607d8b;
  --accent-light: #78909c;
  --accent-dark: #455a64;
  --text-primary: #333;
  --text-secondary: #666;
  --text-muted: #999;
  --bg-primary: #fff;
  --bg-secondary: #f5f5f5;
  --bg-dark: #263238;
  --border-color: #e0e0e0;
  --shadow: 0 2px 8px rgba(0,0,0,0.1);
  --shadow-hover: 0 4px 16px rgba(0,0,0,0.15);
  --radius: 8px;
  --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: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
}

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

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

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

/* ========================================
   布局组件
   ======================================== */

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

/* 头部 */
.header {
  height: var(--header-height);
  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: 100%;
}

.logo {
  font-size: 20px;
  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;
  transition: color 0.2s;
}

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

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

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

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

/* 面包屑 */
.breadcrumb {
  padding: 16px 0;
  font-size: 13px;
  color: var(--text-muted);
}

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

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

.breadcrumb span {
  margin: 0 8px;
}

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

.hero h1 {
  font-size: 36px;
  font-weight: 700;
  margin-bottom: 12px;
}

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

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

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

.footer-brand .logo {
  color: #fff;
  margin-bottom: 12px;
  display: block;
}

.footer-brand p {
  color: rgba(255,255,255,0.6);
  font-size: 13px;
  line-height: 1.8;
}

.footer h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 16px;
  color: #fff;
}

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

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

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

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

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 20px;
  text-align: center;
  color: rgba(255,255,255,0.4);
  font-size: 12px;
}

/* ========================================
   内容组件
   ======================================== */

.section {
  padding: 48px 0;
}

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

/* 分类网格 */
.category-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.category-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  transition: all 0.3s;
}

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

.category-card .icon {
  width: 48px;
  height: 48px;
  background: var(--bg-secondary);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 24px;
}

.category-card h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}

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

/* 内容列表 */
.content-list {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
}

.content-item {
  display: flex;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  transition: background 0.2s;
}

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

.content-item:hover {
  background: var(--bg-secondary);
}

.content-item .thumb {
  width: 80px;
  height: 60px;
  background: var(--bg-secondary);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 20px;
  font-size: 28px;
  flex-shrink: 0;
}

.content-item .info {
  flex: 1;
}

.content-item h4 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-primary);
}

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

.content-item .meta span {
  margin-right: 16px;
}

.content-item .action {
  padding: 8px 20px;
  background: var(--accent-color);
  color: #fff;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
}

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

/* 文章卡片网格 */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

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

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

.article-card .cover {
  height: 160px;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
}

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

.article-card .category {
  font-size: 12px;
  color: var(--accent-color);
  font-weight: 500;
  margin-bottom: 8px;
}

.article-card h4 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 10px;
  line-height: 1.5;
}

.article-card .desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 12px;
}

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

/* 三栏文章列表 */
.article-columns {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}

.article-column h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--accent-color);
}

.article-column ul {
  list-style: none;
}

.article-column li {
  margin-bottom: 12px;
}

.article-column a {
  color: var(--text-secondary);
  font-size: 13px;
  display: block;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border-color);
}

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

/* 规格表格 */
.spec-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-primary);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.spec-table th,
.spec-table td {
  padding: 16px 20px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.spec-table th {
  background: var(--bg-secondary);
  font-weight: 600;
  font-size: 13px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.spec-table td {
  font-size: 14px;
}

.spec-table tr:last-child td {
  border-bottom: none;
}

.spec-table tr:hover td {
  background: var(--bg-secondary);
}

/* 规格卡片 */
.spec-card {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
}

.spec-card h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-color);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

.spec-list li {
  display: flex;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 14px;
}

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

.spec-list .label {
  width: 140px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.spec-list .value {
  color: var(--text-primary);
  font-weight: 500;
}

/* 文章正文 */
.article-header {
  text-align: center;
  padding: 40px 0;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 40px;
}

.article-header h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 16px;
}

.article-header .meta {
  color: var(--text-muted);
  font-size: 14px;
}

.article-header .meta span {
  margin: 0 12px;
}

.article-content {
  max-width: 800px;
  margin: 0 auto;
  font-size: 15px;
  line-height: 1.8;
  color: var(--text-primary);
}

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

.article-content h3 {
  font-size: 18px;
  font-weight: 600;
  margin: 32px 0 16px;
}

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

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

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

.article-content code {
  background: var(--bg-secondary);
  padding: 2px 8px;
  border-radius: 4px;
  font-family: "Monaco", "Consolas", monospace;
  font-size: 13px;
}

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

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

/* 按钮 */
.btn {
  display: inline-block;
  padding: 10px 24px;
  border-radius: var(--radius);
  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;
}

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

.pagination a,
.pagination span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

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

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

/* 404 页面 */
.error-page {
  text-align: center;
  padding: 100px 20px;
}

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

.error-title {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 16px;
}

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

/* 相关推荐 */
.related-bar {
  background: var(--bg-secondary);
  padding: 24px 0;
  margin-top: 48px;
}

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

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

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

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

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

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

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

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

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

  .nav {
    display: none;
  }

  .search-box {
    width: 160px;
    padding: 6px 12px;
  }

  .hero {
    padding: 40px 0;
  }

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

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

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

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

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

  .content-item {
    flex-wrap: wrap;
  }

  .content-item .action {
    margin-top: 12px;
    width: 100%;
    text-align: center;
  }

  .spec-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

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

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

  .article-content {
    font-size: 14px;
  }

  .article-content h2 {
    font-size: 18px;
  }

  .article-content h3 {
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 16px;
  }

  .section {
    padding: 32px 0;
  }

  .section-title {
    font-size: 18px;
  }

  .error-code {
    font-size: 80px;
  }
}
