/* ==========================================================================
   mngmnt — نمایشگر مجله (reader)
   صفحهٔ مجله: 794×1123px (A4 @96dpi) — Paged.js + StPageFlip
   ========================================================================== */

:root {
    --mrd-primary: #640023;
    --mrd-primary-2: #881337;
    --mrd-canvas: #faf9f6;
    --mrd-ink: #23201f;
    --mrd-muted: #8b8178;
    --mrd-line: #e6e0d6;
    --mrd-bar: #20191c;
    --mrd-bar-2: #2b2226;
    --mrd-page-w: 794px;
    --mrd-page-h: 1123px;
}

/* ---------- chrome ---------- */

/* IMPORTANT (Paged.js): the previewer re-creates the content's ancestor chain
   (html > body.mrd-body > .mrd-root) INSIDE every generated page. Any chrome
   styling left on body.mrd-body (dark background, height, overflow) would be
   rebuilt into the pages themselves — that was the "black block" bug.
   All viewer chrome therefore lives on .mrd-root only, which in the app is
   ICB-sized via position:absolute (no positioned ancestor = viewport). */
body.mrd-body {
    margin: 0;
    font-family: Vazirmatn, system-ui, sans-serif;
    background: #fff;
}

/* Fullscreen reader: hide the WP admin bar when logged in. */
body.mrd-body #wpadminbar { display: none !important; }
body.mrd-body.admin-bar { margin-top: 0 !important; }

.mrd-root {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--mrd-bar-2);
    color: #f3ece4;
}

.mrd-chrome--top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: linear-gradient(180deg, #1a1417, var(--mrd-bar));
    padding: 8px 14px;
    border-bottom: 1px solid #ffffff14;
    flex-wrap: wrap;
}
.mrd-chrome__brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mrd-chrome__name { font-weight: 700; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mrd-chrome__issue {
    background: #ffffff1c;
    border-radius: 20px;
    font-size: 12px;
    padding: 2px 10px;
    white-space: nowrap;
}
.mrd-chrome__nav { display: flex; align-items: center; gap: 2px; }
.mrd-chrome__tools { display: flex; align-items: center; gap: 2px; }

.mrd-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #d8cfc6;
    cursor: pointer;
    font-family: inherit;
    font-size: 12.5px;
    text-decoration: none;
    padding: 0 6px;
    transition: background 0.15s ease, color 0.15s ease;
}
.mrd-btn:hover { background: #ffffff1a; color: #fff; }
.mrd-btn--accent { background: var(--mrd-primary); color: #fff; }
.mrd-btn--accent:hover { background: var(--mrd-primary-2); color: #fff; }
.mrd-btn--zoom { width: auto; min-width: 52px; }
.mrd-btn .material-symbols-outlined { font-size: 21px; }

.mrd-pagenum {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: #cfc5bb;
    margin: 0 4px;
}
.mrd-pagenum input {
    width: 44px;
    text-align: center;
    background: #ffffff14;
    border: 1px solid #ffffff22;
    border-radius: 6px;
    color: #fff;
    font-family: inherit;
    font-size: 13px;
    padding: 3px 2px;
}
.mrd-pagenum input:focus { outline: 1px solid var(--mrd-primary-2); }

/* ---------- layout ---------- */

.mrd-main { flex: 1 1 auto; display: flex; min-height: 0; }

.mrd-thumbs {
    width: 118px;
    overflow-y: auto;
    background: #1a1417;
    padding: 10px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.mrd-thumb {
    position: relative;
    width: 86px;
    height: 122px;
    border: 0;
    padding: 0;
    background: #fff;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 0 0 2px transparent, 0 2px 6px #00000059;
}
.mrd-thumb.is-active { box-shadow: 0 0 0 3px #e0b64c, 0 2px 8px #00000080; }
.mrd-thumb__inner {
    width: var(--mrd-page-w);
    height: var(--mrd-page-h);
    transform: scale(0.1083);
    transform-origin: top right;
    direction: rtl;
}
/* فقط اسکرین‌شات PDF (فرزند مستقیم)؛ تصاویر داخل کلون HTML نباید تمام‌صفحه شوند */
.mrd-thumb__inner > img { width: var(--mrd-page-w); height: var(--mrd-page-h); display: block; }
.mrd-thumb__cap {
    position: absolute;
    bottom: 0;
    inset-inline: 0;
    background: #000000a8;
    color: #fff;
    font-size: 10px;
    padding: 1px 0;
    text-align: center;
}

.mrd-stage { flex: 1 1 auto; overflow: hidden; display: flex; background: radial-gradient(1200px 600px at 50% -100px, #38303a, var(--mrd-bar-2)); }
/* هنگام زوم: درگ برای جابه‌جایی (pan) */
.mrd-stage.is-pannable { cursor: grab; touch-action: none; }
.mrd-stage.is-pannable.is-panning { cursor: grabbing; }
/* موبایل زوم‌شده: اسکرول مرورگر قفل شود تا pan کار کند */
.mrd-root--simple.mrd-root--zoomed .mrd-stage {
    touch-action: none;
    overscroll-behavior: none;
}
.mrd-root--simple.mrd-root--zoomed .mrd-zoom,
.mrd-root--simple.mrd-root--zoomed .mrd-mobile-sheet {
    touch-action: none;
}
.mrd-zoom { margin: auto; position: relative; }
.mrd-mirror { position: absolute; top: 0; left: 0; transform: scaleX(-1); }
.mrd-flip { direction: ltr; }
/* Fixed geometry for StPageFlip's block — the library derives page positions
   from the block size at init; a 0-width measurement misplaces pages. */
.mrd-flip .stf__block {
    width: calc(var(--mrd-page-w) * 2);
    height: var(--mrd-page-h);
}

/* un-mirror page content (RTL mirror trick).
   NOTE: در حالت HTML خودِ .mrd-page همان .stf__item است؛ قانعی مثل
   .stf__item img همهٔ تصاویر داخل صفحات را دوباره فلیپ می‌کرد. */
.mrd-mirror .mrd-page { transform: scaleX(-1); }

.mrd-page {
    width: var(--mrd-page-w);
    height: var(--mrd-page-h);
    overflow: hidden;
    background: #fff;
    color: var(--mrd-ink);
    /* کلون صفحات داخل .mrd-flip (ltr) رندر می‌شوند؛ جهت داخلی صفحه باید rtl بماند */
    direction: rtl;
}

/* ریشهٔ چاپ روی صفحه دیده نمی‌شود؛ فقط print.css در چاپ نمایشش می‌دهد */
#mrd-print-root {
    display: none;
}

/* NOTE: styling .pagedjs_page here is pointless — the Paged.js polisher drops
   rules targeting its own classes. The white page box on screen comes from
   .mrd-page above; for print, print.css forces .pagedjs_page backgrounds. */

/* ---------- progress / toast ---------- */

/* NOTE: position must be absolute, never fixed — the Paged.js polisher
   strips `position: fixed` from stylesheets it processes. */
.mrd-progress {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: #140f11e6;
    z-index: 50;
    font-size: 15px;
}
.mrd-progress[hidden] { display: none; }
.mrd-spinner {
    width: 26px;
    height: 26px;
    border: 3px solid #ffffff2e;
    border-top-color: #e0b64c;
    border-radius: 50%;
    animation: mrd-spin 0.8s linear infinite;
}
@keyframes mrd-spin { to { transform: rotate(360deg); } }
.mrd-progress--error .mrd-spinner { animation: none; border-top-color: #e05664; }

.mrd-toast {
    position: absolute;
    bottom: 22px;
    inset-inline: 0;
    margin-inline: auto;
    width: max-content;
    background: #20191c;
    color: #fff;
    border: 1px solid #ffffff26;
    border-radius: 24px;
    padding: 8px 18px;
    z-index: 60;
    font-size: 13px;
}

/* ---------- Paged.js target (offscreen, printable) ---------- */

.mrd-pages {
    position: absolute;
    top: 0;
    left: -20000px;
    width: var(--mrd-page-w);
    direction: rtl;
}

/* ==========================================================================
   صفحه‌آرایی مجله — @page و تایپوگرافی صفحات
   ========================================================================== */

@page {
    size: 794px 1123px;
    margin: 68px 60px 74px;
}

/* شمارهٔ صفحه دیگر در مارجین‌باکس نیست — مدالیون دایره‌ای گوشهٔ بیرونی
   پایین قاب (.rd-folio، تزریق در reader.js) جای آن را گرفته. سرصفحهٔ
   بالایی هم DOM تزریق می‌شود (.rd-runhead) — لوگو در مارجین‌باکس ممکن نیست. */
@page :first { margin: 0; }

.rd-cover {
    /* Do NOT use a named page (`page: cover`) — Paged.js inserts a phantom blank
       page on the named-page transition. */
    position: relative;
    width: 794px;
    height: 1123px;
    overflow: hidden;
    color: #fff;
    display: flex;
    align-items: flex-end;
    background: linear-gradient(165deg, var(--mrd-primary) 0%, #3c0a19 55%, #1c060e 100%);
}
/* روی جلد تصویری: از ناحیهٔ محتوا به کل برگه برسد (مثل پشت‌جلد).
   وگرنه حاشیهٔ صفحه لبه‌های تصویر را می‌بُرد. */
.rd-cover--image {
    position: absolute;
    top: calc(-1 * var(--pagedjs-margin-top, 68px));
    bottom: calc(-1 * var(--pagedjs-margin-bottom, 74px));
    right: calc(-1 * var(--pagedjs-margin-right, 60px));
    left: calc(-1 * var(--pagedjs-margin-left, 60px));
    width: auto;
    height: auto;
}
.rd-cover__img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    background: #1c060e;
}
.rd-cover__overlay {
    position: relative;
    width: 100%;
    padding: 44px 54px 52px;
    background: linear-gradient(to top, #0d0308d9 8%, #0d030826 55%, #0d03085e 100%);
}
/* short brand line on the cover overlay */
.rd-cover__brand { margin: 0 0 6px; font-family: 'Noto Serif', Vazirmatn, serif; font-weight: 800; font-size: 26px; }
.rd-cover__period { margin: 0 0 16px; font-size: 14.5px; color: #f0d9a8; letter-spacing: 0.5px; }
.rd-cover__title { margin: 0 0 14px; font-family: 'Noto Serif', Vazirmatn, serif; font-weight: 800; font-size: 40px; line-height: 1.7; }
.rd-cover__num {
    margin: 0;
    display: inline-block;
    background: #ffffff24;
    border: 1px solid #ffffff3d;
    border-radius: 26px;
    padding: 6px 20px;
    font-size: 16px;
    font-weight: 700;
}

/* پشت جلد: آخرین صفحهٔ نمایشگر — صفحهٔ نام‌دار با حاشیهٔ صفر تا تصویر
   تمام‌صفحه شود (هم‌سان با جلد اول که از @page :first استفاده می‌کند).
   نکته: break-before اینجا نیفزای — شکستِ گذارِ صفحهٔ نام‌دار خودکار است
   و ترکیبشان صفحهٔ سفید اضافه می‌سازد. */
/* پشت جلد: بلوک معمولیِ هم‌اندازهٔ ناحیهٔ محتوا (نه صفحهٔ نام‌دار).
   صفحهٔ نام‌دار در گذار، صفحهٔ شبحِ خالی با همین پس‌زمینهٔ تیره می‌ساخت
   (صفحهٔ سیاه آخر). این راه بدون گذار صفحهٔ نام‌دار، پشت جلد را کامل
   در یک صفحهٔ معمولی رندر می‌کند. */
.rd-cover--back {
    /* تمام‌صفحه — با متغیر حاشیه (صفحهٔ پشت‌جلد حاشیهٔ صفر می‌گیرد) */
    position: absolute;
    top: calc(-1 * var(--pagedjs-margin-top, 68px));
    bottom: calc(-1 * var(--pagedjs-margin-bottom, 74px));
    right: calc(-1 * var(--pagedjs-margin-right, 60px));
    left: calc(-1 * var(--pagedjs-margin-left, 60px));
    width: auto;
    height: auto;
    overflow: hidden;
    background: #1c060e;
    color: #fff;
}
.rd-cover--back .rd-cover__img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    background: #1c060e;
    box-shadow: none;
    border-radius: 0;
}
/* گرادیان تیره روی تصویر پشت‌جلد را برندار — کل تصویر باید خوانا بماند */
.rd-cover--back::after {
    display: none;
}
.rd-cover--back .rd-cover__brand {
    position: absolute;
    right: 54px;
    left: 54px;
    bottom: 92px;
    margin: 0;
    font-size: 24px;
    text-align: center;
    z-index: 1;
    text-shadow: 0 1px 8px #000000b3;
}
.rd-cover--back .rd-cover__num {
    position: absolute;
    right: 0;
    left: 0;
    bottom: 36px;
    margin: 0 auto;
    background: #ffffff24;
    border: 1px solid #ffffff3d;
    border-radius: 26px;
    padding: 6px 20px;
    font-size: 15px;
    font-weight: 700;
    display: block;
    width: fit-content;
    z-index: 1;
}

/* TOC starts on its own page: the cover exactly fills page 1 (margin 0), and a
   single forced break-before keeps the TOC visible without phantom pages.
   Use break-before only — never combine with break-after (double breaks = blanks).
   NOTE: no string-set here — content(text) of the whole TOC would dump every
   title into the running head. The brand line on the cover feeds it instead. */
.rd-toc { break-before: page; }
.rd-toc__title {
    font-family: 'Noto Serif', Vazirmatn, serif;
    font-size: 30px;
    font-weight: 800;
    color: var(--mrd-primary);
    margin: 8px 0 4px;
    padding-bottom: 12px;
    border-bottom: 3px solid var(--mrd-primary);
}
.rd-toc__group { margin-top: 12px; }
.rd-toc__group-title {
    font-size: 15px;
    font-weight: 800;
    color: var(--mrd-primary-2);
    margin: 0 0 4px;
}
.rd-toc__list { list-style: none; margin: 0; padding: 0; }
.rd-toc__item { display: block; padding: 2px 0; }
.rd-toc__head { display: flex; align-items: baseline; gap: 8px; }
.rd-toc__link { text-decoration: none; color: var(--mrd-ink); font-weight: 600; font-size: 14.5px; }
.rd-toc__author { margin: 1px 0 0; color: #5c534d; font-weight: 700; font-size: 12px; line-height: 1.5; }
.rd-toc__author .m-author-with-avatar,
.rd-art__byline .m-author-with-avatar {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
    max-width: 100%;
}
.rd-toc__author .m-author-with-avatar__text,
.rd-art__byline .m-author-with-avatar__text {
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
    min-width: 0;
}
.rd-toc__author-name { font-weight: 700; }
.rd-toc__author-aff { display: block; color: #8a7f74; font-weight: 400; font-size: 11.5px; margin: 0; line-height: 1.5; }
/* تکه‌های فهرست (ساختهٔ paged-flow.js): تکه‌های بعدی صفحهٔ جدید می‌گیرند */
.rd-toc__chunk--break { break-before: page; }
.rd-toc__dots { flex: 1 1 auto; border-bottom: 2px dotted #cfc7bb; transform: translateY(-3px); }
.rd-toc__page {
    text-decoration: none;
    font-weight: 800;
    color: var(--mrd-primary);
    font-size: 14px;
    min-width: 2.5ch;
    text-align: center;
    flex: 0 0 auto;
}
/* target-counter فقط در موتور صفحه‌آرایی؛ در نمایشگر/کش با JS پر می‌شود */
.rd-toc__page::after { content: none; }
.rd-toc__empty { color: var(--mrd-muted); }

/* ارقام فارسی برای فهرست‌های شماره‌دار داخل صفحات */
.mrd-source ol,
.pagedjs_page ol { list-style-type: persian; }

/* ---------- تایپوگرافی مقاله (سلسله‌مراتب بصری تیتر ↔ متن) ---------- */

.rd-article { break-before: page; }

/* فیت: سرتیتر مقاله‌ای که در جریان مقالهٔ قبل ادغام شده (بدون صفحهٔ نیمه‌خالی) */
.rd-art__head--merged { margin-top: 20px; padding-top: 14px; border-top: 1px dotted #d8cfc2; break-before: avoid; }
.rd-art__head { text-align: center; padding-bottom: 4px; }
.rd-art__kicker { margin: 0 0 10px; }
.rd-art__kicker span {
    display: inline-block;
    color: var(--mrd-primary-2);
    font-weight: 700;
    font-size: 12.5px;
    letter-spacing: 1px;
    border: 1px solid #88133740;
    border-radius: 999px;
    padding: 3px 18px;
    background: #8813370a;
}
.rd-art__title {
    font-family: 'Noto Serif', Vazirmatn, serif;
    font-size: 30px;
    font-weight: 800;
    line-height: 1.8;
    margin: 6px 0 2px;
    color: #191512;
}
.rd-art__ornament {
    margin: 2px 0 8px;
    color: var(--mrd-primary);
    font-size: 15px;
    letter-spacing: 10px;
    text-indent: 10px;
}
.rd-art__byline {
    margin: 0 0 4px;
    color: #5c534d;
    font-size: 14.5px;
    font-weight: 700;
    display: flex;
    justify-content: center;
}
.rd-art__byline .m-author-with-avatar {
    justify-content: center;
}
.rd-art__author-name { font-weight: 700; }
.rd-art__byline .m-author-avatar {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: #ebe6df;
}
.rd-art__byline .m-author-avatar img,
.rd-toc__author .m-author-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}
.rd-toc__author .m-author-avatar {
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: #ebe6df;
}

/* ---------- ستون‌بندی مجله‌ای (تک/دو/سه ستونه + بلوک‌های واید) ---------- */

.rd-art__body {
    font-size: 14.5px;
    line-height: 2.15;
    text-align: justify;
    text-justify: inter-word;
    /* جلوگیری از فاصله‌های بزرگ بین کلمات: انتخاب هوشمند نقطهٔ شکست سطرها
       + فشرده‌کردن جزئی فاصلهٔ طبیعی کلمات (فارسی فاصلهٔ پهنی دارد) */
    text-wrap: pretty;
    word-spacing: -0.75px;
    color: #2b2522;
}

/* Paged.js برای عنصر مقاله‌ای که بین صفحات شکسته، text-align-last: justify ست
   می‌کند (تا سطر انتهای تکهٔ نیمه‌کاره justified بماند)؛ چون این خاصیت ارث
   می‌رسد، سطر آخرِ همهٔ پاراگراف‌های کاملِ صفحات ادامه هم کشیده می‌شود. این
   قاعده آن را فقط برای خودِ عنصر شکسته نگه می‌دارد و از فرزندان برمی‌دارد. */
[data-align-last-split-element] * {
    text-align-last: auto;
}
/* چندستونه: سند RTL است؛ ستون اولِ منطقی = راست.
   صفحات پر میانی: column-fill:auto (اول راست، بعد چپ).
   تکهٔ کم‌پر / آخر: balance تا ستون خالی دیده نشود. */
.rd-art__body[data-cols="2"] {
    columns: 2;
    column-gap: 26px;
    column-rule: 1px dotted #d8cfc2;
    column-fill: balance;
}
.rd-art__body[data-cols="3"] {
    columns: 3;
    column-gap: 22px;
    column-rule: 1px dotted #d8cfc2;
    column-fill: balance;
    font-size: 13.5px;
    line-height: 2.05;
}
.rd-art__body[data-cols="1"] { font-size: 15px; }

/* بدنهٔ مقاله‌های بلند چندستونه پیش از صفحه‌آرایی به بلوک‌های هم‌اندازهٔ صفحه
   تقسیم می‌شود (Paged.js ظرف multicol را بین صفحات نمی‌شکند). */
.rd-art__chunk {
    box-sizing: border-box;
}
.rd-art__chunk--page {
    break-inside: avoid;
    overflow: visible;
    column-fill: balance;
}
.rd-art__chunk--end {
    column-fill: balance;
}
.rd-art__chunk--break {
    break-before: page;
}
/* وقتی Paged.js پاراگراف را دو تکه می‌کند، حاشیهٔ اضافه فاصلهٔ خالی نسازد */
.rd-art__body [data-split-to] {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}
.rd-art__body [data-split-from] {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* عناصر واید: تصاویر، تبلیغ‌ها و سرتیترها از ستون بیرون می‌آیند و تمام‌عرض می‌شوند */
.rd-span { column-span: all; }
/* تیترها پیوستار متن را حفظ می‌کنند: با پاراگراف بعدی هم‌صفحه می‌مانند
   و خودشان صفحهٔ جدید اجباری نمی‌سازند.
   نکته: از :is() استفاده نشود — Paged.js آن را خراب می‌کند. */
/* break-after:avoid روی h2 پاراگراف بعد را با تیتر به صفحهٔ بعد می‌کشاند
   و صفحه را نیمه‌خالی می‌کرد — فقط از شکستنِ خودِ تیتر جلوگیری کن. */
.rd-art__body h1,
.rd-art__body h2,
.rd-art__body h3,
.rd-art__body h4,
.rd-art__body h5,
.rd-art__body h6 {
    break-after: auto;
    break-inside: avoid;
    orphans: 1;
    widows: 1;
}
.rd-art__body h1,
.rd-art__body h2 {
    column-span: all;
    font-family: 'Noto Serif', Vazirmatn, serif;
    font-size: 19px;
    font-weight: 800;
    color: var(--mrd-primary);
    margin: 20px 0 8px;
    padding-inline-start: 12px;
    border-inline-start: 3px solid var(--mrd-primary);
}
.rd-art__body h1 { font-size: 22px; }
.rd-art__body h3 { font-size: 15.5px; font-weight: 800; margin: 14px 0 6px; }
.rd-art__body h4,
.rd-art__body h5,
.rd-art__body h6 { font-size: 14.5px; font-weight: 800; margin: 12px 0 6px; }
.rd-art__body p {
    orphans: 1;
    widows: 1;
}

/* تصاویر داخل متن: تمام‌عرض با قاب و زیرنویس */
.rd-art__body img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 12px auto;
    border: 1px solid var(--mrd-line);
    border-radius: 4px;
    padding: 4px;
    background: #fff;
    /* avoid سخت صفحهٔ نیمه‌خالی می‌ساخت؛ اجازه بده موتور جا باز کند */
    break-inside: auto;
}
/* :has() را Paged.js پشتیبانی نمی‌کند — تصویر داخل p را با کلاس/قانون ساده‌تر پوشش بده */
.rd-art__body p img { column-span: all; }
.rd-art__body figure { column-span: all; text-align: center; margin: 10px 0; }
.rd-art__body figcaption,
.rd-art__body .wp-caption-text {
    font-size: 11.5px;
    color: var(--mrd-muted);
    text-align: center;
    margin: -4px auto 12px;
}

.rd-art__body p { margin: 0 0 10px; } /* orphans/widows بالاتر تنظیم شده */
.rd-art__body p:first-of-type::first-letter {
    float: right;
    font-family: 'Noto Serif', Vazirmatn, serif;
    font-size: 46px;
    line-height: 0.9;
    font-weight: 800;
    color: var(--mrd-primary);
    padding-inline-start: 8px;
    padding-top: 5px;
}
.rd-art__body blockquote {
    margin: 10px 0;
    padding: 8px 16px;
    border-inline-start: 3px solid var(--mrd-primary);
    background: var(--mrd-canvas);
    border-radius: 6px;
    color: #4a423d;
    break-inside: auto;
    font-size: 13.5px;
}
.rd-art__body ul, .rd-art__body ol { padding-inline-start: 20px; margin: 0 0 10px; }
.rd-art__body a { color: var(--mrd-primary-2); text-decoration: none; border-bottom: 1px dotted currentColor; }

/* تصویر شاخص مقاله — بنر واید زیر سرشناسه */
.rd-art__hero {
    margin: 0 0 14px;
    break-inside: avoid;
}
.rd-art__hero img {
    width: 100%;
    height: auto;
    max-height: 380px;
    object-fit: contain;
    object-position: center;
    background: var(--mrd-canvas);
    border: 1px solid var(--mrd-line);
    border-radius: 4px;
}

.rd-art__end {
    column-span: all;
    text-align: center;
    color: var(--mrd-primary);
    font-size: 13px;
    letter-spacing: 8px;
    text-indent: 8px;
    margin: 18px 0 0;
}

/* ---------- جایگاه تبلیغات (جدول ۴×۴ — سازگار با Paged.js) ---------- */

.rd-adpage {
    /* صفحهٔ تبلیغ (نیم/تمام‌صفحه) همیشه از صفحهٔ تازه شروع شود: نشستن در
       باقیماندهٔ صفحهٔ آخر مقاله وقتی جا نمی‌شد، Paged.js جدول را خالی یا
       بریده می‌کرد و تبلیغ دیده نمی‌شد (گنجور/اکسیر). مقالهٔ بعدی هم خودش
       break-before:page دارد، پس صفحهٔ خالی اضافه ساخته نمی‌شود. */
    break-before: page;
    break-inside: avoid;
    position: relative;
    display: block;
    direction: rtl;
    width: 100%;
    box-sizing: border-box;
    margin: 12px 0 0;
    padding: 0;
    overflow: hidden;
}
/* بنر باریک (یک ردیف): می‌تواند در باقیماندهٔ همان صفحه بنشیند */
.rd-adpage[data-ad-rows="1"] { break-before: auto; }
/* --break قدیمی در کش: دیگر صفحهٔ جدید اجباری نکند (مگر ردیف‌دار مثل بالا) */
.rd-adpage--break { break-before: auto; }
.rd-adpage--forced { break-before: page; }
.rd-adtable {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    direction: rtl;
}
.rd-adtable td {
    padding: 5px;
    border: 0;
    vertical-align: middle;
}
.rd-adpage .rd-ad {
    position: relative;
    margin: 0;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 80px;
    overflow: hidden;
    break-inside: avoid;
}
.rd-ad__tag {
    position: absolute;
    top: 8px;
    inset-inline-start: 10px;
    background: var(--mrd-primary);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    border-radius: 999px;
    padding: 1px 12px;
    z-index: 2;
}
.rd-ad img,
.rd-ad > a,
.rd-ad__link {
    display: block;
    width: 100%;
    height: 100%;
}
.rd-ad__link {
    cursor: pointer;
    color: inherit;
    text-decoration: none;
}
.rd-ad img { object-fit: cover; border-radius: 4px; }
.rd-ad__box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    height: 100%;
    border: 2px dashed #b3a68f;
    border-radius: 6px;
    background: repeating-linear-gradient(45deg, #faf9f6, #faf9f6 12px, #f3efe7 12px, #f3efe7 24px);
    color: #8b8178;
    box-sizing: border-box;
}
.rd-ad__brand { font-weight: 800; font-size: 16px; color: var(--mrd-primary); text-align: center; padding: 0 8px; }
.rd-ad__hint { font-size: 11px; text-align: center; }
/* سازگاری با کلاس‌های قدیمی در صورت باقی‌ماندن در HTML ذخیره‌شده */
.rd-ad--full { column-span: all; height: 330px; }
.rd-ad--half { column-span: all; height: 220px; }
.rd-ad--quarter { height: 230px; }

/* ---------- قاب تزئینی صفحات (حاشیه اسلیمی) ---------- */

.rd-frame {
    position: absolute;
    inset: 26px 30px 30px;
    pointer-events: none;
    z-index: 3;
}
.rd-frame::before {
    content: '';
    position: absolute;
    inset: 0;
    border: 1px solid #64002345;
    border-radius: 2px;
}
.rd-frame::after {
    content: '';
    position: absolute;
    inset: 5px;
    border: 2px solid #64002355;
    border-radius: 2px;
}
.rd-frame i {
    position: absolute;
    width: 26px;
    height: 26px;
    z-index: 1;
}
.rd-frame i::before {
    content: '❖';
    display: block;
    color: var(--mrd-primary);
    background: #fff;
    width: 14px;
    height: 14px;
    margin: auto;
    line-height: 14px;
    font-size: 11px;
    text-align: center;
    transform: rotate(45deg);
    border: 1px solid #64002355;
}
.rd-frame .rd-frame__c--tl { top: -9px; left: -9px; }
.rd-frame .rd-frame__c--tr { top: -9px; right: -9px; }
.rd-frame .rd-frame__c--bl { bottom: -9px; left: -9px; }
.rd-frame .rd-frame__c--br { bottom: -9px; right: -9px; }

/* ---------- سرصفحهٔ نشریه (لوگو + نام، زیر قاب بالایی) ---------- */

/* بعد از صفحه‌آرایی با DOM تزریق می‌شود (reader.js)؛ جای آن بین خط داخلی
   قاب (y=31) و شروع محتوا (y=68) است. جلد مستثنی است. */
.rd-runhead {
    position: absolute;
    top: 40px;
    inset-inline: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    direction: rtl;
    z-index: 3;
    pointer-events: none;
    white-space: nowrap;
    font-family: Vazirmatn, sans-serif;
}
/* نشان برند — وقتی لوگوی سفارشی تنظیم نشده (مطابق .m-brand__mark سایت) */
.rd-runhead__mark {
    width: 15px;
    height: 15px;
    border-radius: 4px;
    background: linear-gradient(145deg, #991b1b, #7f1d1d);
    box-shadow: inset 0 -1px 0 rgba(245, 158, 11, 0.55);
    flex-shrink: 0;
}
.rd-runhead__logo {
    display: block;
    width: 15px;
    height: 15px;
    max-width: 15px;
    max-height: 15px;
    object-fit: contain;
    object-position: center;
    border-radius: 4px;
    flex-shrink: 0;
}
.rd-runhead__text {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.3px;
    color: var(--mrd-primary);
}

/* ---------- مدالیون شمارهٔ صفحه (دایره روی تلاقی قاب‌ها) ---------- */

/* مرکز دایره دقیقاً روی برخورد خط عمودی و افقی قاب (x=±30 از لبه، y=1093)
   می‌نشیند. صفحات زوج سمت راست گستره‌اند (RTL) → گوشهٔ پایین-راست؛
   فرد → پایین-چپ. پس‌زمینهٔ مات، خطوط قاب زیر دایره را می‌پوشاند. */
.rd-folio {
    position: absolute;
    bottom: 30px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--mrd-canvas);
    border: 1px solid #64002355;
    box-shadow: inset 0 0 0 3px var(--mrd-canvas), inset 0 0 0 4px #64002333;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: Vazirmatn, sans-serif;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--mrd-primary);
    z-index: 4;
    pointer-events: none;
}
.rd-folio--br { right: 30px; transform: translate(50%, 50%); }
.rd-folio--bl { left: 30px; transform: translate(-50%, 50%); }

/* ---------- نشانگرهای ورق‌زدن (فلش، گوشه تاخورده، اسلایدر) ---------- */

.mrd-arrow {
    position: absolute;
    top: 55%;
    transform: translateY(-50%);
    width: 46px;
    height: 46px;
    border: 1px solid #ffffff59;
    border-radius: 50%;
    /* رنگی و پررنگ: گرادیان زرشکی + سایه، تا از پس‌زمینهٔ تیره جدا شود */
    background: linear-gradient(180deg, var(--mrd-primary-2), var(--mrd-primary));
    color: #ffe9c9;
    box-shadow: 0 2px 10px #00000066, inset 0 1px 0 #ffffff30;
    z-index: 12;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, opacity .2s ease;
}
.mrd-arrow:hover {
    transform: translateY(-50%) scale(1.08);
    box-shadow: 0 3px 16px #00000088, inset 0 1px 0 #ffffff40;
    background: linear-gradient(180deg, #a11d43, var(--mrd-primary));
}
.mrd-arrow .material-symbols-outlined { font-size: 26px; }
/* موقعیت افقی/عمودی را JS کنار لبهٔ صفحاتِ نمایان می‌گذارد */
.mrd-arrow--next,
.mrd-arrow--prev { left: auto; right: auto; }
.mrd-arrow.is-hidden { display: none; }

/* نشانگر زوم وقتی روی صفحه کلیک شده */
.mrd-chrome__tools .mrd-btn.is-active {
    outline: 2px solid #f0d9a8;
    outline-offset: 2px;
    background: #ffffff22;
}
/* مسلح (کلیک اول): zoom+ — زوم‌شده (کلیک دوم): zoom− برای بازگشت */
.mrd-root--zoom-mode .mrd-stage { cursor: zoom-in; }
.mrd-root--zoom-mode.mrd-root--zoomed .mrd-stage { cursor: zoom-out; }
.mrd-root--zoom-mode.mrd-root--zoomed .mrd-stage.is-pannable { cursor: grab; }
.mrd-root--zoom-mode.mrd-root--zoomed .mrd-stage.is-pannable.is-panning { cursor: grabbing; }

/* افکت نرم عوض‌شدن صفحه (جایگزین انیمیشن سه‌بعدی خراب زیر آینهٔ RTL) */
.mrd-zoom.is-turning {
    animation: mrd-page-turn 0.32s ease;
}
@keyframes mrd-page-turn {
    0% { opacity: 0.45; filter: blur(1px); }
    100% { opacity: 1; filter: blur(0); }
}

/* صفحهٔ سفید قبل از پشت‌جلد وقتی بدون آن تعداد کل فرد می‌شود */
.rd-blank {
    break-before: page;
    width: 100%;
    height: 1123px;
    background: #fff;
}

/* (گوشه‌های تاخورده mrd-fold حذف شدند — روی مدالیون شمارهٔ صفحه می‌نشستند) */

/* اسلایدر پیشرفت صفحات */
.mrd-slider {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 10px;
    background: #140f11cc;
    border: 1px solid #ffffff1f;
    border-radius: 999px;
    padding: 6px 16px;
    z-index: 20;
    font-size: 12.5px;
    color: #d8cfc6;
    direction: rtl;
}
.mrd-slider input[type="range"] {
    width: min(420px, 44vw);
    accent-color: #e0b64c;
    cursor: pointer;
    margin: 0;
}
.mrd-slider__page { min-width: 2ch; text-align: center; font-weight: 700; color: #fff; }
.mrd-slider__total { color: #a99e94; }

/* ---------- موبایل: نمایشگر سادهٔ تک‌صفحه ---------- */

.mrd-root--mobile .mrd-stage,
.mrd-root--simple .mrd-stage {
    background: radial-gradient(800px 500px at 50% -40px, #3a323c, #1c1619);
}
.mrd-root--simple .mrd-stage {
    display: block; /* نه flex — تا viewport زوم جمع نشود */
    position: relative;
}
.mrd-root--simple .mrd-zoom {
    position: absolute !important;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    overflow: hidden;
    flex: none !important;
    box-shadow: none;
    border-radius: 0;
    background: transparent;
}
/* آینهٔ RTL مخصوص فلیپ دسکتاپ است — روی موبایل محتوا را وارونه/سفید می‌کرد */
.mrd-root--simple .mrd-mirror .mrd-page,
.mrd-root--simple .mrd-mobile-sheet .mrd-page {
    transform: none !important;
}
.mrd-mobile-sheet {
    position: absolute;
    top: 0;
    left: 0;
    width: var(--mrd-page-w);
    height: var(--mrd-page-h);
    overflow: hidden;
    background: #fff;
    color: var(--mrd-ink);
    direction: rtl;
    box-sizing: border-box;
    box-shadow: 0 8px 28px #00000073;
    will-change: transform;
    touch-action: none;
}
.mrd-mobile-sheet .mrd-page,
.mrd-mobile-sheet .pagedjs_page {
    width: var(--mrd-page-w) !important;
    height: var(--mrd-page-h) !important;
    max-width: none !important;
    box-sizing: border-box;
    transform: none !important;
    background: #fff;
    color: var(--mrd-ink);
}
/* جلدها absolute تمام‌صفحه هستند؛ ابعاد ثابت 794×1123 برششان می‌داد */
.mrd-mobile-sheet .rd-cover--image,
.mrd-mobile-sheet .rd-cover--back {
    width: auto !important;
    height: auto !important;
    max-width: none !important;
    transform: none !important;
    color: #fff;
}
.mrd-mobile-sheet__img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #fff;
}
/* لینک تبلیغ روی موبایل واضح و قابل‌لمس */
.mrd-root--simple .rd-ad__link,
.mrd-root--simple a.rd-ad__link {
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(100, 0, 35, 0.15);
}

@media (max-width: 720px) {
    .mrd-chrome--top {
        padding: 6px 8px;
        padding-top: max(6px, env(safe-area-inset-top));
        gap: 4px;
        flex-wrap: nowrap;
    }
    .mrd-chrome__name,
    .mrd-chrome__issue { display: none; }
    .mrd-chrome__nav #mrd-first,
    .mrd-chrome__nav #mrd-last { display: none; }
    .mrd-chrome__tools #mrd-share,
    .mrd-chrome__tools #mrd-fullscreen,
    .mrd-chrome__tools #mrd-thumbs-toggle { display: none !important; }
    .mrd-thumbs { display: none !important; }
    .mrd-btn { width: 34px; height: 34px; }
    .mrd-btn .material-symbols-outlined { font-size: 22px; }
    .mrd-pagenum { font-size: 12px; margin: 0 2px; }
    .mrd-pagenum input { width: 2.6em; font-size: 12px; }
    .mrd-thumbs {
        position: absolute;
        inset: 48px 0 auto 0;
        width: 100%;
        height: auto;
        max-height: 40vh;
        z-index: 30;
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 8px;
        gap: 8px;
    }
    .mrd-root--thumbs .mrd-thumbs { display: flex; }
    .mrd-thumb, .mrd-thumb__inner { transform-origin: top right; }

    /* فلش‌های ورق‌زدن روی موبایل هم دیده شوند */
    .mrd-arrow {
        display: flex;
        width: 40px;
        height: 40px;
        opacity: 0.92;
        z-index: 16;
    }
    .mrd-arrow .material-symbols-outlined { font-size: 24px; }

    .mrd-slider {
        bottom: max(10px, env(safe-area-inset-bottom));
        padding: 8px 14px;
        gap: 8px;
        width: min(92vw, 420px);
        justify-content: center;
        box-sizing: border-box;
    }
    .mrd-slider input[type="range"] {
        width: min(52vw, 220px);
        flex: 1 1 auto;
    }
    .mrd-slider__page,
    .mrd-slider__total { font-size: 13px; }
}

/* ---------- افیلیشن نویسنده در سرصفحهٔ مقالهٔ شماره ---------- */

.rd-art__byline .m-author-aff {
    display: block;
    font-weight: 400;
    font-size: 12.5px;
    color: #8a7f74;
    margin-top: 2px;
}
