/* =========================================================================
   ایران‌گاه — لایهٔ اصلاح مقالات (Editorial Enhance)
   مقصد در پروداکشن: public_html/css/editorial-enhance.css
   وابستگی: بعد از blog-show.min.css و shell-v2.css بارگذاری می‌شود.

   این فایل عمداً یک فایل جدید و مستقل است تا هیچ فایل ساخته‌شدهٔ موجود
   (و legacy-manifest.json) دست‌نخورده بماند.

   سه کار انجام می‌دهد:
   ۱) قوانین جدولِ مقاله که در blog-show.css به کلاس مردهٔ body.ir-public-site
      محدود شده‌اند و هیچ‌وقت اعمال نمی‌شوند را دوباره فعال می‌کند
      (سرستون تیره روی زمینهٔ تیره).
   ۲) قاب سیاهِ <pre> را به یک قاب روشن تبدیل می‌کند.
   ۳) کامپوننت‌های تازه‌ی «همسایگان استان» و «شاخه‌ها» را استایل می‌دهد.
   ========================================================================= */

/* ---------- ۱) جدول‌های داخل مقاله ------------------------------------- */

/* blog-show.css این قوانین را زیر body.ir-public-site نوشته، اما کلاس بدنهٔ
   سایت ir-v2-shell است؛ پس سرستون‌ها رنگِ td (تیره) را روی زمینهٔ تیرهٔ
   thead می‌گرفتند. اینجا بدون آن پیشوند تکرار می‌شوند. */

.blog-story-markdown thead {
    background: #3f4a5a;
}

.blog-story-markdown thead :where(th, td),
.blog-story-markdown thead :where(th, td) :where(p, li, a, span, small, strong, b, em) {
    color: #fbfdff !important;
    font-weight: 700;
}

.blog-story-markdown thead :where(th, td) {
    border-color: #5a6678;
}

.blog-story-markdown tbody tr:nth-child(even) {
    background: #f7f9fc;
}

.blog-story-markdown tbody :where(th, td) {
    color: #1f2937 !important;
    white-space: normal;
}

/* ستون اول جدول‌های دوستونیِ «شاخص / مقدار» عملاً سرستونِ سطر است. */
.blog-story-markdown tbody th {
    background: #eef2f7;
    font-weight: 700;
}

/* ---------- ۲) قاب‌های pre --------------------------------------------- */

/* نمودارهای دست‌سازِ ASCII که هنوز به کامپوننت تبدیل نشده‌اند: قاب روشن
   به‌جای ترمینال سیاه. */
.blog-story-markdown pre,
.blog-story-markdown pre.ir-ascii-figure {
    direction: ltr;
    text-align: center;
    background: #f7f9fc;
    color: #0f172a;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 1.25rem 1rem;
    overflow-x: auto;
    font-size: 0.9rem;
    line-height: 1.9;
    box-shadow: none;
}

/* ---------- ۳) همسایگان استان ------------------------------------------ */

.ir-neighbours {
    margin: 1.75rem 0;
    padding: 1.25rem 1rem 1rem;
    background: #f7f9fc;
    border: 1px solid #e2e8f0;
    border-radius: 22px;
}

/* شبکه عمداً LTR است تا «غرب» واقعاً سمت چپ و «شرق» سمت راست بیفتد؛
   متنِ داخل هر خانه دوباره RTL می‌شود. */
.ir-neighbours__grid {
    direction: ltr;
    display: grid;
    grid-template-columns: 1fr minmax(0, 1.4fr) 1fr;
    grid-template-areas:
        '.    north .'
        'west center east'
        '.    south .';
    gap: 0.6rem;
    align-items: stretch;
}

.ir-neighbours__cell {
    direction: rtl;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    text-align: center;
    padding: 0.7rem 0.6rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    min-height: 64px;
}

.ir-neighbours__cell--north { grid-area: north; }
.ir-neighbours__cell--west  { grid-area: west; }
.ir-neighbours__cell--center{ grid-area: center; }
.ir-neighbours__cell--east  { grid-area: east; }
.ir-neighbours__cell--south { grid-area: south; }

.ir-neighbours__cell--center {
    background: #0044bb;
    border-color: #0044bb;
}

.ir-neighbours__cell--center .ir-neighbours__name {
    color: #fff !important;
    font-weight: 700;
}

.ir-neighbours__dir {
    font-size: 0.75rem !important;
    font-weight: 700;
    color: #0044bb !important;
    letter-spacing: 0.02em;
}

.ir-neighbours__name {
    font-size: 0.95rem !important;
    line-height: 1.6 !important;
    color: #0f172a !important;
}

.ir-neighbours__caption {
    margin-top: 0.85rem;
    text-align: center;
    font-size: 0.8rem;
    color: #64748b;
}

@media (max-width: 640px) {
    .ir-neighbours__grid {
        grid-template-columns: 1fr;
        grid-template-areas:
            'north'
            'west'
            'center'
            'east'
            'south';
    }

    /* در حالت تک‌ستونی ترتیبِ جغرافیایی معنا ندارد؛ مرکز اول بیاید. */
    .ir-neighbours__cell--center { order: -1; }

    .ir-neighbours__cell {
        flex-direction: row;
        justify-content: space-between;
        gap: 0.75rem;
        min-height: 0;
        text-align: start;
    }
}

/* ---------- ۴) شاخه‌ها (صنایع دستی / سوغات) ---------------------------- */

.ir-branches {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
    margin: 1.75rem 0;
}

.ir-branch {
    padding: 1.1rem 1.2rem;
    background: #f7f9fc;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
}

.ir-branch__title {
    margin: 0 0 0.75rem !important;
    padding-bottom: 0.6rem;
    border-bottom: 2px solid #c3d9ff;
    font-size: 1.05rem !important;
    font-weight: 800 !important;
    color: #0044bb !important;
}

.ir-branch__items {
    margin: 0 !important;
    padding-right: 1.1rem !important;
    list-style: disc outside !important;
}

.ir-branch__items li {
    margin-bottom: 0.45rem;
    line-height: 1.9;
}

.ir-branch__items li:last-child {
    margin-bottom: 0;
}

/* ---------- ۵) فاصلهٔ بلوک‌های چسبیده ---------------------------------- */

/* محتوایی که هنوز پاک‌سازی نشده و پاراگراف‌هایش <div> است، بدون این قانون
   همه به هم می‌چسبد (چون فقط <p> مارجین دارد). */
.blog-story-markdown > div:not([class]),
.blog-story-markdown blockquote > div:not([class]) {
    margin-bottom: 1.15rem;
}

/* ---------- ۶) لنگرها و پرش به بخش ------------------------------------- */

/* هدر چسبان نباید روی تیتری که کاربر به آن پرش کرده بیفتد. */
.ir-anchor {
    display: block;
    height: 0;
    scroll-margin-top: calc(var(--ir-header-h, 86px) + 16px);
}

.blog-story-markdown :is(h2, h3)[id] {
    scroll-margin-top: calc(var(--ir-header-h, 86px) + 16px);
}

/* ---------- ۷) تاریخ انتشار و نویسنده ---------------------------------- */

.ir-article-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px 24px;
    margin-bottom: 24px;
    padding: 18px 20px;
    border: 1px solid rgba(148, 163, 184, .24);
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(248, 250, 252, .96), rgba(255, 255, 255, .98));
}

.ir-article-meta__dates {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
}

.ir-article-meta__date {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
    color: #475569;
    font-size: .92rem;
    line-height: 1.7;
}

.ir-article-meta__label {
    color: #64748b;
    font-weight: 700;
}

.ir-author-card {
    min-width: min(100%, 240px);
    max-width: 360px;
}

.ir-author-card__eyebrow {
    margin-bottom: 4px;
    color: #64748b;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .02em;
}

.ir-author-card__name {
    color: #0044bb;
    font-size: 1.02rem;
    font-weight: 900;
    line-height: 1.6;
    text-decoration: none;
}

.ir-author-card__name:hover {
    color: #0035a0;
    text-decoration: underline;
}

.ir-author-card__expertise {
    margin: 6px 0 0;
    color: #475569;
    font-size: .88rem;
    line-height: 1.8;
}

/* ---------- ۸) نوار دسترسی سریع استان ---------------------------------- */

.ir-province-nav {
    margin: 0 0 28px;
    padding: 20px;
    border: 1px solid #e2e8f0;
    border-radius: 22px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .06);
}

.ir-province-nav > * + * {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid #eef2f7;
}

.ir-province-nav__tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none !important;
}

.ir-province-nav__tile {
    display: flex;
    flex-direction: column;
    gap: 2px;
    height: 100%;
    padding: 14px 16px;
    border: 1px solid #c3d9ff;
    border-radius: 16px;
    background: #eef4ff;
    text-decoration: none;
    transition: background .15s ease, border-color .15s ease;
}

.ir-province-nav__tile:hover,
.ir-province-nav__tile:focus-visible {
    background: #dde9ff;
    border-color: #0044bb;
}

.ir-province-nav__value {
    color: #0044bb !important;
    font-size: 1.6rem !important;
    font-weight: 900;
    line-height: 1.25 !important;
}

.ir-province-nav__unit {
    color: #0f172a !important;
    font-size: .95rem !important;
    font-weight: 700;
}

.ir-province-nav__hint {
    color: #64748b !important;
    font-size: .8rem !important;
    line-height: 1.6 !important;
}

.ir-province-nav__row-title {
    display: block;
    margin-bottom: 10px;
    color: #64748b !important;
    font-size: .82rem !important;
    font-weight: 700;
}

.ir-province-nav__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none !important;
}

.ir-province-nav__chip {
    display: inline-block;
    padding: 6px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    background: #f7f9fc;
    color: #0f172a !important;
    font-size: .9rem !important;
    text-decoration: none;
}

.ir-province-nav__chip:hover,
.ir-province-nav__chip:focus-visible {
    border-color: #0044bb;
    background: #eef4ff;
    color: #0044bb !important;
}

.ir-province-nav__toc > summary {
    cursor: pointer;
    color: #0044bb;
    font-size: .92rem;
    font-weight: 700;
    list-style: none;
}

.ir-province-nav__toc > summary::-webkit-details-marker {
    display: none;
}

.ir-province-nav__toc > summary::before {
    content: '▾';
    display: inline-block;
    margin-left: 6px;
    transition: transform .15s ease;
}

.ir-province-nav__toc[open] > summary::before {
    transform: rotate(180deg);
}

.ir-province-nav__toc-list {
    columns: 2;
    column-gap: 28px;
    margin: 14px 0 0;
    padding-right: 1.2rem;
}

.ir-province-nav__toc-list li {
    break-inside: avoid;
    margin-bottom: 6px;
}

.ir-province-nav__toc-list a {
    color: #475569 !important;
    font-size: .9rem !important;
    line-height: 1.8 !important;
    text-decoration: none;
}

.ir-province-nav__toc-list a:hover {
    color: #0044bb !important;
    text-decoration: underline;
}

@media (max-width: 640px) {
    .ir-province-nav {
        padding: 16px;
    }

    .ir-province-nav__toc-list {
        columns: 1;
    }
}

/* ---------- ۹) نوار محلی فوتر ------------------------------------------ */

.ir-local-footer {
    padding: 28px 0;
    border-top: 1px solid #e2e8f0;
    background: #f7f9fc;
}

.ir-local-footer__title {
    margin: 0 0 6px;
    font-size: 1.1rem;
    font-weight: 800;
    color: #0f172a;
}

.ir-local-footer__summary {
    margin: 0 0 18px;
    color: #64748b;
    font-size: .9rem;
    line-height: 1.9;
}

.ir-local-footer__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px 32px;
}

.ir-local-footer__col h3 {
    margin: 0 0 10px;
    font-size: .88rem;
    font-weight: 700;
    color: #0f172a;
}

.ir-local-footer__links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ir-local-footer__links a {
    color: #475569;
    font-size: .88rem;
    line-height: 1.9;
    text-decoration: none;
}

.ir-local-footer__links a:hover,
.ir-local-footer__links a:focus-visible {
    color: #0044bb;
    text-decoration: underline;
}

/* ---------- ۱۰) نظرهای مخاطبان ----------------------------------------- */

.ir-comments {
    margin-top: 2.5rem;
    padding-top: 1.75rem;
    border-top: 1px solid #e2e8f0;
}

.ir-comments__title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 1rem;
    font-size: 1.25rem;
    font-weight: 800;
    color: #0f172a;
}

.ir-comments__count {
    display: inline-block;
    min-width: 28px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #eef4ff;
    color: #0044bb;
    font-size: .85rem;
    font-weight: 700;
    text-align: center;
}

.ir-comments__notice {
    margin: 0 0 1rem;
    padding: 12px 14px;
    border-radius: 12px;
    font-size: .9rem;
    line-height: 1.8;
}

.ir-comments__notice--ok {
    border: 1px solid #bbf7d0;
    background: #f0fdf4;
    color: #166534;
}

.ir-comments__notice--error {
    border: 1px solid #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

.ir-comments__empty {
    margin: 0 0 1.5rem;
    color: #64748b;
    font-size: .95rem;
    line-height: 2;
}

.ir-comments__list,
.ir-comment__replies {
    margin: 0 0 1.75rem;
    padding: 0;
    list-style: none !important;
}

.ir-comment {
    padding: 16px 18px;
    margin-bottom: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    background: #fff;
}

.ir-comment--reply {
    margin-top: 12px;
    margin-bottom: 0;
    background: #f7f9fc;
    border-right: 3px solid #c3d9ff;
}

.ir-comment__replies {
    margin: 12px 0 0;
    padding-right: 18px;
}

.ir-comment__head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 8px;
}

.ir-comment__author {
    font-weight: 800;
    color: #0f172a;
}

.ir-comment__date {
    color: #94a3b8;
    font-size: .8rem;
}

.ir-comment__body {
    margin: 0;
    color: #334155;
    font-size: .95rem;
    line-height: 2;
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.ir-comment-form {
    padding: 20px;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    background: #f7f9fc;
}

.ir-comment-form__title {
    margin: 0 0 6px;
    font-size: 1.05rem;
    font-weight: 800;
    color: #0f172a;
}

.ir-comment-form__note {
    margin: 0 0 16px;
    color: #64748b;
    font-size: .85rem;
    line-height: 1.9;
}

.ir-comment-form__row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.ir-comment-form__field {
    display: block;
    margin-bottom: 14px;
}

.ir-comment-form__field > span {
    display: block;
    margin-bottom: 6px;
    color: #334155;
    font-size: .88rem;
    font-weight: 700;
}

.ir-comment-form__field input,
.ir-comment-form__field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    background: #fff;
    font: inherit;
    font-size: .95rem;
    line-height: 1.9;
    color: #0f172a;
}

/* کادر متن نظر: ارتفاع دو سطر. اگر کاربر بیشتر نوشت، خودِ کادر اسکرول می‌خورد
   و بزرگ نمی‌شود. ارتفاع بر پایهٔ em است (دو سطر × line-height 1.9) به‌علاوهٔ
   padding و border، تا با تغییر اندازهٔ فونت هم دو سطر بماند. */
.ir-comment-form__field textarea {
    height: calc(3.8em + 22px);
    min-height: 0;
    resize: none;
    overflow-y: auto;
}

.ir-comment-form__field input:focus,
.ir-comment-form__field textarea:focus {
    outline: none;
    border-color: #0044bb;
    box-shadow: 0 0 0 3px rgba(29, 78, 216, .35);
}

.ir-comment-form__error {
    display: block;
    margin-top: 6px;
    color: #991b1b;
    font-size: .8rem;
}

/* تلهٔ ربات: باید برای انسان و صفحه‌خوان نامرئی باشد اما برای ربات پرشدنی. */
.ir-comment-form__trap {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.ir-comment-form__submit {
    padding: 11px 26px;
    border: 0;
    border-radius: 12px;
    background: #0044bb;
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.ir-comment-form__submit:hover,
.ir-comment-form__submit:focus-visible {
    background: #0035a0;
}

/* ---------- ۱۱) فهرست منابع -------------------------------------------- */

.blog-story-markdown ol.ir-references {
    margin: 1rem 0 1.5rem;
    padding-right: 1.4rem;
    list-style: decimal outside !important;
}

.ir-reference {
    margin-bottom: 0.8rem;
    padding-right: 0.3rem;
    line-height: 2;
}

.ir-reference__org {
    font-weight: 800;
    color: #0f172a !important;
}

.ir-reference__org a {
    color: #0044bb !important;
    text-decoration: none;
}

.ir-reference__org a:hover,
.ir-reference__org a:focus-visible {
    text-decoration: underline;
}

.ir-reference__org::after {
    content: '—';
    margin: 0 0.4rem;
    color: #94a3b8;
    font-weight: 400;
}

.ir-reference__detail {
    color: #475569 !important;
}
