/*
Theme Name: 数智化转型网-轻量
Theme URI: https://www.szhzxw.cn/
Author: 数智化转型网
Author URI: https://www.szhzxw.cn/
Description: 为数智化转型网重写的轻量 WordPress 主题。视觉风格保留原主题 Dameiti 的深蓝主调 (#152d8d) 与卡片化布局；代码完全重写，移除 jQuery 与 5 个第三方插件，PHP 仅保留必要 WP_Query 并使用 transient 缓存，目标是彻底解决原主题慢查询多、CPU 高的问题。
Version: 1.0.0
Requires at least: 5.0
Tested up to: 6.6
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: szh-light
Tags: two-columns, right-sidebar, custom-menu, featured-images, translation-ready
*/

/*--------------------------------------------------------------
# 0. Reset（精简版）
--------------------------------------------------------------*/
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: #f5f5f5;
  color: #444;
  font: 15px/1.7 "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4, h5, h6, p, ul, ol, figure, blockquote, pre { margin: 0 0 1em; }
ul, ol { padding-left: 1.4em; }
img { max-width: 100%; height: auto; vertical-align: middle; border: 0; }
a { color: #333; text-decoration: none; background: transparent; }
a:hover { color: #00aeff; }

/*--------------------------------------------------------------
# 1. 主题色（CSS 变量）
--------------------------------------------------------------*/
:root {
  --c-primary: #152d8d;
  --c-primary-dark: #0f226b;
  --c-accent: #00aeff;
  --c-badge: #ffbe02;
  --c-text: #333;
  --c-text-light: #666;
  --c-text-muted: #999;
  --c-bg: #f5f5f5;
  --c-bg-card: #fff;
  --c-border: #eaeaea;
  --c-link-hover: #00aeff;
  --container: 1200px;
  --radius: 4px;
  --gap: 20px;
}

/*--------------------------------------------------------------
# 2. 容器
--------------------------------------------------------------*/
.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 15px;
}
.container::after { content: ""; display: block; clear: both; }

/*--------------------------------------------------------------
# 3. 顶部 top-bar
--------------------------------------------------------------*/
.top-bar {
  background: #fafafa;
  border-bottom: 1px solid var(--c-border);
  font-size: 13px;
  color: var(--c-text-muted);
  height: 34px;
  line-height: 34px;
}
.top-bar a { color: var(--c-text-light); margin: 0 8px; }
.top-bar a:hover { color: var(--c-primary); }
.top-bar .header-right { float: right; }
.top-bar .header-right li { display: inline-block; list-style: none; }

/*--------------------------------------------------------------
# 4. 头部 header + 主导航
--------------------------------------------------------------*/
.site-header {
  background: #fff;
  height: 75px;
  box-shadow: 0 0 4px rgba(0,0,0,0.06);
  position: relative;
  z-index: 50;
}
.site-header .container { display: flex; align-items: center; height: 100%; }
.site-branding { flex: 0 0 auto; }
.site-branding .site-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
}
.site-branding .site-title a { color: var(--c-primary); }
.site-branding .site-description { display: none; }
.site-branding .custom-logo { max-height: 60px; width: auto; }

/* 主导航 */
.main-navigation {
  flex: 1 1 auto;
  margin-left: 40px;
}
.main-navigation ul.menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
}
.main-navigation ul.menu > li {
  position: relative;
  margin: 0 12px;
}
.main-navigation ul.menu > li > a {
  display: block;
  height: 75px;
  line-height: 75px;
  font-size: 15px;
  color: var(--c-text);
  font-weight: 500;
  position: relative;
}
.main-navigation ul.menu > li > a:hover,
.main-navigation ul.menu > li.current-menu-item > a,
.main-navigation ul.menu > li.current-menu-ancestor > a {
  color: var(--c-primary);
}
.main-navigation ul.menu > li > a:hover::after,
.main-navigation ul.menu > li.current-menu-item > a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 18px;
  height: 2px;
  background: var(--c-primary);
}
.main-navigation .sub-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 180px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  padding: 8px 0;
  display: none;
  z-index: 99;
}
.main-navigation li:hover > .sub-menu,
.main-navigation li:focus-within > .sub-menu { display: block; }
.main-navigation .sub-menu li { margin: 0; }
.main-navigation .sub-menu li a {
  display: block;
  padding: 8px 18px;
  font-size: 14px;
  height: auto;
  line-height: 1.5;
  white-space: nowrap;
}
.main-navigation .sub-menu li a:hover { background: #f8f9fb; color: var(--c-primary); }

/* 搜索图标 */
.header-search-toggle {
  flex: 0 0 auto;
  margin-left: auto;
  cursor: pointer;
  color: var(--c-text-light);
  font-size: 18px;
}
.header-search {
  position: absolute;
  top: 75px; right: 0;
  width: 320px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  padding: 12px;
  display: none;
}
.header-search.active { display: block; }
.header-search input[type="search"] {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
}

/*--------------------------------------------------------------
# 5. 主内容区
--------------------------------------------------------------*/
.site-content {
  margin-top: 20px;
  margin-bottom: 30px;
}
.content-area {
  width: calc(100% - 320px);
  float: left;
}
.sidebar-area {
  width: 300px;
  float: right;
  position: sticky;
  top: 20px;
}
@media (max-width: 959px) {
  .content-area, .sidebar-area { width: 100%; float: none; }
  .sidebar-area { margin-top: 30px; position: static; }
}

/*--------------------------------------------------------------
# 6. 卡片 / 列表条目
--------------------------------------------------------------*/
.post-card {
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 15px;
  margin-bottom: 15px;
  display: flex;
  gap: 15px;
}
.post-card .thumbnail {
  flex: 0 0 220px;
  overflow: hidden;
  border-radius: var(--radius);
}
.post-card .thumbnail img { width: 100%; height: 140px; object-fit: cover; }
.post-card .body { flex: 1 1 auto; min-width: 0; }
.post-card .entry-title {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
  margin: 0 0 8px;
}
.post-card .entry-title a { color: var(--c-text); }
.post-card .entry-title a:hover { color: var(--c-primary); }
.post-card .entry-meta {
  font-size: 12px;
  color: var(--c-text-muted);
  margin-bottom: 8px;
}
.post-card .entry-meta span { margin-right: 12px; }
.post-card .entry-meta a { color: var(--c-text-muted); }
.post-card .entry-summary {
  font-size: 13px;
  color: var(--c-text-light);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-card .entry-cats {
  display: inline-block;
  font-size: 12px;
  color: #fff;
  background: var(--c-primary);
  padding: 1px 8px;
  border-radius: 2px;
  margin-right: 8px;
}
@media (max-width: 600px) {
  .post-card { flex-direction: column; }
  .post-card .thumbnail { flex: 0 0 auto; }
  .post-card .thumbnail img { height: 180px; }
}

/* 文章无图 默认缩略图 */
.post-card .thumbnail.no-thumb {
  background: linear-gradient(135deg, #152d8d 0%, #00aeff 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 32px;
  font-weight: 700;
}

/*--------------------------------------------------------------
# 7. 首页区块（content-block）
--------------------------------------------------------------*/
.content-block {
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  margin-bottom: 20px;
  overflow: hidden;
}
.block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid var(--c-border);
  background: #fafafa;
}
.block-header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}
.block-header h2 a { color: var(--c-primary); }
.block-header .block-more {
  font-size: 13px;
  color: var(--c-text-muted);
}
.block-header .block-more:hover { color: var(--c-primary); }
.block-body { padding: 18px; }

/* 焦点大图（hero） */
.hero-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 15px;
}
.hero-grid .hero-main .post-card .thumbnail img { height: 300px; }
.hero-grid .hero-main .post-card .entry-title { font-size: 22px; }
.hero-grid .hero-side .post-card { padding: 10px; }
.hero-grid .hero-side .post-card .thumbnail { flex: 0 0 90px; }
.hero-grid .hero-side .post-card .thumbnail img { height: 60px; }
.hero-grid .hero-side .post-card .entry-title { font-size: 14px; }
@media (max-width: 600px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-grid .hero-main .post-card .thumbnail img { height: 200px; }
}

/* 网格列表（3 列） */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
}
.grid-3 .post-card { flex-direction: column; padding: 10px; }
.grid-3 .post-card .thumbnail img { height: 130px; }
.grid-3 .post-card .entry-title { font-size: 14px; }
.grid-3 .post-card .entry-summary { display: none; }
@media (max-width: 959px) { .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .grid-3 { grid-template-columns: 1fr; } }

/* Tab 切换（原生 JS 驱动） */
.block-tabs {
  display: flex;
  gap: 20px;
  margin-bottom: 15px;
  border-bottom: 1px solid var(--c-border);
}
.block-tabs .tab {
  cursor: pointer;
  padding: 8px 2px;
  font-size: 14px;
  color: var(--c-text-light);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.block-tabs .tab.active { color: var(--c-primary); border-bottom-color: var(--c-primary); font-weight: 600; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/*--------------------------------------------------------------
# 8. 右栏侧边栏
--------------------------------------------------------------*/
.widget-area .widget {
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  margin-bottom: 20px;
  overflow: hidden;
}
.widget .widget-title {
  margin: 0;
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 600;
  border-bottom: 1px solid var(--c-border);
  background: #fafafa;
  color: var(--c-primary);
}
.widget .widget-body { padding: 15px; }

/* 标签云 */
.tagcloud { padding: 12px 15px; }
.tagcloud a {
  display: inline-block;
  padding: 3px 9px;
  margin: 0 4px 6px 0;
  background: #f5f5f5;
  border-radius: 2px;
  font-size: 13px !important;
  color: var(--c-text-light);
}
.tagcloud a:hover { background: var(--c-primary); color: #fff; }

/* 热门文章 */
.popular-posts { list-style: none; margin: 0; padding: 0; }
.popular-posts li {
  padding: 10px 15px;
  border-bottom: 1px dashed var(--c-border);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}
.popular-posts li:last-child { border-bottom: 0; }
.popular-posts .rank {
  display: inline-block;
  width: 20px;
  height: 20px;
  line-height: 20px;
  text-align: center;
  background: #ddd;
  color: #fff;
  font-size: 12px;
  border-radius: 2px;
  flex: 0 0 20px;
}
.popular-posts li:nth-child(1) .rank { background: #f54545; }
.popular-posts li:nth-child(2) .rank { background: #ff8522; }
.popular-posts li:nth-child(3) .rank { background: var(--c-badge); }
.popular-posts a { color: var(--c-text); flex: 1; }
.popular-posts a:hover { color: var(--c-primary); }

/* 二维码 */
.qrcode-widget { text-align: center; }
.qrcode-widget img { width: 160px; height: 160px; }
.qrcode-widget p { margin: 8px 0 0; font-size: 13px; color: var(--c-text-muted); }

/*--------------------------------------------------------------
# 9. 文章页（single）
--------------------------------------------------------------*/
.entry-header {
  padding: 20px 25px;
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  margin-bottom: 15px;
}
.entry-header .entry-title {
  margin: 0 0 12px;
  font-size: 26px;
  line-height: 1.4;
  color: var(--c-text);
}
.entry-header .entry-meta {
  font-size: 13px;
  color: var(--c-text-muted);
}
.entry-header .entry-meta span { margin-right: 15px; }

.entry-content {
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 25px;
  font-size: 16px;
  line-height: 1.8;
  color: var(--c-text);
}
.entry-content h2, .entry-content h3, .entry-content h4 {
  margin-top: 1.6em;
  margin-bottom: 0.6em;
  font-weight: 600;
  color: var(--c-text);
}
.entry-content h2 { font-size: 22px; border-left: 4px solid var(--c-primary); padding-left: 10px; }
.entry-content h3 { font-size: 18px; }
.entry-content p { margin: 0 0 1.2em; }
.entry-content a { color: var(--c-primary); text-decoration: underline; }
.entry-content a:hover { color: var(--c-accent); text-decoration: none; }
.entry-content img { margin: 10px 0; border-radius: var(--radius); }
.entry-content blockquote {
  border-left: 4px solid var(--c-primary);
  background: #f8f9fb;
  padding: 12px 18px;
  margin: 1.2em 0;
  color: var(--c-text-light);
}
.entry-content code {
  background: #f5f5f5;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.92em;
}
.entry-content pre {
  background: #2d2d2d;
  color: #f8f8f2;
  padding: 15px;
  border-radius: var(--radius);
  overflow-x: auto;
}
.entry-content pre code { background: transparent; color: inherit; padding: 0; }
.entry-content ul, .entry-content ol { padding-left: 1.6em; }
.entry-content table { width: 100%; border-collapse: collapse; margin: 1em 0; }
.entry-content table th, .entry-content table td { border: 1px solid var(--c-border); padding: 8px 12px; }
.entry-content table thead { background: #fafafa; }

.entry-footer {
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 15px 25px;
  margin-top: 15px;
  font-size: 13px;
  color: var(--c-text-muted);
}
.entry-footer .tags a {
  display: inline-block;
  padding: 2px 10px;
  background: #f5f5f5;
  border-radius: 2px;
  margin: 0 4px 4px 0;
  color: var(--c-text-light);
}
.entry-footer .tags a:hover { background: var(--c-primary); color: #fff; }

.author-box {
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 15px;
  display: flex;
  gap: 15px;
}
.author-box .avatar { width: 60px; height: 60px; border-radius: 50%; }
.author-box .author-name { font-weight: 600; margin-bottom: 5px; }
.author-box .author-bio { font-size: 13px; color: var(--c-text-light); }

.post-navigation {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  margin-top: 15px;
}
.post-navigation a {
  flex: 1;
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 12px 15px;
  font-size: 13px;
  color: var(--c-text-light);
}
.post-navigation a:hover { border-color: var(--c-primary); color: var(--c-primary); }
.post-navigation .prev::before { content: "← "; }
.post-navigation .next { text-align: right; }
.post-navigation .next::after { content: " →"; }

.comments-area {
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 15px;
}

/*--------------------------------------------------------------
# 10. 面包屑
--------------------------------------------------------------*/
.breadcrumbs {
  background: #fbfbfb;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 10px 18px;
  margin-bottom: 15px;
  font-size: 13px;
  color: var(--c-text-muted);
}
.breadcrumbs a { color: var(--c-text-light); }
.breadcrumbs a:hover { color: var(--c-primary); }
.breadcrumbs .separator { margin: 0 8px; color: var(--c-text-muted); }

/*--------------------------------------------------------------
# 11. 翻页
--------------------------------------------------------------*/
.pagination {
  margin: 20px 0;
  text-align: center;
}
.pagination .page-numbers {
  display: inline-block;
  padding: 6px 12px;
  margin: 0 2px;
  border: 1px solid var(--c-border);
  background: #fff;
  border-radius: var(--radius);
  color: var(--c-text-light);
  font-size: 13px;
}
.pagination .page-numbers.current,
.pagination .page-numbers:hover {
  background: var(--c-primary);
  color: #fff;
  border-color: var(--c-primary);
}

/*--------------------------------------------------------------
# 12. footer
--------------------------------------------------------------*/
.site-footer {
  background: #2a2a2a;
  color: #aaa;
  padding: 30px 0 20px;
  margin-top: 40px;
  font-size: 13px;
}
.site-footer .footer-widgets {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 30px;
  padding-bottom: 20px;
  border-bottom: 1px solid #3a3a3a;
}
.site-footer .footer-widget h3 {
  font-size: 15px;
  color: #fff;
  margin-bottom: 12px;
  font-weight: 600;
}
.site-footer .footer-widget ul { list-style: none; padding: 0; margin: 0; }
.site-footer .footer-widget li { margin-bottom: 6px; }
.site-footer .footer-widget a { color: #aaa; }
.site-footer .footer-widget a:hover { color: #fff; }
.site-footer .footer-widget .qrcode-widget img { width: 120px; height: 120px; }
.site-footer .footer-bottom {
  padding-top: 15px;
  text-align: center;
  color: #888;
  font-size: 12px;
}
.site-footer .footer-bottom a { color: #aaa; margin: 0 8px; }
@media (max-width: 959px) {
  .site-footer .footer-widgets { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .site-footer .footer-widgets { grid-template-columns: 1fr; }
}

/*--------------------------------------------------------------
# 13. 页面模板
--------------------------------------------------------------*/
.page-header {
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 20px 25px;
  margin-bottom: 15px;
}
.page-header h1 {
  margin: 0 0 6px;
  font-size: 22px;
  color: var(--c-text);
}
.page-header .page-description { color: var(--c-text-light); font-size: 14px; }

.search-results-list { list-style: none; padding: 0; margin: 0; }
.search-results-list li {
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 15px;
  margin-bottom: 10px;
}
.search-results-list h2 { font-size: 16px; margin: 0 0 6px; }

.error-404 {
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 60px 20px;
  text-align: center;
}
.error-404 h1 { font-size: 80px; color: var(--c-primary); margin: 0; }
.error-404 p { color: var(--c-text-light); font-size: 16px; }
.error-404 .search-form { max-width: 400px; margin: 20px auto; }

/*--------------------------------------------------------------
# 14. 通用工具
--------------------------------------------------------------*/
.clear::after { content: ""; display: block; clear: both; }
.text-muted { color: var(--c-text-muted); }
.text-center { text-align: center; }
.mb-0 { margin-bottom: 0 !important; }
.mt-0 { margin-top: 0 !important; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--c-primary);
  color: #fff;
  padding: 8px 16px;
  z-index: 999;
}
.skip-link:focus { left: 0; }

/*--------------------------------------------------------------
# 15. 响应式
--------------------------------------------------------------*/
@media (max-width: 959px) {
  .site-header { height: 60px; }
  .site-header .main-navigation,
  .site-header .header-search-toggle { display: none; }
  .site-header .header-search { width: 100%; top: 60px; }
  .main-navigation.mobile-open {
    display: block;
    position: absolute;
    top: 60px; left: 0; right: 0;
    background: #fff;
    margin: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  }
  .main-navigation.mobile-open ul.menu {
    flex-direction: column;
  }
  .main-navigation.mobile-open ul.menu > li {
    margin: 0;
    border-bottom: 1px solid var(--c-border);
  }
  .main-navigation.mobile-open ul.menu > li > a {
    height: 44px;
    line-height: 44px;
    padding: 0 15px;
  }
  .main-navigation.mobile-open .sub-menu {
    position: static;
    box-shadow: none;
    padding: 0 0 0 15px;
  }
  .header-mobile-toggle {
    display: block;
    margin-left: auto;
    font-size: 22px;
    cursor: pointer;
    color: var(--c-text);
  }
}
@media (min-width: 960px) {
  .header-mobile-toggle { display: none; }
}

@media (max-width: 480px) {
  .top-bar { display: none; }
  .entry-header .entry-title { font-size: 20px; }
  .entry-content { font-size: 15px; padding: 18px; }
}
