/*
 * RoyayeShab Intelligence Surfaces — بلوک پیشنهاد مقاله
 *
 * رنگ برند از design-tokens.php ریدیزاین خوانده می‌شود، با مقدار واقعی سایت
 * به‌عنوان fallback. پس اگر لودر mu-plugin روی صفحه نبود هم رنگ درست می‌ماند.
 * قالب Flatsome است: سایدبار نوشته‌ها .post-sidebar.large-3.col و فقط ۲۵۶px،
 * پس کارت دسکتاپ عمداً فشرده طراحی شده.
 */

.rysb-article {
    --rysb-brand: var(--rs-primary, #90266e);
    --rysb-brand-soft: rgba(144, 38, 110, .07);
    --rysb-brand-line: rgba(144, 38, 110, .30);
    --rysb-heading: var(--rs-heading, #1f1f24);
    --rysb-text: var(--rs-muted, #6b6b73);
    --rysb-border: rgba(31, 31, 36, .10);
    --rysb-surface: #fbfafb;
    --rysb-radius: var(--rs-radius, 14px);
    direction: rtl;
    font-family: inherit;
    color: var(--rysb-heading);
    background: #fff;
    border: 1px solid var(--rysb-border);
    border-radius: var(--rysb-radius);
    padding: 13px;
    box-sizing: border-box;
}

.rysb-article *,
.rysb-article *::before,
.rysb-article *::after,
.rysb-article-jump *,
.rysb-article-jump *::before,
.rysb-article-jump *::after { box-sizing: border-box; }

.rysb-article__head { margin: 0 0 8px; }
.rysb-article__title {
    margin: 0;
    color: var(--rysb-heading);
    font-size: 15px;
    font-weight: 700;
    line-height: 1.55;
    letter-spacing: 0;
}
.rysb-article__subtitle {
    margin: 3px 0 0;
    color: var(--rysb-text);
    font-size: 11.5px;
    font-weight: 400;
    line-height: 1.6;
}

.rysb-article__list { display: flex; flex-direction: column; }
.rysb-article__item { margin: 0; padding: 0; border: 0; border-bottom: 1px solid var(--rysb-border); }
.rysb-article__item:last-child { border-bottom: 0; }

.rysb-article__link {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 9px;
    align-items: center;
    min-height: 76px;
    padding: 9px 0;
    color: inherit;
    text-decoration: none;
    border-radius: 10px;
    transition: background-color .18s ease, transform .18s ease;
}
.rysb-article__link:hover,
.rysb-article__link:focus { color: inherit; text-decoration: none; }
.rysb-article__link:hover { background: var(--rysb-surface); transform: translateY(-1px); }
.rysb-article__link:focus-visible,
.rysb-article__more:focus-visible,
.rysb-article__advisor:focus-visible,
.rysb-article-jump:focus-visible {
    outline: 3px solid var(--rysb-brand-soft);
    outline-offset: 2px;
}

.rysb-article__image {
    display: flex;
    width: 58px;
    height: 58px;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--rysb-surface);
    border-radius: 10px;
}
.rysb-article__image img { display: block; width: 100%; height: 100%; object-fit: cover; margin: 0; border-radius: 10px; }

.rysb-article__body { display: flex; min-width: 0; flex-direction: column; align-items: stretch; }
.rysb-article__name {
    display: -webkit-box;
    overflow: hidden;
    color: var(--rysb-heading);
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.55;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}
.rysb-article__reason {
    display: block;
    overflow: hidden;
    margin-top: 3px;
    color: var(--rysb-brand);
    font-size: 10.5px;
    font-weight: 500;
    line-height: 1.45;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.rysb-article__row { display: flex; gap: 8px; align-items: center; justify-content: space-between; margin-top: 6px; }
.rysb-article__price { min-width: 0; color: var(--rysb-heading); font-size: 12px; font-weight: 700; line-height: 1.4; white-space: nowrap; }
.rysb-article__price del { color: var(--rysb-text); font-size: 10px; font-weight: 400; opacity: .72; }
.rysb-article__price ins { color: var(--rysb-heading); text-decoration: none; }
.rysb-article__cta {
    display: inline-flex;
    min-height: 27px;
    align-items: center;
    justify-content: center;
    padding: 4px 9px;
    color: var(--rysb-brand);
    border: 1px solid var(--rysb-brand-line);
    border-radius: 9px;
    font-size: 10.5px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    transition: background-color .18s ease, color .18s ease, border-color .18s ease;
}
.rysb-article__link:hover .rysb-article__cta { color: #fff; background: var(--rysb-brand); border-color: var(--rysb-brand); }

.rysb-article__more {
    display: none;
    width: 100%;
    min-height: 40px;
    margin: 8px 0 0;
    padding: 8px 12px;
    color: var(--rysb-brand);
    background: transparent;
    border: 1px solid var(--rysb-brand-line);
    border-radius: 10px;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.rysb-article__advisor {
    display: flex;
    width: 100%;
    min-height: 42px;
    margin: 10px 0 0;
    padding: 8px 12px;
    gap: 7px;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: var(--rysb-brand);
    border: 1px solid var(--rysb-brand);
    border-radius: 11px;
    font: inherit;
    font-size: 12px;
    font-weight: 650;
    line-height: 1.4;
    cursor: pointer;
    transition: opacity .18s ease;
}
.rysb-article__advisor[hidden] { display: none !important; }
.rysb-article__advisor:hover { opacity: .92; }
.rysb-article__advisor-icon { display: inline-flex; width: 17px; height: 17px; flex: 0 0 17px; }
.rysb-article__advisor-icon svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.rysb-article__benefits {
    display: grid;
    grid-template-columns: 1fr;
    gap: 5px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--rysb-border);
}
.rysb-article__benefit { display: flex; min-width: 0; gap: 7px; align-items: center; padding: 6px 7px; background: var(--rysb-surface); border-radius: 9px; }
.rysb-article__benefit-icon {
    display: inline-flex;
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    align-items: center;
    justify-content: center;
    color: var(--rysb-brand);
    background: var(--rysb-brand-soft);
    border-radius: 8px;
}
.rysb-article__benefit-icon svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.rysb-article__benefit-copy { display: flex; min-width: 0; flex-direction: column; }
.rysb-article__benefit-copy strong { color: var(--rysb-heading); font-size: 10.5px; font-weight: 600; line-height: 1.4; }

.rysb-article-sticky-placeholder { display: none; height: 0; }

/* ---------- دسکتاپ ---------- */
@media (min-width: 850px) {
    .rysb-article--inline { display: none !important; }

    /*
     * سایدبار نوشته‌های Flatsome روی این سایت فقط ۱۹۵px فضای واقعی دارد (اندازه‌گیری
     * شده روی خود صفحه، نه از روی عرض ستون). با تصویر ۵۸px، برای متن حدود ۱۰۰px
     * می‌ماند و قیمت و دکمهٔ «مشاهده» روی هم می‌افتند. در این عرض آن دکمه تزئین
     * مضر است: کل ردیف از قبل یک لینک کامل است، پس در سایدبار حذف می‌شود و همهٔ
     * فضا به قیمت می‌رسد. در موبایل که ستون پهن است، دکمه سر جایش می‌ماند.
     */
    .rysb-article--sidebar .rysb-article__cta { display: none; }
    .rysb-article--sidebar .rysb-article__row { justify-content: flex-start; }
    .rysb-article--sidebar .rysb-article__price { white-space: normal; }
    .rysb-article--sidebar .rysb-article__link { grid-template-columns: 52px minmax(0, 1fr); gap: 8px; }
    .rysb-article--sidebar .rysb-article__image { width: 52px; height: 52px; }
    .rysb-article--sidebar .rysb-article__reason { white-space: normal; }
    .rysb-article-host,
    .rysb-article--sidebar {
        position: -webkit-sticky;
        position: sticky;
        top: var(--rysb-sticky-top, 92px);
        align-self: flex-start;
    }
    .rysb-article--sidebar {
        max-height: calc(100vh - var(--rysb-sticky-top, 92px) - 24px);
        overflow: auto;
        overscroll-behavior: contain;
        scrollbar-width: thin;
    }
    /*
     * قالب خودش ستون سایدبار را می‌چسباند (Flatsome: .is-sticky-column).
     * در آن حالت چسبندگی خودمان باید کامل خاموش شود، وگرنه دو مکانیزم روی هم
     * سوار می‌شوند و کارت موقع اسکرول می‌پرد. دو مسیر تشخیص:
     *   - ساختاری، برای Flatsome همین سایت
     *   - data-rysb-theme-sticky که جاوااسکریپت با بررسی واقعی والدها می‌گذارد،
     *     تا قالب دیگری با نام کلاس دیگر هم پوشش داده شود.
     */
    .is-sticky-column .rysb-article-host,
    .is-sticky-column .rysb-article--sidebar,
    [data-rysb-theme-sticky="1"],
    [data-rysb-theme-sticky="1"] .rysb-article--sidebar {
        position: static;
        top: auto;
        max-height: none;
        overflow: visible;
    }

    .rysb-article-jump { display: none !important; }
}

/* ---------- موبایل و تبلت ---------- */
@media (max-width: 849px) {
    /* Flatsome سایدبار نوشته‌ها را زیر مقاله می‌چیند؛ آن‌جا دیگر خیلی دیر است. */
    .rysb-article--sidebar,
    .post-sidebar .rysb-article-host { display: none !important; }

    .rysb-article--inline { margin: 26px 0; padding: 14px; }
    .rysb-article--inline .rysb-article__title { font-size: 16px; }
    .rysb-article--inline .rysb-article__subtitle { font-size: 12px; }
    .rysb-article--inline .rysb-article__link { grid-template-columns: 72px minmax(0, 1fr); min-height: 92px; padding: 10px 0; }
    .rysb-article--inline .rysb-article__image { width: 72px; height: 72px; }
    .rysb-article--inline .rysb-article__name { font-size: 13.5px; }
    .rysb-article--inline .rysb-article__reason { font-size: 11px; white-space: normal; }
    .rysb-article--inline .rysb-article__price { font-size: 13px; }
    .rysb-article--inline .rysb-article__cta { min-height: 30px; font-size: 11px; }
    .rysb-article--inline .rysb-article__item--more { display: none; }
    .rysb-article--inline[data-expanded="1"] .rysb-article__item--more { display: block; }
    .rysb-article--inline .rysb-article__more { display: block; }
    .rysb-article--inline[data-expanded="1"] .rysb-article__more { margin-top: 10px; }
    .rysb-article__benefits { grid-template-columns: 1fr 1fr; gap: 6px; }
    .rysb-article__benefit { min-height: 48px; padding: 8px; }
    .rysb-article__benefit-copy strong { font-size: 11px; }

    .rysb-article-jump {
        --rysb-brand: var(--rs-primary, #90266e);
        position: fixed;
        right: 12px;
        left: 12px;
        bottom: calc(var(--rysb-bottom-bar-h, 0px) + env(safe-area-inset-bottom, 0px) + 10px);
        z-index: 9996;
        display: flex;
        min-height: 44px;
        align-items: center;
        justify-content: center;
        gap: 7px;
        padding: 9px 14px;
        direction: rtl;
        font: inherit;
        color: #fff;
        background: var(--rysb-brand);
        border: 1px solid var(--rysb-brand);
        border-radius: 12px;
        box-shadow: 0 8px 22px rgba(60, 12, 46, .18);
        cursor: pointer;
        opacity: 0;
        transform: translateY(10px);
        transition: opacity .18s ease, transform .18s ease;
    }
    .rysb-article-jump[hidden] { display: none !important; }
    .rysb-article-jump[data-open="1"] { opacity: 1; transform: translateY(0); }
    .rysb-article-jump svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
    .rysb-article-jump span { font-size: 12.5px; font-weight: 650; line-height: 1.35; }
}

@media (prefers-reduced-motion: reduce) {
    .rysb-article *,
    .rysb-article-jump { transition-duration: .01ms !important; }
}
