/* =========================================================
   وبلاگ — فهرست مطالب (blog.html) و صفحه‌ی مطلب (post.html)
   تایپوگرافی: قانون ۲۳/۱۵ — همه‌ی عنوان‌ها یک اندازه، همه‌ی متن‌ها یک اندازه
   ========================================================= */

.bl, .bp {
  --ab-h: var(--fs-h);
  --ab-t: var(--fs-t);
  overflow-x: clip;
}
/* فاصله‌ی بالا = ارتفاع هدر + همان فاصله‌ی «درباره ما» (page و bl روی یک عنصرند؛ پس در یک مقدار) */
.bl { max-width: 1280px; margin: 0 auto; padding: calc(var(--header-h) + clamp(56px, 9vh, 120px)) var(--gutter) clamp(64px, 10vh, 120px); }

/* ---------- سرصفحه ---------- */
.bl__head { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 20px 32px; margin-bottom: clamp(28px, 4vh, 44px); }
.bl__title { margin: 0; font-size: var(--ab-h); font-weight: 700; line-height: 1.6; color: var(--brand); }
.bl__tools { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }

.bl__search {
  position: relative;
  display: flex;
  align-items: center;
  width: clamp(200px, 22vw, 280px);
  height: 46px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 999px;
  background: rgba(255, 255, 255, .03);
  transition: border-color .3s, box-shadow .3s, width .5s var(--ease-out);
}
.bl__search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(255, 106, 0, .18); width: clamp(220px, 26vw, 340px); }
.bl__search svg { position: absolute; right: 16px; width: 18px; height: 18px; fill: none; stroke: var(--fg-mute); stroke-width: 1.8; stroke-linecap: round; }
.bl__search input {
  width: 100%;
  height: 100%;
  padding: 0 44px 0 18px;
  border: 0;
  background: none;
  color: #fff;
  font-family: inherit;
  font-size: var(--ab-t);
  outline: none;
}
.bl__search input::placeholder { color: var(--fg-mute); }
.bl__search input::-webkit-search-cancel-button { filter: invert(1) opacity(.5); }

/* دسته‌ها با نشانگر لغزان */
.bl__cats {
  position: relative;
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 999px;
  background: rgba(255, 255, 255, .03);
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.bl__cats::-webkit-scrollbar { display: none; }
.bl__cats:empty, .bl__cats:has(> .bl__cats-ind:only-child) { display: none; }
.bl__cats-ind {
  position: absolute;
  top: 4px;
  bottom: 4px;
  border-radius: 999px;
  background: var(--brand);
  transition: left .5s var(--ease-out), width .5s var(--ease-out);
}
.bl__cat {
  position: relative;
  z-index: 1;
  height: 36px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--fg-dim);
  font-family: inherit;
  font-size: var(--ab-t);
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: color .3s;
}
.bl__cat:hover { color: #fff; }
.bl__cat[aria-selected="true"] { color: #fff; }
.bl__cat:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* ---------- کارت (مشترک فهرست/مرتبط) ---------- */
.bl__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(16px, 2vw, 28px); }
.pc {
  --rx: 0deg; --ry: 0deg; --gx: 50%; --gy: 0%; --go: 0;
  perspective: 1000px;
  opacity: 0;
  transform: translate3d(0, 40px, 0) scale(.97);
  transition: opacity .7s var(--ease-out), transform .9s var(--ease-out);
}
.pc.is-in { opacity: 1; transform: none; }
.pc.is-out { opacity: 0; transform: scale(.94); transition-duration: .25s; }
.pc__link {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 20px;
  background: linear-gradient(180deg, #160a04, #100703);
  color: inherit;
  text-decoration: none;
  transform: rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform .6s var(--ease-out), border-color .4s, box-shadow .5s;
  box-shadow: 0 30px 60px -40px rgba(0, 0, 0, .9);
}
.pc.is-tilting .pc__link { transition: border-color .4s, box-shadow .5s; }
.pc__link:hover, .pc__link:focus-visible { border-color: rgba(255, 140, 60, .4); box-shadow: 0 40px 70px -40px rgba(255, 106, 0, .35); }
.pc__link:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }
.pc__link::after {                 /* بازتاب نور */
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(420px circle at var(--gx) var(--gy), rgba(255, 210, 170, .12), transparent 45%);
  opacity: var(--go);
  transition: opacity .4s;
  pointer-events: none;
}
.pc__media { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: #1b0d06; }
.pc__media img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.04); transition: transform 1s var(--ease-out); }
.pc__link:hover .pc__media img { transform: scale(1.1); }
/* بدون تصویر: طرح نارنجی هم‌خانواده‌ی لوگو */
.pc__media--empty {
  background:
    linear-gradient(to top right, rgba(255, 255, 255, .08) 50%, transparent 50%),
    linear-gradient(to top left, rgba(150, 30, 0, .25) 50%, transparent 50%),
    linear-gradient(135deg, #ff9a3d, #ff6a00 55%, #c94a05);
}
.pc__cat {
  position: absolute;
  top: 14px;
  right: 14px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(10, 5, 2, .6);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: #fff;
  font-size: var(--ab-t);
  font-weight: 500;
  line-height: 1.2;
}
.pc__body { display: flex; flex-direction: column; flex: 1; gap: 10px; padding: 20px 22px 22px; }
.pc__title { margin: 0; font-size: var(--ab-h); font-weight: 700; line-height: 1.55; color: #fff; text-wrap: balance; }
.pc__excerpt {
  flex: 1;
  margin: 0;
  font-size: var(--ab-t);
  font-weight: 300;
  line-height: 2;
  color: var(--fg-dim);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.pc__meta { display: flex; align-items: center; gap: 8px; font-size: var(--ab-t); color: var(--fg-mute); }
.pc__meta i { width: 3px; height: 3px; border-radius: 50%; background: var(--fg-mute); }

/* ---------- مطلب ویژه (جدیدترین) ---------- */
.bl__featured:empty { display: none; }
.bl__featured { margin-bottom: clamp(16px, 2vw, 28px); }
.pc--feat .pc__link { flex-direction: row; min-height: clamp(320px, 34vw, 460px); }
.pc--feat .pc__media { flex: 1.25; aspect-ratio: auto; }
.pc--feat .pc__body { flex: 1; justify-content: center; gap: 16px; padding: clamp(24px, 3.5vw, 52px); }
.pc--feat .pc__excerpt { flex: none; -webkit-line-clamp: 4; }
.pc__read {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  height: 44px;
  padding: 0 20px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: var(--ab-t);
  font-weight: 600;
}
.pc__read svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform .4s var(--ease-out); }
.pc__link:hover .pc__read svg { transform: translateX(-4px); }

.bl__empty { margin: 48px 0; text-align: center; font-size: var(--ab-t); color: var(--fg-mute); }
.bl__more-wrap { display: flex; justify-content: center; margin-top: clamp(28px, 4vh, 48px); }
.bl__more {
  height: 50px;
  padding: 0 36px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 999px;
  background: none;
  color: #fff;
  font-family: inherit;
  font-size: var(--ab-t);
  font-weight: 600;
  cursor: pointer;
  transition: background .3s, border-color .3s;
}
.bl__more:hover, .bl__more:focus-visible { background: var(--brand); border-color: var(--brand); }

/* =========================================================
   صفحه‌ی مطلب
   ========================================================= */
.rp { position: fixed; top: 0; right: 0; left: 0; z-index: 60; height: 3px; pointer-events: none; }
.rp > span { display: block; height: 100%; background: linear-gradient(90deg, #ffb26b, var(--brand)); transform: scaleX(0); transform-origin: right center; }

.bp { max-width: 1280px; margin: 0 auto; padding: calc(var(--header-h) + clamp(56px, 9vh, 120px)) var(--gutter) clamp(64px, 10vh, 120px); }
.bp__head { max-width: 860px; margin: 0 auto clamp(24px, 4vh, 40px); text-align: center; }
.bp__back { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 16px; color: var(--fg-mute); font-size: var(--ab-t); text-decoration: none; transition: color .3s; }
.bp__back svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.bp__back:hover { color: var(--brand); }
.bp__title { margin: 0 0 14px; font-size: var(--ab-h); font-weight: 700; line-height: 1.6; color: #fff; text-wrap: balance; }
.bp__meta { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 8px 10px; font-size: var(--ab-t); color: var(--fg-mute); }
.bp__meta .bp__chip { padding: 4px 12px; border-radius: 999px; background: rgba(255, 106, 0, .14); color: #ffb27a; }
.bp__meta i { width: 3px; height: 3px; border-radius: 50%; background: var(--fg-mute); }

.bp__cover { margin: 0 0 clamp(32px, 5vh, 56px); overflow: hidden; border-radius: 24px; aspect-ratio: 16 / 8; background: #1b0d06; }
.bp__cover img { width: 100%; height: 115%; object-fit: cover; transform: translateY(var(--py, 0px)); will-change: transform; }

.bp__layout { display: grid; grid-template-columns: minmax(0, 1fr); justify-content: center; gap: clamp(32px, 5vw, 80px); }
.bp__layout.has-toc { grid-template-columns: 240px minmax(0, 720px); }
.bp__side { order: -1; }
.bp__toc { position: sticky; top: calc(var(--header-h-scrolled) + 32px); }
.bp__side-h { display: block; margin: 0 0 12px; font-size: var(--ab-t); font-weight: 700; color: var(--brand); }
.bp__toc ol { margin: 0; padding: 0; list-style: none; border-right: 1px solid rgba(255, 255, 255, .1); }
.bp__toc a {
  position: relative;
  display: block;
  padding: 7px 16px 7px 0;
  color: var(--fg-mute);
  font-size: var(--ab-t);
  line-height: 1.7;
  text-decoration: none;
  transition: color .3s;
}
.bp__toc a::before { content: ""; position: absolute; top: 0; bottom: 0; right: -1px; width: 2px; background: var(--brand); transform: scaleY(0); transition: transform .4s var(--ease-out); }
.bp__toc a:hover { color: #fff; }
.bp__toc a.is-active { color: #fff; }
.bp__toc a.is-active::before { transform: scaleY(1); }

.bp__body { max-width: 720px; margin: 0 auto; width: 100%; }
.bp__body > * { margin: 0 0 1.3em; }
.bp__body p, .bp__body li { font-size: var(--ab-t); font-weight: 300; line-height: 2.15; color: var(--fg-dim); }
.bp__body h2, .bp__body h3 { margin-top: 1.8em; font-size: var(--ab-h); font-weight: 700; line-height: 1.6; color: var(--brand); scroll-margin-top: calc(var(--header-h-scrolled) + 24px); }
.bp__body a { color: #ffb27a; }
.bp__body img { max-width: 100%; height: auto; border-radius: 16px; }
.bp__body blockquote { margin-right: 0; padding: 4px 20px 4px 0; border-right: 2px solid var(--brand); }
.bp__body ul, .bp__body ol { padding-right: 1.4em; }

.bp__share { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; max-width: 720px; margin: clamp(32px, 5vh, 56px) auto 0; padding-top: 24px; border-top: 1px solid rgba(255, 255, 255, .08); }
.bp__share .bp__side-h { margin: 0 0 0 8px; }
.bp__share-btn {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 18px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 999px;
  background: none;
  color: #fff;
  font-family: inherit;
  font-size: var(--ab-t);
  text-decoration: none;
  cursor: pointer;
  transition: background .3s, border-color .3s;
}
.bp__share-btn:hover, .bp__share-btn:focus-visible { background: var(--brand); border-color: var(--brand); }
.bp__share-btn.is-done { background: rgba(255, 106, 0, .2); border-color: var(--brand); }
.bp__related { margin-top: clamp(64px, 10vh, 110px); }
.bp__related-h { margin: 0 0 24px; font-size: var(--ab-h); font-weight: 700; color: var(--brand); }

/* ---------------------------------------------------------
   ریسپانسیو
   --------------------------------------------------------- */
@media (max-width: 1023px) {
  .bl__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bp__layout.has-toc { grid-template-columns: minmax(0, 1fr); }
  .bp__toc { position: static; }
}
@media (max-width: 699px) {
  .bl__grid { grid-template-columns: 1fr; }
  .bl__tools, .bl__search, .bl__search:focus-within { width: 100%; }
  .pc--feat .pc__link { flex-direction: column; }
  .pc--feat .pc__media { aspect-ratio: 16 / 10; flex: none; }
  .bp__cover { aspect-ratio: 16 / 10; border-radius: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .pc, .pc.is-in, .pc.is-out { opacity: 1; transform: none; transition: none; }
  .pc__media img { transition: none; }
}

/* =========================================================
   صفحه‌ی اول — بخش وبلاگ (فاصله‌ی بالا/پایین را services.js تنظیم می‌کند)
   ========================================================= */
.hb {
  --ab-h: var(--fs-h);
  --ab-t: var(--fs-t);
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.hb[hidden] { display: none; }
.hb__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: clamp(24px, 3vw, 40px); }
.hb__title { margin: 0; font-size: var(--fs-h); font-weight: 700; line-height: 1.6; color: var(--brand); }
.hb__all {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 20px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 999px;
  color: #fff;
  font-size: var(--fs-t);
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  transition: background .3s, border-color .3s;
}
.hb__all svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform .4s var(--ease-out); }
.hb__all:hover, .hb__all:focus-visible { background: var(--brand); border-color: var(--brand); }
.hb__all:hover svg { transform: translateX(-4px); }
