/* ===========================
   Ajand Blog Page Styles
   - سایدبار چپ + گرید پست‌ها
   - هماهنگ با دارک‌مود سراسری (body.dark)
   =========================== */

/* کانتینر کلی صفحه وبلاگ */
.blog-page {
  max-width: 1200px;
  margin: 30px auto;
  padding: 0 16px;
}

/* گرید اصلی: سایدبار (300px) + محتوا */
.blog-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 28px;
  align-items: start;
}

/* ————— Sidebar ————— */

.blog-sidebar .sidebar-widget {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,.05);
  padding: 16px;
  margin-bottom: 18px;
}

body.dark .blog-sidebar .sidebar-widget {
  background: #2b2b2b;
  box-shadow: 0 2px 8px rgba(255,255,255,.05);
}

.blog-sidebar h3 {
  font-size: 1rem;
  margin: 0 0 12px;
}

/* سرچ */
/* چیدمان فرم جستجو */
.blog-search{
  display:flex;
  align-items:center;
  gap:10px;
}

.blog-search input[type="search"]{
  flex:1;
  height:42px;
  padding:0 12px;
  border-radius:10px;
  border:1px solid #d7d7d7;
  outline:none;
  background:#fff; color:#222;
  font-size:.95rem;
}

.blog-search input[type="search"]:focus{ border-color:#0077ff; }

.blog-search .search-btn{
  height:42px;
  padding:0 14px;
  border-radius:10px;
  border:1px solid #d7d7d7;
  background:#fff; cursor:pointer;
}

body.dark .blog-search input[type="search"],
body.dark .blog-search .search-btn{
  background:#1f1f1f; color:#eee; border-color:#444;
}

/* دسترس‌پذیری: پنهان کردن لیبل بصری */
.sr-only{
  position:absolute; width:1px; height:1px; padding:0; margin:-1px;
  overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0;
}


/* دسته‌بندی‌ها */
.category-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.category-list li {
  margin: 8px 0;
}
.category-list a {
  color: inherit;
  text-decoration: none;
  display: inline-block;
  padding: 8px 10px;
  border-radius: 8px;
  transition: background .2s ease, color .2s ease;
}
.category-list a:hover {
  background: rgba(0,119,255,.08);
  color: #0077ff;
}
body.dark .category-list a:hover {
  background: rgba(0,119,255,.15);
}

/* Top posts (شماره‌دار) */
.top-posts {
  counter-reset: rank;
  list-style: none;
  padding: 0;
  margin: 0;
}
.top-posts li {
  position: relative;
  padding: 10px 10px 10px 34px; /* جا برای شماره سمت چپ (در RTL می‌شود راست) */
  margin: 8px 0;
  background: #fafafa;
  border-radius: 10px;
}
.top-posts li::before {
  counter-increment: rank;
  content: counter(rank);
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  right: auto;
  left: 10px; /* RTL: سمت چپ شماره */
  width: 20px; height: 20px;
  border-radius: 6px;
  background: #0077ff;
  color: #fff;
  display: grid; place-items: center;
  font-size: .8rem;
}
.top-posts a {
  color: inherit;
  text-decoration: none;
}
body.dark .top-posts li {
  background: #242424;
}

/* Instagram grid */
.insta-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.insta-grid a, .insta-grid img {
  display: block;
  width: 100%;
  border-radius: 8px;
}

/* ————— Posts area ————— */

.posts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 26px;
}

.post-card {
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,.05);
  transition: transform .18s ease, box-shadow .18s ease;
}
.post-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 18px rgba(0,0,0,.08);
}
body.dark .post-card {
  background: #2b2b2b;
  box-shadow: 0 2px 8px rgba(255,255,255,.05);
}

.post-thumb img {
  width: 100%;
  height: auto;
  display: block;
}

.post-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: .85rem;
  color: #666;
  padding: 12px 16px 0;
}
.post-cat {
  color: #0077ff;
  text-decoration: none;
}
.post-cat:hover { text-decoration: underline; }
body.dark .post-meta { color: #bbb; }

.post-title {
  font-size: 1.05rem;
  line-height: 1.5;
  padding: 6px 16px 0;
  margin: 0;
}
.post-title a {
  color: inherit;
  text-decoration: none;
}
.post-title a:hover { color: #0077ff; }

.post-excerpt {
  padding: 8px 16px 16px;
  color: #555;
  font-size: .95rem;
  line-height: 1.7;
}
body.dark .post-excerpt { color: #ccc; }

/* Pagination */
.blog-pagination {
  display: flex;
  gap: 8px;
  align-items: center;
}
.blog-pagination a {
  display: inline-block;
  min-width: 36px;
  text-align: center;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid #ddd;
  text-decoration: none;
  color: inherit;
  background: #fff;
}
.blog-pagination a:hover {
  border-color: #0077ff;
  color: #0077ff;
}
.blog-pagination .is-active {
  background: #0077ff;
  color: #fff !important;
  border-color: #0077ff;
}
body.dark .blog-pagination a {
  background: #2b2b2b;
  border-color: #444;
}

/* ————— RTL & Header ————— */
/* کل صفحه RTL، ولی هدر را LTR نگه دارید */
html { direction: rtl; }
header { direction: ltr; }

/* ————— ریسپانسیو ————— */

@media (max-width: 1024px) {
  .blog-layout {
    grid-template-columns: 260px 1fr;
    gap: 22px;
  }
}

/* ===========================
   فقط برای موبایل (بدون تاثیر روی دسکتاپ)
   =========================== */

@media (max-width: 860px) {

  /* کل طرح وبلاگ تک‌ستونه می‌شود */
  .blog-layout {
    grid-template-columns: 1fr !important;
    gap: 22px;
  }

  /* پست‌ها تک‌ستونه می‌شوند */
  .posts-grid {
    grid-template-columns: 1fr !important;
    gap: 20px;
  }

  /* ترتیب: پست‌ها بالا → سایدبار پایین */
  .blog-content {
    order: 1 !important;
  }

  .blog-sidebar {
    order: 2 !important;
  }

  /* اصلاح فاصله‌ها */
  .blog-sidebar .sidebar-widget {
    margin-bottom: 16px;
  }

  /* تصویر پست‌ها همیشه 100٪ */
  .post-thumb img {
    width: 100%;
    height: auto;
  }
}

