/*
Theme Name: Maghalat
Theme URI: https://maghalat.com
Author: ایران دیزاینر (irandesigner.com)
Author URI: https://irandesigner.com
Description: قالب وردپرس فارسی و راست‌چین «مقالات» — مجله‌ای مدرن، سریع و سئو‌محور برای تولید محتوای تخصصی. دارای فهرست مطلب خودکار، طراحی واکنش‌گرا، داده‌های ساختاریافته و تجربه‌ی خواندن بی‌نقص.
Version: 1.0.16
Requires at least: 6.0
Tested up to: 6.5
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: maghalat
Tags: rtl-language-support, blog, news, two-columns, right-sidebar, custom-logo, custom-menu, featured-images, threaded-comments, translation-ready, editor-style
*/

/* ============================================================
   1. DESIGN TOKENS
   ============================================================ */
:root {
  /* Brand */
  --brand: #4f46e5;
  --brand-strong: #4338ca;
  --brand-2: #7c3aed;
  --brand-50: #eef2ff;
  --brand-100: #e0e7ff;
  --brand-grad: linear-gradient(135deg, #6366f1 0%, #7c3aed 100%);

  /* Accent */
  --accent: #f43f5e;
  --accent-strong: #e11d48;
  --accent-soft: #fff1f2;
  --amber: #f59e0b;
  --emerald: #10b981;

  /* Ink & neutrals */
  --ink: #0f172a;
  --text: #283446;
  --muted: #64748b;
  --faint: #94a3b8;
  --line: #e9edf4;
  --line-soft: #f1f4f9;

  /* Surfaces */
  --bg: #ffffff;
  --bg-soft: #f7f8fc;
  --bg-tint: #f5f3ff;
  --white: #ffffff;

  /* Shape */
  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius: 18px;
  --radius-lg: 26px;
  --radius-pill: 999px;

  /* Shadow */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow-sm: 0 4px 14px rgba(15, 23, 42, .06);
  --shadow: 0 10px 30px rgba(15, 23, 42, .08);
  --shadow-lg: 0 24px 60px rgba(49, 46, 129, .14);
  --shadow-brand: 0 12px 30px rgba(79, 70, 229, .28);

  /* Layout */
  --container: 1200px;
  --reading: 760px;
  --gap: 28px;
  --header-h: 76px;

  /* Type */
  --font: 'Vazirmatn', 'Tahoma', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --fs-body: 1.0625rem;
  --lh-body: 2.05;

  --ease: cubic-bezier(.4, 0, .2, 1);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 20px);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--text);
  background: var(--bg-soft);
  direction: rtl;
  text-align: right;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img, svg, video { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; transition: color .2s var(--ease); }
ul, ol { list-style: none; padding: 0; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; font-size: 1rem; }
time { font-family: inherit; unicode-bidi: plaintext; }
h1, h2, h3, h4, h5, h6 { line-height: 1.5; color: var(--ink); font-weight: 800; }
:focus-visible { outline: 3px solid var(--brand-100); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--brand-100); color: var(--brand-strong); }

/* Accessibility */
.screen-reader-text {
  position: absolute; width: 1px; height: 1px; padding: 0;
  margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0;
}
.skip-link {
  position: absolute; right: 16px; top: -60px; z-index: 9999;
  background: var(--brand); color: #fff; padding: 10px 18px;
  border-radius: var(--radius-pill); transition: top .25s var(--ease);
}
.skip-link:focus { top: 16px; }

/* ============================================================
   3. LAYOUT HELPERS
   ============================================================ */
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: 22px; }
.section { padding-block: 56px; }
.section-soft { background: var(--bg-soft); }
.section-tint { background: var(--bg-tint); }

.section-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 28px;
}
.section-head .title-wrap { display: flex; align-items: center; gap: 12px; }
.section-title {
  font-size: 1.55rem; font-weight: 800; color: var(--ink);
  position: relative; padding-inline-start: 16px;
}
.section-title::before {
  content: ""; position: absolute; inset-inline-start: 0; top: 50%;
  transform: translateY(-50%); width: 6px; height: 26px;
  border-radius: var(--radius-pill); background: var(--brand-grad);
}
.section-link {
  color: var(--brand); font-weight: 700; font-size: .95rem;
  display: inline-flex; align-items: center; gap: 6px;
}
.section-link:hover { color: var(--brand-strong); gap: 10px; }
.section-link svg { width: 18px; height: 18px; }

/* ============================================================
   4. BUTTONS & CHIPS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 24px; border-radius: var(--radius-pill); font-weight: 700;
  font-size: .98rem; transition: all .22s var(--ease); white-space: nowrap;
}
.btn-primary { background: var(--brand-grad); color: #fff; box-shadow: var(--shadow-brand); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 16px 36px rgba(79,70,229,.36); color:#fff; }
.btn-ghost { background: var(--white); color: var(--brand); border: 1.5px solid var(--line); box-shadow: var(--shadow-xs); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand-strong); }
.btn-block { width: 100%; }

.chip, .cat-badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: .8rem;
  font-weight: 700; padding: 5px 13px; border-radius: var(--radius-pill);
  background: var(--brand-50); color: var(--brand-strong); transition: all .2s var(--ease);
}
.cat-badge:hover { background: var(--brand); color: #fff; }
.cat-badge.is-accent { background: var(--accent-soft); color: var(--accent-strong); }
.cat-badge.is-accent:hover { background: var(--accent); color: #fff; }

.tag-pill {
  display: inline-flex; padding: 6px 14px; border-radius: var(--radius-pill);
  background: var(--white); border: 1px solid var(--line); color: var(--muted);
  font-size: .85rem; font-weight: 600; transition: all .2s var(--ease);
}
.tag-pill:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-50); }

/* ============================================================
   5. HEADER
   ============================================================ */
.site-header {
  position: sticky; top: 0; z-index: 100; background: rgba(255,255,255,.92);
  backdrop-filter: saturate(180%) blur(14px); -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topicbar {
  background: #f8fafc; border-bottom: 1px solid var(--line-soft); color: var(--muted);
  font-size: .84rem;
}
.topicbar .container {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  min-height: 42px;
}
.topicbar-kicker {
  display: inline-flex; align-items: center; gap: 7px; flex-shrink: 0;
  color: var(--brand-strong); font-weight: 800;
}
.topicbar-kicker svg { width: 16px; height: 16px; color: var(--accent); }
.topicbar-links {
  display: flex; align-items: center; gap: 8px; overflow-x: auto;
  scrollbar-width: none; margin-inline-end: auto;
}
.topicbar-links::-webkit-scrollbar { display: none; }
.topicbar-links a {
  display: inline-flex; align-items: center; white-space: nowrap;
  padding: 5px 11px; border: 1px solid transparent; border-radius: var(--radius-pill);
  color: var(--text); font-weight: 700;
}
.topicbar-links a:hover { background: var(--white); border-color: var(--line); color: var(--brand); }
.topicbar-action {
  display: inline-flex; align-items: center; gap: 5px; flex-shrink: 0;
  color: var(--accent-strong); font-weight: 800;
}
.topicbar-action:hover { color: var(--brand); }
.topicbar-action svg { width: 15px; height: 15px; }

.header-main { display: flex; align-items: center; gap: 18px; height: var(--header-h); }

/* Logo lockup (live text + svg mark) */
.site-branding { flex: 0 0 auto; min-width: 0; }
.site-brand { display: inline-flex; align-items: center; justify-content: center; }
.site-brand .brand-mark { width: 48px; height: 48px; flex-shrink: 0; }
.site-brand .brand-text { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.site-brand .brand-name {
  font-size: 1.55rem; font-weight: 800; letter-spacing: 0;
  background: var(--brand-grad); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.site-brand .brand-tag {
  max-width: 210px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: .68rem; font-weight: 600; color: var(--faint); letter-spacing: 0;
}
.custom-logo { max-height: 50px; width: auto; }

/* Primary nav */
/* منو بلافاصله بعد از لوگو (سمت راست) شروع می‌شود؛ اکشن‌ها به انتهای چپ می‌روند */
.primary-nav { margin-inline-start: 0; min-width: 0; }
.primary-nav > ul { display: flex; align-items: center; gap: 2px; flex-wrap: nowrap; }
.primary-nav a {
  display: inline-flex; align-items: center; gap: 5px; padding: 8px 11px;
  white-space: nowrap; font-weight: 700; font-size: .93rem; color: var(--text); border-radius: var(--radius-sm);
}
.primary-nav > ul > li { position: relative; flex: 0 0 auto; }
.primary-nav > ul > li:nth-child(n+9) { display: none; }
.primary-nav > ul > li > a:hover { color: var(--brand); background: var(--brand-50); }
.primary-nav .current-menu-item > a,
.primary-nav .current-menu-parent > a { color: var(--brand); }
.primary-nav .menu-item-has-children > a::after,
.primary-nav > ul > li:has(> ul) > a::after {
  content: ""; width: 7px; height: 7px; border-inline-end: 2px solid currentColor;
  border-bottom: 2px solid currentColor; transform: rotate(45deg); margin-top: -3px; opacity: .6;
}
/* Dropdown / sub-menu */
.primary-nav ul ul {
  position: absolute; top: calc(100% + 10px); inset-inline-start: 0; min-width: 224px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 8px; opacity: 0; visibility: hidden;
  transform: translateY(10px); transition: all .22s var(--ease); z-index: 50;
}
.primary-nav ul ul::before {
  content: ""; position: absolute; top: -9px; inset-inline-start: 28px; width: 18px; height: 18px;
  background: var(--brand-grad); border-radius: 5px; box-shadow: 0 8px 18px rgba(79,70,229,.22);
  transform: rotate(45deg); pointer-events: none;
}
.primary-nav ul ul::after {
  content: ""; position: absolute; top: -5px; inset-inline-start: 32px; width: 10px; height: 10px;
  background: #fff; border-radius: 3px; transform: rotate(45deg); pointer-events: none;
}
.primary-nav li:hover > ul { opacity: 1; visibility: visible; transform: translateY(0); }
.primary-nav ul ul a { padding: 10px 14px; border-radius: var(--radius-xs); width: 100%; }
.primary-nav ul ul a:hover { background: var(--brand-50); color: var(--brand); padding-inline-start: 20px; }

/* Header actions */
.header-actions { display: flex; align-items: center; gap: 6px; margin-inline-start: auto; flex-shrink: 0; }
.icon-btn {
  width: 44px; height: 44px; display: grid; place-items: center; border-radius: var(--radius-sm);
  color: var(--text); transition: all .2s var(--ease);
}
.icon-btn:hover { background: var(--brand-50); color: var(--brand); }
.icon-btn svg { width: 22px; height: 22px; }
.menu-toggle {
  width: auto; padding-inline: 12px 13px; display: inline-flex; align-items: center; justify-content: center;
  gap: 7px; border: 1px solid var(--line); background: #fff; color: var(--brand-strong);
  font-size: .9rem; font-weight: 800; white-space: nowrap;
}
.menu-toggle:hover { border-color: var(--brand-100); background: var(--brand-50); color: var(--brand-strong); }
.menu-toggle-label { line-height: 1; }

/* Search overlay */
.search-overlay {
  position: fixed; inset: 0; z-index: 200; background: rgba(15,23,42,.6);
  backdrop-filter: blur(6px); display: grid; place-items: start center; padding-top: 16vh;
  opacity: 0; visibility: hidden; transition: all .3s var(--ease);
}
.search-overlay.is-open { opacity: 1; visibility: visible; }
.search-overlay .search-box {
  width: min(620px, 92vw); background: #fff; border-radius: var(--radius-lg);
  padding: 30px; box-shadow: var(--shadow-lg); transform: translateY(-20px); transition: transform .3s var(--ease);
}
.search-overlay.is-open .search-box { transform: translateY(0); }
.search-overlay h3 { margin-bottom: 16px; font-size: 1.2rem; }

.search-form { display: flex; gap: 10px; }
.search-form input[type="search"] {
  flex: 1; padding: 14px 18px; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  background: var(--bg-soft); transition: all .2s var(--ease);
}
.search-form input[type="search"]:focus { outline: none; border-color: var(--brand); background: #fff; }
.search-form button { padding: 14px 22px; border-radius: var(--radius-sm); background: var(--brand-grad); color:#fff; font-weight: 700; }

/* ============================================================
   6. MOBILE NAV
   ============================================================ */
.mobile-nav {
  position: fixed; inset: 0 0 0 auto; width: min(86vw, 340px); z-index: 210;
  background: #fff; transform: translateX(100%); transition: transform .32s var(--ease);
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow-y: auto;
}
.mobile-nav.is-open { transform: translateX(0); }
.mobile-nav-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.mobile-nav ul { padding: 12px; }
.mobile-nav a { display: block; padding: 13px 14px; font-weight: 700; border-radius: var(--radius-sm); }
.mobile-nav a:hover, .mobile-nav .current-menu-item > a { background: var(--brand-50); color: var(--brand); }
.mobile-nav ul ul { padding-inline-start: 14px; }
.mobile-nav ul ul a { font-weight: 500; color: var(--muted); }
.nav-backdrop {
  position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 205;
  opacity: 0; visibility: hidden; transition: all .3s var(--ease);
}
.nav-backdrop.is-open { opacity: 1; visibility: visible; }

/* ============================================================
   7. HERO / FEATURED
   ============================================================ */
.hero { padding-block: 34px 54px; }
.hero-grid {
  display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, .95fr);
  gap: 24px; align-items: stretch;
}
.hero-grid.hero-count-1 { grid-template-columns: minmax(0, 1fr); }
.hero-side {
  display: grid; grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 24px; min-height: 500px;
}
.hero-grid.hero-count-2 .hero-side { grid-template-rows: 1fr; }

.feature-card {
  position: relative; border-radius: var(--radius-lg); overflow: hidden;
  min-height: 240px; display: flex; align-items: flex-end; box-shadow: var(--shadow);
  isolation: isolate; background: linear-gradient(135deg, #111827 0%, #312e81 100%);
  border: 1px solid rgba(255,255,255,.12);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.feature-card.is-main { min-height: 500px; }
.feature-card.is-solo { min-height: 460px; }
.feature-card.is-small { min-height: 0; }
.feature-card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; transition: transform .6s var(--ease); }
.feature-card::before {
  content: ""; position: absolute; inset: 0; z-index: -3;
  background: linear-gradient(135deg, rgba(99,102,241,.88), rgba(244,63,94,.62));
}
.feature-card::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(to top, rgba(15,23,42,.94) 0%, rgba(15,23,42,.68) 44%, rgba(15,23,42,.12) 100%),
    linear-gradient(to left, rgba(79,70,229,.24), transparent 54%);
}
.feature-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.feature-card:hover img { transform: scale(1.06); }
.feature-card:hover .feature-fallback-mark img { transform: none; }
.feature-card .feature-body { position: relative; padding: 30px; color: #fff; width: 100%; }
.feature-card.is-small .feature-body { padding: 20px; }
.feature-card h2, .feature-card h3 { color: #fff; }
.feature-card h2 { font-size: 1.9rem; line-height: 1.55; max-width: 760px; }
.feature-card.is-small h3 { font-size: 1.14rem; line-height: 1.65; }
.feature-card .cat-badge {
  background: rgba(255,255,255,.16); color: #fff; border: 1px solid rgba(255,255,255,.24);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); margin-bottom: 12px;
}
.feature-card .cat-badge:hover { background: rgba(255,255,255,.26); color: #fff; }
.feature-card .feature-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 12px; color: #e2e8f0; font-size: .84rem; }
.feature-card .feature-meta span { display: inline-flex; align-items: center; gap: 5px; }
.feature-card .feature-meta svg { width: 15px; height: 15px; }
.feature-card.has-fallback {
  background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 54%, #fff1f2 100%);
  border-color: var(--line);
}
.feature-card.has-fallback::after {
  background: linear-gradient(to top, rgba(15,23,42,.9) 0%, rgba(15,23,42,.52) 48%, rgba(15,23,42,.08) 100%);
}
.feature-fallback-mark {
  position: absolute; inset: 0; z-index: -2; display: grid; place-items: center;
  background:
    repeating-linear-gradient(135deg, rgba(79,70,229,.08) 0 1px, transparent 1px 18px),
    linear-gradient(135deg, #f8fafc 0%, #eef2ff 56%, #fff1f2 100%);
}
.feature-fallback-mark img {
  position: relative; inset: auto; z-index: auto; width: 78px; height: 78px;
  object-fit: contain; opacity: .72; filter: drop-shadow(0 18px 36px rgba(79,70,229,.18));
  transform: none;
}

/* ============================================================
   8. POST CARDS
   ============================================================ */
.cards-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; align-items: stretch; }
.cards-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cards-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }

.post-card {
  background: #fff; border-radius: var(--radius); overflow: visible; padding: 18px;
  border: 1px solid var(--line); box-shadow: var(--shadow-xs);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s var(--ease);
  display: flex; flex-direction: column; height: 100%;
}
.post-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-sm); border-color: var(--brand-100); }
.post-card .card-kicker { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.post-card .thumb {
  position: relative; aspect-ratio: 16 / 10; overflow: hidden;
  background: linear-gradient(135deg, var(--brand-50), var(--accent-soft));
}
.post-card .thumb::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(15,23,42,.22), transparent 48%);
  pointer-events: none;
}
.post-card .thumb img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease), filter .5s var(--ease); }
.post-card:hover .thumb img { transform: scale(1.07); }
.post-card .thumb .cat-badge {
  position: absolute; top: 12px; inset-inline-start: 12px; z-index: 1;
  background: rgba(255,255,255,.94); box-shadow: var(--shadow-xs);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.thumb-fallback {
  position: absolute; inset: 0; display: grid; place-items: center;
  background:
    repeating-linear-gradient(135deg, rgba(79,70,229,.08) 0 1px, transparent 1px 18px),
    linear-gradient(135deg, #f8fafc 0%, #eef2ff 58%, #fff1f2 100%);
  color: var(--brand-strong);
}
.thumb-fallback img {
  position: relative; z-index: 1; width: 56px !important; height: 56px !important;
  object-fit: contain !important; opacity: .72; transform: none !important;
  filter: drop-shadow(0 14px 26px rgba(79,70,229,.18));
}
.thumb-fallback span {
  position: absolute; inset-block-end: 14px; inset-inline-start: 16px;
  font-size: .78rem; font-weight: 900; color: rgba(67,56,202,.72);
}
.post-card .card-body { padding: 0; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.post-card .card-title { font-size: 1.08rem; font-weight: 900; line-height: 1.75; letter-spacing: 0; }
.post-card .card-title a:hover { color: var(--brand); }
.post-card .card-excerpt { color: var(--muted); font-size: .93rem; line-height: 1.95; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.post-card .card-meta {
  margin-top: auto; padding-top: 8px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); font-size: .79rem;
}
.post-card .card-meta span {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  padding: 5px 9px; border-radius: var(--radius-pill);
  background: var(--bg-soft); border: 1px solid var(--line-soft);
  font-weight: 700; line-height: 1.4;
}
.post-card .card-meta svg { width: 15px; height: 15px; color: var(--brand); }
.post-card .author-mini { display: inline-flex; align-items: center; gap: 7px; }
.post-card .author-mini img { width: 24px; height: 24px; border-radius: 50%; }

/* List variant (for sidebar) */
.post-list-item { display: block; padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.post-list-item:last-child { border-bottom: none; }
.post-list-item .thumb { width: 116px; height: 84px; flex-shrink: 0; border-radius: var(--radius-sm); overflow: hidden; }
.post-list-item .thumb img { width: 100%; height: 100%; object-fit: cover; }
.post-list-item .thumb-fallback { position: relative; inset: auto; width: 100%; height: 100%; }
.post-list-item .thumb-fallback img { width: 34px !important; height: 34px !important; }
.post-list-item .list-body { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.post-list-item h4 { font-size: .98rem; line-height: 1.75; }
.post-list-item h4 a:hover { color: var(--brand); }
.post-list-item .list-meta { color: var(--muted); font-size: .8rem; font-weight: 700; }

.empty-category-card {
  min-height: 220px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 28px; text-align: center;
  background: #fff; border: 1px dashed var(--brand-100); border-radius: var(--radius);
  color: var(--muted); box-shadow: var(--shadow-xs);
}
.empty-category-card span {
  width: 52px; height: 52px; display: grid; place-items: center;
  border-radius: var(--radius-sm); background: var(--brand-50); color: var(--brand);
}
.empty-category-card svg { width: 25px; height: 25px; }
.empty-category-card strong { color: var(--ink); font-size: 1.05rem; }
.empty-category-card em { font-style: normal; font-size: .9rem; line-height: 1.8; }
.empty-category-card:hover { border-color: var(--brand); transform: translateY(-3px); box-shadow: var(--shadow); }

/* ============================================================
   9. BREADCRUMBS
   ============================================================ */
.breadcrumbs { font-size: .85rem; color: var(--muted); padding-block: 14px; }
.breadcrumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.breadcrumbs a:hover { color: var(--brand); }
.breadcrumbs .sep { color: var(--faint); }
.breadcrumbs [aria-current="page"] { color: var(--ink); font-weight: 600; }

/* ============================================================
   10. ARCHIVE / PAGE HEADER
   ============================================================ */
.page-hero {
  background: var(--brand-grad); color: #fff; padding-block: 44px; position: relative; overflow: hidden;
}
.page-hero::before {
  content: ""; position: absolute; inset-inline-end: -80px; top: -80px; width: 320px; height: 320px;
  background: radial-gradient(circle, rgba(255,255,255,.16), transparent 70%); border-radius: 50%;
}
.page-hero h1 { color: #fff; font-size: 2rem; margin-bottom: 8px; }
.page-hero .archive-desc { color: rgba(255,255,255,.85); max-width: 640px; }
.page-hero .breadcrumbs { color: rgba(255,255,255,.8); padding: 0 0 14px; }
.page-hero .breadcrumbs a { color: rgba(255,255,255,.8); }
.page-hero .breadcrumbs a:hover { color: #fff; }
.page-hero .breadcrumbs [aria-current="page"] { color: #fff; }
.page-hero .archive-count { display: inline-flex; margin-top: 14px; background: rgba(255,255,255,.16); padding: 6px 16px; border-radius: var(--radius-pill); font-size: .85rem; font-weight: 600; }

/* ============================================================
   11. CONTENT + SIDEBAR LAYOUT
   ============================================================ */
.content-area {
  display: grid; direction: ltr; grid-template-columns: minmax(0, 1fr) 320px;
  grid-template-areas: "main sidebar"; gap: 40px; align-items: start; padding-block: 48px;
}
.content-area.no-sidebar { grid-template-columns: 1fr; grid-template-areas: "main"; }
.content-main { grid-area: main; direction: rtl; min-width: 0; }
.sidebar {
  grid-area: sidebar; direction: rtl; position: sticky; top: calc(var(--header-h) + 20px);
  display: flex; flex-direction: column; gap: 24px;
}

.widget {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-xs);
}
.widget .widget-title {
  font-size: 1.1rem; font-weight: 800; margin-bottom: 16px; padding-bottom: 14px;
  border-bottom: 1px solid var(--line-soft); position: relative;
}
.widget .widget-title::after { content:""; position:absolute; bottom:-1px; inset-inline-start:0; width: 48px; height: 3px; border-radius: var(--radius-pill); background: var(--brand-grad); }
.widget ul li { padding: 9px 0; border-bottom: 1px dashed var(--line); }
.widget ul li:last-child { border-bottom: none; }
.widget a:hover { color: var(--brand); }
.widget.widget-cta { background: var(--brand-grad); color: #fff; text-align: center; border: none; }
.widget.widget-cta .widget-title { color:#fff; border:none; }
.widget.widget-cta .widget-title::after { display:none; }
.tagcloud { display: flex; flex-wrap: wrap; gap: 8px; }

.context-list { display: grid; gap: 10px; }
.context-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px; border: 1px solid var(--line-soft); border-radius: var(--radius-sm);
  background: var(--bg-soft);
}
.context-item span { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: .82rem; font-weight: 700; }
.context-item strong { color: var(--ink); font-size: .88rem; white-space: nowrap; }
.context-item svg { width: 16px; height: 16px; color: var(--brand); }
.context-item.is-link:hover { background: var(--brand-50); border-color: var(--brand-100); }

.widget-lessons .lesson-tree,
.widget-lessons .children { display: grid; gap: 6px; }
.widget-lessons .children { margin-top: 6px; padding-inline-start: 12px; border-inline-start: 2px solid var(--line-soft); }
.widget-lessons li { border: none; padding: 0; }
.widget-lessons a {
  display: inline-flex; align-items: center; max-width: 100%;
  padding: 7px 10px; border-radius: var(--radius-sm); font-weight: 800;
}
.widget-lessons a:hover { background: var(--brand-50); }
.widget-lessons .count { color: var(--faint); font-size: .76rem; }
.reading-path-list { display: grid; gap: 8px; }
.reading-path-item {
  display: grid; grid-template-columns: 34px minmax(0, 1fr); align-items: center; gap: 10px;
  padding: 10px; border-radius: var(--radius-sm); border: 1px solid var(--line-soft);
  background: var(--bg-soft);
}
.reading-path-item span {
  width: 34px; height: 34px; display: grid; place-items: center;
  border-radius: 10px; background: #fff; color: var(--brand);
  box-shadow: var(--shadow-xs);
}
.reading-path-item svg { width: 17px; height: 17px; }
.reading-path-item strong {
  min-width: 0; color: var(--ink); font-size: .88rem; line-height: 1.7;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.reading-path-item:hover { background: var(--brand-50); border-color: var(--brand-100); }
.reading-path-item.is-primary { background: var(--brand-grad); border-color: transparent; }
.reading-path-item.is-primary span { color: var(--brand-strong); }
.reading-path-item.is-primary strong { color: #fff; }
.reading-path-empty {
  padding: 12px 14px; border: 1px dashed var(--line); border-radius: var(--radius-sm);
  color: var(--muted); font-size: .86rem; line-height: 1.8; background: var(--bg-soft);
}
.btn-light { background: #fff; color: var(--brand); box-shadow: var(--shadow-xs); }
.btn-light:hover { color: var(--brand-strong); transform: translateY(-2px); }

/* Newsletter widget */
.newsletter-widget input { width: 100%; padding: 12px 16px; border: 1.5px solid rgba(255,255,255,.4); background: rgba(255,255,255,.14); border-radius: var(--radius-sm); color: #fff; margin-block: 12px; }
.newsletter-widget input::placeholder { color: rgba(255,255,255,.7); }
.newsletter-widget button { background: #fff; color: var(--brand); width: 100%; padding: 12px; border-radius: var(--radius-sm); font-weight: 800; }

/* ============================================================
   12. SINGLE POST
   ============================================================ */
.reading-progress { position: fixed; top: 0; inset-inline-start: 0; height: 3px; width: 0; background: var(--brand-grad); z-index: 300; transition: width .1s linear; }

.single-article { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-xs); }
.article-header { padding: 32px 36px 0; }
.article-header .post-cats { display: flex; gap: 8px; margin-bottom: 16px; }
.article-title { font-size: 2.05rem; line-height: 1.55; margin-bottom: 18px; letter-spacing: 0; }
.article-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; padding-bottom: 24px; border-bottom: 1px solid var(--line-soft); color: var(--muted); font-size: .9rem; }
.article-meta .meta-item { display: inline-flex; align-items: center; gap: 7px; }
.article-meta svg { width: 17px; height: 17px; color: var(--brand); }
.article-meta .author-chip { display: inline-flex; align-items: center; gap: 9px; font-weight: 700; color: var(--ink); }
.article-meta .author-chip img { width: 34px; height: 34px; border-radius: 50%; }
.article-meta .author-chip .site-author-logo,
.author-box .site-author-logo {
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--brand-100);
  padding: 4px;
}

.article-featured { padding: 24px 36px 0; }
.article-featured img { width: 100%; border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.article-featured figcaption { text-align: center; font-size: .82rem; color: var(--faint); margin-top: 10px; }

/* Table of contents */
.toc-box {
  margin: 28px 36px 0; background: var(--bg-tint); border: 1px solid var(--brand-100);
  border-radius: var(--radius); overflow: hidden;
}
.toc-head {
  display: flex; align-items: center; justify-content: flex-start; gap: 10px; width: 100%;
  padding: 15px 20px; cursor: pointer; user-select: none; font-weight: 800; color: var(--brand-strong);
  font-family: inherit; font-size: 1rem; text-align: start; direction: rtl;
}
.toc-head .toc-label { display: inline-flex; align-items: center; gap: 9px; }
.toc-head svg.toc-icon { width: 20px; height: 20px; }
.toc-head .toc-chevron { width: 20px; height: 20px; margin-inline-start: auto; transition: transform .25s var(--ease); }
.toc-box.is-collapsed .toc-chevron { transform: rotate(-90deg); }
.toc-list { padding: 0 20px 18px; max-height: 1200px; overflow: hidden; transition: max-height .3s var(--ease), opacity .3s var(--ease); }
.toc-box.is-collapsed .toc-list { max-height: 0; opacity: 0; padding-bottom: 0; }
.toc-list ol { counter-reset: toc; display: flex; flex-direction: column; gap: 2px; list-style: none; margin: 0; padding-inline-start: 0; }
.toc-list .toc-h2 { counter-increment: toc; }
.toc-list a { display: flex; gap: 9px; padding: 7px 10px; border-radius: var(--radius-xs); color: var(--text); font-size: .94rem; font-weight: 600; transition: all .18s var(--ease); }
.toc-list a::before { content: counter(toc) "."; color: var(--brand); font-weight: 800; min-width: 22px; }
.toc-list a:hover, .toc-list a.is-active { background: #fff; color: var(--brand); box-shadow: var(--shadow-xs); }
.toc-list .toc-h3 { padding-inline-start: 22px; }
.toc-list .toc-h3 a { font-size: .88rem; font-weight: 500; }
.toc-list .toc-h3 a::before { content: "—"; min-width: 16px; color: var(--faint); }

/* The content typography (optimised for reading) */
.article-content { padding: 28px 36px 36px; max-width: none; }
.article-content > * { max-width: var(--reading); margin-inline: auto; }
.article-content p { margin-block: 1.25em; color: var(--text); }
.article-content h2 { font-size: 1.55rem; margin-block: 1.6em .7em; scroll-margin-top: calc(var(--header-h) + 20px); position: relative; padding-inline-start: 18px; }
.article-content h2::before { content:""; position:absolute; inset-inline-start:0; top:8px; bottom:8px; width:6px; border-radius: var(--radius-pill); background: var(--brand-grad); }
.article-content h3 { font-size: 1.28rem; margin-block: 1.4em .6em; scroll-margin-top: calc(var(--header-h) + 20px); color: var(--brand-strong); }
.article-content h4 { font-size: 1.1rem; margin-block: 1.2em .5em; }
.article-content a { color: var(--brand); font-weight: 600; text-decoration: underline; text-decoration-color: var(--brand-100); text-underline-offset: 4px; text-decoration-thickness: 2px; }
.article-content a:hover { text-decoration-color: var(--brand); }
.article-content ul, .article-content ol { margin-block: 1.25em; padding-inline-start: 1.4em; }
.article-content ul li, .article-content ol li { margin-block: .55em; position: relative; }
.article-content ul { list-style: none; padding-inline-start: 1.6em; }
.article-content ul li::before { content:""; position:absolute; inset-inline-start:-1.4em; top:.85em; width:8px; height:8px; border-radius:50%; background: var(--brand-grad); }
.article-content ol { list-style: decimal; }
.article-content ol li::marker { color: var(--brand); font-weight: 800; }
/* فهرست مطالب داخل محتوا تزریق می‌شود؛ شماره‌گذاری ol مقاله نباید رویش اعمال شود */
.article-content .toc-list ol { list-style: none; padding-inline-start: 0; margin-block: 0; }
.article-content .toc-list li { margin-block: 0; }
.article-content img { border-radius: var(--radius); box-shadow: var(--shadow-sm); margin-block: 1.6em; }
.article-content figure { margin-block: 1.8em; }
.article-content figcaption { text-align: center; font-size: .85rem; color: var(--faint); margin-top: 10px; }
.article-content blockquote {
  margin-block: 1.8em; padding: 22px 26px; background: var(--bg-tint); border-inline-start: 5px solid var(--brand);
  border-radius: var(--radius-sm); font-size: 1.12rem; color: var(--ink); font-weight: 600; position: relative;
}
.article-content blockquote p:first-child { margin-top: 0; }
.article-content blockquote p:last-child { margin-bottom: 0; }
.article-content pre { background: var(--ink); color: #e2e8f0; padding: 22px; border-radius: var(--radius); overflow-x: auto; direction: ltr; text-align: left; margin-block: 1.6em; line-height: 1.8; }
.article-content code { background: var(--brand-50); color: var(--brand-strong); padding: 2px 7px; border-radius: 6px; font-size: .9em; direction: ltr; unicode-bidi: embed; }
.article-content pre code { background: none; color: inherit; padding: 0; }
.article-content table { width: 100%; border-collapse: collapse; margin-block: 1.6em; border-radius: var(--radius-sm); overflow: hidden; box-shadow: var(--shadow-xs); }
.article-content th { background: var(--brand-50); color: var(--brand-strong); font-weight: 800; padding: 13px 16px; text-align: right; }
.article-content td { padding: 12px 16px; border-top: 1px solid var(--line); }
.article-content tr:nth-child(even) td { background: var(--bg-soft); }
.article-content hr { border: none; height: 1px; background: var(--line); margin-block: 2.4em; }

/* Highlight / callout boxes (via .has-* utility classes for editor) */
.article-content .callout { background: var(--accent-soft); border: 1px solid #fecdd3; border-radius: var(--radius); padding: 20px 24px; margin-block: 1.8em; }

/* Share + tags + footer */
.article-footer { padding: 0 36px 32px; }
.article-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-block: 24px; border-top: 1px solid var(--line-soft); }
.article-tags .tags-label { font-weight: 800; color: var(--ink); margin-inline-end: 6px; }

.share-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 18px 22px; background: var(--bg-soft); border-radius: var(--radius); }
.share-bar .share-label { font-weight: 800; color: var(--ink); margin-inline-end: auto; }
.share-btn { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; color: #fff; transition: transform .2s var(--ease); }
.share-btn:hover { transform: translateY(-3px); color: #fff; }
.share-btn svg { width: 19px; height: 19px; }
.share-tg { background: #0088cc; }
.share-wa { background: #25d366; }
.share-tw { background: #0f172a; }
.share-li { background: #0a66c2; }
.share-cp { background: var(--brand); }

/* Author box */
.author-box { display: flex; gap: 18px; padding: 24px; background: var(--bg-soft); border-radius: var(--radius); margin-top: 24px; }
.author-box img { width: 78px; height: 78px; border-radius: 50%; flex-shrink: 0; box-shadow: var(--shadow-sm); }
.author-box .author-name { font-size: 1.15rem; font-weight: 800; }
.author-box .author-role { color: var(--brand); font-size: .85rem; font-weight: 700; margin-bottom: 8px; }
.author-box .author-bio { color: var(--muted); font-size: .92rem; }

/* Related posts */
.related-posts { margin-top: 48px; }

/* Post navigation (prev/next) */
.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 28px; }
.post-nav a { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; transition: all .2s var(--ease); box-shadow: var(--shadow-xs); }
.post-nav a:hover { border-color: var(--brand); box-shadow: var(--shadow-sm); }
.post-nav .nav-label { font-size: .8rem; color: var(--faint); font-weight: 700; display: inline-flex; align-items: center; gap: 6px; }
.post-nav .nav-title { font-weight: 700; color: var(--ink); margin-top: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post-nav .next-post { text-align: left; }

/* ============================================================
   13. COMMENTS
   ============================================================ */
.comments-area { margin-top: 40px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 30px 36px; }
.comments-title { font-size: 1.3rem; margin-bottom: 24px; }
.comment-list { display: flex; flex-direction: column; gap: 18px; }
.comment-list .children { margin-inline-start: 40px; margin-top: 18px; display: flex; flex-direction: column; gap: 18px; }
.comment-body { background: var(--bg-soft); border-radius: var(--radius); padding: 18px 20px; }
.comment-meta { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.comment-meta img { width: 44px; height: 44px; border-radius: 50%; }
.comment-author { font-weight: 800; color: var(--ink); }
.comment-date { font-size: .8rem; color: var(--faint); }
.comment-reply-link { color: var(--brand); font-weight: 700; font-size: .85rem; }
.comment-respond { margin-top: 28px; background: var(--bg-soft); border-radius: var(--radius); padding: 24px; }
.comment-form { display: grid; gap: 14px; }
.comment-form p { margin: 0; }
.comment-form label { display: block; font-weight: 700; margin-bottom: 6px; font-size: .9rem; }
.comment-form input, .comment-form textarea { width: 100%; padding: 13px 16px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: #fff; transition: border-color .2s var(--ease); }
.comment-form input:focus, .comment-form textarea:focus { outline: none; border-color: var(--brand); }
.comment-form .form-submit input { background: var(--brand-grad); color: #fff; border: none; font-weight: 800; cursor: pointer; }

/* ============================================================
   14. FORMS (contact)
   ============================================================ */
.styled-form { display: grid; gap: 18px; max-width: 640px; }
.styled-form .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.styled-form label { font-weight: 700; margin-bottom: 7px; display: block; }
.styled-form input, .styled-form textarea, .styled-form select { width: 100%; padding: 14px 16px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: #fff; transition: all .2s var(--ease); }
.styled-form input:focus, .styled-form textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-50); }

.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: start; }
.contact-cards { display: grid; gap: 16px; }
.contact-card { display: flex; gap: 16px; padding: 20px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-xs); }
.contact-card .ci { width: 50px; height: 50px; flex-shrink: 0; border-radius: var(--radius-sm); display: grid; place-items: center; background: var(--brand-50); color: var(--brand); }
.contact-card .ci svg { width: 24px; height: 24px; }
.contact-card .ct strong { display: block; color: var(--ink); }
.contact-card .ct span { color: var(--muted); font-size: .92rem; }

/* ============================================================
   15. PAGINATION
   ============================================================ */
.pagination { display: flex; justify-content: center; margin-top: 44px; }
.pagination .page-numbers {
  min-width: 44px; height: 44px; display: inline-grid; place-items: center; padding-inline: 12px;
  border-radius: var(--radius-sm); background: #fff; border: 1px solid var(--line); margin-inline: 4px;
  font-weight: 700; color: var(--text); transition: all .2s var(--ease);
}
.pagination .page-numbers:hover { border-color: var(--brand); color: var(--brand); }
.pagination .page-numbers.current { background: var(--brand-grad); color: #fff; border-color: transparent; box-shadow: var(--shadow-brand); }

/* ============================================================
   16. FOOTER
   ============================================================ */
.site-footer {
  background: var(--ink); color: #94a3b8; margin-top: 34px;
}
.footer-bottom { border-top: 1px solid rgba(255,255,255,.08); padding-block: 16px; }
.footer-bottom .container {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px 22px; flex-wrap: wrap;
}
.footer-copy, .footer-credit { font-size: .84rem; }
.footer-credit { display: inline-flex; align-items: center; gap: 6px; }
.footer-credit a { color: #c7d2fe; font-weight: 700; }
.footer-credit a:hover { color: #fff; }
.footer-credit .heart { color: var(--accent); }
.footer-legal ul {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 16px;
}
.footer-legal a {
  display: inline-flex; align-items: center;
  color: #cbd5e1; font-size: .82rem; font-weight: 700;
}
.footer-legal a:hover { color: #fff; }

/* ============================================================
   17. 404 & EMPTY STATES
   ============================================================ */
.error-404, .no-results { text-align: center; padding-block: 80px; }
.error-404 .big-code { font-size: 7rem; font-weight: 900; line-height: 1; background: var(--brand-grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.error-404 h1, .no-results h2 { font-size: 1.6rem; margin-block: 18px 10px; }
.error-404 p, .no-results p { color: var(--muted); max-width: 480px; margin-inline: auto; margin-bottom: 26px; }

/* ============================================================
   18. BACK TO TOP
   ============================================================ */
.to-top {
  position: fixed; inset-block-end: 26px; inset-inline-start: 26px; width: 48px; height: 48px;
  border-radius: 50%; background: var(--brand-grad); color: #fff; display: grid; place-items: center;
  box-shadow: var(--shadow-brand); opacity: 0; visibility: hidden; transform: translateY(16px);
  transition: all .3s var(--ease); z-index: 90;
}
.to-top.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
.to-top:hover { transform: translateY(-3px); color: #fff; }
.to-top svg { width: 22px; height: 22px; }

/* ============================================================
   18.5 FRONT PAGE — UX جدید (هیرو CTA، گام‌ها، پربازدیدها)
   ============================================================ */
.home-hero {
  background: var(--brand-grad);
  color: #fff;
  padding-block: 34px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.home-hero .container { position: relative; }
.hero-kicker {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.28);
  color: #fff; font-size: .88rem; font-weight: 700;
  padding: 7px 16px; border-radius: var(--radius-pill); margin-bottom: 20px;
}
.hero-kicker svg { width: 17px; height: 17px; color: #fde68a; }
.hero-title {
  color: #fff; font-size: clamp(1.7rem, 4vw, 2.6rem); font-weight: 900;
  max-width: 40rem; margin-inline: auto;
}
.hero-sub {
  color: rgba(255,255,255,.86); font-size: 1.05rem;
  max-width: 36rem; margin: 14px auto 30px;
}
.hero-cta { width: 100%; margin-inline: auto; }
.hero-cta .mg-submit-box {
  background: #fff; border: none; box-shadow: var(--shadow-lg);
  border-radius: var(--radius); max-width: none; width: 100%;
}
.hero-cta .mg-submit-box h2 { font-size: 1.1rem; }
.hero-stats {
  display: flex; justify-content: center; gap: clamp(20px, 5vw, 56px);
  flex-wrap: wrap; margin: 24px 0 20px; padding: 0;
}
.hero-stats li { display: flex; flex-direction: column; gap: 2px; }
.hero-stats strong { font-size: 1.5rem; font-weight: 900; color: #fff; }
.hero-stats span { font-size: .84rem; color: rgba(255,255,255,.75); }
.hero-chips { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.hero-chips .chip {
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.25);
  color: #fff; font-size: .84rem; padding: 6px 15px;
}
.hero-chips .chip:hover { background: #fff; color: var(--brand-strong); }

.home-steps { padding-block: 40px 8px; }
.steps-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); }
.step-card {
  position: relative; background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 26px 24px 22px; box-shadow: var(--shadow-xs);
  transition: all .22s var(--ease);
}
.step-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-sm); border-color: var(--brand-100); }
.step-num {
  position: absolute; top: 18px; inset-inline-end: 20px;
  font-size: 2rem; font-weight: 900; color: var(--brand-50);
  line-height: 1;
}
.step-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 46px; height: 46px; border-radius: 14px;
  background: var(--brand-50); color: var(--brand); margin-bottom: 14px;
}
.step-icon svg { width: 23px; height: 23px; }
.step-card h3 { font-size: 1.05rem; margin-bottom: 6px; }
.step-card p { color: var(--muted); font-size: .92rem; margin: 0; }

.home-cols {
  display: grid;
  direction: ltr;
  grid-template-columns: 340px minmax(0, 1fr);
  grid-template-areas: "popular latest";
  gap: var(--gap);
  align-items: start;
}
.home-main { grid-area: latest; direction: rtl; min-width: 0; }
.home-aside { grid-area: popular; direction: rtl; min-width: 0; }
.cards-grid.is-two { grid-template-columns: repeat(2, 1fr); }
.latest-stream {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 32px; align-items: stretch; border-bottom: 1px solid var(--line);
}
.latest-story {
  min-width: 0; min-height: 218px; padding: 22px 0 20px;
  border-top: 1px solid var(--line); display: flex; flex-direction: column;
}
.latest-story:nth-child(even) { border-inline-start: 1px solid var(--line); padding-inline-start: 32px; }
.latest-story-topline {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  color: var(--faint); font-size: .78rem; font-weight: 700;
}
.latest-story-category { color: var(--brand); font-weight: 900; }
.latest-story-category:hover { color: var(--brand-strong); }
.latest-story-title { margin: 14px 0 8px; font-size: 1.12rem; line-height: 1.75; font-weight: 900; }
.latest-story-title a:hover { color: var(--brand); }
.latest-story-excerpt {
  margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.9;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
.latest-story-footer {
  margin-top: auto; padding-top: 16px; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; color: var(--faint); font-size: .79rem; font-weight: 700;
}
.latest-story-footer > span { display: inline-flex; align-items: center; gap: 6px; }
.latest-story-footer svg { width: 16px; height: 16px; }
.latest-story-open {
  width: 34px; height: 34px; display: inline-grid; place-items: center;
  border: 1px solid var(--line); border-radius: 50%; color: var(--brand); transition: color .18s var(--ease), border-color .18s var(--ease), background .18s var(--ease);
}
.latest-story-open:hover { color: #fff; border-color: var(--brand); background: var(--brand); }
.latest-story-open svg { width: 17px; height: 17px; }
.home-aside { border-inline-start: 1px solid var(--line); padding-inline-start: 28px; }
.popular-list { display: flex; flex-direction: column; margin: 0; }
.popular-list li {
  display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 14px; align-items: start;
  padding: 18px 0; border-top: 1px solid var(--line); transition: border-color .18s var(--ease);
}
.popular-list li:last-child { border-bottom: 1px solid var(--line); }
.popular-list li:hover { border-color: var(--brand-100); }
.popular-rank {
  display: block; color: var(--brand); font-weight: 900; font-size: 1.35rem;
  line-height: 1.35; font-variant-numeric: tabular-nums;
}
.popular-body { min-width: 0; }
.popular-title { display: block; font-weight: 800; font-size: .94rem; color: var(--ink); line-height: 1.75; }
.popular-title:hover { color: var(--brand); }
.popular-meta { display: inline-flex; align-items: center; gap: 5px; color: var(--faint); font-size: .8rem; margin-top: 3px; }
.popular-meta svg { width: 15px; height: 15px; }

/* ============================================================
   19. RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  :root { --gap: 22px; }
  .hero-grid { grid-template-columns: 1fr; }
  .hero-side { grid-template-rows: none; grid-template-columns: 1fr 1fr; min-height: auto; }
  .feature-card.is-main { min-height: 360px; }
  .feature-card.is-small { min-height: 230px; }
  .content-area { grid-template-columns: 1fr; grid-template-areas: "main" "sidebar"; }
  .sidebar { position: static; flex-direction: row; flex-wrap: wrap; }
  .sidebar .widget { flex: 1 1 280px; }
  .cards-grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1180px) {
  .primary-nav, .topicbar { display: none; }
  .site-branding { flex-basis: auto; }
}

@media (max-width: 860px) {
  .menu-toggle { width: 44px; padding-inline: 0; display: grid; border: 0; background: transparent; color: var(--text); }
  .menu-toggle-label { display: none; }
  .article-title { font-size: 1.6rem; }
  .article-header, .article-content, .article-featured, .article-footer, .toc-box { padding-inline: 22px; margin-inline: 0; }
  .toc-box { margin-inline: 22px; }
  .article-content > * { max-width: 100%; }
  .contact-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 30px; }
}

@media (max-width: 1024px) {
  .home-cols { direction: rtl; grid-template-columns: 1fr; grid-template-areas: "latest" "popular"; }
  .home-aside { border-inline-start: 0; border-top: 1px solid var(--line); padding-inline-start: 0; padding-top: 28px; }
  .steps-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  .cards-grid, .cards-grid.cols-2, .cards-grid.cols-4, .cards-grid.is-two { grid-template-columns: 1fr; }
  .latest-stream { grid-template-columns: 1fr; }
  .latest-story { min-height: 0; }
  .latest-story:nth-child(even) { border-inline-start: 0; padding-inline-start: 0; }
  .steps-grid { grid-template-columns: 1fr; }
  .home-hero { padding-block: 28px; }
  .hero-stats { gap: 26px; }
  .hero-side { grid-template-columns: 1fr; }
  .feature-card.is-main, .feature-card.is-solo { min-height: 300px; }
  .feature-card.is-small { min-height: 220px; }
  .feature-card .feature-body { padding: 22px; }
  .feature-card h2 { font-size: 1.42rem; }
  .section { padding-block: 40px; }
  .section-title { font-size: 1.3rem; }
  .article-title { font-size: 1.42rem; }
  .article-content { font-size: 1rem; }
  .styled-form .form-row { grid-template-columns: 1fr; }
  .post-nav { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .footer-bottom .container { flex-direction: column; text-align: center; }
  .comment-list .children { margin-inline-start: 18px; }
  .article-header, .article-content, .article-featured, .article-footer { padding-inline: 18px; }
  .error-404 .big-code { font-size: 5rem; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* Print (clean article printing) */
@media print {
  .site-header, .site-footer, .sidebar, .share-bar, .comments-area, .to-top, .reading-progress, .related-posts, .post-nav, .toc-box { display: none !important; }
  body { background: #fff; }
  .single-article { border: none; box-shadow: none; }
}

/* ============================================================
   20. SUPPLEMENTAL
   ============================================================ */
/* Sane default icon sizing (component-level rules still override). */
.mi { width: 1.25em; height: 1.25em; display: inline-block; vertical-align: -.15em; flex-shrink: 0; }

.footer-legal ul { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 16px; }
.footer-legal a { font-size: .82rem; }
.footer-legal a:hover { color: #fff; }

.share-btn.is-copied { background: var(--emerald) !important; }

.page-links { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 28px; font-weight: 700; max-width: var(--reading); margin-inline: auto; }
.page-links a, .page-links > span:not(.page-links-title) { min-width: 38px; height: 38px; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: var(--radius-xs); }
.page-links a:hover { border-color: var(--brand); color: var(--brand); }

.comment-awaiting em { color: var(--accent); font-size: .85rem; }
.comment-respond .comment-form-comment textarea,
.comment-respond input[type="text"], .comment-respond input[type="email"], .comment-respond input[type="url"] { width: 100%; padding: 13px 16px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: #fff; }
.comment-form .form-submit { margin-top: 4px; }

.newsletter-form { display: flex; flex-direction: column; }
.footer-newsletter .newsletter-form .btn { margin-top: 4px; }
