/* ==========================================================================
   وبلاگ — فهرست مقالات و صفحهٔ مقاله
   ========================================================================== */

.page-head {
  padding: 28px 0 8px;
  background: var(--page-bg);
}
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 400;
  color: var(--muted);
}
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .sep { opacity: 0.5; }
.breadcrumb .current { color: var(--text); font-weight: 600; }

/* ---------- مقالات ویژه (سه کارت بالای صفحه) ---------- */
.featured-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  padding: 24px 0 8px;
}
.featured-card {
  position: relative;
  display: block;
  height: 300px;
  border-radius: 14px;
  overflow: hidden;
  background: #e5e5e5 center / cover no-repeat;
  transition: transform 0.3s;
}
.featured-card:hover { transform: translateY(-4px); }
.featured-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 40%, rgba(0, 0, 0, 0.78) 100%);
}
.featured-card .label {
  position: absolute;
  z-index: 1;
  inset: auto 24px 22px 24px;
  font-family: "Meem", serif;
  font-size: 18px;
  line-height: 30px;
  font-weight: 600;
  color: #fff;
}

/* ---------- شبکهٔ مقالات ---------- */
.blog-list { padding: 40px 0 70px; background: var(--page-bg); }
.posts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  margin-top: 32px;
}
.post-card {
  display: flex;
  flex-direction: column;
  padding: 14px;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
  transition: transform 0.3s, box-shadow 0.3s;
}
html[data-theme="dark"] .post-card { background: #1c1c1c; box-shadow: none; }
.post-card:hover { transform: translateY(-6px); box-shadow: 0 18px 40px rgba(0, 0, 0, 0.1); }
.post-card .thumb {
  height: 232px;
  border-radius: 12px;
  background: #ececec center / cover no-repeat;
}
.post-card .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 16px;
  font-family: "YekanBakh-FaNum", serif;
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
}
.post-card .meta span { display: inline-flex; align-items: center; gap: 5px; }
.post-card h2 {
  margin-top: 10px;
  font-family: "Meem", serif;
  font-size: 18px;
  line-height: 30px;
  font-weight: 600;
  color: var(--heading);
  transition: color 0.3s;
}
.post-card:hover h2 { color: var(--primary); }
.post-card .excerpt {
  margin-top: 10px;
  font-size: 15px;
  line-height: 27px;
  font-weight: 400;
  color: var(--muted);
}
.post-card .more {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  font-size: 15px;
  font-weight: 600;
  color: var(--primary);
}
.post-card .more svg { transition: transform 0.3s; }
.post-card:hover .more svg { transform: translateX(-4px); }

.blog-empty {
  padding: 70px 20px;
  text-align: center;
  color: var(--muted);
}

/* ---------- صفحهٔ مقاله ---------- */
.article-wrap { padding: 24px 0 70px; background: var(--page-bg); }

/* کارت معرفی بالای صفحه */
.article-hero {
  padding: 24px;
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.06);
}
html[data-theme="dark"] .article-hero { background: #1c1c1c; box-shadow: none; }
.article-hero .hero-row { display: flex; align-items: stretch; gap: 26px; }
.article-hero .hero-copy { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; gap: 14px; }
.article-hero h1 {
  font-family: "Meem", serif;
  font-size: 28px;
  line-height: 46px;
  font-weight: 700;
  color: var(--primary);
}
.article-hero .hero-copy p { font-size: 15px; line-height: 30px; font-weight: 400; color: var(--muted); }
.article-hero .hero-cover {
  flex: 0 0 46%;
  min-height: 240px;
  border-radius: 14px;
  background: #ececec center / cover no-repeat;
}
.article-hero .hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 26px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  font-family: "YekanBakh-FaNum", serif;
  font-size: 14px;
  font-weight: 400;
  color: var(--muted);
}
html[data-theme="dark"] .article-hero .hero-meta { border-top-color: rgba(255, 255, 255, 0.1); }
.article-hero .hero-meta span { display: inline-flex; align-items: center; gap: 7px; }
.article-hero .hero-meta svg { width: 17px; height: 17px; }

/* چیدمان دو ستونی */
.article-layout { display: flex; align-items: flex-start; gap: 26px; margin-top: 26px; }
.article-side { flex: 0 0 300px; display: grid; gap: 20px; position: sticky; top: 20px; }
.article { flex: 1 1 auto; min-width: 0; }

.side-card {
  padding: 18px;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.05);
}
html[data-theme="dark"] .side-card { background: #1c1c1c; box-shadow: none; }
.side-title {
  margin-bottom: 14px;
  font-family: "Meem", serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--heading);
}
.side-search { display: flex; align-items: center; gap: 8px; }
.side-search input {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0 14px;
  border: 1.5px solid rgba(0, 0, 0, 0.1);
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-size: 14px;
}
html[data-theme="dark"] .side-search input { border-color: rgba(255, 255, 255, 0.12); }
.side-search input:focus { outline: 0; border-color: var(--primary); }
.side-search button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
}
.side-search svg { width: 20px; height: 20px; }

.side-posts { display: grid; gap: 14px; }
.side-post { display: flex; align-items: center; gap: 12px; }
.side-post .thumb {
  flex: 0 0 64px;
  height: 58px;
  border-radius: 10px;
  background: #ececec center / cover no-repeat;
}
.side-post .copy { min-width: 0; }
.side-post strong {
  display: block;
  font-size: 14px;
  line-height: 24px;
  font-weight: 600;
  color: var(--heading);
  transition: color 0.2s;
}
.side-post:hover strong { color: var(--primary); }
.side-post small { font-family: "YekanBakh-FaNum", serif; font-size: 12px; color: var(--muted); }
.side-empty { font-size: 14px; color: var(--muted); }

/* فهرست مطالب */
.toc {
  margin-bottom: 24px;
  padding: 16px 20px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 14px;
  background: var(--surface);
}
html[data-theme="dark"] .toc { background: #1c1c1c; border-color: rgba(255, 255, 255, 0.1); }
.toc summary {
  cursor: pointer;
  font-family: "Meem", serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--heading);
  list-style: none;
}
.toc summary::-webkit-details-marker { display: none; }
.toc summary::after {
  content: "⌄";
  float: left;
  font-size: 20px;
  line-height: 1;
  color: var(--primary);
  transition: transform 0.25s;
}
.toc[open] summary::after { transform: rotate(180deg); }
/* شماره‌گذاری فقط از counter می‌آید، وگرنه دو بار شماره چاپ می‌شود */
.toc ol { margin: 14px 0 0; padding: 0; list-style: none; counter-reset: toc; }
.toc li { counter-increment: toc; margin-bottom: 8px; list-style: none; }
.toc li.lvl-h3 { padding-right: 18px; }
.toc a { font-size: 14.5px; line-height: 28px; color: var(--text); }
.toc a::before { content: counter(toc) ". "; color: var(--primary); font-weight: 700; }
.toc a:hover { color: var(--primary); }

/* متن مقاله */
.article-body p {
  margin-bottom: 18px;
  font-size: 17px;
  line-height: 36px;
  font-weight: 400;
  color: var(--text);
  text-align: justify;
}
.article-body h2 {
  margin: 34px 0 14px;
  font-family: "Meem", serif;
  font-size: 24px;
  line-height: 38px;
  font-weight: 700;
  color: var(--heading);
  scroll-margin-top: 90px;
}
.article-body h3 {
  margin: 26px 0 12px;
  font-family: "Meem", serif;
  font-size: 20px;
  line-height: 32px;
  font-weight: 600;
  color: var(--heading);
  scroll-margin-top: 90px;
}
.article-body ul { margin: 0 0 20px; padding: 0; }
.article-body li {
  position: relative;
  padding-right: 26px;
  margin-bottom: 10px;
  font-size: 17px;
  line-height: 34px;
  font-weight: 400;
  color: var(--text);
}
.article-body li::before {
  content: "";
  position: absolute;
  top: 14px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
}
.article-body strong { font-weight: 700; color: var(--heading); }

/* اشتراک‌گذاری */
.share {
  margin-top: 34px;
  padding-top: 22px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}
html[data-theme="dark"] .share { border-top-color: rgba(255, 255, 255, 0.1); }
.share h3 {
  margin-bottom: 14px;
  font-family: "Meem", serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--heading);
}
.share-btns { display: flex; flex-wrap: wrap; gap: 10px; }
.share-btns a, .share-btns button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(239, 90, 60, 0.1);
  color: var(--primary);
  transition: background-color 0.2s, color 0.2s, transform 0.2s;
}
.share-btns a:hover, .share-btns button:hover { background: var(--primary); color: #fff; transform: translateY(-2px); }
.share-btns svg { width: 21px; height: 21px; }
.share-btns button.copied { background: #1c914e; color: #fff; }

.related { margin-top: 56px; }
.related h2 {
  margin-bottom: 22px;
  font-family: "Meem", serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--heading);
}


/* ---------- دیدگاه‌ها ---------- */
.article-main { flex: 1 1 auto; min-width: 0; }
.comments, .comment-form-wrap { margin-top: 34px; }
.comments-title {
  margin-bottom: 18px;
  font-family: "Meem", serif;
  font-size: 19px;
  font-weight: 700;
  color: var(--heading);
}
.comments-list { display: grid; gap: 16px; }
.comment {
  display: flex;
  gap: 14px;
  padding: 16px 18px;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.05);
}
html[data-theme="dark"] .comment { background: #1c1c1c; box-shadow: none; }
.comment .avatar {
  flex: 0 0 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px 0 12px 0;
  background: var(--primary);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
}
.comment .copy { min-width: 0; flex: 1; }
.comment .head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.comment .head strong { font-size: 15px; color: var(--heading); }
.comment .head small { font-family: "YekanBakh-FaNum", serif; font-size: 12px; color: var(--muted); }
.comment p { font-size: 15px; line-height: 29px; font-weight: 400; color: var(--text); }

.comment-note { margin-bottom: 16px; font-size: 14px; line-height: 26px; font-weight: 400; color: var(--muted); }
.comment-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.comment-form-wrap .field { margin-bottom: 14px; }
.comment-form-wrap input[type="text"],
.comment-form-wrap input[type="email"],
.comment-form-wrap textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  font-weight: 400;
  transition: border-color 0.2s, box-shadow 0.2s;
}
html[data-theme="dark"] .comment-form-wrap input,
html[data-theme="dark"] .comment-form-wrap textarea { background: #1c1c1c; border-color: rgba(255, 255, 255, 0.12); }
.comment-form-wrap textarea { line-height: 30px; resize: vertical; min-height: 150px; }
.comment-form-wrap input:focus, .comment-form-wrap textarea:focus {
  outline: 0;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(239, 90, 60, 0.1);
}
.comment-form-wrap ::placeholder { color: #b0b0b0; }

.comment-remember {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-bottom: 18px;
  font-size: 14px;
  line-height: 24px;
  font-weight: 400;
  color: var(--muted);
  cursor: pointer;
}
.comment-remember input { margin-top: 5px; accent-color: var(--primary); }

.comment-submit {
  min-width: 170px;
  height: 52px;
  padding: 0 30px;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  transition: filter 0.2s, transform 0.2s;
}
.comment-submit:hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.05); }
.comment-submit:disabled { opacity: 0.6; cursor: not-allowed; }

.comment-alert { display: none; margin-bottom: 16px; padding: 12px 16px; border-radius: 12px; font-size: 14px; line-height: 25px; }
.comment-alert.is-shown { display: block; }
.comment-alert.error { background: rgba(214, 42, 42, 0.1); color: #c62828; }
.comment-alert.success { background: rgba(28, 145, 78, 0.1); color: #1c914e; }

/* ---------- responsive ---------- */
@media (max-width: 1024px) {
  .featured-grid { grid-template-columns: repeat(2, 1fr); gap: 20px; }
  .posts-grid { grid-template-columns: repeat(2, 1fr); gap: 22px; }
  /* ستون کناری زیر مقاله می‌رود */
  .article-layout { flex-direction: column; }
  .article-side { position: static; flex: 1 1 auto; width: 100%; order: 2; grid-template-columns: 1fr 1fr; }
  .article-main { order: 1; width: 100%; }
  .article-hero h1 { font-size: 23px; line-height: 40px; }
}
@media (max-width: 700px) {
  .featured-grid { grid-template-columns: 1fr; }
  .featured-card { height: 220px; }
  .posts-grid { grid-template-columns: 1fr; }
  .post-card .thumb { height: 200px; }
  .article-side { grid-template-columns: 1fr; }
  .comment-grid { grid-template-columns: 1fr; }
  .comment-submit { width: 100%; }
  /* کارت معرفی تک‌ستونه؛ تصویر بالای متن */
  .article-hero { padding: 16px; }
  .article-hero .hero-row { flex-direction: column-reverse; gap: 18px; }
  .article-hero .hero-cover { flex: 1 1 auto; width: 100%; min-height: 190px; }
  .article-hero h1 { font-size: 20px; line-height: 34px; }
  .article-hero .hero-meta { gap: 12px 20px; font-size: 13px; }
  .article-body p, .article-body li { font-size: 16px; line-height: 32px; }
  .article-body h2 { font-size: 20px; line-height: 32px; }
  .toc { padding: 14px 16px; }
}
