/* ===== بلاگ با ظاهر قالب اصلی (Gnusmas) — صفحه‌های اسکرولی معمولی ===== */
:root {
    --bg-dark: #515151;
    --bg-deep: #2d2d2d;
    --text: #2e2e2e;
    --muted: #696969;
    --line: #eee;
    --soft: #f5f5f5;
    --shadow: 0 0 12px rgba(0, 0, 0, .13);
}

html { scroll-behavior: smooth; }
/* قالب اصلی برای body حداقل عرض 320px گذاشته؛ در عرض‌های کمتر صفحه از سمت چپ بریده می‌شد */
html, body.bg-page { min-width: 0 !important; max-width: 100%; }
body.bg-page { background: #fff; color: var(--text); overflow-x: hidden; }
.bg-page .container { max-width: 100%; }
.bg-page h1, .bg-page h2, .bg-page h3, .bg-page h4, .bg-page p, .bg-page a { overflow-wrap: anywhere; }
.bg-page a { color: inherit; }
.bg-page img { max-width: 100%; }

/* ---------- هدر ---------- */
/* مثل هدر صفحه‌ی اصلی: لوگو، شبکه‌های اجتماعی و دکمه‌ی منو روی هیروی تیره؛ بعد از اسکرول نوار تیره می‌شود (blog-gnusmas.js) */
.bg-header {
    position: fixed; top: 0; left: 0; right: 0; z-index: 50;
    display: flex; align-items: center; justify-content: space-between;
    padding: 25px 50px; background: transparent;
    transition: background-color .3s ease, padding .3s ease, box-shadow .3s ease;
}
.bg-header.is-scrolled { background: var(--bg-deep); padding-top: 14px; padding-bottom: 14px; box-shadow: 0 2px 14px rgba(0, 0, 0, .25); }
.bg-header .alx-logo img { height: 40px; display: block; }
.bg-header .alx-social-links ul li a { color: #fff; }
.bg-header .alx-social-links ul li a:hover { color: #bdbdbd; }
.bg-header .alx-burger span, .bg-header .alx-burger span:after, .bg-header .alx-burger span:before { background-color: #fff; }
/* منوی بالا (_HeaderMenuGnusmas، استایل پایه در site.css): روی هیروی تیره و نوار تیره سفید است */
.bg-header .alx-top-menu a { color: #cfcfcf; }
.bg-header .alx-top-menu a:hover, .bg-header .alx-top-menu a:focus, .bg-header .alx-top-menu a.is-active { color: #fff; }
.bg-header .alx-top-menu a::after { background-color: #fff; }
.bg-header .alx-top-menu a:focus-visible { outline-color: #fff; }

/* ---------- هیرو ---------- */
.bg-hero {
    position: relative; padding: 170px 0 80px; color: #fff; text-align: center;
    background-color: var(--bg-dark); background-size: cover; background-position: 50% 50%;
}
.bg-hero:before { content: ""; position: absolute; inset: 0; background: rgba(30, 30, 30, .55); }
.bg-hero > .container { position: relative; }
.bg-hero .alx-heading { color: #fff; }
.bg-hero .alx-heading__title { color: #fff; }
.bg-hero .alx-heading__zigzag { margin-left: auto !important; margin-right: auto !important; }
.bg-hero .alx-heading__zigzag svg { fill: #fff; }
.bg-hero .alx-heading__description { color: #e2e2e2; max-width: 620px; margin: 0 auto; }
/* هیروی کم‌ارتفاع همه‌ی صفحه‌های بلاگ: خانه‌ی بلاگ، آرشیو، دسته، برچسب و مقاله (بدون margin-bottom ۵۰px قالب زیر .alx-heading) */
.bg-hero--compact { padding: 125px 0 48px; }
.bg-hero--compact .alx-heading { margin-bottom: 0; }
.bg-hero--compact h1.alx-heading__title { font-size: 52px; line-height: 1.5; }
.bg-hero--compact .bg-crumbs { margin-bottom: 10px; }
.bg-hero--compact .alx-heading__zigzag { margin-top: 12px; margin-bottom: 14px; }
/* هیروی مقاله کوتاه‌تر از بقیه: کاور دیگر روی هیرو نمی‌آید و بالای ستون متن است */
.bg-hero--post { padding: 115px 0 36px; }
.bg-hero--post h1.alx-heading__title { font-size: 38px; line-height: 1.5; letter-spacing: 0; }
.bg-hero--post .bg-meta { margin-top: 14px; }

.bg-crumbs { font-size: 13px; margin-bottom: 18px; color: #e2e2e2; }
.bg-crumbs a { color: #fff; text-decoration: none; }
.bg-crumbs a:hover { text-decoration: underline; }
.bg-crumbs span { margin: 0 6px; opacity: .6; }

.bg-meta { display: flex; flex-wrap: wrap; gap: 8px 22px; justify-content: center; font-size: 13px; color: #e2e2e2; margin-top: 22px; }
.bg-meta i { margin-inline-end: 6px; }
.bg-meta__cats a { color: #fff; text-decoration: none; }
.bg-meta__cats a:hover { text-decoration: underline; }

/* ---------- جستجو و دسته‌ها ---------- */
.bg-toolbar { padding: 36px 0 6px; }
.bg-search { position: relative; max-width: 520px; margin: 0 auto 22px; }
.bg-search input {
    width: 100%; border: none; border-bottom: 1px solid var(--line); border-radius: 30px;
    padding: 13px 22px; padding-inline-end: 52px; box-shadow: var(--shadow); font-size: 16px; outline: 0;
}
.bg-search button {
    position: absolute; top: 5px; inset-inline-end: 5px; width: 40px; height: 40px; border: 0; border-radius: 50%;
    background: var(--bg-dark); color: #fff; cursor: pointer;
}
.bg-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; padding: 0; margin: 0; list-style: none; }
.bg-chip {
    display: inline-block; padding: 7px 18px; border-radius: 30px; font-size: 13px; text-decoration: none;
    background: var(--soft); color: var(--text); transition: all .3s;
}
.bg-chip:hover, .bg-chip.is-active { background: var(--bg-dark); color: #fff !important; text-decoration: none; }

/* ---------- کارت نوشته ---------- */
.bg-grid { padding: 34px 0 30px; }
.bg-grid > .row > [class*="col-"] { margin-bottom: 30px; }
.bg-card {
    display: flex; flex-direction: column; height: 100%; overflow: hidden;
    background: var(--bg-dark); border-radius: 25px; color: #e2e2e2;
    transition: transform .4s ease, box-shadow .4s ease;
}
.bg-card:hover { transform: translateY(-6px); box-shadow: 0 14px 30px rgba(0, 0, 0, .25); }
.bg-card__img { position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden; background: #3d3d3d; }
.bg-card__img img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(1); transition: filter .5s ease, transform .5s ease; }
.bg-card:hover .bg-card__img img { filter: grayscale(0); transform: scale(1.04); }
.bg-card__cat {
    position: absolute; top: 14px; inset-inline-start: 14px; padding: 4px 14px; border-radius: 30px;
    background: #fff; color: var(--text); font-size: 12px;
}
.bg-card__body { display: flex; flex-direction: column; flex: 1; padding: 20px 24px 22px; }
.bg-card__meta { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12px; color: #cfcfcf; margin-bottom: 10px; }
.bg-card__meta i { margin-inline-end: 5px; }
.bg-card__title { font-size: 22px; line-height: 1.5; margin: 0 0 8px; letter-spacing: 0; }
.bg-card__title a { color: #fff; text-decoration: none; }
.bg-card__text { font-size: 13.5px; line-height: 2; color: #e2e2e2; margin: 0 0 18px; }
.bg-card__more { margin-top: auto; font-size: 13px; color: #fff; text-decoration: none; }
.bg-card__more i { margin-inline-start: 6px; transition: transform .3s; }
.bg-card:hover .bg-card__more i { transform: translateX(-5px); }
html[dir="ltr"] .bg-card:hover .bg-card__more i { transform: translateX(5px); }

/* کارت ویژه (اولین نوشته) */
.bg-card--featured { flex-direction: row; }
.bg-card--featured .bg-card__img { flex: 0 0 52%; aspect-ratio: auto; min-height: 320px; }
.bg-card--featured .bg-card__body { justify-content: center; padding: 34px 38px; }
.bg-card--featured .bg-card__title { font-size: 32px; }
.bg-card--featured .bg-card__text { font-size: 15px; }

/* ---------- صفحه‌بندی ---------- */
.bg-pager { display: flex; justify-content: center; gap: 8px; padding: 0 0 60px; margin: 0; list-style: none; }
.bg-pager a, .bg-pager span {
    display: flex; align-items: center; justify-content: center; min-width: 42px; height: 42px; padding: 0 12px;
    border-radius: 30px; background: var(--soft); color: var(--text); text-decoration: none; font-size: 14px; transition: all .3s;
}
.bg-pager a:hover, .bg-pager .is-active { background: var(--bg-dark); color: #fff !important; }

.bg-empty { text-align: center; padding: 70px 0; color: var(--muted); }
.bg-empty i { font-size: 46px; display: block; margin-bottom: 14px; }

/* ---------- متن مقاله ---------- */
.bg-article { padding: 50px 0 20px; }
.bg-article__wrap { max-width: 780px; margin: 0 auto; }
.bg-cover { margin: -110px auto 40px; position: relative; z-index: 2; border-radius: 25px; overflow: hidden; box-shadow: 0 18px 40px rgba(0, 0, 0, .25); }
.bg-cover img { display: block; width: 100%; }

/* صفحه‌ی مقاله با سایدبار: متن در ستون ۸تایی، سایدبار (لینک کوتاه، دسته‌ها، آخرین مقاله‌ها) در ستون ۴تایی */
.bg-article--side .bg-article__wrap { max-width: none; }
.bg-article--side .bg-cover { margin: 0 0 34px; box-shadow: 0 10px 28px rgba(0, 0, 0, .14); }
.bg-post-side { padding-top: 4px; }
.bg-widget__more { display: inline-flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 13px; color: var(--text) !important; text-decoration: none !important; }
.bg-widget__more:hover { color: var(--muted) !important; }

.bg-shortlink__url {
    background: #fff; border-radius: 14px; padding: 10px 14px; margin-bottom: 10px; font-size: 13.5px; color: var(--text);
    text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; user-select: all;
}
.bg-shortlink__actions { display: flex; gap: 8px; }
.bg-shortlink__btn {
    flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 12px; border: 0;
    border-radius: 14px; background: #fff; color: var(--text); font: inherit; font-size: 13.5px; cursor: pointer; transition: all .3s;
}
.bg-shortlink__btn:hover, .bg-shortlink__btn:focus-visible { background: var(--bg-dark); color: #fff; }
.bg-shortlink__btn--dark { background: var(--bg-dark); color: #fff; }
.bg-shortlink__btn--dark:hover, .bg-shortlink__btn--dark:focus-visible { background: var(--text); }
.bg-shortlink__menu { display: none; justify-content: center; gap: 8px; margin-top: 12px; }
.bg-shortlink__menu.is-open { display: flex; }
.bg-shortlink__menu a {
    width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    background: #fff; color: var(--text) !important; text-decoration: none !important; transition: all .3s;
}
.bg-shortlink__menu a:hover { background: var(--bg-dark); color: #fff !important; }

.post-content { font-size: 17px; line-height: 2.1; color: var(--text); word-wrap: break-word; }
.post-content p { margin: 0 0 1.4em; }
.post-content h2 { font-size: 28px; line-height: 1.6; margin: 1.8em 0 .6em; letter-spacing: 0; }
.post-content h3 { font-size: 22px; line-height: 1.6; margin: 1.6em 0 .5em; letter-spacing: 0; }
.post-content a { text-decoration: underline; text-underline-offset: 4px; }
.post-content img { display: block; height: auto; margin: 1.6em auto; border-radius: 12px; }
.post-content figure { margin: 1.8em 0; }
.post-content figcaption { text-align: center; font-size: 13px; color: var(--muted); margin-top: -8px; }
.post-content ul, .post-content ol { padding-inline-start: 1.4em; margin: 0 0 1.4em; }
.post-content li { margin-bottom: .4em; }
.post-content blockquote {
    margin: 1.8em 0; padding: 18px 24px; background: var(--soft); border-radius: 12px;
    border-inline-start: 3px solid var(--bg-dark); font-size: 18px; color: #444;
}
.post-content blockquote p:last-child { margin-bottom: 0; }
.post-content pre {
    direction: ltr; text-align: left; background: #2e2e2e; color: #f1f1f1; border-radius: 12px;
    padding: 18px 20px; overflow-x: auto; font-size: 14px; line-height: 1.8; margin: 1.8em 0;
    font-family: Consolas, "Courier New", monospace;
}
.post-content code { direction: ltr; unicode-bidi: isolate; font-family: Consolas, "Courier New", monospace; font-size: .88em; background: var(--soft); padding: 2px 7px; border-radius: 6px; color: var(--text); }
.post-content pre code { background: none; padding: 0; font-size: inherit; color: inherit; }
.post-content .table-wrap { overflow-x: auto; margin: 1.8em 0; }
.post-content table { width: 100%; border-collapse: collapse; font-size: 15px; }
.post-content th { background: var(--bg-dark); color: #fff; font-weight: 500; }
.post-content th, .post-content td { padding: 10px 14px; border: 1px solid var(--line); text-align: start; }
.post-content tr:nth-child(even) td { background: #fafafa; }

/* خروجی CKEditor 5 (فرم مقاله‌ی پنل) */
.post-content figure.image { display: table; clear: both; text-align: center; margin: 1.8em auto; max-width: 100%; }
.post-content figure.image img { display: block; margin: 0 auto; max-width: 100%; min-width: 100%; }
.post-content figure.image.image_resized { max-width: 100%; display: block; box-sizing: border-box; }
.post-content figure.image.image_resized img { width: 100%; }
.post-content figure.image > figcaption { display: table-caption; caption-side: bottom; padding: 8px 4px 0; margin: 0; }
.post-content .image-style-side { float: left; max-width: 50%; margin: .4em 0 1em 1.6em; }
.post-content .image-style-align-left { float: left; margin-right: 1.6em; }
.post-content .image-style-align-right { float: right; margin-left: 1.6em; }
.post-content .image-style-block-align-left { margin-left: 0; margin-right: auto; }
.post-content .image-style-block-align-right { margin-right: 0; margin-left: auto; }
.post-content img.image_resized { height: auto; }
.post-content figure.table { margin: 1.8em 0; display: block; overflow-x: auto; }
.post-content figure.table > table { margin: 0; }
.post-content figure.media { margin: 1.8em 0; }
.post-content .bg-embed { position: relative; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: #000; }
.post-content .bg-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.post-content hr { border: 0; border-top: 1px solid var(--line); margin: 2.4em 0; }
.post-content pre { position: relative; }

/* قاب بلوک کد (blog-gnusmas.js): نوار بالا با زبان، تعداد خط، کپی و باز/بسته؛ کد بلند آکاردئونی */
.post-content .code-block {
    margin: 1.8em 0; border-radius: 14px; overflow: hidden; overflow: clip; /* clip: نوار چسبان «بستن کد» کار کند */
    background: #1f2128; border: 1px solid #2d3039;
    box-shadow: 0 14px 34px -18px rgba(0, 0, 0, .45);
}
.post-content .code-block pre { margin: 0; border-radius: 0; background: transparent; padding: 16px 20px 18px; }
.post-content .code-block pre::-webkit-scrollbar { height: 8px; }
.post-content .code-block pre::-webkit-scrollbar-thumb { background: #3b3f4b; border-radius: 8px; }
.post-content .code-block pre::-webkit-scrollbar-track { background: transparent; }
.code-block__head {
    display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 14px; background: #272a33;
    border-bottom: 1px solid #343844; font-size: 12.5px; line-height: 1.4; color: #9aa0ad;
}
.code-block__dots { display: inline-flex; gap: 6px; flex: none; }
.code-block__dots i { width: 10px; height: 10px; border-radius: 50%; background: #ff5f57; }
.code-block__dots i:nth-child(2) { background: #febc2e; }
.code-block__dots i:nth-child(3) { background: #28c840; }
.code-block__lang {
    color: #eceff4; font-weight: 500; padding: 3px 10px; border-radius: 20px; background: rgba(255, 255, 255, .08);
    direction: ltr; unicode-bidi: isolate; white-space: nowrap;
}
.code-block__lines { white-space: nowrap; }
.code-block__actions { margin-inline-start: auto; display: inline-flex; gap: 6px; flex: none; }
.code-block__btn {
    display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border: 0; border-radius: 8px;
    background: rgba(255, 255, 255, .08); color: #dfe3ea; font: inherit; font-size: 12.5px; cursor: pointer; transition: background .2s, color .2s;
}
.code-block__btn:hover { background: rgba(255, 255, 255, .16); color: #fff; }
.code-block__btn i { font-size: 13px; }
.code-block__more {
    display: flex; width: 100%; align-items: center; justify-content: center; gap: 8px; padding: 11px 14px; border: 0;
    border-top: 1px solid #343844; background: #272a33; color: #eceff4; font: inherit; font-size: 13.5px; cursor: pointer; transition: background .2s;
}
.code-block__more:hover { background: #30343f; }
.code-block:not(.is-collapsed) .code-block__more { position: sticky; bottom: 0; z-index: 1; }
.code-block__btn:focus-visible, .code-block__more:focus-visible { outline: 2px solid #8ab4ff; outline-offset: -2px; }
.code-block__btn:focus:not(:focus-visible), .code-block__more:focus:not(:focus-visible) { outline: none; }
.code-block__body { position: relative; }
.code-block.is-collapsed .code-block__body { max-height: 330px; overflow: hidden; }
.code-block.is-collapsed .code-block__body::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 120px; pointer-events: none;
    background: linear-gradient(to bottom, rgba(31, 33, 40, 0), #1f2128 88%);
}
/* متن فارسی (پرامپت، توضیح) داخل بلوک: راست‌به‌چپ، هر خط با جهت خودش، با فونت متن */
.post-content pre.is-prose { direction: rtl; text-align: right; white-space: pre-wrap; overflow-wrap: anywhere; font-family: Vazir, Tahoma, sans-serif; font-size: 14px; line-height: 2.1; }
.post-content pre.is-prose code { display: block; direction: rtl; unicode-bidi: plaintext; text-align: start; font-family: inherit; }
.post-content pre.is-prose .code-indent { display: inline-block; vertical-align: bottom; overflow: hidden; white-space: pre; }

/* پیام کوتاه «کپی شد» (blog-gnusmas.js: showToast) */
.bg-toast {
    position: fixed; left: 50%; bottom: 28px; z-index: 1100; display: inline-flex; align-items: center; gap: 8px;
    max-width: calc(100vw - 32px); padding: 10px 18px; border-radius: 30px; background: var(--bg-deep); color: #fff;
    font-size: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); pointer-events: none;
    opacity: 0; transform: translate(-50%, 12px); transition: opacity .25s ease, transform .25s ease;
}
.bg-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* رنگ‌بندی کد (Prism.js؛ رنگ‌های تم Tomorrow روی پس‌زمینه‌ی خود بلوک) */
.post-content pre .token.comment, .post-content pre .token.prolog, .post-content pre .token.doctype, .post-content pre .token.cdata { color: #999; font-style: italic; }
.post-content pre .token.punctuation { color: #ccc; }
.post-content pre .token.tag, .post-content pre .token.attr-name, .post-content pre .token.namespace, .post-content pre .token.deleted { color: #e2777a; }
.post-content pre .token.function-name { color: #6196cc; }
.post-content pre .token.boolean, .post-content pre .token.number, .post-content pre .token.function { color: #f08d49; }
.post-content pre .token.property, .post-content pre .token.class-name, .post-content pre .token.constant, .post-content pre .token.symbol { color: #f8c555; }
.post-content pre .token.selector, .post-content pre .token.important, .post-content pre .token.atrule, .post-content pre .token.keyword, .post-content pre .token.builtin { color: #cc99cd; }
.post-content pre .token.string, .post-content pre .token.char, .post-content pre .token.attr-value, .post-content pre .token.regex, .post-content pre .token.variable { color: #7ec699; }
.post-content pre .token.operator, .post-content pre .token.entity, .post-content pre .token.url { color: #67cdcc; }
.post-content pre .token.important, .post-content pre .token.bold { font-weight: bold; }
.post-content pre .token.italic { font-style: italic; }
.post-content pre .token.inserted { color: #7ec699; }
/* Markdown */
.post-content pre .token.title { color: #f8c555; font-weight: bold; font-style: normal; }
.post-content pre .token.title .token.punctuation, .post-content pre .token.list { color: #cc99cd; }
.post-content pre .token.bold .token.content { color: #fff; }
.post-content pre .token.code-snippet, .post-content pre .token.code { color: #7ec699; }
.post-content pre .token.blockquote, .post-content pre .token.hr { color: #999; }
.post-content pre .token.url .token.content { color: #67cdcc; }
.post-content::after { content: ""; display: table; clear: both; }
@media (max-width: 575px) {
    .post-content .image-style-side, .post-content .image-style-align-left, .post-content .image-style-align-right { float: none; max-width: 100%; margin: 1.6em auto; }
}

/* کارت بدون تصویر، پیام‌ها و فرم نظر */
.bg-card__noimg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #8a8a8a; font-size: 42px; }
.bg-empty--inline { padding: 20px 0; }
.bg-alert { background: var(--soft); border-radius: 12px; padding: 12px 16px; margin-bottom: 18px; font-size: 14px; line-height: 1.9; }
.bg-alert--ok { background: #2e2e2e; color: #fff; }
.bg-alert--error { background: #fff; border: 1px solid #2e2e2e; color: var(--text); }
.bg-form__note { font-size: 13px; color: var(--muted); margin: 12px 0 0; }
.bg-hp { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; inset-inline-start: -9999px; }

/* ---------- زیر مقاله ---------- */
.bg-block { margin-top: 44px; padding-top: 34px; border-top: 1px solid var(--line); }
.bg-block__title { font-size: 24px; margin: 0 0 20px; letter-spacing: 0; }
.bg-tags { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 34px; }
.bg-share { display: flex; align-items: center; gap: 10px; margin-top: 26px; font-size: 14px; color: var(--muted); }
.bg-share a, .bg-share button {
    width: 42px; height: 42px; border-radius: 50%; border: 0; display: inline-flex; align-items: center; justify-content: center;
    background: var(--bg-dark); color: #fff !important; cursor: pointer; text-decoration: none; transition: background .3s;
}
.bg-share a:hover, .bg-share button:hover { background: var(--bg-deep); }

.bg-author { display: flex; gap: 20px; align-items: center; background: var(--bg-dark); color: #e2e2e2; border-radius: 25px; padding: 26px 28px; margin-top: 44px; }
.bg-author img { width: 86px; height: 86px; border-radius: 50%; object-fit: cover; flex: none; filter: grayscale(1); }
.bg-author h4 { font-size: 22px; color: #fff; margin: 0 0 6px; letter-spacing: 0; }
.bg-author p { margin: 0; font-size: 14px; line-height: 2; color: #e2e2e2; }

/* ---------- دانلودها ---------- */
.bg-downloads { margin-top: 40px; }
.bg-downloads .bg-block__title i { margin-inline-end: 6px; }
.bg-downloads__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.bg-download {
    display: flex; align-items: center; gap: 14px; padding: 14px 18px; min-height: 64px;
    background: var(--soft); border-radius: 16px; text-decoration: none !important; color: var(--text);
    transition: background .3s, color .3s;
}
.bg-download:hover { background: var(--bg-dark); color: #fff; }
.bg-download__icon {
    flex: none; width: 44px; height: 44px; border-radius: 50%; background: var(--bg-dark); color: #fff;
    display: flex; align-items: center; justify-content: center; font-size: 18px; transition: background .3s;
}
.bg-download:hover .bg-download__icon { background: #fff; color: var(--bg-dark); }
.bg-download__text { flex: 1; min-width: 0; }
.bg-download__text strong { display: block; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bg-download__text small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.bg-download:hover .bg-download__text small { color: #e2e2e2; }
.bg-download__go { flex: none; font-size: 16px; opacity: .7; }

/* ---------- نوار پیش‌نمایش ادمین ---------- */
.bg-preview-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; box-shadow: 0 -2px 14px rgba(0, 0, 0, .3);
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px;
    background: #000; color: #e2e2e2; font-size: 13px; line-height: 1.8; padding: 10px 20px;
}
.bg-preview-bar i { margin-inline-end: 4px; }
.bg-preview-bar a {
    flex: none; color: #fff !important; border: 1px solid #fff; border-radius: 30px; padding: 6px 16px;
    text-decoration: none; min-height: 40px; display: inline-flex; align-items: center;
}
.bg-preview-bar a:hover { background: #fff; color: #000 !important; }

/* ---------- نظرات ---------- */
.bg-comment { display: flex; gap: 14px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.bg-comment__avatar { flex: none; width: 46px; height: 46px; border-radius: 50%; background: var(--bg-dark); color: #fff; display: flex; align-items: center; justify-content: center; }
.bg-comment__body { flex: 1; min-width: 0; }
.bg-comment__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 4px; }
.bg-comment__name { font-weight: 700; }
.bg-comment__date { font-size: 12px; color: var(--muted); }
.bg-comment__text { margin: 0 0 6px; font-size: 15px; line-height: 2; }
.bg-comment__reply { background: none; border: 0; padding: 0; font-size: 13px; color: var(--muted); cursor: pointer; }
.bg-comment__reply:hover { color: var(--text); }
.bg-replies { margin-inline-start: 60px; }
.bg-replies .bg-comment:last-child { border-bottom: 0; }

.bg-form { margin-top: 30px; }
.bg-form .alx-input-group input, .bg-form .alx-input-group textarea { width: 100%; font-size: 16px; }
.bg-form .alx-input-group { margin-bottom: 20px; }
.bg-replying { display: none; background: var(--soft); border-radius: 12px; padding: 10px 16px; margin-bottom: 16px; font-size: 14px; }
.bg-replying.is-on { display: block; }
.bg-replying button { background: none; border: 0; text-decoration: underline; cursor: pointer; }

/* ---------- نوشته‌های مرتبط ---------- */
.bg-related { background: var(--soft); padding: 60px 0 40px; margin-top: 60px; }
.bg-related .alx-heading { margin-bottom: 34px; }

/* اسلایدر نوشته‌های مرتبط: --per کارت در هر نما؛ وقتی کارت‌ها بیشتر باشند JS کلاس is-sliding می‌گذارد */
.bg-slider { --per: 3; --gap: 30px; position: relative; }
.bg-slider__viewport { overflow: hidden; padding: 10px 0 24px; margin: -10px 0 -24px; }
.bg-slider__track { display: flex; gap: var(--gap); will-change: transform; }
.bg-slider__item { flex: 0 0 calc((100% - (var(--per) - 1) * var(--gap)) / var(--per)); min-width: 0; }
.bg-slider__controls { display: none; justify-content: center; gap: 10px; margin-top: 26px; }
.bg-slider.is-sliding .bg-slider__controls { display: flex; }
.bg-slider__nav {
    width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--bg-dark); color: #fff; font-size: 22px;
    display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: background .3s;
}
.bg-slider__nav:hover, .bg-slider__nav:focus-visible { background: var(--bg-deep); }
.bg-slider.is-sliding .bg-slider__track { touch-action: pan-y; }

/* ---------- فوتر: مثل پایین صفحه‌ی اصلی (کپی‌رایت و تغییر زبان روی عکس روشن) ---------- */
.bg-footer { background-color: #f1f1f1; background-size: cover; background-position: 50% 50%; padding: 40px 50px; }
.bg-footer__bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px 30px; }
.bg-footer .alx-copyright p { color: #2e2e2e; }
.bg-footer .alx-copyright p span { color: #515151; }
.bg-footer .alx-lang-change ul { align-items: center; }
.bg-footer .alx-lang-change ul:before { color: #2e2e2e; }
.bg-footer .alx-lang-change ul li a { color: #2e2e2e; display: inline-block; padding: 4px 10px; }
.bg-footer .alx-lang-change ul .current-lang a { background-color: #e2e2e2; color: #545454; }

/* ---------- منوی کناری (همان منوی صفحه‌ی اصلی، خارج از pagePiling) ---------- */
.bg-page .alx-aside-sidebar { background-size: cover; background-position: 50% 50%; }
.bg-page .alx-sidebar-menu ul li { opacity: 1 !important; transform: none !important; }
.bg-page .alx-sidebar-menu ul li a { color: #fff !important; opacity: .85; }
.bg-page .alx-sidebar-menu ul li a:hover { opacity: 1; }

/* ---------- ریسپانسیو ---------- */
@media (max-width: 991.98px) {
    .bg-header { padding: 18px 24px; }
    .bg-slider { --per: 2; --gap: 20px; }
    .bg-post-side { margin-top: 44px; padding-top: 0; }
    .bg-card--featured { flex-direction: column; }
    .bg-card--featured .bg-card__img { flex: none; aspect-ratio: 16 / 9; min-height: 0; }
    .bg-card--featured .bg-card__body { padding: 22px 24px; }
    .bg-card--featured .bg-card__title { font-size: 24px; }
    .bg-page .alx-aside-sidebar { width: 60%; }
}
@media (max-width: 767.98px) {
    /* مثل صفحه‌ی اصلی در موبایل، هدر از اول تیره است */
    .bg-header, .bg-header.is-scrolled { padding: 14px 16px; background: var(--bg-deep); }
    .bg-footer { padding: 26px 20px; }
    .bg-footer__bar { justify-content: center; }
    .bg-hero { padding: 110px 0 54px; }
    .bg-hero--compact { padding: 92px 0 34px; }
    .bg-hero--compact h1.alx-heading__title { font-size: 34px; }
    .bg-hero--post { padding: 88px 0 26px; }
    .bg-hero--post h1.alx-heading__title { font-size: 28px !important; }
    .bg-cover { margin-top: -30px; border-radius: 18px; }
    .bg-article { padding-top: 30px; }
    .post-content { font-size: 16px; line-height: 2.05; }
    .post-content h2 { font-size: 23px; }
    .post-content h3 { font-size: 19px; }
    .post-content blockquote { font-size: 16px; padding: 14px 18px; }
    /* در موبایل خط‌های کد شکسته می‌شوند تا بلوک کد اسکرول افقی نداشته باشد */
    .post-content pre { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; overflow-x: hidden; }
    .post-content pre::-webkit-scrollbar { display: none; }
    .code-block__dots { display: none; }
    .post-content .code-block pre { padding: 14px 16px 16px; }
    .bg-card__title { font-size: 20px; }
    .bg-author { flex-direction: column; text-align: center; padding: 24px 20px; }
    .bg-replies { margin-inline-start: 22px; }
    .bg-pager a, .bg-pager span { min-width: 40px; height: 40px; }
    .bg-page .alx-aside-sidebar { width: 86vw !important; max-width: 360px; }
}

/* گوشی‌های خیلی باریک و پنجره‌های کوچک */
@media (max-width: 380px) {
    .bg-header, .bg-header.is-scrolled { padding: 12px 14px; }
    .bg-header .alx-logo img { height: 34px; }
    .bg-hero { padding: 96px 0 40px; }
    .bg-hero--compact { padding: 86px 0 30px; }
    .bg-hero--post { padding: 82px 0 22px; }
    .bg-hero h1.alx-heading__title { font-size: 32px !important; }
    .bg-hero--post h1.alx-heading__title { font-size: 23px !important; }
    .bg-hero .alx-heading__description { font-size: 14px; }
    .bg-meta { gap: 6px 14px; font-size: 12px; }
    .bg-toolbar { padding-top: 26px; }
    .bg-search input { padding: 12px 16px; padding-inline-end: 50px; }
    .bg-chip { padding: 6px 13px; font-size: 12px; }
    .bg-card { border-radius: 20px; }
    .bg-card__body { padding: 16px 16px 18px; }
    .bg-card__title, .bg-card--featured .bg-card__title { font-size: 18px; }
    .bg-card__meta { gap: 4px 10px; font-size: 11px; }
    .post-content { font-size: 15.5px; }
    .post-content h2 { font-size: 21px; }
    .post-content pre { padding: 14px; font-size: 12.5px; border-radius: 10px; }
    .code-block__lines { display: none; }
    .code-block__btn { padding: 0 10px; }
    .post-content th, .post-content td { padding: 8px 10px; font-size: 13px; }
    .bg-share { flex-wrap: wrap; }
    .bg-share a, .bg-share button { width: 38px; height: 38px; }
    .bg-comment { gap: 10px; }
    .bg-comment__avatar { width: 36px; height: 36px; }
    .bg-replies { margin-inline-start: 10px; }
    .bg-pager { gap: 5px; flex-wrap: wrap; }
    .bg-pager a, .bg-pager span { min-width: 36px; height: 36px; padding: 0 8px; }
    .bg-block__title { font-size: 20px; }
    .bg-related { padding: 40px 0 20px; }
    .bg-slider { --per: 1; --gap: 16px; }
    .bg-related h2.alx-heading__title { font-size: 26px !important; }
}

/* ================= صفحه‌ی آرشیو ================= */
.bg-archive { padding: 40px 0 20px; }
.bg-archive__main { min-width: 0; }

/* نوار بالای نتایج */
.bg-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-bottom: 18px; }
.bg-bar__count { font-size: 15px; color: var(--muted); margin-inline-end: auto; }
.bg-bar__count strong { color: var(--text); font-size: 18px; }
.bg-select {
    appearance: none; -webkit-appearance: none; border: 0; border-radius: 30px; height: 42px; font-size: 14px; color: var(--text);
    padding: 0 18px; padding-inline-end: 40px; background-color: var(--soft); cursor: pointer; outline: 0; font-family: inherit;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23515151' stroke-width='2'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: left 16px center;
}
html[dir="ltr"] .bg-select { background-position: right 16px center; }
.bg-view { display: flex; background: var(--soft); border-radius: 30px; padding: 4px; }
.bg-view button {
    width: 38px; height: 34px; border: 0; border-radius: 30px; background: none; color: var(--muted); cursor: pointer; transition: all .3s;
}
.bg-view button.is-active { background: var(--bg-dark); color: #fff; }
.bg-filterbar { display: none; }
.bg-filter-toggle { height: 42px; padding: 0 18px; border: 0; border-radius: 30px; background: var(--bg-dark); color: #fff; font-size: 14px; cursor: pointer; font-family: inherit; }
.bg-filter-toggle i { margin-inline-end: 6px; }

/* فیلترهای فعال */
.bg-active { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 22px; font-size: 13px; color: var(--muted); }
.bg-active__item {
    display: inline-flex; align-items: center; gap: 8px; padding: 6px 8px; padding-inline-start: 14px; border-radius: 30px;
    background: var(--bg-dark); color: #fff !important; text-decoration: none !important; font-size: 13px;
}
.bg-active__item i { width: 20px; height: 20px; border-radius: 50%; background: rgba(255, 255, 255, .2); display: inline-flex; align-items: center; justify-content: center; font-size: 11px; }
.bg-active__clear { color: var(--text) !important; text-decoration: underline !important; margin-inline-start: 6px; }

/* شبکه‌ی کارت‌ها و نمای فهرستی */
.bg-archive .bg-grid { padding-top: 0; }
.bg-archive.is-list .bg-grid > .row > [class*="col-"] { flex: 0 0 100%; max-width: 100%; margin-bottom: 20px; }
.bg-archive.is-list .bg-card { flex-direction: row; }
.bg-archive.is-list .bg-card__img { flex: 0 0 36%; aspect-ratio: auto; min-height: 190px; }
.bg-archive.is-list .bg-card__body { padding: 20px 26px; justify-content: center; }
.bg-archive.is-list .bg-card__text { margin-bottom: 12px; }
.bg-card__tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.bg-card__tags a { font-size: 11.5px; padding: 2px 10px; border-radius: 30px; background: rgba(255, 255, 255, .12); color: #e2e2e2 !important; text-decoration: none; transition: background .3s; }
.bg-card__tags a:hover { background: rgba(255, 255, 255, .28); }

/* سایدبار */
.bg-side { position: sticky; top: 96px; }
.bg-widget { background: var(--soft); border-radius: 25px; padding: 24px 24px 22px; margin-bottom: 24px; }
.bg-widget__title { font-size: 20px; margin: 0 0 16px; letter-spacing: 0; display: flex; align-items: center; gap: 10px; }
.bg-widget__title:after { content: ""; flex: 1; height: 1px; background: #ddd; }
.bg-widget .bg-search { margin: 0; max-width: none; }
.bg-widget .bg-search input { box-shadow: none; background: #fff; }

.bg-cats { list-style: none; margin: 0; padding: 0; }
.bg-cats a {
    display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 14px; margin-bottom: 4px;
    border-radius: 14px; text-decoration: none; font-size: 15px; color: var(--text); transition: all .3s;
}
.bg-cats a:hover { background: #e9e9e9; text-decoration: none; }
.bg-cats a.is-active { background: var(--bg-dark); color: #fff !important; }
.bg-count { min-width: 30px; height: 24px; padding: 0 8px; border-radius: 30px; background: #fff; color: var(--text); font-size: 12px; display: inline-flex; align-items: center; justify-content: center; }
.bg-cats a.is-active .bg-count { background: rgba(255, 255, 255, .2); color: #fff; }

/* درخت دسته‌ها: دکمه‌ی باز/بسته کنار دسته‌ی دارای زیر‌دسته، زیرلیست با خط کناری */
.bg-cats__row { display: flex; align-items: center; gap: 4px; margin-bottom: 4px; }
.bg-cats__row > a { flex: 1; min-width: 0; margin-bottom: 0; }
.bg-cats__toggle {
    flex: none; width: 34px; height: 34px; border: 0; border-radius: 12px; background: transparent; color: var(--muted);
    display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: all .3s;
}
.bg-cats__spacer { flex: none; width: 34px; }
.bg-cats__toggle:hover, .bg-cats__toggle:focus-visible { background: #e9e9e9; color: var(--text); }
.bg-cats__toggle i { font-size: 18px; transition: transform .25s; }
.bg-cats__toggle[aria-expanded="true"] i { transform: rotate(180deg); }
.bg-cats__sub { margin: 0 0 6px; margin-inline-start: 14px; padding-inline-start: 10px; border-inline-start: 2px solid #e2e2e2; }
.bg-cats__sub[hidden] { display: none; }
.bg-cats__sub a { font-size: 14px; padding: 7px 12px; }

.bg-tagcloud { display: flex; flex-wrap: wrap; gap: 8px; }
.bg-tagcloud a {
    display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 30px; background: #fff; color: var(--text);
    font-size: 13px; text-decoration: none; transition: all .3s;
}
.bg-tagcloud a small { color: var(--muted); font-size: 11px; }
.bg-tagcloud a:hover, .bg-tagcloud a.is-active { background: var(--bg-dark); color: #fff !important; text-decoration: none; }
.bg-tagcloud a:hover small, .bg-tagcloud a.is-active small { color: #e2e2e2; }

.bg-mini { display: flex; gap: 12px; align-items: center; text-decoration: none !important; padding: 8px 0; }
.bg-mini + .bg-mini { border-top: 1px solid #e4e4e4; }
.bg-mini img { width: 64px; height: 64px; border-radius: 14px; object-fit: cover; flex: none; filter: grayscale(1); transition: filter .4s; }
.bg-mini:hover img { filter: grayscale(0); }
.bg-mini__title { font-size: 14px; line-height: 1.8; color: var(--text); display: block; }
.bg-mini__meta { font-size: 11.5px; color: var(--muted); }

/* باکس فید RSS در سایدبار آرشیو */
.bg-rss .bg-widget__title:after { order: 1; }  /* خط بین عنوان و دکمه‌ی کپی */
.bg-rss__copy {
    order: 2; flex: none; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 0; border-radius: 30px;
    background: #fff; color: var(--text); font: inherit; font-size: 12.5px; font-weight: normal; cursor: pointer; transition: all .3s;
}
.bg-rss__copy:hover, .bg-rss__copy:focus-visible { background: var(--bg-dark); color: #fff; }
.bg-rss__text { font-size: 13.5px; line-height: 1.9; color: var(--muted); margin: 0 0 10px; }
.bg-rss__list { margin-bottom: 14px; }
.bg-rss__summary {
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    font-size: 12.5px; line-height: 1.8; color: var(--muted); margin-bottom: 2px;
}
.bg-rss__open {
    display: flex; align-items: center; justify-content: center; gap: 8px; height: 44px; border-radius: 14px;
    background: var(--bg-dark); color: #fff !important; font-size: 14px; text-decoration: none !important; transition: background .3s;
}
.bg-rss__open:hover { background: var(--text); }

@media (max-width: 991.98px) {
    .bg-filterbar { display: block; margin-bottom: 16px; }
    .bg-filter-toggle { display: block; width: 100%; }
    .bg-side { position: static; display: none; margin-bottom: 24px; }
    .bg-side.is-open { display: block; }
    .bg-archive__side { order: -1; }
}
@media (max-width: 767.98px) {
    .bg-archive { padding-top: 28px; }
    .bg-bar__count { flex: 0 0 100%; }
    .bg-archive.is-list .bg-card__img { flex: 0 0 34%; min-height: 0; }
    .bg-archive.is-list .bg-card__body { padding: 14px 16px; }
    .bg-archive.is-list .bg-card__title { font-size: 16px; margin-bottom: 4px; }
    .bg-archive.is-list .bg-card__text, .bg-archive.is-list .bg-card__tags, .bg-archive.is-list .bg-card__more { display: none; }
    .bg-archive.is-list .bg-card__cat { display: none; }
    .bg-archive.is-list .bg-card { border-radius: 18px; }
    .bg-widget { padding: 20px 18px; border-radius: 20px; }
}
@media (max-width: 380px) {
    .bg-select { padding: 0 12px; padding-inline-end: 34px; font-size: 13px; background-position: left 12px center; max-width: 100%; }
    .bg-filter-toggle { padding: 0 14px; font-size: 13px; }
    .bg-bar { gap: 8px; }
    .bg-view button { width: 34px; }
    .bg-archive.is-list .bg-card__meta span:nth-child(n+2) { display: none; }
}

/* نوار پیش‌نمایش ادمین پایین صفحه ثابت است؛ فوتر زیرش نماند */
body.bg-page:has(.bg-preview-bar) { padding-bottom: 64px; }
