/*
Theme Name: Qisas Pro - قصص برو
Description: ثيم عربي احترافي لمواقع القصص — مُحسَّن بالكامل لـ AdSense مع تقسيم تلقائي للمحتوى
Author: Qisas Pro
Version: 2.0
Text Domain: qisas-pro
Requires at least: 6.0
Tested up to: 6.5
*/

/* =============================================
   LIGHT MODE (DEFAULT)
   ============================================= */
:root {
  /* Surfaces */
  --bg:          #f7f3ec;
  --surface:     #ffffff;
  --surface-2:   #f0ece3;
  --surface-3:   #e8e2d8;

  /* Brand */
  --primary:     #1a3a6b;
  --primary-dark:#122a52;
  --primary-mid: #2451a0;
  --primary-glow:rgba(26,58,107,0.12);

  /* Text */
  --text-1:      #1c1c1e;
  --text-2:      #3a3a3c;
  --text-3:      #6e6e73;
  --text-4:      #aeaeb2;

  /* UI */
  --border:      rgba(26,58,107,0.1);
  --border-md:   rgba(26,58,107,0.22);
  --border-lg:   rgba(26,58,107,0.4);
  --shadow-sm:   0 1px 4px rgba(0,0,0,0.06);
  --shadow:      0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg:   0 8px 32px rgba(0,0,0,0.10);
  --shadow-blue: 0 4px 20px rgba(26,58,107,0.18);

  /* Stars */
  --star-on:  #f5a623;
  --star-off: #d1c9bb;

  /* Misc */
  --radius-sm: 8px;
  --radius:    14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --transition: all 0.28s cubic-bezier(.4,0,.2,1);
  --font-h: 'Amiri', serif;
  --font-b: 'Cairo', sans-serif;

  /* Ad zones */
  --ad-bg:     #f0ece3;
  --ad-border: rgba(26,58,107,0.12);
}

/* =============================================
   DARK MODE
   ============================================= */
[data-theme="dark"] {
  --bg:          #0e0e10;
  --surface:     #1c1c1e;
  --surface-2:   #2c2c2e;
  --surface-3:   #3a3a3c;

  --primary:     #4a90d9;
  --primary-dark:#2f6bb5;
  --primary-mid: #6aaee8;
  --primary-glow:rgba(74,144,217,0.15);

  --text-1:      #f2f2f7;
  --text-2:      #c7c7cc;
  --text-3:      #8e8e93;
  --text-4:      #48484a;

  --border:      rgba(255,255,255,0.08);
  --border-md:   rgba(255,255,255,0.15);
  --border-lg:   rgba(255,255,255,0.28);
  --shadow-sm:   0 1px 4px rgba(0,0,0,0.3);
  --shadow:      0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg:   0 8px 32px rgba(0,0,0,0.5);
  --shadow-blue: 0 4px 20px rgba(74,144,217,0.2);

  --star-off: #48484a;

  --ad-bg:     #2c2c2e;
  --ad-border: rgba(255,255,255,0.1);
}

/* =============================================
   RESET & BASE
   ============================================= */
*, *::before, *::after { box-sizing: border-box; margin:0; padding:0; }

html {
  direction: rtl;
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-b);
  background: var(--bg);
  color: var(--text-1);
  line-height: 1.8;
  min-height: 100vh;
  transition: background .3s ease, color .3s ease;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-mid); }
img { max-width: 100%; height: auto; display: block; }
ul, ol { list-style: none; }
button { font-family: var(--font-b); cursor: pointer; border: none; background: none; }

/* =============================================
   SCROLLBAR
   ============================================= */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 99px; }

/* =============================================
   READING PROGRESS
   ============================================= */
#reading-progress {
  position: fixed; top: 0; right: 0;
  width: 0%; height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--primary-mid));
  z-index: 9999;
  transition: width .1s linear;
  box-shadow: 0 0 10px var(--primary-glow);
}

/* =============================================
   HEADER
   ============================================= */
#site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 900;
  box-shadow: var(--shadow-sm);
  transition: background .3s ease, box-shadow .3s ease;
}

#site-header.scrolled {
  box-shadow: var(--shadow);
}

.header-row-top {
  max-width: 1240px; margin: 0 auto;
  padding: 0 20px;
  display: flex; align-items: center;
  justify-content: space-between;
  height: 66px; gap: 16px;
}

/* Logo */
.site-logo {
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
}
.logo-icon {
  width: 40px; height: 40px;
  background: var(--primary);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; color: #fff;
  box-shadow: var(--shadow-blue);
}
.logo-text { display: flex; flex-direction: column; }
.logo-name {
  font-family: var(--font-h);
  font-size: 1.35rem; font-weight: 700;
  color: var(--primary); line-height: 1;
}
.logo-tagline {
  font-size: 0.7rem; color: var(--text-3);
  font-weight: 400; line-height: 1.4;
}

/* Header Ad */
.header-ad-wrap {
  flex: 1; display: flex;
  justify-content: center; align-items: center;
  max-width: 728px; overflow: hidden;
}

/* Header Controls */
.header-controls { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* Dark Mode Toggle */
#theme-toggle {
  width: 44px; height: 24px;
  background: var(--surface-2);
  border: 1px solid var(--border-md);
  border-radius: 99px;
  position: relative;
  transition: background .3s ease;
  flex-shrink: 0;
}
#theme-toggle::after {
  content: '☀️';
  position: absolute;
  right: 2px; top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  transition: right .3s ease, content .3s ease;
}
[data-theme="dark"] #theme-toggle::after {
  content: '🌙';
  right: calc(100% - 22px);
}
[data-theme="dark"] #theme-toggle {
  background: var(--surface-3);
}

/* Search Toggle */
.search-toggle-btn {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.search-toggle-btn:hover { background: var(--primary); color: #fff; }

/* Search Bar */
.header-search-bar {
  max-height: 0; overflow: hidden;
  transition: max-height .35s ease, padding .35s ease;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
}
.header-search-bar.open { max-height: 70px; }
.search-bar-inner {
  max-width: 1240px; margin: 0 auto;
  padding: 10px 20px;
  display: flex; gap: 10px;
}
.search-bar-inner input {
  flex: 1; padding: 10px 16px;
  border: 1px solid var(--border-md);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-1);
  font-family: var(--font-b);
  font-size: 0.95rem;
  outline: none;
  transition: border-color .2s;
}
.search-bar-inner input:focus { border-color: var(--primary); }
.search-bar-inner button {
  padding: 10px 20px;
  background: var(--primary);
  color: #fff; border-radius: var(--radius);
  font-weight: 700; font-size: 0.9rem;
  transition: var(--transition);
}
.search-bar-inner button:hover { background: var(--primary-dark); }

/* Nav */
.header-row-nav {
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.nav-inner {
  max-width: 1240px; margin: 0 auto;
  padding: 0 20px;
  display: flex; gap: 0; align-items: center;
  overflow-x: auto; scrollbar-width: none;
}
.nav-inner::-webkit-scrollbar { display: none; }
.nav-inner a {
  padding: 10px 16px;
  color: var(--text-2); font-size: 0.88rem; font-weight: 600;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: var(--transition);
}
.nav-inner a:hover, .nav-inner a.current {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* =============================================
   AD STRIP (Below Header / Above Footer)
   ============================================= */
.ad-strip {
  background: var(--ad-bg);
  border-bottom: 1px solid var(--ad-border);
  padding: 12px 0;
  text-align: center;
}
.ad-strip-label {
  font-size: 0.65rem; color: var(--text-4);
  letter-spacing: 1.5px; text-transform: uppercase;
  display: block; margin-bottom: 4px;
}

/* =============================================
   LAYOUT
   ============================================= */
.site-wrap {
  max-width: 1240px; margin: 0 auto;
  padding: 28px 20px;
  display: grid;
  grid-template-columns: 1fr 308px;
  gap: 28px;
  align-items: start;
}

.main-col { min-width: 0; }

/* =============================================
   SIDEBAR
   ============================================= */
.sidebar-col {
  position: sticky; top: 80px;
  display: flex; flex-direction: column; gap: 20px;
}

.s-widget {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.s-widget-title {
  font-family: var(--font-h);
  font-size: 1rem; font-weight: 700;
  color: var(--text-1);
  padding-bottom: 12px; margin-bottom: 16px;
  border-bottom: 2px solid var(--primary);
  display: flex; align-items: center; gap: 8px;
}
.s-widget-title .wtitle-icon {
  width: 26px; height: 26px;
  background: var(--primary-glow);
  border-radius: 6px; display: flex;
  align-items: center; justify-content: center;
  font-size: 0.85rem;
}

/* Recent posts in sidebar */
.s-post-list { display: flex; flex-direction: column; gap: 14px; }
.s-post-item { display: flex; gap: 10px; align-items: center; }
.s-post-thumb {
  width: 62px; height: 52px; flex-shrink: 0;
  border-radius: var(--radius-sm); overflow: hidden;
  background: var(--surface-2);
}
.s-post-thumb img { width: 100%; height: 100%; object-fit: cover; }
.s-post-info { flex: 1; min-width: 0; }
.s-post-title {
  font-size: 0.83rem; font-weight: 600;
  color: var(--text-2); line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
  transition: color .2s;
}
.s-post-item:hover .s-post-title { color: var(--primary); }
.s-post-date { font-size: 0.72rem; color: var(--text-4); margin-top: 3px; }

/* Category list in sidebar */
.s-cat-list { display: flex; flex-direction: column; gap: 2px; }
.s-cat-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 10px; border-radius: var(--radius-sm);
  transition: var(--transition);
}
.s-cat-item:hover { background: var(--surface-2); }
.s-cat-name { font-size: 0.88rem; color: var(--text-2); font-weight: 500; }
.s-cat-count {
  background: var(--primary-glow); color: var(--primary);
  font-size: 0.75rem; font-weight: 700;
  padding: 2px 8px; border-radius: 99px;
}

/* Tags cloud */
.s-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.s-tag {
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-3); font-size: 0.8rem;
  padding: 4px 10px; border-radius: 99px;
  transition: var(--transition);
}
.s-tag:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* =============================================
   AD ZONES
   ============================================= */
.ad-zone {
  margin: 24px 0; text-align: center;
  position: relative;
}
.ad-zone-label {
  font-size: 0.62rem; color: var(--text-4);
  letter-spacing: 1.5px; text-transform: uppercase;
  display: block; margin-bottom: 4px;
}
.ad-zone-box {
  background: var(--ad-bg);
  border: 1px solid var(--ad-border);
  border-radius: var(--radius);
  padding: 10px;
  display: flex; align-items: center; justify-content: center;
  min-height: 90px;
  overflow: hidden;
}

/* =============================================
   POST CARDS (Archive / Index)
   ============================================= */
.post-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 20px;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}
.post-card:hover {
  border-color: var(--border-md);
  box-shadow: var(--shadow), var(--shadow-blue);
  transform: translateY(-2px);
}
.post-card-inner { display: flex; }
.post-card-thumb {
  width: 220px; min-height: 170px;
  flex-shrink: 0; overflow: hidden;
}
.post-card-thumb img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .5s ease;
}
.post-card:hover .post-card-thumb img { transform: scale(1.04); }
.post-card-body { padding: 20px 22px; flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }

.cat-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--primary-glow); border: 1px solid var(--border-md);
  color: var(--primary); font-size: 0.72rem; font-weight: 700;
  padding: 3px 10px; border-radius: 99px;
  margin-bottom: 9px; letter-spacing: .3px;
}

.card-title {
  font-family: var(--font-h); font-size: 1.12rem; font-weight: 700;
  color: var(--text-1); line-height: 1.55;
  margin-bottom: 8px;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.card-title a { color: inherit; }
.card-title a:hover { color: var(--primary); }

.card-excerpt {
  font-size: 0.87rem; color: var(--text-3);
  line-height: 1.7; margin-bottom: 12px;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}

.card-meta {
  display: flex; gap: 14px;
  font-size: 0.76rem; color: var(--text-4);
  flex-wrap: wrap;
}
.card-meta span { display: flex; align-items: center; gap: 4px; }

/* Star rating on card */
.card-stars { display: flex; gap: 1px; }
.card-stars .star { color: var(--star-on); font-size: 0.8rem; }
.card-stars .star.empty { color: var(--star-off); }

/* =============================================
   SINGLE POST
   ============================================= */
.single-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow);
}

/* Hero */
.post-hero {
  position: relative;
  height: 400px; overflow: hidden;
  background: var(--surface-2);
}
.post-hero img {
  width: 100%; height: 100%; object-fit: cover;
}
.post-hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.55) 0%, transparent 55%);
}
.post-hero-badge {
  position: absolute; top: 20px; right: 20px;
  display: flex; gap: 8px;
}
.hero-cat-badge {
  background: var(--primary); color: #fff;
  font-size: 0.75rem; font-weight: 700;
  padding: 5px 14px; border-radius: 99px;
}

/* Post Header */
.post-header { padding: 28px 36px 20px; border-bottom: 1px solid var(--border); }

.breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.78rem; color: var(--text-4);
  margin-bottom: 14px; flex-wrap: wrap;
}
.breadcrumb a { color: var(--primary); }
.breadcrumb-sep { opacity: .4; }

.post-title {
  font-family: var(--font-h);
  font-size: 1.95rem; font-weight: 700;
  color: var(--text-1); line-height: 1.45;
  margin-bottom: 16px;
}

.post-meta-bar {
  display: flex; gap: 20px; flex-wrap: wrap;
  align-items: center;
  font-size: 0.82rem; color: var(--text-3);
}
.post-meta-bar span { display: flex; align-items: center; gap: 5px; }
.post-meta-bar a { color: var(--primary); }

/* Rating Row in Header */
.post-rating-row {
  display: flex; align-items: center; gap: 10px;
  margin-top: 14px; padding-top: 14px;
  border-top: 1px solid var(--border);
}
.rating-stars-display { display: flex; gap: 2px; }
.rating-stars-display .star { font-size: 1rem; }
.rating-avg {
  font-weight: 700; color: var(--text-1); font-size: 1rem;
}
.rating-count { font-size: 0.78rem; color: var(--text-4); }
.rating-interactive {
  margin-right: auto;
  display: flex; align-items: center; gap: 8px;
}
.rating-interactive-label { font-size: 0.8rem; color: var(--text-3); }
.rating-stars-input { display: flex; gap: 3px; }
.rating-stars-input .star-btn {
  font-size: 1.3rem; color: var(--star-off);
  transition: color .15s, transform .15s;
  cursor: pointer;
  padding: 2px;
  line-height: 1;
}
.rating-stars-input .star-btn:hover,
.rating-stars-input .star-btn.active { color: var(--star-on); transform: scale(1.2); }

/* Progress bar reading indicator */
.page-progress-bar {
  height: 4px; background: var(--border);
  border-radius: 0;
  overflow: hidden;
}
.page-progress-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--primary-mid));
  transition: width .4s ease;
}

/* Post Content */
.post-content-wrap { padding: 0 36px; }

.entry-content {
  font-size: 1.06rem; line-height: 2.0;
  color: var(--text-1); padding: 28px 0;
}
.entry-content p { margin-bottom: 1.5em; text-align: justify; }
.entry-content h2 {
  font-family: var(--font-h); font-size: 1.45rem; color: var(--primary);
  margin: 2em 0 .7em; padding-right: 14px;
  border-right: 3px solid var(--primary);
}
.entry-content h3 {
  font-family: var(--font-h); font-size: 1.2rem; color: var(--text-1);
  margin: 1.6em 0 .6em;
}
.entry-content blockquote {
  background: var(--surface-2);
  border-right: 4px solid var(--primary);
  padding: 18px 22px; border-radius: 0 var(--radius) var(--radius) 0;
  margin: 1.5em 0; font-style: italic;
  color: var(--text-2); font-family: var(--font-h); font-size: 1.08rem;
}
.entry-content ul, .entry-content ol {
  padding-right: 24px; margin-bottom: 1.4em;
  list-style: disc;
}
.entry-content ol { list-style: decimal; }
.entry-content li { margin-bottom: .5em; }
.entry-content img { border-radius: var(--radius); margin: 1em 0; }
.entry-content a { color: var(--primary); text-decoration: underline; }
.entry-content strong { color: var(--text-1); font-weight: 700; }

/* =============================================
   PAGINATION (The Revenue Engine)
   ============================================= */
.pager-wrap {
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  padding: 24px 36px;
}

.pager-info {
  text-align: center; margin-bottom: 12px;
  font-size: 0.8rem; color: var(--text-3); letter-spacing: .5px;
}
.pager-info strong { color: var(--primary); font-weight: 700; }

/* Page progress dots */
.pager-dots {
  display: flex; gap: 5px; justify-content: center;
  margin-bottom: 16px;
}
.p-dot {
  height: 5px; border-radius: 99px;
  background: var(--border-md);
  transition: var(--transition);
  cursor: pointer;
}
.p-dot.done { background: var(--primary); opacity: .5; width: 16px; }
.p-dot.active { background: var(--primary); width: 28px; }
.p-dot.upcoming { background: var(--border); width: 8px; }

/* Pagination Buttons */
.pager-nav {
  display: flex; align-items: center;
  justify-content: center; gap: 6px;
  flex-wrap: wrap;
}

.pg-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 42px; height: 42px; padding: 0 14px;
  background: var(--surface); border: 1px solid var(--border-md);
  border-radius: var(--radius); color: var(--text-2);
  font-size: 0.88rem; font-weight: 600; font-family: var(--font-b);
  cursor: pointer; transition: var(--transition);
}
.pg-btn:hover {
  background: var(--primary-glow);
  border-color: var(--primary); color: var(--primary);
  box-shadow: var(--shadow-blue);
}
.pg-btn.current {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff; font-weight: 700;
  box-shadow: var(--shadow-blue);
}
.pg-btn.pg-prev, .pg-btn.pg-next {
  padding: 0 18px; gap: 6px;
  background: var(--surface-2);
  border-color: var(--border-md);
  font-size: .9rem;
}
.pg-btn.pg-next:hover { transform: translateX(-3px); }
.pg-btn.pg-prev:hover { transform: translateX(3px); }
.pg-btn.pg-next:hover, .pg-btn.pg-prev:hover {
  background: var(--primary); color: #fff;
}
.pg-btn.pg-end {
  color: var(--text-4); cursor: default;
  border-style: dashed;
}
.pg-ellipsis {
  width: 32px; text-align: center;
  color: var(--text-4); font-size: .9rem;
}

/* =============================================
   POST FOOTER: TAGS + SHARE
   ============================================= */
.post-footer-bar {
  padding: 20px 36px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 14px;
}
.post-tags-wrap { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.post-tags-label { font-size: 0.78rem; color: var(--text-4); font-weight: 600; }
.post-tag {
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-3); padding: 4px 12px;
  border-radius: 99px; font-size: .8rem;
  transition: var(--transition);
}
.post-tag:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

.share-wrap { display: flex; align-items: center; gap: 8px; }
.share-label { font-size: .78rem; color: var(--text-4); font-weight: 600; }
.share-btn {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; transition: var(--transition);
  border: 1px solid var(--border);
  color: var(--text-2);
  background: var(--surface-2);
}
.share-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.share-btn.tw:hover { background: #1da1f2; color: #fff; border-color: #1da1f2; }
.share-btn.fb:hover { background: #1877f2; color: #fff; border-color: #1877f2; }
.share-btn.wa:hover { background: #25d366; color: #fff; border-color: #25d366; }
.share-btn.cp:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* =============================================
   RELATED POSTS
   ============================================= */
.related-section { margin-top: 24px; }

.section-heading {
  font-family: var(--font-h); font-size: 1.3rem; color: var(--text-1);
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 18px;
}
.section-heading::before {
  content: ''; width: 4px; height: 24px;
  background: var(--primary); border-radius: 99px;
  display: inline-block;
}
.section-heading::after {
  content: ''; flex: 1; height: 1px;
  background: var(--border);
}

.related-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
}
.rel-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  transition: var(--transition);
}
.rel-card:hover {
  border-color: var(--border-md);
  transform: translateY(-3px); box-shadow: var(--shadow-blue);
}
.rel-card-img {
  height: 130px; overflow: hidden; background: var(--surface-2);
}
.rel-card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.rel-card:hover .rel-card-img img { transform: scale(1.06); }
.rel-card-body { padding: 12px; }
.rel-card-title {
  font-family: var(--font-h); font-size: .9rem; color: var(--text-1);
  line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.rel-card:hover .rel-card-title { color: var(--primary); }
.rel-card-meta { font-size: .72rem; color: var(--text-4); margin-top: 5px; }

/* =============================================
   COMMENTS
   ============================================= */
.comments-section { margin-top: 24px; }
.comment-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-xl); padding: 28px 36px;
  box-shadow: var(--shadow-sm);
}

/* =============================================
   FOOTER
   ============================================= */
#site-footer {
  background: var(--primary-dark);
  color: rgba(255,255,255,.75);
  margin-top: 50px;
}
.footer-ad-row {
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  padding: 12px; text-align: center;
}
.footer-main {
  max-width: 1240px; margin: 0 auto;
  padding: 40px 20px 24px;
  display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 40px;
}
.footer-brand .logo-name { color: #fff; font-size: 1.6rem; }
.footer-brand .logo-tagline { color: rgba(255,255,255,.5); }
.footer-brand p { font-size: .88rem; line-height: 1.8; margin-top: 12px; color: rgba(255,255,255,.55); }

.footer-col h4 {
  font-family: var(--font-h); color: rgba(255,255,255,.9);
  margin-bottom: 14px; font-size: 1rem;
  border-bottom: 1px solid rgba(255,255,255,.1);
  padding-bottom: 8px;
}
.footer-col ul li { margin-bottom: 8px; }
.footer-col ul li a { color: rgba(255,255,255,.55); font-size: .87rem; transition: var(--transition); }
.footer-col ul li a:hover { color: #fff; padding-right: 4px; }

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.08);
  padding: 16px 20px; text-align: center;
  font-size: .78rem; color: rgba(255,255,255,.35);
  max-width: 1240px; margin: 0 auto;
}

/* =============================================
   BACK TO TOP
   ============================================= */
#back-to-top {
  position: fixed; bottom: 28px; left: 22px;
  width: 44px; height: 44px;
  background: var(--primary); color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; box-shadow: var(--shadow-blue);
  opacity: 0; transform: translateY(16px);
  transition: var(--transition); z-index: 800;
}
#back-to-top.show { opacity: 1; transform: translateY(0); }
#back-to-top:hover { transform: translateY(-3px) scale(1.05); }

/* =============================================
   404 PAGE
   ============================================= */
.page-404 {
  min-height: 60vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; padding: 60px 20px;
}
.page-404 .err-icon { font-size: 5rem; margin-bottom: 16px; }
.page-404 h1 {
  font-family: var(--font-h); font-size: 5rem;
  color: var(--primary); font-weight: 900; line-height: 1;
}
.page-404 h2 { font-size: 1.4rem; color: var(--text-1); margin: 12px 0 8px; }
.page-404 p { color: var(--text-3); max-width: 440px; margin: 0 auto 28px; }
.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--primary); color: #fff;
  padding: 12px 28px; border-radius: var(--radius);
  font-weight: 700; font-size: .95rem; transition: var(--transition);
  box-shadow: var(--shadow-blue);
}
.btn-primary:hover { background: var(--primary-dark); color: #fff; transform: translateY(-2px); }

/* =============================================
   SEARCH RESULTS
   ============================================= */
.search-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px; margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}
.search-hero h1 { font-family: var(--font-h); color: var(--text-1); font-size: 1.5rem; margin-bottom: 14px; }
.search-form-full { display: flex; gap: 10px; }
.search-form-full input {
  flex: 1; padding: 12px 18px;
  border: 1px solid var(--border-md); border-radius: var(--radius);
  background: var(--surface-2); color: var(--text-1);
  font-family: var(--font-b); font-size: 1rem; outline: none;
}
.search-form-full input:focus { border-color: var(--primary); }
.search-form-full button {
  padding: 12px 24px; background: var(--primary); color: #fff;
  border-radius: var(--radius); font-weight: 700; font-size: .95rem;
  transition: var(--transition);
}
.search-form-full button:hover { background: var(--primary-dark); }
.search-count { font-size: .85rem; color: var(--text-3); margin-top: 8px; }

/* =============================================
   ARCHIVE HEADER
   ============================================= */
.archive-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 28px; margin-bottom: 24px;
  display: flex; align-items: center; gap: 16px;
  box-shadow: var(--shadow-sm);
}
.archive-icon {
  width: 54px; height: 54px; border-radius: var(--radius);
  background: var(--primary-glow); font-size: 1.6rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.archive-info h1 { font-family: var(--font-h); font-size: 1.5rem; color: var(--text-1); }
.archive-info p { font-size: .88rem; color: var(--text-3); margin-top: 4px; }

/* =============================================
   ARCHIVE PAGINATION (WP default)
   ============================================= */
.archive-pagination {
  margin-top: 28px; display: flex;
  justify-content: center; gap: 6px; flex-wrap: wrap;
}
.archive-pagination a, .archive-pagination span {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 42px; height: 42px; padding: 0 14px;
  background: var(--surface); border: 1px solid var(--border-md);
  border-radius: var(--radius); color: var(--text-2);
  font-size: .88rem; font-weight: 600; transition: var(--transition);
}
.archive-pagination a:hover { background: var(--primary-glow); border-color: var(--primary); color: var(--primary); }
.archive-pagination .current { background: var(--primary); border-color: var(--primary); color: #fff; }

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 960px) {
  .site-wrap { grid-template-columns: 1fr; }
  .sidebar-col { position: static; }
  .header-ad-wrap { display: none; }
  .footer-main { grid-template-columns: 1fr; gap: 24px; }
  .related-grid { grid-template-columns: repeat(2,1fr); }
  .post-card-thumb { width: 160px; }
}

@media (max-width: 640px) {
  .header-row-top { height: 56px; }
  .logo-name { font-size: 1.15rem; }
  .logo-tagline { display: none; }
  .post-hero { height: 220px; }
  .post-title { font-size: 1.35rem; }
  .post-header, .post-content-wrap, .pager-wrap, .post-footer-bar { padding-left: 18px; padding-right: 18px; }
  .related-grid { grid-template-columns: 1fr; }
  .entry-content { font-size: .98rem; }
  .pg-btn { min-width: 36px; height: 36px; font-size: .82rem; }
  .comment-wrap { padding: 20px 18px; }
}
