/*
Theme Name: Baidu SEO Knowledge
Theme URI: https://example.com/
Author: Codex
Author URI: https://example.com/
Description: 面向百度 SEO 知识站的轻量 WordPress 主题，支持动态分类、菜单、专题聚合、FAQ、面包屑与基础结构化数据。
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.9
Requires PHP: 7.4
Text Domain: baidu-seo-knowledge
*/

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-muted: #f1f5f9;
  --text: #172033;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #116149;
  --brand-dark: #0f4838;
  --brand-soft: #e7f4ef;
  --accent: #1d4ed8;
  --warning: #b45309;
  --radius: 8px;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
  --wrap: 1180px;
  --content: 780px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  text-rendering: optimizeLegibility;
}

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

a:hover {
  color: var(--brand);
  text-decoration: underline;
}

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

table {
  border-collapse: collapse;
  display: block;
  margin: 18px 0;
  max-width: 100%;
  overflow-x: auto;
  width: 100%;
}

th,
td {
  border: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--surface-muted);
}

.site-wrap {
  min-height: 100vh;
}

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

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar {
  align-items: center;
  display: flex;
  gap: 22px;
  min-height: 70px;
}

.site-brand {
  color: var(--text);
  display: inline-flex;
  flex-direction: column;
  flex: 0 0 auto;
  line-height: 1.25;
  max-width: 280px;
}

.site-brand:hover {
  text-decoration: none;
}

.site-brand strong {
  font-size: 20px;
  font-weight: 800;
}

.site-brand span {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.nav-toggle {
  display: none;
}

.primary-nav {
  flex: 1 1 auto;
}

.primary-nav ul {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.primary-nav a {
  border-radius: 6px;
  color: var(--text);
  display: block;
  font-size: 14px;
  padding: 7px 8px;
  white-space: nowrap;
}

.primary-nav a:hover {
  background: var(--brand-soft);
  color: var(--brand);
  text-decoration: none;
}

.site-search {
  display: flex;
  flex: 0 0 240px;
}

.site-search input[type="search"] {
  border: 1px solid var(--line);
  border-radius: 6px 0 0 6px;
  min-width: 0;
  padding: 9px 10px;
  width: 100%;
}

.site-search button,
.button-link,
.wp-block-button__link {
  background: var(--brand);
  border: 1px solid var(--brand);
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  font-size: 15px;
  font-weight: 700;
  justify-content: center;
  line-height: 1.4;
  padding: 9px 14px;
}

.site-search button {
  border-radius: 0 6px 6px 0;
  white-space: nowrap;
}

.button-link:hover,
.wp-block-button__link:hover,
.site-search button:hover {
  background: var(--brand-dark);
  color: #fff;
  text-decoration: none;
}

.hero {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 34px 0 28px;
}

.home-hero {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 24px 0 18px;
}

.home-hero-inner {
  align-items: end;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(260px, 0.7fr) minmax(0, 1.3fr);
}

.home-hero h1 {
  font-size: clamp(30px, 4vw, 42px);
  line-height: 1.2;
  margin: 0;
}

.home-search-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.home-search-strip a {
  background: var(--brand-soft);
  border: 1px solid #cae8dc;
  border-radius: 999px;
  color: var(--brand-dark);
  font-size: 14px;
  padding: 7px 12px;
}

.hero-grid {
  align-items: start;
  display: grid;
  gap: 28px;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
}

.eyebrow {
  color: var(--brand);
  font-size: 14px;
  font-weight: 800;
  margin: 0 0 8px;
}

.hero h1,
.page-title {
  font-size: clamp(28px, 4vw, 40px);
  letter-spacing: 0;
  line-height: 1.25;
  margin: 0 0 14px;
}

.hero p,
.archive-intro,
.term-description {
  color: var(--muted);
  margin: 0;
}

.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.quick-links a {
  background: var(--brand-soft);
  border: 1px solid #cae8dc;
  border-radius: 999px;
  color: var(--brand-dark);
  font-size: 14px;
  padding: 7px 12px;
}

.quick-links a:hover {
  background: #d8efe6;
  text-decoration: none;
}

.hero-searches {
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 18px;
}

.hero-searches strong {
  color: var(--text);
}

.topic-mini-list {
  display: grid;
  gap: 10px;
}

.topic-mini-list a {
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 7px;
  display: block;
  padding: 10px 12px;
}

.topic-mini-list a:hover {
  border-color: #b6d7ca;
  text-decoration: none;
}

.topic-mini-list strong,
.topic-mini-list span {
  display: block;
}

.topic-mini-list span {
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.hero-panel,
.side-card,
.card,
.article-card,
.toc,
.content-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.hero-panel {
  padding: 18px;
}

.hero-panel h2,
.side-card h2 {
  font-size: 18px;
  margin: 0 0 12px;
}

.main {
  padding: 28px 0 42px;
}

.home-main {
  padding-top: 18px;
}

.home-title {
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
  padding-bottom: 12px;
}

.home-title h1 {
  font-size: 28px;
  line-height: 1.25;
  margin: 0 0 4px;
}

.home-title p {
  color: var(--muted);
  margin: 0;
}

.knowledge-layout {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) 310px;
}

.knowledge-primary,
.knowledge-side {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.plain-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.plain-head {
  border-bottom: 1px solid var(--line);
  padding: 10px 14px;
}

.plain-head h2 {
  font-size: 18px;
  line-height: 1.35;
  margin: 0;
}

.category-rows {
  display: grid;
}

.category-row {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 14px;
  grid-template-columns: 130px minmax(0, 1fr);
  padding: 10px 14px;
}

.category-row:last-child {
  border-bottom: 0;
}

.category-name {
  color: var(--text);
  font-weight: 800;
}

.category-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
}

.category-links a,
.side-link-list a {
  color: var(--accent);
  font-size: 14px;
}

.compact-list,
.side-link-list {
  display: grid;
}

.compact-list a,
.side-link-list a,
.empty-inline {
  border-bottom: 1px solid var(--line);
  padding: 9px 14px;
}

.compact-list a {
  align-items: center;
  color: var(--text);
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.compact-list a:last-child,
.side-link-list a:last-child {
  border-bottom: 0;
}

.compact-list time {
  color: var(--muted);
  flex: 0 0 auto;
  font-size: 13px;
}

.section {
  margin-bottom: 28px;
}

.compact-section {
  margin-bottom: 22px;
}

.section-head {
  align-items: end;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-head h2 {
  font-size: 22px;
  line-height: 1.35;
  margin: 0;
}

.compact-head {
  margin-bottom: 10px;
}

.compact-head h2 {
  font-size: 20px;
}

.section-head p {
  color: var(--muted);
  margin: 4px 0 0;
}

.grid {
  display: grid;
  gap: 16px;
}

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

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

.card {
  min-width: 0;
  padding: 18px;
}

.card h3 {
  font-size: 18px;
  line-height: 1.35;
  margin: 0 0 8px;
}

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

.topic-card,
.faq-card {
  min-height: 132px;
}

.directory-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.directory-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-width: 0;
  padding: 14px;
}

.directory-card h3 {
  font-size: 18px;
  margin: 0 0 10px;
}

.mini-links {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.mini-links a,
.topic-index a,
.question-grid a {
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
  padding: 6px 9px;
}

.mini-links a:hover,
.topic-index a:hover,
.question-grid a:hover,
.home-search-strip a:hover {
  border-color: #b6d7ca;
  color: var(--brand);
  text-decoration: none;
}

.topic-index {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 14px;
}

.question-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.empty-inline {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  padding: 14px;
}

.card-meta {
  color: var(--muted);
  display: block;
  font-size: 13px;
  margin-bottom: 8px;
}

.layout {
  align-items: start;
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1fr) 320px;
}

.content-column {
  min-width: 0;
}

.sidebar {
  display: grid;
  gap: 16px;
  min-width: 0;
  position: sticky;
  top: 88px;
}

.side-card {
  padding: 16px;
}

.side-card ul,
.link-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.side-card li,
.link-list li {
  border-bottom: 1px solid var(--line);
  padding: 9px 0;
}

.side-card li:last-child,
.link-list li:last-child {
  border-bottom: 0;
}

.article-list {
  display: grid;
  gap: 14px;
}

.article-card {
  display: grid;
  gap: 14px;
  grid-template-columns: 180px minmax(0, 1fr);
  overflow: hidden;
}

.article-thumb {
  background: var(--surface-muted);
  min-height: 130px;
}

.article-thumb img {
  display: block;
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.article-body {
  padding: 16px 16px 16px 0;
}

.article-card.no-thumbnail .article-body {
  grid-column: 1 / -1;
  padding-left: 16px;
}

.article-body h2,
.article-body h3 {
  font-size: 20px;
  line-height: 1.4;
  margin: 0 0 8px;
}

.meta {
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 13px;
  gap: 8px 14px;
  margin-bottom: 8px;
}

.excerpt {
  color: var(--muted);
  margin: 0;
}

.breadcrumb {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 14px;
}

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

.content-box {
  padding: 28px;
}

.entry-header {
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
  padding-bottom: 18px;
}

.entry-summary {
  background: var(--surface-muted);
  border-left: 4px solid var(--brand);
  color: #334155;
  margin: 18px 0 0;
  padding: 12px 14px;
}

.entry-content {
  max-width: var(--content);
}

.entry-content h2 {
  border-bottom: 1px solid var(--line);
  font-size: 24px;
  line-height: 1.35;
  margin: 32px 0 14px;
  padding-bottom: 8px;
}

.entry-content h3 {
  font-size: 20px;
  line-height: 1.4;
  margin: 24px 0 10px;
}

.entry-content p {
  margin: 0 0 16px;
}

.entry-content ul,
.entry-content ol {
  padding-left: 1.4em;
}

.entry-content blockquote {
  background: var(--surface-muted);
  border-left: 4px solid var(--accent);
  margin: 18px 0;
  padding: 12px 16px;
}

.toc {
  margin: 18px 0 24px;
  max-width: var(--content);
  padding: 16px;
}

.toc strong {
  display: block;
  margin-bottom: 8px;
}

.toc ol {
  margin: 0;
  padding-left: 1.3em;
}

.faq-list details {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 10px;
  padding: 12px 14px;
}

.faq-list summary {
  cursor: pointer;
  font-weight: 800;
}

.post-nav {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr 1fr;
  margin-top: 24px;
  padding-top: 18px;
}

.pagination {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 24px;
}

.pagination .page-numbers {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  padding: 7px 11px;
}

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

.site-footer {
  background: #111827;
  color: #cbd5e1;
  padding: 24px 0 16px;
}

.footer-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: 1.3fr repeat(3, 1fr);
}

.footer-compact {
  align-items: start;
  display: grid;
  gap: 28px;
  grid-template-columns: 300px minmax(0, 1fr);
}

.footer-brand p {
  margin: 0;
}

.footer-inline-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-footer h2,
.site-footer h3 {
  color: #fff;
  font-size: 17px;
  margin: 0 0 10px;
}

.site-footer a {
  color: #dbeafe;
}

.footer-bottom {
  border-top: 1px solid rgba(226, 232, 240, 0.18);
  color: #94a3b8;
  font-size: 13px;
  margin-top: 18px;
  padding-top: 12px;
}

.footer-links {
  display: inline-flex;
  gap: 12px;
  margin-left: 14px;
}

.screen-reader-text {
  clip: rect(1px, 1px, 1px, 1px);
  height: 1px;
  overflow: hidden;
  position: absolute !important;
  width: 1px;
}

@media (max-width: 960px) {
  .topbar {
    align-items: stretch;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 0;
  }

  .site-brand {
    flex: 1 1 auto;
  }

  .nav-toggle {
    align-items: center;
    background: var(--surface-muted);
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--text);
    display: inline-flex;
    font-weight: 800;
    padding: 8px 11px;
  }

  .primary-nav,
  .site-search {
    display: none;
    flex: 0 0 100%;
  }

  .site-header.is-open .primary-nav {
    display: block;
  }

  .site-header.is-open .site-search {
    display: flex;
  }

  .primary-nav ul {
    align-items: stretch;
    display: grid;
  }

  .site-search {
    display: none;
  }

  .hero-grid,
  .layout,
  .footer-grid,
  .footer-compact,
  .home-hero-inner {
    grid-template-columns: 1fr;
  }

  .home-search-strip {
    justify-content: flex-start;
  }

  .sidebar {
    position: static;
  }

  .grid-3,
  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .directory-grid,
  .topic-index,
  .question-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  body {
    font-size: 16px;
  }

  .container {
    padding: 0 14px;
  }

  .hero {
    padding: 24px 0;
  }

  .grid-3,
  .grid-4,
  .directory-grid,
  .topic-index,
  .question-grid,
  .article-card,
  .post-nav {
    grid-template-columns: 1fr;
  }

  .article-body,
  .article-card.no-thumbnail .article-body {
    padding: 14px;
  }

  .article-thumb {
    min-height: 180px;
  }

  .content-box {
    padding: 18px;
  }

  .entry-content h2 {
    font-size: 22px;
  }

  .section-head {
    align-items: start;
    flex-direction: column;
  }
}
