/**
 * blog.css — استایل صفحه لیست و تک پست
 * کپی دقیق از blog-new-design.html + کلاس‌های اضافی rules
 */

/* ===== Page Content — فاصله از navbar ===== */

/* جلوگیری از اسکرول افقی — فقط روی محتوا (نه html/body که sticky و fixed رو میشکنه) */
main,
.page-content {
  overflow-x: clip;
}

/* فوتر سایت اصلی: جلوگیری از بیرون زدن */
#footer-container {
  max-width: 100%;
  overflow: hidden;
}
#navbar-container {
  max-width: 100%;
  overflow: hidden;
}

.page-content {
  padding-top: 80px;
  flex: 1;
}

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 16px; }
main { padding: 28px 0 60px; flex: 1; }

/* ===== HERO SECTION ===== */
.hero-section { margin-bottom: 40px; }

.featured-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  grid-template-rows: 200px 200px;
  gap: 16px;
}

/* وقتی Swiper CSS لود می‌شود، کلاس swiper-wrapper می‌تواند display:flex را تحمیل کند.
   برای اینکه دسکتاپ Hero دقیقاً همان گرید قبلی بماند، این override با specificity بالاتر لازم است. */
.hero-swiper.swiper {
  overflow: visible;
}
@media (min-width: 981px) {
  .hero-swiper .featured-grid.swiper-wrapper {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    grid-template-rows: 200px 200px;
    gap: 16px;
    height: auto;
    transform: none !important;
    box-sizing: border-box;
  }
}

.featured-card {
  position: relative;
  isolation: isolate;
  border-radius: var(--r);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
  cursor: pointer;
}
[data-theme="light"] .featured-card {
  border-color: transparent;
}
.featured-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 28px 60px rgba(0,0,0,.5);
  border-color: rgba(239,68,68,.3);
}

.featured-card.large { grid-row: 1 / -1; }

/* === کارت بزرگ: تصویر بالا + محتوا پایین === */
.featured-card-top {
  display: flex;
  flex-direction: column;
}
.featured-card-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  flex-shrink: 0;
}
.featured-card-image img {
  width: 100%;
  height: 100%;
  object-fit: var(--hero-img-fit, cover);
  background: #0b1020;
  transition: transform 0.4s ease;
}
.featured-card-top:hover .featured-card-image img {
  transform: scale(1.03);
}
.featured-card-body {
  padding: 20px 24px 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  overflow: hidden;
  min-height: 0;
}

/* === Desktop: در کارت بزرگ، تصویر کوتاه‌تر شود تا زیرش تیتر/توضیحات دیده شود === */
@media (min-width: 981px) {
  .featured-card.large.featured-card-top { height: 100%; }
  .featured-card.large.featured-card-top .featured-card-image {
    height: 56%;
    aspect-ratio: auto;
  }
  .featured-card.large.featured-card-top .featured-card-body {
    padding-top: 16px;
  }
}

/* badge در کارت بزرگ */
.featured-card-top .featured-badge {
  top: 16px;
  right: 16px;
  z-index: 2;
}

.featured-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(400px 300px at 20% 30%, rgba(239,68,68,.25), transparent 60%),
    radial-gradient(400px 300px at 80% 70%, rgba(6,182,212,.2), transparent 60%),
    linear-gradient(135deg, rgba(255,255,255,.08), rgba(255,255,255,.02));
  background-size: 200% 200%;
  animation: bgShift 8s ease infinite;
}
.featured-img {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
@keyframes bgShift {
  0%,100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.featured-content {
  position: absolute;
  inset: 0;
  z-index: 2;
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: linear-gradient(to top, rgba(11,16,32,.95) 0%, rgba(11,16,32,.6) 50%, transparent 100%);
}

[data-theme="light"] .featured-content {
  background: linear-gradient(to top, rgba(255,255,255,.95) 0%, rgba(255,255,255,.6) 50%, transparent 100%);
}

.featured-badge {
  position: absolute;
  z-index: 2;
  top: 16px;
  right: 16px;
  padding: 6px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: white;
  font-size: 11px;
  font-weight: 1000;
  box-shadow: 0 4px 15px rgba(239,68,68,.4);
}

.featured-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 10px;
}
.featured-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.featured-card.large .featured-title {
  font-size: 22px;
  line-height: 1.5;
  margin: 0 0 12px 0;
  font-weight: 1000;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.featured-card:not(.large) .featured-title {
  font-size: 15px;
  line-height: 1.6;
  margin: 0 0 8px 0;
  font-weight: 1000;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.featured-excerpt {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.featured-card:not(.large) .featured-excerpt {
  -webkit-line-clamp: 1;
  font-size: 12px;
}

/* === Small pinned cards: full-card bottom-heavy dark overlay + white text === */
.featured-card:not(.large)::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(
    to top,
    rgba(4, 8, 20, .94) 0%,
    rgba(4, 8, 20, .86) 22%,
    rgba(4, 8, 20, .68) 46%,
    rgba(4, 8, 20, .42) 70%,
    rgba(4, 8, 20, .22) 100%
  );
}
.featured-card:not(.large) .featured-content {
  background: transparent;
  border-radius: inherit;
}
.featured-card:not(.large) .featured-title,
.featured-card:not(.large) .featured-title a {
  color: #fff !important;
}
.featured-card:not(.large) .featured-meta,
.featured-card:not(.large) .featured-meta span {
  color: rgba(255,255,255,.78) !important;
}
.featured-card:not(.large) .featured-excerpt {
  color: rgba(255,255,255,.74) !important;
}
[data-theme="light"] .featured-card:not(.large)::after {
  background: linear-gradient(
    to top,
    rgba(4, 8, 20, .94) 0%,
    rgba(4, 8, 20, .86) 22%,
    rgba(4, 8, 20, .68) 46%,
    rgba(4, 8, 20, .42) 70%,
    rgba(4, 8, 20, .22) 100%
  );
}
[data-theme="light"] .featured-card:not(.large) .featured-title,
[data-theme="light"] .featured-card:not(.large) .featured-title a {
  color: #fff !important;
}
[data-theme="light"] .featured-card:not(.large) .featured-meta,
[data-theme="light"] .featured-card:not(.large) .featured-meta span {
  color: rgba(255,255,255,.78) !important;
}
[data-theme="light"] .featured-card:not(.large) .featured-excerpt {
  color: rgba(255,255,255,.74) !important;
}

.featured-arrow {
  z-index: 2;
  position: absolute;
  top: 16px;
  left: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  opacity: 0;
  transform: translateX(-10px);
  transition: all 0.3s ease;
}
.featured-card:hover .featured-arrow {
  opacity: 1;
  transform: translateX(0);
}

/* Hero card خالی */
.featured-empty {
  background: rgba(255,255,255,.03);
  border: 1px dashed var(--line);
  cursor: default;
  pointer-events: none;
}

/* Hero Carousel Dots — hidden on desktop */
.hero-pagination {
  display: none;
}

/* ===== MAIN LAYOUT ===== */
.layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 24px;
  align-items: start;
}
/* صفحه تک‌پست: عریض‌تر */
.single-post-page .layout {
  grid-template-columns: 1fr 260px;
  gap: 28px;
}

/* ===== Sticky Sidebar ===== */
.side {
  position: sticky;
  top: 90px;
  background: rgba(255,255,255,.05);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--r);
  box-shadow: 0 8px 32px rgba(0,0,0,.12);
  overflow: hidden;
  height: fit-content;
  margin-left: 10px;
}
[data-theme="light"] .side {
  background: rgba(255,255,255,.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid transparent;
  box-shadow: 0 8px 32px rgba(0,0,0,.06);
}
/* Close button for drawer — فقط موبایل */
.side-close {
  display: none !important;
  position: absolute;
  top: 12px;
  left: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.15);
  background: rgba(255,255,255,.08);
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  z-index: 10;
}
[data-theme="light"] .side-close {
  border: 1px solid rgba(0,0,0,.12);
  background: rgba(0,0,0,.05);
}
.side .bd { padding: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
  font-size: 12px;
  font-weight: 900;
  color: var(--muted);
  transition: all 0.2s ease;
  text-decoration: none;
}
[data-theme="light"] .chip {
  border: 1px solid rgba(0,0,0,.15);
  background: rgba(0,0,0,.04);
  color: #374151;
}
.chip:hover {
  border-color: rgba(239,68,68,.28);
  color: var(--text);
  background: rgba(239,68,68,.08);
}
.chip-more {
  border-color: rgba(239,68,68,.3);
  color: var(--accent);
}
.chip-more:hover {
  background: rgba(239,68,68,.1);
}

.mini { display: grid; gap: 12px; margin-top: 20px; }
.mini a {
  display: block;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
  transition: all 0.2s ease;
}
[data-theme="light"] .mini a {
  border: 1px solid rgba(0,0,0,.1);
  background: rgba(0,0,0,.02);
}
.mini a:hover {
  border-color: rgba(6,182,212,.3);
  background: rgba(6,182,212,.05);
}
.mini b { display: block; font-size: 12px; font-weight: 1000; line-height: 1.8; }
.mini span { display: block; margin-top: 6px; color: var(--muted); font-size: 11px; line-height: 1.7; }

/* backdrop overlay for mobile sidebar */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
}
.sidebar-backdrop.active {
  display: block;
}

/* ===== Posts List ===== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding: 0 4px;
}
.section-title {
  font-size: 18px;
  font-weight: 1000;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title::before { content: "📰"; }

.posts-list { display: grid; gap: 20px; margin-bottom: 48px; }

.post-card {
  background: rgba(255,255,255,.05);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: grid;
  grid-template-columns: 280px 1fr;
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
}
[data-theme="light"] .post-card {
  background: var(--card);
  border-color: transparent;
}
.post-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 24px 56px rgba(0,0,0,.45);
  border-color: rgba(148,163,184,.3);
}

.post-thumb {
  border-left: 1px solid rgba(255,255,255,.08);
  background-color: var(--card);
  overflow: hidden;
  position: relative;
  aspect-ratio: 4 / 3;
}
[data-theme="light"] .post-thumb {
  border-left-color: transparent;
}
.post-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}
.post-card:hover .post-thumb img {
  transform: scale(1.05);
}
/* hover circle arrow */
.post-hover-arrow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(239,68,68,.85);
  border: 2px solid rgba(255,255,255,.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #fff;
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 2;
  pointer-events: none;
}
.post-card:hover .post-hover-arrow {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
@keyframes sh { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
@keyframes shine {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.post-body {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
}

.post-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
  align-items: center;
  margin-bottom: 12px;
}
.post-tag {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
  font-weight: 1000;
  color: rgba(6,182,212,.95);
  font-size: 11px;
}
.post-title {
  margin: 0 0 12px 0;
  font-size: 18px;
  line-height: 1.6;
  letter-spacing: -.2px;
  font-weight: 1000;
}
.post-title a:hover { color: var(--accent2); }
.post-excerpt {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.9;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ===== Pagination ===== */
.pagination {
  margin-top: 32px;
  margin-bottom: 48px;
  padding: 24px;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--line);
  border-radius: var(--r);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.page-btn {
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  transition: all 0.2s ease;
  min-width: 40px;
  text-align: center;
}
.page-btn:hover {
  border-color: rgba(239,68,68,.4);
  background: rgba(239,68,68,.1);
  color: var(--text);
}
.page-btn.active {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: white;
  border-color: transparent;
}
.page-btn.prev, .page-btn.next { padding: 10px 20px; }

/* ===== Empty State ===== */
.empty-state {
  padding: 60px 20px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--r);
  font-size: 15px;
}

/* ===== Single Post Page ===== */
.single-post-page { max-width: 1100px; margin: 0 auto; }
.single-post { margin-bottom: 40px; }

.post-header { margin-bottom: 32px; }
.single-post-title {
  font-size: 28px;
  font-weight: 1000;
  line-height: 1.6;
  margin: 16px 0;
}
.single-post-excerpt {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.8;
  margin: 0;
}

.post-cover {
  margin-bottom: 32px;
  border-radius: var(--r);
  overflow: hidden;
  border: 1px solid var(--line);
}
.post-cover img {
  width: 100%;
  display: block;
}

/* ===== Blog Content ===== */
.blog-content {
  word-break: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
  overflow-x: hidden;
}
.blog-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.blog-content th, .blog-content td {
  padding: 10px 14px;
  border: 1px solid var(--line);
  text-align: right;
  font-size: 14px;
  line-height: 1.8;
}
.blog-content th {
  background: rgba(255,255,255,.06);
  font-weight: 700;
}
[data-theme="light"] .blog-content th {
  background: #f8f9fa;
}
.blog-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}
.blog-content figure {
  margin: 1rem 0;
}
.blog-content figure img {
  width: 100%;
}

/* ===== Comments Section ===== */
.comments-section {
  margin-top: 48px;
  padding-top: 32px;
  padding-bottom: 60px;
  border-top: 1px solid var(--line);
}
.comments-title {
  font-size: 18px;
  font-weight: 1000;
  margin: 0 0 24px;
}

.comments-list { display: grid; gap: 16px; margin-bottom: 32px; }
.comment-item {
  padding: 20px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
[data-theme="light"] .comment-item {
  background: var(--card);
}
.comment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.comment-name { font-weight: 900; font-size: 14px; }
.comment-date { color: var(--muted); font-size: 12px; }
.comment-body { font-size: 14px; line-height: 1.9; color: var(--text); }

.admin-reply {
  margin-top: 14px;
  padding: 14px;
  background: rgba(6,182,212,.06);
  border: 1px solid rgba(6,182,212,.2);
  border-radius: 12px;
}
.admin-reply-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.admin-badge {
  font-size: 12px;
  font-weight: 1000;
  color: var(--accent2);
}
.admin-reply-date { color: var(--muted); font-size: 11px; }
.admin-reply-body { font-size: 13px; line-height: 1.9; }

/* Comment Form */
.comment-form-wrap {
  padding: 24px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
[data-theme="light"] .comment-form-wrap {
  background: var(--card);
}
.comment-form-wrap h4 {
  margin: 0 0 16px;
  font-size: 16px;
  font-weight: 1000;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}
.comment-form-wrap input,
.comment-form-wrap textarea {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.04);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
.comment-form-wrap input:focus,
.comment-form-wrap textarea:focus {
  border-color: var(--accent2);
}
.comment-form-wrap textarea { resize: vertical; min-height: 100px; }
.comment-submit {
  margin-top: 12px;
  padding: 12px 28px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: white;
  font-family: inherit;
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
  transition: opacity 0.2s;
}
.comment-submit:hover { opacity: 0.9; }
.comment-note {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.comment-success {
  padding: 12px 16px;
  border-radius: 10px;
  background: rgba(16,185,129,.12);
  border: 1px solid rgba(16,185,129,.3);
  color: #10b981;
  margin-top: 12px;
}
.comment-error {
  padding: 12px 16px;
  border-radius: 10px;
  background: rgba(239,68,68,.1);
  border: 1px solid rgba(239,68,68,.3);
  color: var(--accent);
  margin-top: 12px;
}

/* ===== Categories Page ===== */
.categories-page { padding: 40px 0; }
.categories-page h1 {
  font-size: 24px;
  font-weight: 1000;
  margin: 0 0 24px;
}

/* ===== Breadcrumb ===== */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 0 20px;
  font-size: 13px;
  color: var(--muted);
  flex-wrap: wrap;
}
.breadcrumb a {
  color: var(--muted);
  transition: color 0.2s;
}
.breadcrumb a:hover { color: var(--accent); }
.bc-sep { color: var(--line); font-size: 11px; }
.bc-current { color: var(--text); font-weight: 600; }

/* ===== Comments ===== */
#comments-summary {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.04);
}
#comments-summary:hover {
  border-color: var(--accent);
  background: rgba(239,68,68,.04);
}
[data-theme="light"] #comments-summary {
  background: rgba(0,0,0,.02);
  border-color: rgba(0,0,0,.1);
}
[data-theme="light"] #comments-summary:hover {
  border-color: var(--accent);
  background: rgba(239,68,68,.04);
}
.comment-item { margin-bottom: 12px; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
[data-theme="light"] .comment-item { border-color: rgba(0,0,0,.1); }
.comment-header { padding: 12px 16px; background: rgba(255,255,255,.03); }
[data-theme="light"] .comment-header { background: rgba(0,0,0,.02); }
.comment-body { padding: 12px 16px; }
.comment-hidden { display: none; }
.comment-name { font-size: 13px; font-weight: 800; }
.comment-date { font-size: 11px; color: var(--muted); }

/* ===== Responsive ===== */

/* Tablet: sidebar narrower, safe spacing */
@media (max-width: 1200px) and (min-width: 981px) {
  .layout { grid-template-columns: 1fr 220px; gap: 20px; }
  .single-post-page .layout { grid-template-columns: 1fr 200px; }
  .side { margin-left: 0; }
}

/* Sidebar toggle: hidden on desktop, shown on mobile */
#sidebar-toggle { display: none; }

/* Mobile: < 980px */
@media (max-width: 980px) {
  /* Hero موبایل: pagination باید داخل باکس Hero و دقیقاً زیر اسلایدها بنشیند */
  .hero-section {
    position: relative;
    margin-bottom: 28px;
  }
  /* === Hero Slider (Swiper) — بدون تغییر اندازه کارت‌ها === */
  .hero-swiper.swiper {
    overflow: hidden;
    padding-bottom: 0;
  }

  /* ✅ موبایل: همه اسلایدها هم‌قد (فقط دسکتاپ کارت منتخب بزرگ‌تر است)
     ارتفاع پایه همان ارتفاع کارت‌های کوچک Hero است. */
  .hero-swiper { --hero-mobile-h: 200px; }
  .hero-swiper .featured-card {
    height: var(--hero-mobile-h);
    min-height: var(--hero-mobile-h);
  }
  .hero-swiper.swiper-initialized .featured-card {
    height: var(--hero-mobile-h) !important;
    min-height: var(--hero-mobile-h) !important;
  }

  /* کارت منتخب (large) در موبایل مثل بقیه: تصویر تمام‌قد + متن روی تصویر */
  .hero-swiper .featured-card.large { grid-row: auto; }
  .hero-swiper .featured-card.large.featured-card-top { display: block; }
  .hero-swiper .featured-card.large.featured-card-top .featured-card-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    aspect-ratio: auto;
  }
  .hero-swiper .featured-card.large.featured-card-top .featured-card-image img {
    width: 100%;
    height: 100%;
    object-fit: var(--hero-img-fit, cover);
    object-position: center;
  }
  .hero-swiper .featured-card::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    border-radius: inherit;
    background: linear-gradient(
      to top,
      rgba(4, 8, 20, .94) 0%,
      rgba(4, 8, 20, .86) 22%,
      rgba(4, 8, 20, .68) 46%,
      rgba(4, 8, 20, .42) 70%,
      rgba(4, 8, 20, .22) 100%
    );
  }
  [data-theme="light"] .hero-swiper .featured-card::after {
    background: linear-gradient(
      to top,
      rgba(4, 8, 20, .94) 0%,
      rgba(4, 8, 20, .86) 22%,
      rgba(4, 8, 20, .68) 46%,
      rgba(4, 8, 20, .42) 70%,
      rgba(4, 8, 20, .22) 100%
    );
  }
  .hero-swiper .featured-card.large.featured-card-top .featured-card-body {
    position: absolute;
    z-index: 2;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 18px 18px 16px;
    background: transparent;
    overflow: hidden;
  }
  [data-theme="light"] .hero-swiper .featured-card.large.featured-card-top .featured-card-body {
    background: transparent;
  }
  .hero-swiper .featured-card.large.featured-card-top .featured-title,
  .hero-swiper .featured-card.large.featured-card-top .featured-title a {
    color: #fff !important;
    font-size: 16px;
    margin: 0 0 8px 0;
  }
  .hero-swiper .featured-card.large.featured-card-top .featured-meta,
  .hero-swiper .featured-card.large.featured-card-top .featured-meta span {
    color: rgba(255,255,255,.75) !important;
  }
  .hero-swiper .featured-card.large.featured-card-top .featured-excerpt {
    color: rgba(255,255,255,.7) !important;
    font-size: 12px;
    -webkit-line-clamp: 1;
  }
  [data-theme="light"] .hero-swiper .featured-card.large.featured-card-top .featured-title,
  [data-theme="light"] .hero-swiper .featured-card.large.featured-card-top .featured-title a {
    color: #fff !important;
  }
  [data-theme="light"] .hero-swiper .featured-card.large.featured-card-top .featured-meta,
  [data-theme="light"] .hero-swiper .featured-card.large.featured-card-top .featured-meta span {
    color: rgba(255,255,255,.78) !important;
  }
  [data-theme="light"] .hero-swiper .featured-card.large.featured-card-top .featured-excerpt {
    color: rgba(255,255,255,.74) !important;
  }

  /* وقتی Swiper فعال شد، خودش layout را مدیریت می‌کند (اینجا فقط gap را صفر می‌کنیم). */
  .hero-swiper.swiper-initialized .featured-grid.swiper-wrapper {
    /* مهم: کلاس .featured-grid در حالت پایه display:grid دارد.
       اگر این فایل CSS بعد از Swiper لود شود، آن display:flex پیش‌فرض Swiper override می‌شود
       و فقط اسلاید اول درست دیده می‌شود. */
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: stretch;
    /* خنثی‌سازی تنظیمات Grid برای موبایل */
    grid-template-columns: unset;
    grid-template-rows: unset;
    gap: 0;
    height: auto !important;
  }

  /* ===== Mobile Hero: حذف هاله/سایه‌ی مزاحم زیر کارت‌ها =====
     سایه‌ی پیش‌فرض (var(--shadow)) در موبایل باعث می‌شود زیر Hero یک خط/هاله دیده شود
     و pagination نصفه زیر آن برود. در موبایل سایه را کامل حذف می‌کنیم.
  */
  .hero-swiper .featured-card {
    box-shadow: none !important;
    transform: none !important;
    border: none !important;
    outline: none !important;
  }
  .hero-swiper .featured-card:hover {
    box-shadow: none !important;
    transform: none !important;
  }

  /* اگر اسلاید خالی (fallback) نمایش داده شد، دورش هیچ خط/حاشیه‌ای نباشد */
  .hero-swiper .featured-empty {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
  }

  /* Swiper باید هر اسلاید را تمام‌عرض بگیرد؛ این قفل باعث می‌شود اسلاید ۲ و ۳ خالی/نامرئی نشوند. */
  .hero-swiper.swiper-initialized .featured-grid.swiper-wrapper > .swiper-slide {
    flex: 0 0 100% !important;
    width: 100% !important;
    box-sizing: border-box;
  }

  /* Fallback اگر CDN/JS لود نشد: همان اسکرول افقی قبلی */
  .hero-swiper:not(.swiper-initialized) .featured-grid {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    gap: 0;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    overscroll-behavior-x: contain;
    touch-action: pan-x;
  }
  .hero-swiper:not(.swiper-initialized) .featured-grid::-webkit-scrollbar { display: none; }
  .hero-swiper:not(.swiper-initialized) .featured-card {
    flex: 0 0 100%;
    min-width: 100%;
    scroll-snap-align: center;
    scroll-snap-stop: always;
    border-radius: var(--r);
  }
  .featured-card.large {
    grid-row: auto;
  }
  
  /* Dots visible (Swiper pagination) */
  .hero-pagination {
    display: flex !important;
    justify-content: center;
    align-items: center;
    gap: 8px;
    width: 100%;
    margin: 12px 0 0;
    padding: 0;
    position: static !important;
    inset: auto !important;
    transform: none !important;
    z-index: 1;
    pointer-events: auto;
  }
  .hero-pagination .swiper-pagination-bullet {
    width: 9px;
    height: 9px;
    padding: 0;
    line-height: 0;
    border-radius: 50%;
    -webkit-appearance: none;
    appearance: none;
    flex: 0 0 auto;
    background: rgba(239,68,68,.22);
    border: 1px solid rgba(239,68,68,.28);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: none;
  }
  [data-theme="light"] .hero-pagination .swiper-pagination-bullet {
    background: rgba(239,68,68,.18);
    border: 1px solid rgba(239,68,68,.26);
  }
  .hero-pagination .swiper-pagination-bullet-active {
    background: var(--accent, #ef4444);
    border-color: transparent;
    transform: scale(1.15);
    box-shadow: 0 0 0 4px rgba(239,68,68,.14), 0 0 12px rgba(239,68,68,.42);
  }
  .layout { grid-template-columns: 1fr; }
  .single-post-page .layout { grid-template-columns: 1fr; }

  /* دکمه toggle — سمت راست صفحه */
  #sidebar-toggle {
    display: flex !important;
    align-items: center;
    justify-content: center;
    position: fixed;
    right: 0;
    left: auto;
    top: 50%;
    transform: translateY(-50%);
    -webkit-transform: translateY(-50%);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    width: 22px;
    height: 36px;
    border-radius: 8px 0 0 8px;
    background: linear-gradient(135deg, rgba(239,68,68,.92), rgba(236,72,153,.88));
    border: 1px solid rgba(255,255,255,.2);
    border-right: none;
    color: white;
    font-size: 11px;
    cursor: pointer;
    box-shadow: -2px 0 8px rgba(239,68,68,.2);
    z-index: 9999;
    padding: 0;
    transition: none;
    will-change: auto;
  }
  #sidebar-toggle:active {
    box-shadow: -2px 0 8px rgba(239,68,68,.2);
  }
  #sidebar-toggle svg {
    width: 11px;
    height: 11px;
    flex-shrink: 0;
  }

  /* Close button visible on mobile only */
  .side-close { display: flex !important; }

  /* sidebar — drawer از سمت راست با 10px margin */
  .side {
    position: fixed !important;
    top: 10px;
    right: -110%;
    left: auto;
    width: min(300px, calc(100vw - 20px));
    height: calc(100vh - 20px);
    overflow-y: auto;
    z-index: 1001;
    background: rgba(20,25,40,.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 16px;
    transition: right 0.3s ease;
    padding-top: 48px;
    margin-left: 0;
    order: 0;
    box-shadow: -8px 0 40px rgba(0,0,0,.3);
  }
  [data-theme="light"] .side {
    background: rgba(255,255,255,.95);
    border: 1px solid rgba(0,0,0,.08);
    box-shadow: -8px 0 40px rgba(0,0,0,.1);
  }
  .side.side-open {
    right: 10px;
  }
  .side-close {
    left: 12px;
    right: auto;
  }

  .post-card { grid-template-columns: 1fr; }
  .post-thumb {
    border-left: 0;
    border-bottom: 1px solid rgba(255,255,255,.08);
    aspect-ratio: 4 / 3;
    min-height: auto;
  }
  .form-row { grid-template-columns: 1fr; }
}


/* Sticky menu heading */
.sticky-menu-title{margin:0 0 12px 0;color:#718096;font-size:0.96rem;font-weight:800;line-height:1.4;text-align:right;}
