/*
Theme Name: Cainuan
Theme URI:  https://www.cainuan123.com
Author:     Cainuan
Author URI: https://www.cainuan123.com
Description: 本地暖通网专用主题 — 卡片式、两栏、紫色风格
Requires at least: 5.0
Requires PHP: 7.4
Version: 1.1
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: cainuan
*/

/* ========== 1. Variables ========== */
:root {
  --primary: #7c5cbf;
  --primary-dark: #5a3d9a;
  --primary-light: #f0ebff;
  --accent: #34a853;
  --bg: #f5f6f7;
  --card-bg: #ffffff;
  --text: #2d2d4e;
  --text-secondary: #5f6368;
  --text-muted: #9aa0a6;
  --border: #e0e0e0;
  --border-light: #f0f0f0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.10);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 4px;
  --max-width: 1200px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", system-ui, sans-serif;
}

/* ========== 2. Reset ========== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.7;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; height: auto; }

/* ========== 3. Top Notice Bar ========== */
.top-notice {
  background: var(--primary);
  color: #fff;
  text-align: center;
  font-size: 13px;
  padding: 8px 20px;
  letter-spacing: 0.5px;
}
.top-notice a { color: #fff; text-decoration: underline; }

/* ========== 4. Header ========== */
.site-header {
  background: var(--card-bg);
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.site-branding {
  display: flex;
  align-items: center;
  gap: 12px;
}
.custom-logo { max-height: 40px; width: auto; }
.site-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
}
.site-title a { color: var(--text) !important; }
.site-description { display: none; }

.main-nav { display: flex; align-items: center; gap: 0; }
.main-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 0;
}
.main-nav ul li { margin: 0; padding: 0; position: relative; }
.main-nav ul li a {
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  padding: 0 16px;
  line-height: 64px;
  display: block;
  letter-spacing: 0.3px;
  transition: color 0.2s;
  white-space: nowrap;
}
.main-nav ul li a:hover,
.main-nav ul li.current-menu-item > a { color: var(--primary) !important; }
.main-nav ul li.current-menu-item > a { font-weight: 600; }

/* Sub-menu */
.main-nav ul ul {
  display: none;
  position: absolute;
  top: 64px;
  left: 0;
  background: var(--card-bg);
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-sm);
  padding: 8px 0;
  min-width: 160px;
  z-index: 200;
}
.main-nav ul li:hover > ul { display: block; }
.main-nav ul ul li { display: block; }
.main-nav ul ul li a {
  line-height: 40px;
  padding: 0 20px;
  font-size: 13px;
  white-space: nowrap;
}

.search-toggle {
  width: 36px;
  height: 36px;
  border: none;
  background: var(--bg);
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  margin-left: 8px;
  transition: background 0.2s;
}
.search-toggle:hover { background: var(--border-light); }

/* Mobile menu toggle */
.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text);
  padding: 0;
  line-height: 64px;
}

/* ========== 5. Hero Section (front-page) ========== */
.hero-section {
  max-width: var(--max-width);
  margin: 0 auto 28px;
  padding: 0 20px;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 20px;
}
.hero-main {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 360px;
  display: flex;
  align-items: flex-end;
  cursor: pointer;
  transition: box-shadow 0.3s;
  text-decoration: none;
  color: #fff;
}
.hero-main:hover { box-shadow: var(--shadow-lg); }
.hero-main-overlay {
  padding: 32px;
  color: #fff;
  width: 100%;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
}
.hero-main-overlay .cat-tag {
  display: inline-block;
  background: rgba(255,255,255,0.2);
  padding: 2px 10px;
  border-radius: var(--radius-xs);
  font-size: 11px;
  font-weight: 500;
  margin-bottom: 8px;
  backdrop-filter: blur(4px);
}
.hero-main-overlay h2 {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 8px;
  color: #fff;
}
.hero-main-overlay .meta {
  font-size: 13px;
  opacity: 0.8;
}

.hero-side {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.hero-side-item {
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.2s;
  flex: 1;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--text);
}
.hero-side-item:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.hero-side-img {
  height: 120px;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}
.hero-side-img .cat-tag {
  position: absolute;
  top: 10px; left: 10px;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  font-weight: 500;
}
.hero-side-content { padding: 14px 16px; flex: 1; }
.hero-side-content h3 {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  margin: 0;
  color: var(--text);
}
.hero-side-content .meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ========== 6. Category Nav (front-page) ========== */
.category-nav {
  max-width: var(--max-width);
  margin: 28px auto;
  padding: 0 20px;
}
.cat-nav-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}
.cat-nav-item {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.2s;
  text-decoration: none;
  color: var(--text);
  display: block;
}
.cat-nav-item:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.cat-nav-item .icon {
  font-size: 28px;
  margin-bottom: 6px;
  display: block;
}
.cat-nav-item .label {
  font-size: 13px;
  font-weight: 600;
  display: block;
}
.cat-nav-item .count {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
  margin-top: 2px;
}

/* ========== 7. Content Layout ========== */
.site-content {
  max-width: var(--max-width);
  margin: 24px auto;
  padding: 0 20px;
}
.content-row,
.content-area {
  display: flex;
  gap: 24px;
  margin-top: 8px;
}
.content-main,
.main-column { flex: 1; min-width: 0; }
.content-sidebar { width: 320px; flex-shrink: 0; }

/* ========== 8. Article Cards ========== */
.article-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  transition: box-shadow 0.2s, transform 0.2s;
  border: 1px solid var(--border-light);
}
.article-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
  border-color: var(--primary-light);
}
.article-card-img {
  width: 200px;
  min-height: 140px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  background: var(--bg);
  display: block;
}
.article-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0; left: 0;
}
.article-card-img .cat-tag {
  position: absolute;
  top: 10px; left: 10px;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  padding: 2px 10px;
  border-radius: var(--radius-xs);
  font-weight: 500;
  z-index: 1;
}
.article-card-body {
  padding: 18px 22px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.article-card-body h3 {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.5;
  margin: 0 0 8px;
}
.article-card-body h3 a { color: var(--text); }
.article-card-body h3 a:hover { color: var(--primary); }
.article-card-body p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
  flex: 1;
  margin: 0;
}
.article-meta,
.article-card-body .meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 10px;
}
.article-meta a,
.article-card-body .meta a { color: var(--text-muted); }
.article-meta a:hover,
.article-card-body .meta a:hover { color: var(--primary); }

/* Article card without image — text only, card style with left accent */
.article-card.no-image {
  border-left: 3px solid var(--primary-light);
  padding-left: 0;
}
.article-card.no-image:hover {
  border-left-color: var(--primary);
}
.article-card.no-image .article-card-body {
  padding: 18px 22px;
}

/* ========== 9. Section Headers (front-page) ========== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-header h2 {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  position: relative;
  padding-left: 14px;
}
.section-header h2::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 3px;
  background: var(--primary);
  border-radius: 2px;
}
.section-header .more-link {
  font-size: 13px;
  color: var(--primary);
  font-weight: 500;
}
.section-header .more-link:hover { text-decoration: underline; }

.article-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

/* ========== 10. Pagination ========== */
.pagination-wrap {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 24px 0;
}
.pagination-wrap .page-numbers,
.pagination-wrap a.page-numbers {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 8px 14px;
  font-size: 14px;
  color: var(--text);
  text-decoration: none;
  transition: all 0.2s;
}
.pagination-wrap .page-numbers.current,
.pagination-wrap .page-numbers:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ========== 11. Sidebar Widgets ========== */
.widget {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  margin-bottom: 20px;
}
.widget-title {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--primary);
}
.widget ul { list-style: none; margin: 0; padding: 0; }
.widget ul li {
  border-bottom: 1px solid var(--border-light);
  padding: 8px 0;
}
.widget ul li:last-child { border-bottom: none; }
.widget ul li a {
  color: var(--text);
  font-size: 14px;
}
.widget ul li a:hover { color: var(--primary); }

/* Popular posts (numbered list) */
.popular-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.popular-list li {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
  align-items: flex-start;
}
.popular-list li:last-child { border-bottom: none; }
.popular-list .num {
  width: 24px; height: 24px;
  background: var(--bg);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
  margin-top: 2px;
}
.popular-list li:nth-child(1) .num,
.popular-list li:nth-child(2) .num,
.popular-list li:nth-child(3) .num {
  background: var(--primary-light);
  color: var(--primary);
}
.popular-list li a {
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  line-height: 1.4;
}
.popular-list li a:hover { color: var(--primary); }

/* City grid */
.city-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.city-list a {
  display: block;
  padding: 6px 10px;
  background: var(--bg);
  border-radius: var(--radius-xs);
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  text-align: center;
  transition: all 0.2s;
}
.city-list a:hover {
  background: var(--primary-light);
  color: var(--primary);
}

/* Tag cloud */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tag-cloud a {
  display: block;
  padding: 4px 10px;
  background: var(--bg);
  border-radius: var(--radius-xs);
  font-size: 12px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.2s;
}
.tag-cloud a:hover {
  background: var(--primary);
  color: #fff;
}

/* ========== 12. Archive Header ========== */
.archive-header {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px 24px;
  margin-bottom: 20px;
}
.archive-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0;
}
.archive-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 6px;
}

/* ========== 13. Single Post ========== */
.single-header {
  background: var(--card-bg);
  padding: 24px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}
.single-header .entry-title {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 10px;
}
.single-header .entry-meta {
  font-size: 13px;
  color: var(--text-muted);
}
.single-header .entry-meta a { color: var(--text-muted); }
.single-header .entry-meta a:hover { color: var(--primary); }
.single-header .cat-links { margin-bottom: 10px; }
.single-header .cat-links a {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary) !important;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  font-weight: 500;
  margin-right: 4px;
}
.single .entry-content, .page .entry-content {
  background: var(--card-bg);
  padding: 24px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  font-size: 16px;
  line-height: 1.8;
}
.single .entry-content img, .page .entry-content img {
  border-radius: var(--radius-sm);
  margin: 16px 0;
}
.single .entry-footer {
  margin-top: 20px;
  font-size: 13px;
  color: var(--text-secondary);
}
.single .entry-footer a { color: var(--text-secondary); }
.single .entry-footer a:hover { color: var(--primary); }

/* Post navigation */
.post-navigation {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px 24px;
  margin-top: 20px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
}
.post-navigation .nav-previous,
.post-navigation .nav-next { flex: 1; }
.post-navigation a {
  font-size: 14px;
  color: var(--text);
}
.post-navigation a:hover { color: var(--primary); }

/* Comments */
.comments-area {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  margin-top: 20px;
}
.comments-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 16px;
}

/* ========== 14. Footer ========== */
.site-footer {
  background: #22223a;
  color: #8a7aa0;
  margin-top: 40px;
}
.footer-bottom-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 13px;
  color: #8a7aa0;
  text-align: center;
}
.footer-bottom-inner a { color: #9990b0; }
.footer-bottom-inner a:hover { color: #d0c8e0; }
.footer-legal { display: inline-flex; gap: 8px; align-items: center; }
.footer-sep { color: #5a4a70; }

/* ========== 15. 404 ========== */
.error404 .site-content {
  text-align: center;
  padding: 80px 20px;
}
.error404 h1 { font-size: 72px; margin: 0; color: var(--primary); }
.error404 p { font-size: 16px; color: var(--text-secondary); }

/* ========== 16. Empty State ========== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  color: var(--text-secondary);
  font-size: 15px;
}

/* ========== 17. Dark Mode ========== */
body.aft-dark-mode {
  --bg: #121212;
  --card-bg: #1e1e1e;
  --text: #e0e0e0;
  --text-secondary: #9a9a9a;
  --border: #333;
  --border-light: #2a2a2a;
}

/* ========== 18. Responsive ========== */
@media (max-width: 1024px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-main { min-height: 240px; }
  .cat-nav-grid { grid-template-columns: repeat(3, 1fr); }
  .content-row,
  .content-area { flex-direction: column; }
  .content-sidebar { width: 100% !important; }
}

@media (max-width: 768px) {
  .site-content { margin: 16px auto; }
  .header-inner { padding: 0 12px; }
  .main-nav ul li a { padding: 0 10px; font-size: 13px; }

  .mobile-menu-toggle { display: block; }
  .main-nav ul {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--card-bg);
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    z-index: 200;
  }
  .main-nav ul.open { display: flex; }
  .main-nav ul li a { line-height: 44px; }
  .main-nav ul ul {
    position: static;
    box-shadow: none;
    padding-left: 20px;
  }
  .main-nav ul ul li a { line-height: 36px; }

  .hero-main { min-height: 200px; }
  .hero-main-overlay { padding: 20px; }
  .hero-main-overlay h2 { font-size: 18px; }
  .hero-side { gap: 12px; }

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

  .article-card { flex-direction: column; }
  .article-card-img { width: 100%; height: 140px; }

  .footer-bottom-inner {
    flex-direction: column;
    text-align: center;
  }
}
