/* ===== 主题变量（浅色默认） ===== */
:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #f1f3f5;
  --text: #1f2933;
  --text-muted: #6b7280;
  --primary: #2563eb;
  --primary-dark: #1e40af;
  --border: #e5e7eb;
  --accent: #f59e0b;
  --code-bg: #f3f4f6;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --radius: 10px;
  --max-width: 1160px;
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text);
  line-height: 1.75; font-size: 16px;
}
img { max-width: 100%; height: auto; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.3; font-weight: 700; }

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

/* ===== Header ===== */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--surface); border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.header-inner { display: flex; align-items: center; gap: 16px; height: 60px; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 700;
  font-size: 18px; color: var(--text); }
.logo:hover { text-decoration: none; }
.logo-icon { font-size: 22px; }
.main-nav { margin-left: auto; }
.main-nav ul { display: flex; list-style: none; gap: 4px; flex-wrap: wrap; }
.main-nav a { display: block; padding: 8px 12px; border-radius: 6px;
  color: var(--text); font-size: 15px; }
.main-nav a:hover { background: var(--surface-2); text-decoration: none; }
.menu-toggle { display: none; flex-direction: column; gap: 4px; padding: 8px;
  background: none; border: none; cursor: pointer; }
.menu-toggle span { width: 22px; height: 2px; background: var(--text); border-radius: 1px; }
.theme-toggle { background: none; border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 10px; cursor: pointer; font-size: 16px; }

/* ===== Main ===== */
.main-content { min-height: calc(100vh - 200px); padding: 32px 20px; }

/* ===== Hero ===== */
.hero { text-align: center; padding: 48px 20px 40px; }
.hero h1 { font-size: 32px; margin-bottom: 12px; }
.hero-tagline { font-size: 18px; color: var(--primary); font-weight: 600; margin-bottom: 8px; }
.hero-desc { color: var(--text-muted); max-width: 640px; margin: 0 auto 24px; }
.hero-search { display: flex; max-width: 480px; margin: 0 auto; gap: 8px; }
.hero-search input { flex: 1; padding: 12px 16px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 15px; background: var(--surface); color: var(--text); }
.hero-search button { padding: 12px 20px; background: var(--primary); color: #fff;
  border: none; border-radius: 8px; font-size: 15px; cursor: pointer; }
.hero-search button:hover { background: var(--primary-dark); }

/* ===== Section ===== */
.section { margin: 40px 0; }
.section-title { font-size: 24px; margin-bottom: 20px; padding-bottom: 10px;
  border-bottom: 2px solid var(--border); }

/* ===== 分类卡片 ===== */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.cat-card { display: block; padding: 24px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); transition: transform .15s, box-shadow .15s; color: var(--text); }
.cat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); text-decoration: none; }
.cat-icon { font-size: 32px; }
.cat-card h3 { margin: 12px 0 8px; font-size: 18px; }
.cat-card p { color: var(--text-muted); font-size: 14px; min-height: 42px; }
.cat-count { display: inline-block; margin-top: 12px; font-size: 13px; color: var(--primary);
  background: var(--surface-2); padding: 2px 10px; border-radius: 20px; }

/* ===== 文章卡片 ===== */
.article-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.article-card { background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); transition: transform .15s, box-shadow .15s; }
.article-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.card-link { display: block; padding: 20px; color: var(--text); }
.card-link:hover { text-decoration: none; }
.card-cat { display: inline-block; font-size: 12px; color: var(--primary);
  background: var(--surface-2); padding: 2px 8px; border-radius: 4px; margin-bottom: 8px; }
.card-title { font-size: 17px; margin-bottom: 8px; line-height: 1.4; }
.card-summary { color: var(--text-muted); font-size: 14px; min-height: 48px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { font-size: 13px; color: var(--text-muted); margin-top: 12px; }

/* ===== 面包屑 ===== */
.breadcrumb { padding: 8px 0; margin-bottom: 16px; font-size: 14px; }
.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.breadcrumb li::after { content: "›"; margin-left: 6px; color: var(--text-muted); }
.breadcrumb li:last-child::after { content: ""; }
.breadcrumb a { color: var(--text-muted); }

/* ===== 两栏布局 ===== */
.layout-two-col { display: grid; grid-template-columns: 1fr 280px; gap: 32px; }
.category-header { margin-bottom: 24px; }
.category-header h1 { font-size: 28px; margin-bottom: 8px; }
.category-header p { color: var(--text-muted); }
.article-list { display: flex; flex-direction: column; gap: 16px; }
.article-list .article-card { background: var(--surface); }
.sidebar-block { background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.sidebar-block h3 { font-size: 15px; margin-bottom: 10px; }
.cat-list { list-style: none; }
.cat-list li a { display: block; padding: 6px 0; color: var(--text); font-size: 14px;
  border-bottom: 1px dashed var(--border); }
.cat-list li:last-child a { border-bottom: none; }

/* ===== 文章详情 ===== */
.article { background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 32px; max-width: 800px; margin: 0 auto; }
.article-cat { display: inline-block; font-size: 13px; color: var(--primary);
  background: var(--surface-2); padding: 2px 10px; border-radius: 4px; margin-bottom: 12px; }
.article-header h1 { font-size: 28px; margin-bottom: 12px; line-height: 1.35; }
.article-meta { font-size: 13px; color: var(--text-muted); display: flex; flex-wrap: wrap; gap: 12px; }
.article-content { margin: 24px 0; }
.article-content h2 { font-size: 22px; margin: 28px 0 12px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.article-content h3 { font-size: 18px; margin: 24px 0 8px; }
.article-content p { margin-bottom: 16px; }
.article-content ul, .article-content ol { margin: 0 0 16px 24px; }
.article-content li { margin-bottom: 6px; }
.article-content blockquote { border-left: 4px solid var(--primary); padding: 8px 16px;
  background: var(--surface-2); border-radius: 0 6px 6px 0; margin-bottom: 16px; color: var(--text-muted); }
.article-content code { background: var(--code-bg); padding: 2px 6px; border-radius: 4px; font-size: 14px; }
.article-content pre { background: var(--code-bg); padding: 16px; border-radius: 8px; overflow-x: auto; margin-bottom: 16px; }
.article-content pre code { background: none; padding: 0; }
.article-content img { border-radius: 8px; margin: 16px 0; }
.article-footer { border-top: 1px solid var(--border); padding-top: 16px; }
.article-tags { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tags-label { color: var(--text-muted); font-size: 14px; }

/* ===== FAQ ===== */
.faq-section { max-width: 800px; margin: 32px auto; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.faq-section h2 { font-size: 20px; margin-bottom: 16px; }
.faq-item { border-bottom: 1px solid var(--border); padding: 12px 0; }
.faq-item:last-child { border-bottom: none; }
.faq-item summary { cursor: pointer; font-weight: 600; font-size: 15px; }
.faq-answer { padding-top: 8px; color: var(--text-muted); font-size: 14px; }

/* ===== 相关文章 ===== */
.related-section { max-width: 800px; margin: 32px auto; }
.related-section h2 { font-size: 20px; margin-bottom: 16px; }
.related-list { list-style: none; }
.related-list li { padding: 10px 0; border-bottom: 1px solid var(--border); }
.related-meta { float: right; color: var(--text-muted); font-size: 13px; }

/* ===== 标签云 ===== */
.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { display: inline-block; padding: 4px 12px; background: var(--surface-2);
  border-radius: 20px; font-size: 13px; color: var(--text); }
.tag:hover { background: var(--primary); color: #fff; text-decoration: none; }

/* ===== 分页 ===== */
.pagination { display: flex; justify-content: center; gap: 6px; margin: 24px 0; flex-wrap: wrap; }
.page-link { display: inline-block; padding: 8px 14px; border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); font-size: 14px; }
.page-link:hover { background: var(--surface-2); text-decoration: none; }
.page-link.current { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ===== 搜索页 ===== */
.search-page { max-width: 720px; margin: 0 auto; }
.search-page h1 { font-size: 28px; margin-bottom: 20px; }
.search-form { display: flex; gap: 8px; margin-bottom: 24px; }
.search-form input { flex: 1; padding: 12px 16px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 15px; background: var(--surface); color: var(--text); }
.search-form button { padding: 12px 20px; background: var(--primary); color: #fff;
  border: none; border-radius: 8px; cursor: pointer; }
.search-hint { color: var(--text-muted); }
.search-result-item { padding: 16px; border: 1px solid var(--border); border-radius: 8px;
  margin-bottom: 12px; background: var(--surface); }
.search-result-item h3 { font-size: 16px; margin-bottom: 4px; }
.search-result-item p { color: var(--text-muted); font-size: 14px; }
.search-result-item .meta { font-size: 12px; color: var(--text-muted); margin-top: 6px; }

/* ===== 404 ===== */
.not-found { text-align: center; padding: 60px 20px; }
.not-found h1 { font-size: 72px; color: var(--primary); }
.not-found p { margin: 16px 0; color: var(--text-muted); }
.nf-search { max-width: 400px; margin: 20px auto; display: flex; gap: 8px; }
.nf-search input { flex: 1; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; }
.nf-search button { padding: 10px 16px; background: var(--primary); color: #fff; border: none; border-radius: 8px; }
.nf-cats { max-width: 360px; margin: 24px auto; }
.nf-cats ul { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.nf-cats a { padding: 6px 14px; background: var(--surface-2); border-radius: 20px; font-size: 14px; color: var(--text); }
.nf-home { margin-top: 24px; }

/* ===== Footer ===== */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); margin-top: 40px; }
.footer-inner { display: grid; grid-template-columns: 2fr 1fr 1fr 1.2fr; gap: 32px; padding: 32px 20px; }
.footer-contact .contact-note { font-size: 12px; color: var(--text-muted); margin-top: 8px; line-height: 1.5; }
.footer-contact .contact-phones a { display: inline-block; margin: 2px 8px 2px 0; color: var(--text); text-decoration: none; }
.footer-contact .contact-phones a:hover { color: var(--link); text-decoration: underline; }
.footer-col h3, .footer-col h4 { font-size: 16px; margin-bottom: 12px; }
.footer-col p { color: var(--text-muted); font-size: 14px; }
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 6px; }
.footer-col a { color: var(--text-muted); font-size: 14px; }
.footer-bottom { border-top: 1px solid var(--border); padding: 16px 20px; text-align: center;
  color: var(--text-muted); font-size: 13px; }
.footer-bottom .disclaimer { margin-top: 4px; font-size: 12px; opacity: 0.8; }

/* ===== 回到顶部 ===== */
.back-to-top { position: fixed; right: 24px; bottom: 24px; width: 44px; height: 44px;
  border-radius: 50%; background: var(--primary); color: #fff; border: none; cursor: pointer;
  font-size: 20px; box-shadow: var(--shadow); opacity: 0; visibility: hidden; transition: opacity .2s; }
.back-to-top.visible { opacity: 1; visibility: visible; }

/* ===== 响应式 ===== */
@media (max-width: 900px) {
  .layout-two-col { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; gap: 20px; }
}
@media (max-width: 720px) {
  .menu-toggle { display: flex; }
  .main-nav { position: fixed; top: 60px; left: 0; right: 0; background: var(--surface);
    border-bottom: 1px solid var(--border); padding: 12px 20px; transform: translateY(-150%);
    transition: transform .2s; }
  .main-nav.open { transform: translateY(0); }
  .main-nav ul { flex-direction: column; gap: 0; }
  .main-nav a { padding: 12px 0; border-bottom: 1px solid var(--border); }
  .hero h1 { font-size: 26px; }
  .article { padding: 20px; }
  .article-header h1 { font-size: 22px; }
}

/* ===== 打印 ===== */
@media print {
  .site-header, .site-footer, .back-to-top, .related-section, .menu-toggle, .theme-toggle { display: none; }
  body { background: #fff; }
}
