/*
Theme Name: XZhibot AI Community
Theme URI: https://xzhibot.com
Author: xzhibot.com
Author URI: https://xzhibot.com
Description: 专为 xzhibot.com AI Agent 社区定制的现代简洁主题，暖米色风格，支持右侧边栏小工具和精选文章轮播。
Version: 1.2.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: xzhibot
Tags: blog, technology, two-columns, right-sidebar, custom-menu, custom-logo, featured-images, threaded-comments, translation-ready, light
*/

/* ============================================================
   CSS Variables — Warm Cream Theme (inspired by ofox.ai)
   ============================================================ */
:root {
  /* Core Colors */
  --color-bg:            #f0ebe4;   /* warm cream page background */
  --color-bg-secondary:  #e9e3db;
  --color-bg-tertiary:   #e2dbd2;
  --color-bg-card:       #ffffff;
  --color-border:        #e2d9cf;
  --color-border-light:  #ede8e2;

  /* Brand / Accent */
  --color-accent:        #e8533a;   /* coral — matches ofox.ai CTA */
  --color-accent-hover:  #d04430;
  --color-accent-light:  #fdecea;
  --color-accent-glow:   rgba(232, 83, 58, 0.14);

  /* Text */
  --color-text-primary:   #1a1714;
  --color-text-secondary: #574f47;
  --color-text-muted:     #9c8f84;
  --color-text-light:     #c5b9b0;

  /* Multi-color Tag Palette (6 colors cycling by term_id) */
  --tag-0-bg:   #fde8e4; --tag-0-text: #c53d2a;  /* coral */
  --tag-1-bg:   #d4f5f1; --tag-1-text: #0b7a6e;  /* teal */
  --tag-2-bg:   #fef3cd; --tag-2-text: #b45309;  /* amber */
  --tag-3-bg:   #ede9fe; --tag-3-text: #5b21b6;  /* purple */
  --tag-4-bg:   #d1fae5; --tag-4-text: #065f46;  /* emerald */
  --tag-5-bg:   #dbeafe; --tag-5-text: #1d4ed8;  /* blue */

  /* Legacy single-color tag (fallback) */
  --color-tag-bg:   #fde8e4;
  --color-tag-text: #c53d2a;

  /* Fonts */
  --font-sans: 'Inter', 'PingFang SC', 'Noto Sans SC', 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

  /* Radius */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* Shadows — softer, warmer */
  --shadow-xs:         0 1px 2px rgba(60,40,20,0.06);
  --shadow-sm:         0 2px 6px rgba(60,40,20,0.07);
  --shadow-md:         0 4px 16px rgba(60,40,20,0.09);
  --shadow-lg:         0 12px 32px rgba(60,40,20,0.12);
  --shadow-card:       0 1px 4px rgba(60,40,20,0.07), 0 0 0 1px rgba(60,40,20,0.04);
  --shadow-card-hover: 0 8px 24px rgba(60,40,20,0.12), 0 0 0 1px rgba(232,83,58,0.12);

  /* Layout */
  --sidebar-width:    300px;
  --content-max-width: 1200px;
  --header-height:    60px;
  --transition:       all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body { font-family: var(--font-sans); background-color: var(--color-bg); color: var(--color-text-primary); line-height: 1.7; min-height: 100vh; }
a { color: var(--color-accent); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--color-accent-hover); }
img { max-width: 100%; height: auto; display: block; }
ul, ol { list-style: none; }
button { font-family: var(--font-sans); }

/* ============================================================
   Typography
   ============================================================ */
h1,h2,h3,h4,h5,h6 { font-weight: 700; line-height: 1.3; color: var(--color-text-primary); letter-spacing: -0.02em; }
h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
h2 { font-size: clamp(1.35rem, 3vw, 1.875rem); }
h3 { font-size: clamp(1.05rem, 2.5vw, 1.25rem); }
h4 { font-size: 1.0625rem; }
p  { margin-bottom: 1.2em; color: var(--color-text-secondary); line-height: 1.8; }
blockquote { border-left: 3px solid var(--color-accent); padding: 1rem 1.5rem; background: var(--color-accent-light); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin: 1.5rem 0; color: var(--color-text-secondary); font-style: italic; }
code { font-family: var(--font-mono); font-size: 0.875em; background: var(--color-accent-light); color: var(--color-accent); padding: 0.15em 0.4em; border-radius: var(--radius-xs); border: 1px solid rgba(232,83,58,0.12); }
pre { font-family: var(--font-mono); background: #1e1e2e; color: #cdd6f4; border-radius: var(--radius-md); padding: 1.25rem 1.5rem; overflow-x: auto; margin: 1.5rem 0; font-size: 0.875rem; line-height: 1.65; position: relative; }
pre code { background: none; padding: 0; color: inherit; border: none; font-size: 1em; }
hr { border: none; border-top: 1px solid var(--color-border); margin: 2rem 0; }
table { width: 100%; border-collapse: collapse; margin: 1.5rem 0; font-size: 0.9rem; }
th, td { padding: 0.75rem 1rem; text-align: left; border: 1px solid var(--color-border); }
th { background: var(--color-bg-secondary); color: var(--color-text-primary); font-weight: 600; }
td { color: var(--color-text-secondary); }

/* ============================================================
   Layout
   ============================================================ */
.container { max-width: var(--content-max-width); margin: 0 auto; padding: 0 1.5rem; }
.site-main-layout { display: flex; gap: 1.75rem; align-items: flex-start; padding: 2rem 0 4rem; }
.site-content  { flex: 1; min-width: 0; }
.site-sidebar  { width: var(--sidebar-width); flex-shrink: 0; position: sticky; top: calc(var(--header-height) + 1rem); align-self: flex-start; }

/* ============================================================
   Header  —  ofox.ai style: white bar, clean nav, coral CTA
   ============================================================ */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: #fff;
  border-bottom: 1px solid var(--color-border);
  box-shadow: 0 1px 3px rgba(60,40,20,0.06);
}
.site-header .container { display: flex; align-items: center; height: var(--header-height); gap: 1.5rem; }

/* Logo */
.site-logo { display: flex; align-items: center; gap: 0.625rem; text-decoration: none; flex-shrink: 0; }
.site-logo-img { width: 36px; height: 36px; border-radius: 9px; display: block; flex-shrink: 0; }
.site-logo-text { font-size: 1.05rem; font-weight: 800; color: var(--color-text-primary); letter-spacing: -0.025em; line-height: 1.2; white-space: nowrap; }
.site-logo-text span { color: var(--color-accent); }

/* Primary Nav — right-aligned via margin-left: auto */
.main-navigation { margin-left: auto; }
.main-navigation ul { display: flex; gap: 0.25rem; align-items: center; }
.main-navigation ul li a {
  display: block; padding: 0.375rem 0.7rem;
  font-size: 0.9rem; font-weight: 500;
  color: var(--color-text-secondary);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.main-navigation ul li a:hover,
.main-navigation ul li.current-menu-item > a,
.main-navigation ul li.current-page-ancestor > a {
  color: var(--color-text-primary);
  background: var(--color-bg);
}
.main-navigation ul li { position: relative; }
.main-navigation ul ul {
  display: none; position: absolute; top: calc(100% + 0.5rem); left: 0;
  background: #fff; border: 1px solid var(--color-border);
  border-radius: var(--radius-md); padding: 0.4rem;
  min-width: 180px; box-shadow: var(--shadow-lg);
  flex-direction: column; gap: 0.125rem; z-index: 200;
}
.main-navigation ul li:hover > ul { display: flex; }
.main-navigation ul ul li a { padding: 0.45rem 0.75rem; width: 100%; }

/* Header right: search + CTA */
.header-right { display: flex; align-items: center; gap: 0.75rem; flex-shrink: 0; }
.header-search-form {
  display: flex; align-items: center; gap: 0.4rem;
  background: var(--color-bg); border: 1px solid var(--color-border);
  border-radius: 999px; padding: 0.3rem 0.875rem;
  transition: var(--transition);
}
.header-search-form:focus-within { border-color: var(--color-accent); background: #fff; box-shadow: 0 0 0 3px var(--color-accent-glow); }
.header-search-form input { background: none; border: none; outline: none; color: var(--color-text-primary); font-size: 0.875rem; width: 130px; }
.header-search-form input::placeholder { color: var(--color-text-muted); }
.header-search-form button { background: none; border: none; cursor: pointer; color: var(--color-text-muted); display: flex; align-items: center; padding: 0; }
.header-search-form button:hover { color: var(--color-accent); }

/* CTA button (Get Started style) */
.header-cta {
  display: inline-flex; align-items: center;
  padding: 0.4rem 1.1rem;
  background: var(--color-accent); color: #fff;
  font-size: 0.875rem; font-weight: 600;
  border-radius: 999px; border: none; cursor: pointer;
  text-decoration: none; transition: var(--transition);
  white-space: nowrap;
}
.header-cta:hover { background: var(--color-accent-hover); color: #fff; }

.menu-toggle {
  display: none; background: none; border: 1px solid var(--color-border);
  border-radius: var(--radius-sm); padding: 0.375rem; cursor: pointer;
  color: var(--color-text-secondary);
}

/* ============================================================
   Multi-color Tag System
   ============================================================ */
.post-category,
.post-tag,
.widget_tag_cloud .tagcloud a {
  display: inline-block;
  font-size: 0.68rem; font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  text-decoration: none;
  transition: var(--transition);
  border: none;
}

/* Color variants - assigned via PHP class tag-c0 … tag-c5 */
.tag-c0 { background: var(--tag-0-bg); color: var(--tag-0-text); }
.tag-c1 { background: var(--tag-1-bg); color: var(--tag-1-text); }
.tag-c2 { background: var(--tag-2-bg); color: var(--tag-2-text); }
.tag-c3 { background: var(--tag-3-bg); color: var(--tag-3-text); }
.tag-c4 { background: var(--tag-4-bg); color: var(--tag-4-text); }
.tag-c5 { background: var(--tag-5-bg); color: var(--tag-5-text); }

/* Hover darkens slightly */
.tag-c0:hover { background: #f9d0c9; color: var(--tag-0-text); }
.tag-c1:hover { background: #abe8e0; color: var(--tag-1-text); }
.tag-c2:hover { background: #fde68a; color: var(--tag-2-text); }
.tag-c3:hover { background: #ddd6fe; color: var(--tag-3-text); }
.tag-c4:hover { background: #a7f3d0; color: var(--tag-4-text); }
.tag-c5:hover { background: #bfdbfe; color: var(--tag-5-text); }

/* Fallback (no color class) */
.post-category:not([class*="tag-c"]),
.post-tag:not([class*="tag-c"]) {
  background: var(--color-tag-bg);
  color: var(--color-tag-text);
}

/* Meta row */
.post-meta { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.post-date  { font-size: 0.76rem; color: var(--color-text-muted); }

/* ============================================================
   Featured Posts Slider
   ============================================================ */
.featured-slider-section {
  background: #fff;
  border-bottom: 1px solid var(--color-border);
}
.featured-slider-wrap {
  position: relative;
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding: 1.5rem 1.5rem 0.875rem;
}
.slider-section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.slider-section-title {
  font-size: 0.85rem; font-weight: 700; color: var(--color-text-primary);
  display: flex; align-items: center; gap: 0.4rem;
}
.slider-section-title::before { content: ''; display: inline-block; width: 3px; height: 14px; background: var(--color-accent); border-radius: 2px; }
.slider-counter { font-size: 0.78rem; color: var(--color-text-muted); }

.featured-slider  { position: relative; overflow: hidden; border-radius: var(--radius-xl); box-shadow: var(--shadow-md); }
.featured-slides  { display: flex; transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1); will-change: transform; }
.featured-slide   { min-width: 100%; display: flex; background: #fff; min-height: 300px; }

.featured-slide-thumbnail { width: 52%; flex-shrink: 0; overflow: hidden; background: var(--color-bg-secondary); position: relative; }
.featured-slide-thumbnail img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; }
.featured-slide:hover .featured-slide-thumbnail img { transform: scale(1.03); }
.featured-slide-thumbnail .no-img { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 3.5rem; background: linear-gradient(135deg, #fde8e4, #fef3cd); }

/* 精选推荐 badge — overlaid on thumbnail top-left */
.featured-badge {
  position: absolute; top: 12px; left: 12px; z-index: 3;
  background: var(--color-accent); color: #fff;
  font-size: 0.65rem; font-weight: 700; letter-spacing: 0.06em;
  padding: 0.22rem 0.65rem; border-radius: 999px;
  box-shadow: 0 2px 6px rgba(232,83,58,0.4);
  white-space: nowrap;
}

.featured-slide-body { flex: 1; padding: 1.875rem 2.125rem; display: flex; flex-direction: column; justify-content: center; gap: 0.75rem; }
.featured-slide-body .post-meta { flex-wrap: wrap; gap: 0.4rem; }
.featured-slide-body h2 { font-size: clamp(1.05rem, 2.5vw, 1.45rem); line-height: 1.35; margin: 0; }
.featured-slide-body h2 a { color: var(--color-text-primary); }
.featured-slide-body h2 a:hover { color: var(--color-accent); }
.featured-slide-body .excerpt { color: var(--color-text-secondary); font-size: 0.875rem; line-height: 1.75; margin: 0; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.slide-footer { display: flex; align-items: center; justify-content: space-between; padding-top: 0.75rem; border-top: 1px solid var(--color-border); margin-top: auto; }

.slider-arrow {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 10;
  width: 34px; height: 34px; border-radius: 50%;
  background: #fff; border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--color-text-primary); transition: var(--transition);
}
.slider-arrow:hover { background: var(--color-accent); color: #fff; border-color: var(--color-accent); }
.slider-arrow.prev { left: -17px; }
.slider-arrow.next { right: -17px; }

.slider-dots { display: flex; justify-content: center; gap: 0.375rem; padding: 0.875rem 0 0.125rem; }
.slider-dot { width: 6px; height: 6px; border-radius: 999px; background: var(--color-border); border: none; cursor: pointer; transition: var(--transition); padding: 0; }
.slider-dot.active { width: 20px; background: var(--color-accent); }

/* ============================================================
   Section Header
   ============================================================ */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.125rem; }
.section-title { font-size: 0.9rem; font-weight: 700; color: var(--color-text-primary); display: flex; align-items: center; gap: 0.45rem; }
.section-title::before { content: ''; display: inline-block; width: 3px; height: 14px; background: var(--color-accent); border-radius: 2px; }
.section-more { font-size: 0.78rem; color: var(--color-accent); padding: 0.2rem 0.6rem; border: 1px solid rgba(232,83,58,0.3); border-radius: 999px; transition: var(--transition); }
.section-more:hover { background: var(--color-accent); color: #fff; border-color: var(--color-accent); }

/* ============================================================
   Post Cards Grid  —  clean, flat, ofox.ai style
   ============================================================ */
.posts-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.25rem; }

.post-card {
  background: #fff;
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: var(--transition);
  box-shadow: var(--shadow-card);
  display: flex; flex-direction: column;
  border: 1px solid transparent;
}
.post-card:hover { box-shadow: var(--shadow-card-hover); transform: translateY(-2px); border-color: rgba(232,83,58,0.1); }

.post-card-thumbnail { aspect-ratio: 16/9; overflow: hidden; background: var(--color-bg-secondary); }
.post-card-thumbnail img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.post-card:hover .post-card-thumbnail img { transform: scale(1.04); }
.post-card-thumbnail .no-thumbnail { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 2.5rem; background: linear-gradient(135deg, #fde8e4, #fef3cd); }

.post-card-body { padding: 1.125rem 1.125rem 1rem; flex: 1; display: flex; flex-direction: column; gap: 0.5rem; }

.post-card-body h3 { font-size: 0.9375rem; line-height: 1.5; margin: 0; font-weight: 600; }
.post-card-body h3 a { color: var(--color-text-primary); text-decoration: none; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post-card-body h3 a:hover { color: var(--color-accent); }

.post-card-excerpt { font-size: 0.84rem; color: var(--color-text-muted); line-height: 1.65; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; flex: 1; }

.post-card-footer { display: flex; align-items: center; justify-content: space-between; padding-top: 0.625rem; margin-top: auto; border-top: 1px solid var(--color-border-light); }
.post-read-time  { font-size: 0.74rem; color: var(--color-text-muted); display: flex; align-items: center; gap: 0.25rem; }
.post-read-more  { font-size: 0.76rem; color: var(--color-accent); display: flex; align-items: center; gap: 0.25rem; font-weight: 500; }
.post-read-more:hover { color: var(--color-accent-hover); }

/* ============================================================
   Post List (alternative layout)
   ============================================================ */
.posts-list { display: flex; flex-direction: column; gap: 0.875rem; }
.post-list-item {
  background: #fff; border-radius: var(--radius-lg);
  padding: 1.125rem; display: flex; gap: 1.125rem;
  transition: var(--transition); box-shadow: var(--shadow-card);
  border: 1px solid transparent;
}
.post-list-item:hover { box-shadow: var(--shadow-card-hover); transform: translateX(3px); border-color: rgba(232,83,58,0.1); }
.post-list-thumbnail { width: 105px; height: 78px; flex-shrink: 0; border-radius: var(--radius-sm); overflow: hidden; background: var(--color-bg-secondary); }
.post-list-thumbnail img { width: 100%; height: 100%; object-fit: cover; }
.post-list-body { flex: 1; min-width: 0; }
.post-list-body h2 { font-size: 0.975rem; margin-bottom: 0.3rem; font-weight: 600; }
.post-list-body h2 a { color: var(--color-text-primary); }
.post-list-body h2 a:hover { color: var(--color-accent); }
.post-list-excerpt { font-size: 0.84rem; color: var(--color-text-muted); margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ============================================================
   Pagination
   ============================================================ */
.pagination { display: flex; align-items: center; justify-content: center; gap: 0.375rem; margin-top: 2.5rem; }
.pagination .page-numbers {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  font-size: 0.875rem; font-weight: 500; color: var(--color-text-secondary);
  background: #fff; border: 1px solid var(--color-border);
  transition: var(--transition); text-decoration: none;
}
.pagination .page-numbers:hover,
.pagination .page-numbers.current { background: var(--color-accent); color: #fff; border-color: var(--color-accent); }
.pagination .page-numbers.dots { background: none; border: none; color: var(--color-text-muted); width: auto; }

/* ============================================================
   Single Post
   ============================================================ */
.single-post-header { margin-bottom: 1.75rem; }
.single-post-header .post-meta { margin-bottom: 0.875rem; }
.single-post-header h1 { font-size: clamp(1.5rem, 4vw, 2.25rem); line-height: 1.3; margin-bottom: 1rem; }

.post-author-info { display: flex; align-items: center; gap: 0.75rem; padding: 0.875rem 1.125rem; background: #fff; border: 1px solid var(--color-border); border-radius: var(--radius-md); margin-bottom: 1.5rem; box-shadow: var(--shadow-xs); }
.post-author-avatar { width: 40px; height: 40px; border-radius: 50%; overflow: hidden; background: var(--color-bg-secondary); flex-shrink: 0; }
.post-author-avatar img { width: 100%; height: 100%; object-fit: cover; }
.post-author-name { font-weight: 600; font-size: 0.875rem; color: var(--color-text-primary); }
.post-author-meta { font-size: 0.76rem; color: var(--color-text-muted); }

.single-post-thumbnail { border-radius: var(--radius-xl); overflow: hidden; margin-bottom: 2rem; aspect-ratio: 16/9; box-shadow: var(--shadow-sm); }
.single-post-thumbnail img { width: 100%; height: 100%; object-fit: cover; }

/* Entry Content */
.entry-content { color: var(--color-text-secondary); line-height: 1.85; font-size: 1.0125rem; }
.entry-content h2 { font-size: 1.45rem; margin: 2.25rem 0 0.875rem; padding-bottom: 0.5rem; border-bottom: 2px solid var(--color-border); color: var(--color-text-primary); }
.entry-content h3 { font-size: 1.175rem; margin: 1.75rem 0 0.625rem; color: var(--color-text-primary); }
.entry-content h4 { font-size: 1.0rem; margin: 1.5rem 0 0.5rem; color: var(--color-text-primary); }
.entry-content p  { margin-bottom: 1.25rem; }
.entry-content ul, .entry-content ol { list-style: initial; padding-left: 1.5rem; margin-bottom: 1.25rem; }
.entry-content ol { list-style: decimal; }
.entry-content li { margin-bottom: 0.4rem; color: var(--color-text-secondary); }
.entry-content a  { color: var(--color-accent); text-decoration: underline; text-underline-offset: 2px; }
.entry-content img { border-radius: var(--radius-md); margin: 1.5rem 0; }

/* Ad Slots */
.ad-slot { margin: 1.5rem 0; text-align: center; clear: both; overflow: hidden; }
.ad-slot:empty { display: none; }

/* Tags & Share */
.post-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid var(--color-border); }
.post-tags .tag-label { font-size: 0.8rem; font-weight: 600; color: var(--color-text-muted); margin-right: 0.25rem; align-self: center; }
.post-share { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--color-border); }
.post-share .share-label { font-size: 0.84rem; color: var(--color-text-muted); font-weight: 500; }
.share-btn { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.8rem; color: var(--color-text-secondary); padding: 0.28rem 0.72rem; background: #fff; border: 1px solid var(--color-border); border-radius: 999px; transition: var(--transition); text-decoration: none; }
.share-btn:hover { border-color: var(--color-accent); color: var(--color-accent); background: var(--color-accent-light); }

/* Related Posts */
.related-posts { margin-top: 2.5rem; padding-top: 2rem; border-top: 1px solid var(--color-border); }

/* ============================================================
   Comments
   ============================================================ */
.comments-area { margin-top: 2.5rem; padding-top: 2rem; border-top: 1px solid var(--color-border); }
.comments-title { font-size: 1.1rem; margin-bottom: 1.5rem; }
.comment-list .comment { margin-bottom: 1.125rem; }
.comment-body { background: #fff; border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: 1rem 1.125rem; box-shadow: var(--shadow-xs); }
.comment-author { display: flex; align-items: center; gap: 0.625rem; margin-bottom: 0.6rem; }
.comment-author img { width: 34px; height: 34px; border-radius: 50%; }
.comment-author .fn { font-weight: 600; font-size: 0.875rem; color: var(--color-text-primary); }
.comment-metadata { font-size: 0.75rem; color: var(--color-text-muted); }
.comment-content p { font-size: 0.9rem; color: var(--color-text-secondary); margin-bottom: 0; }
.comment-respond { margin-top: 2rem; }
.comment-reply-title { font-size: 1rem; margin-bottom: 1.125rem; }
.comment-form label { display: block; font-size: 0.84rem; font-weight: 500; color: var(--color-text-secondary); margin-bottom: 0.3rem; }
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
  width: 100%; background: #fff; border: 1px solid var(--color-border);
  border-radius: var(--radius-sm); padding: 0.625rem 0.875rem;
  color: var(--color-text-primary); font-family: var(--font-sans);
  font-size: 0.9rem; transition: var(--transition); outline: none; margin-bottom: 0.875rem;
}
.comment-form input:focus, .comment-form textarea:focus { border-color: var(--color-accent); box-shadow: 0 0 0 3px var(--color-accent-glow); }
.comment-form textarea { min-height: 110px; resize: vertical; }
.comment-form .submit { background: var(--color-accent); color: #fff; border: none; border-radius: var(--radius-sm); padding: 0.625rem 1.625rem; font-size: 0.875rem; font-weight: 600; cursor: pointer; font-family: var(--font-sans); transition: var(--transition); }
.comment-form .submit:hover { background: var(--color-accent-hover); }

/* ============================================================
   Sidebar
   ============================================================ */
.site-sidebar {
  position: sticky;
  top: calc(var(--header-height) + 1rem);
  align-self: flex-start;
}

.sidebar-widget { background: #fff; border-radius: var(--radius-lg); padding: 1.125rem; margin-bottom: 1.125rem; box-shadow: var(--shadow-card); }
.sidebar-widget:last-child { margin-bottom: 0; }
.sidebar-widget-title { font-size: 0.76rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--color-text-muted); margin-bottom: 0.875rem; padding-bottom: 0.625rem; border-bottom: 1px solid var(--color-border); display: flex; align-items: center; gap: 0.4rem; }
.sidebar-widget-title::before { content: ''; display: inline-block; width: 3px; height: 12px; background: var(--color-accent); border-radius: 2px; }

/* Search Widget */
.widget_search .search-form { display: flex; gap: 0.375rem; }
.widget_search .search-field { flex: 1; background: var(--color-bg); border: 1px solid var(--color-border); border-radius: var(--radius-sm); padding: 0.5rem 0.75rem; color: var(--color-text-primary); font-size: 0.875rem; font-family: var(--font-sans); outline: none; transition: var(--transition); }
.widget_search .search-field:focus { border-color: var(--color-accent); background: #fff; }
.widget_search .search-submit { background: var(--color-accent); color: #fff; border: none; border-radius: var(--radius-sm); padding: 0.5rem 0.75rem; cursor: pointer; font-size: 0.8rem; font-weight: 600; font-family: var(--font-sans); transition: var(--transition); }
.widget_search .search-submit:hover { background: var(--color-accent-hover); }

/* Recent Posts Widget */
.widget_recent_entries ul li { padding: 0.55rem 0; border-bottom: 1px solid var(--color-border-light); }
.widget_recent_entries ul li:last-child { border-bottom: none; padding-bottom: 0; }
.widget_recent_entries ul li:first-child { padding-top: 0; }
.widget_recent_entries ul li a { font-size: 0.84rem; color: var(--color-text-secondary); line-height: 1.5; display: block; margin-bottom: 0.15rem; font-weight: 500; }
.widget_recent_entries ul li a:hover { color: var(--color-accent); }
.widget_recent_entries ul li .post-date { font-size: 0.72rem; color: var(--color-text-muted); }

/* Categories Widget */
.widget_categories ul li { display: flex; align-items: center; justify-content: space-between; padding: 0.5rem 0; border-bottom: 1px solid var(--color-border-light); }
.widget_categories ul li:last-child { border-bottom: none; padding-bottom: 0; }
.widget_categories ul li:first-child { padding-top: 0; }
.widget_categories ul li a { font-size: 0.84rem; color: var(--color-text-secondary); font-weight: 500; transition: var(--transition); }
.widget_categories ul li a:hover { color: var(--color-accent); }
.widget_categories ul li .count { font-size: 0.7rem; color: var(--color-text-muted); background: var(--color-bg); padding: 0.1rem 0.4rem; border-radius: 999px; }

/* Tag Cloud Widget */
.widget_tag_cloud .tagcloud { display: flex; flex-wrap: wrap; gap: 0.375rem; }
.widget_tag_cloud .tagcloud a { font-size: 0.76rem !important; background: var(--color-tag-bg); color: var(--color-tag-text) !important; padding: 0.22rem 0.55rem; border-radius: 999px; text-decoration: none; border: none; }
.widget_tag_cloud .tagcloud a:hover { opacity: 0.8; }

/* Archives Widget */
.widget_archive ul li { padding: 0.5rem 0; border-bottom: 1px solid var(--color-border-light); display: flex; justify-content: space-between; }
.widget_archive ul li:last-child { border-bottom: none; }
.widget_archive ul li a { font-size: 0.84rem; color: var(--color-text-secondary); font-weight: 500; }
.widget_archive ul li a:hover { color: var(--color-accent); }

/* Nav Menu Widget */
.widget_nav_menu ul li { padding: 0.4rem 0; border-bottom: 1px solid var(--color-border-light); }
.widget_nav_menu ul li:last-child { border-bottom: none; }
.widget_nav_menu ul li a { font-size: 0.84rem; color: var(--color-text-secondary); font-weight: 500; }
.widget_nav_menu ul li a:hover { color: var(--color-accent); }

/* Text Widget */
.widget_text p { font-size: 0.875rem; color: var(--color-text-muted); line-height: 1.7; }

/* Banner / Ad Widget */
.xzhibot-ad-widget,
.sidebar-widget.widget_xzhibot_banner {
  background: linear-gradient(135deg, #fde8e4, #fef3cd);
  border: 1px solid rgba(232,83,58,0.15);
  text-align: center;
}
.xzhibot-ad-widget h4 { font-size: 0.88rem; margin-bottom: 0.45rem; color: var(--color-text-primary); }
.xzhibot-ad-widget p  { font-size: 0.8rem; color: var(--color-text-secondary); margin-bottom: 0.875rem; }
.xzhibot-ad-widget .btn,
.xzhibot-ad-widget a.btn { display: inline-block; background: var(--color-accent); color: #fff; padding: 0.45rem 1.125rem; border-radius: 999px; font-size: 0.8rem; font-weight: 600; text-decoration: none; transition: var(--transition); }
.xzhibot-ad-widget .btn:hover { background: var(--color-accent-hover); color: #fff; }

/* Popular Posts Widget */
.popular-posts-list { list-style: none; padding: 0; margin: 0; }
.popular-post-item { display: flex; align-items: flex-start; gap: 0.625rem; padding: 0.55rem 0; border-bottom: 1px solid var(--color-border-light); }
.popular-post-item:last-child { border-bottom: none; padding-bottom: 0; }
.popular-post-item:first-child { padding-top: 0; }
.popular-rank { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; font-size: 0.66rem; font-weight: 800; border-radius: 4px; flex-shrink: 0; margin-top: 1px; }
.popular-post-item:nth-child(1) .popular-rank { background: #fbbf24; color: #fff; }
.popular-post-item:nth-child(2) .popular-rank { background: #94a3b8; color: #fff; }
.popular-post-item:nth-child(3) .popular-rank { background: #f97316; color: #fff; }
.popular-post-item:nth-child(n+4) .popular-rank { background: var(--color-bg); color: var(--color-text-muted); }
.popular-post-item a { font-size: 0.84rem; color: var(--color-text-secondary); line-height: 1.5; font-weight: 500; }
.popular-post-item a:hover { color: var(--color-accent); }

/* Latest Comments Widget */
.latest-comments-list { list-style: none; padding: 0; margin: 0; }
.latest-comment-item { display: flex; align-items: flex-start; gap: 0.55rem; padding: 0.55rem 0; border-bottom: 1px solid var(--color-border-light); }
.latest-comment-item:last-child { border-bottom: none; padding-bottom: 0; }
.latest-comment-item:first-child { padding-top: 0; }
.latest-comment-item img { width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; }
.latest-comment-body { flex: 1; min-width: 0; }
.comment-author-link { display: block; font-size: 0.78rem; font-weight: 600; color: var(--color-text-secondary); margin-bottom: 0.1rem; }
.comment-excerpt { display: block; font-size: 0.74rem; color: var(--color-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ============================================================
   Footer  —  white bg with warm border
   ============================================================ */
.site-footer { background: #fff; border-top: 1px solid var(--color-border); padding: 3rem 0 1.5rem; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 2.5rem; margin-bottom: 2.5rem; }
.footer-brand .site-logo { margin-bottom: 0.625rem; }
.footer-brand p { font-size: 0.875rem; color: var(--color-text-muted); line-height: 1.7; margin-bottom: 1rem; }
.footer-social { display: flex; gap: 0.4rem; }
.footer-social a { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: var(--radius-sm); background: var(--color-bg); border: 1px solid var(--color-border); color: var(--color-text-muted); transition: var(--transition); }
.footer-social a:hover { border-color: var(--color-accent); color: var(--color-accent); background: var(--color-accent-light); }
.footer-col h4 { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-text-secondary); margin-bottom: 0.875rem; }
.footer-col ul li { margin-bottom: 0.4rem; }
.footer-col ul li a { font-size: 0.875rem; color: var(--color-text-muted); transition: var(--transition); }
.footer-col ul li a:hover { color: var(--color-accent); }
.footer-bottom { display: flex; align-items: center; justify-content: space-between; padding-top: 1.5rem; border-top: 1px solid var(--color-border); font-size: 0.78rem; color: var(--color-text-muted); flex-wrap: wrap; gap: 0.625rem; }
.footer-bottom a { color: var(--color-text-muted); }
.footer-bottom a:hover { color: var(--color-accent); }

/* ============================================================
   Breadcrumb
   ============================================================ */
.breadcrumb { display: flex; align-items: center; gap: 0.4rem; font-size: 0.78rem; color: var(--color-text-muted); margin-bottom: 1.25rem; flex-wrap: wrap; }
.breadcrumb a { color: var(--color-text-muted); }
.breadcrumb a:hover { color: var(--color-accent); }
.breadcrumb-sep { color: var(--color-border); }
.breadcrumb-current { color: var(--color-text-secondary); }

/* ============================================================
   404
   ============================================================ */
.error-404 { text-align: center; padding: 5rem 1.5rem; }
.error-404 .error-code { font-size: 7rem; font-weight: 900; color: var(--color-border); line-height: 1; margin-bottom: 1rem; }
.error-404 h1 { margin-bottom: 0.875rem; }
.error-404 p { margin-bottom: 1.75rem; }

/* ============================================================
   Buttons
   ============================================================ */
.btn { display: inline-flex; align-items: center; gap: 0.375rem; padding: 0.575rem 1.375rem; border-radius: 999px; font-size: 0.875rem; font-weight: 600; font-family: var(--font-sans); cursor: pointer; border: none; transition: var(--transition); text-decoration: none; }
.btn-primary { background: var(--color-accent); color: #fff; }
.btn-primary:hover { background: var(--color-accent-hover); color: #fff; }
.btn-outline { background: transparent; color: var(--color-accent); border: 1px solid rgba(232,83,58,0.35); }
.btn-outline:hover { background: var(--color-accent-light); border-color: var(--color-accent); color: var(--color-accent-hover); }

/* ============================================================
   Search Form
   ============================================================ */
.search-form { display: flex; gap: 0.4rem; }
.search-form .search-field { flex: 1; background: #fff; border: 1px solid var(--color-border); border-radius: var(--radius-sm); padding: 0.625rem 0.875rem; color: var(--color-text-primary); font-family: var(--font-sans); font-size: 0.875rem; outline: none; transition: var(--transition); }
.search-form .search-field:focus { border-color: var(--color-accent); }
.search-form .search-submit { background: var(--color-accent); color: #fff; border: none; border-radius: var(--radius-sm); padding: 0.625rem 1.0rem; cursor: pointer; font-family: var(--font-sans); font-size: 0.875rem; font-weight: 600; transition: var(--transition); }
.search-form .search-submit:hover { background: var(--color-accent-hover); }

/* No Results */
.no-results { text-align: center; padding: 3.5rem 1.5rem; color: var(--color-text-muted); }
.no-results p { margin-bottom: 1.5rem; }

/* ============================================================
   Reading Progress + Back to Top
   ============================================================ */
#reading-progress { position: fixed; top: var(--header-height); left: 0; width: 0%; height: 2px; background: linear-gradient(90deg, var(--color-accent), #f97316); z-index: 200; transition: width 0.1s linear; pointer-events: none; }
#back-to-top { position: fixed; bottom: 1.5rem; right: 1.5rem; width: 38px; height: 38px; background: var(--color-accent); color: #fff; border: none; border-radius: 50%; cursor: pointer; z-index: 100; display: none; align-items: center; justify-content: center; box-shadow: var(--shadow-md); transition: var(--transition); }
#back-to-top:hover { background: var(--color-accent-hover); transform: translateY(-2px); }

/* ============================================================
   TOC
   ============================================================ */
.toc-container { display: none; background: var(--color-accent-light); border: 1px solid rgba(232,83,58,0.15); border-radius: var(--radius-md); padding: 1rem 1.125rem; margin-bottom: 1.125rem; }
.toc-container .toc-title { font-size: 0.76rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-accent); margin-bottom: 0.75rem; }
.toc-list { list-style: none; padding: 0; margin: 0; }
.toc-item { padding: 0.25rem 0; }
.toc-item.toc-h3 { padding-left: 1rem; }
.toc-item a { font-size: 0.8rem; color: var(--color-text-secondary); display: block; transition: color 0.15s; }
.toc-item a:hover { color: var(--color-accent); }

/* ============================================================
   WP Core helpers
   ============================================================ */
.wp-block-image img { border-radius: var(--radius-md); }
.alignleft  { float: left; margin: 0 1.5rem 1rem 0; }
.alignright { float: right; margin: 0 0 1rem 1.5rem; }
.aligncenter { margin: 1.5rem auto; display: block; }
.sticky { border-left: 3px solid var(--color-accent); padding-left: 1.25rem; }
.screen-reader-text { clip: rect(1px,1px,1px,1px); height: 1px; overflow: hidden; position: absolute; width: 1px; word-wrap: normal; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1024px) {
  :root { --sidebar-width: 260px; }
  .posts-grid { grid-template-columns: repeat(2, 1fr); gap: 1rem; }
}

@media (max-width: 768px) {
  .site-main-layout { flex-direction: column; padding: 1.25rem 0 3rem; }
  .site-sidebar { width: 100%; position: static; max-height: none; }
  .posts-grid { grid-template-columns: 1fr; }
  .featured-slide { flex-direction: column; min-height: auto; }
  .featured-slide-thumbnail { width: 100%; height: 220px; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 1.5rem; }
  .header-search-form { display: none; }
  .menu-toggle { display: flex; }
  .main-navigation { display: none; }
  .main-navigation.active { display: block; position: absolute; top: var(--header-height); left: 0; right: 0; background: #fff; border-bottom: 1px solid var(--color-border); padding: 0.75rem 1.5rem; box-shadow: var(--shadow-md); z-index: 99; }
  .main-navigation.active ul { flex-direction: column; gap: 0; }
}

@media (max-width: 480px) {
  .container { padding: 0 1rem; }
  .featured-slide-body { padding: 1.25rem 1.25rem; }
  .footer-grid { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; align-items: flex-start; }
}
