/* ==========================================================================
   مجله‌ی کانین — فهرست مقالات (blog.php) و صفحه‌ی مقاله (article.php).
   فقط همین دو صفحه این فایل را بار می‌کنند ($page_styles) و هر دو
   body.mg-page دارند؛ سربرگ و پانویس سایت دست نمی‌خورند.

   طرح: زمینه‌ی سفید، متن خاکستری خنثی، تیتر تقریباً مشکی، آبی کانین فقط برای
   لینک و برچسب دسته. بدون گرادیان و سایه — الهام از وبلاگ Stripe، Vercel و Ahrefs.
   کلاس‌های جدول قیمت و پرسش‌ها خروجی includes/category-guide.php است (sx-g*)
   و این‌جا داخل .ba-body محدودند تا به صفحه‌ی دسته‌ها کاری نداشته باشند.
   ========================================================================== */

body.mg-page {
    --mg-ink: #18181b;
    --mg-text: #3f3f46;
    --mg-mute: #71717a;
    --mg-soft: #a1a1aa;
    --mg-line: #e4e4e7;
    --mg-tile: #f4f4f5;
    --mg-wash: #fafafa;
    --mg-ac: #1677ff;
    --mg-ok: #15803d;
    background: #fff;
}

.mg-wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.mg-page .ba-preview {
    margin: 18px 0 0;
    padding: 12px 16px;
    border: 1px solid #f5c26b;
    border-radius: 12px;
    background: #fff8ec;
    color: #8a4b00;
    font-size: 14px;
    line-height: 2;
}
.mg-page .ba-preview ul { margin: 4px 0 0; padding-right: 20px; }
.mg-label { display: inline-block; color: var(--mg-ac); font-size: 13.5px; font-weight: 700; text-decoration: none; }

/* ── صفحه‌ی مقاله ─────────────────────────────────────────────────────────── */
.mg-grid {
    display: grid;
    grid-template-columns: 210px minmax(0, 680px) 180px;
    gap: 0 52px;
    justify-content: center;
}
.mg-head, .mg-cover { grid-column: 2 / 4; }
.mg-head { padding: 34px 0 26px; }
.mg-crumbs { display: flex; gap: 6px; margin: 0 0 24px; padding: 0; list-style: none; font-size: 13px; }
.mg-crumbs li + li::before { content: '/'; margin-left: 6px; color: var(--mg-soft); }
.mg-crumbs a { color: var(--mg-mute); text-decoration: none; }
.mg-head .mg-label { margin-bottom: 8px; }
.mg-h1 { margin: 0 0 14px; font-size: 38px; line-height: 1.6; font-weight: 800; color: var(--mg-ink); overflow-wrap: anywhere; }
.mg-dek { margin: 0 0 22px; font-size: 18.5px; line-height: 1.95; color: var(--mg-mute); }
.mg-by { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 14px; color: var(--mg-mute); }
.mg-by img { width: 36px; height: 36px; padding: 3px; border: 1px solid var(--mg-line); border-radius: 50%; background: #fff; object-fit: contain; }
.mg-by b { color: var(--mg-ink); font-weight: 700; }
.mg-by i { width: 3px; height: 3px; border-radius: 50%; background: var(--mg-soft); }
.mg-by-share { display: none; margin-inline-start: auto; }

.mg-cover {
    display: grid;
    place-items: center;
    margin: 0 0 44px;
    aspect-ratio: 5 / 2;
    overflow: hidden;
    border-radius: 20px;
    background: var(--mg-tile);
}
.mg-cover img { max-width: 72%; max-height: 86%; width: auto; height: auto; object-fit: contain; mix-blend-mode: multiply; }
.mg-cover.is-fill img { width: 100%; height: 100%; max-width: none; max-height: none; object-fit: cover; mix-blend-mode: normal; }

.mg-toc { grid-column: 1; grid-row: 3; position: sticky; top: 110px; align-self: start; max-height: calc(100vh - 130px); overflow-y: auto; font-size: 13.5px; }
.mg-toc-t { margin: 0 0 10px; color: var(--mg-soft); font-size: 12.5px; font-weight: 600; }
.mg-toc a { display: block; padding: 6px 12px 6px 0; border-right: 2px solid var(--mg-tile); color: var(--mg-mute); line-height: 1.75; text-decoration: none; }
.mg-toc a:hover { color: var(--mg-ink); }
.mg-toc a.on { border-right-color: var(--mg-ac); color: var(--mg-ink); font-weight: 700; }
.mg-main { grid-column: 2; grid-row: 3; min-width: 0; padding-bottom: 50px; }
.mg-side { grid-column: 3; grid-row: 3; position: sticky; top: 110px; align-self: start; display: grid; gap: 14px; font-size: 13px; color: var(--mg-mute); }
.mg-grid.no-toc .mg-main { grid-row: 3; }

.mg-share.sh-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid var(--mg-line);
    border-radius: 999px;
    background: #fff;
    color: var(--mg-text);
    font: inherit;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
}
.mg-share.sh-btn svg { width: 17px; height: 17px; }
.mg-share--wide.sh-btn { width: auto; padding: 0 16px; justify-self: start; }
.mg-share.sh-btn:hover { border-color: var(--mg-soft); color: var(--mg-ink); }
.mg-buy { padding: 14px; border: 1px solid var(--mg-line); border-radius: 14px; background: var(--mg-wash); line-height: 1.9; }
.mg-buy b { display: block; color: var(--mg-ink); font-size: 14px; }
.mg-buy a { display: inline-block; margin-top: 6px; color: var(--mg-ac); font-weight: 700; text-decoration: none; }

.mg-mtoc { display: none; margin: 0 0 26px; border-top: 1px solid var(--mg-line); border-bottom: 1px solid var(--mg-line); }
.mg-mtoc summary { display: flex; justify-content: space-between; padding: 13px 0; color: var(--mg-ink); font-size: 15px; font-weight: 700; cursor: pointer; list-style: none; }
.mg-mtoc summary::-webkit-details-marker { display: none; }
.mg-mtoc summary span { color: var(--mg-soft); font-size: 13px; font-weight: 500; }
.mg-mtoc summary span::after { content: ' ▾'; }
.mg-mtoc[open] summary span::after { content: ' ▴'; }
.mg-mtoc a { display: block; padding: 7px 0; border-top: 1px solid var(--mg-tile); color: var(--mg-text); font-size: 15px; line-height: 1.8; text-decoration: none; }
.mg-mtoc a:last-child { margin-bottom: 8px; }

.mg-about { display: flex; gap: 14px; margin: 44px 0 0; padding: 22px 0 0; border-top: 1px solid var(--mg-line); color: var(--mg-mute); font-size: 15px; line-height: 2; }
.mg-about img { flex: none; width: 48px; height: 48px; padding: 4px; border: 1px solid var(--mg-line); border-radius: 50%; object-fit: contain; }
.mg-about b { display: block; color: var(--mg-ink); font-size: 15.5px; }

/* متن مقاله */
.ba-body { font-size: 18px; line-height: 2.05; color: var(--mg-text); overflow-wrap: anywhere; }
.ba-body > :first-child { margin-top: 0; }
.ba-body p { margin: 0 0 20px; }
.ba-body h2 { margin: 46px 0 12px; font-size: 25px; line-height: 1.7; font-weight: 800; color: var(--mg-ink); scroll-margin-top: 100px; }
.ba-body h3 { margin: 30px 0 8px; font-size: 20px; line-height: 1.7; font-weight: 800; color: var(--mg-ink); }
.ba-body ul, .ba-body ol { margin: 0 0 20px; padding-right: 24px; }
.ba-body li { margin: 4px 0; }
.ba-body li::marker { color: var(--mg-soft); }
.ba-body strong { color: var(--mg-ink); }
.ba-body a { color: var(--mg-ac); text-decoration: underline; text-decoration-color: rgba(22, 119, 255, .3); text-underline-offset: 5px; }
.ba-body a:hover { text-decoration-color: var(--mg-ac); }

.ba-body .ba-keys { margin: 0 0 34px; padding: 18px 22px; border-right: 3px solid var(--mg-ac); border-radius: 12px; background: var(--mg-wash); }
.ba-body .ba-keys-t { margin: 0 0 6px; color: var(--mg-ink); font-size: 15.5px; font-weight: 800; }
.ba-body .ba-keys ul { margin: 0; padding-right: 18px; font-size: 16px; line-height: 2; }
.ba-body .ba-keys li::marker { color: var(--mg-ac); }

.ba-body .sx-gdate { display: block; margin: -4px 0 10px; color: var(--mg-soft); font-size: 13px; }
.ba-body .sx-gtable-wrap { overflow-x: auto; margin: 0 0 6px; border: 1px solid var(--mg-line); border-radius: 14px; }
.ba-body .sx-gtable { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.9; }
.ba-body .sx-gtable th { padding: 11px 16px; background: var(--mg-wash); color: var(--mg-mute); font-size: 13px; font-weight: 600; text-align: right; }
.ba-body .sx-gtable td { padding: 11px 16px; border-top: 1px solid var(--mg-tile); vertical-align: top; }
.ba-body .sx-gtable td a { color: var(--mg-ink); font-weight: 600; text-decoration: none; }
.ba-body .sx-gtable td a:hover { color: var(--mg-ac); }
.ba-body .sx-gtable .sx-gt-price { color: var(--mg-ink); font-weight: 800; white-space: nowrap; }
.ba-body .sx-gtable td.sx-gt-sellers { color: var(--mg-soft); font-size: 13px; white-space: nowrap; }
.ba-body .sx-gtable td.sx-gt-sellers.is-many { color: var(--mg-ok); font-weight: 700; }
.ba-body .sx-gnote { margin: 8px 0 20px; color: var(--mg-soft); font-size: 13px; line-height: 1.9; }

.ba-body .sx-gfaq { margin: 0 0 20px; border-top: 1px solid var(--mg-line); }
.ba-body .sx-gfaq details { border-bottom: 1px solid var(--mg-line); }
.ba-body .sx-gfaq summary { display: flex; justify-content: space-between; gap: 12px; padding: 16px 0; color: var(--mg-ink); font-weight: 700; line-height: 1.9; cursor: pointer; list-style: none; }
.ba-body .sx-gfaq summary::-webkit-details-marker { display: none; }
.ba-body .sx-gfaq summary::after { content: '+'; flex: none; color: var(--mg-soft); font-size: 20px; line-height: 1.5; }
.ba-body .sx-gfaq details[open] summary::after { content: '−'; }
.ba-body .sx-gfaq details p { margin: 0 0 16px; }

/* کارت محصول داخل متن: [محصول: …] */
.ba-body .ba-prods { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 6px 0 22px; }
.ba-body .ba-prod {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    padding: 10px;
    border: 1px solid var(--mg-line);
    border-radius: 14px;
    background: #fff;
    color: var(--mg-ink);
    line-height: 1.7;
    text-decoration: none;
    transition: border-color .15s;
}
.ba-body .ba-prod:hover { border-color: var(--mg-soft); }
.ba-body .ba-prod-img { flex: none; display: flex; align-items: center; justify-content: center; width: 84px; height: 84px; overflow: hidden; border-radius: 10px; background: var(--mg-tile); }
.ba-body .ba-prod-img img { max-width: 100%; max-height: 100%; object-fit: contain; mix-blend-mode: multiply; }
.ba-body .ba-prod-info { display: flex; flex: 1; flex-direction: column; gap: 3px; min-width: 0; }
.ba-body .ba-prod-title { display: -webkit-box; overflow: hidden; color: var(--mg-ink); font-size: 14px; font-weight: 700; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ba-body .ba-prod-price { color: var(--mg-ink); font-size: 15px; font-weight: 800; }
.ba-body .ba-prod-price small { color: var(--mg-mute); font-size: 11.5px; font-weight: 500; }
.ba-body .ba-prod-meta { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 8px; color: var(--mg-mute); font-size: 12px; }
.ba-body .ba-prod-meta b { font-weight: 600; }
.ba-body .ba-prod-meta b.is-many { color: var(--mg-ok); }
.ba-body .ba-prod-meta b.is-out { color: #b45309; }
.ba-body .ba-prod-go { color: var(--mg-ac); font-weight: 700; white-space: nowrap; }

/* عکس داخل متن: [تصویر: … | توضیح] */
.ba-body .ba-figure { margin: 10px 0 24px; }
.ba-body .ba-figure img { display: block; width: 100%; height: auto; max-height: 640px; object-fit: contain; border-radius: 14px; background: var(--mg-tile); }
.ba-body .ba-figure figcaption { margin-top: 8px; color: var(--mg-mute); font-size: 13.5px; line-height: 1.9; text-align: center; }

/* محصولات مرتبط زیر متن */
.mg-main .ba-products { margin-top: 44px; }
.mg-main .ba-products h2 { margin: 0 0 14px; color: var(--mg-ink); font-size: 21px; }
.mg-main .ba-products .pc-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }

/* مقاله‌های دیگر (زیر مقاله) */
.mg-more { padding: 40px 0 70px; border-top: 1px solid var(--mg-line); }
.mg-sec-h { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 22px; }
.mg-sec-h h2 { margin: 0; color: var(--mg-ink); font-size: 21px; font-weight: 800; }
.mg-sec-h a { color: var(--mg-ac); font-size: 14px; font-weight: 700; text-decoration: none; }

/* ── فهرست مقالات ─────────────────────────────────────────────────────────── */
.mg-list { padding-bottom: 70px; }
.mg-top { padding: 42px 0 0; }
.mg-top h1 { margin: 0 0 6px; color: var(--mg-ink); font-size: 42px; line-height: 1.5; font-weight: 800; }
.mg-top > p { margin: 0 0 26px; color: var(--mg-mute); font-size: 17px; }
.mg-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 36px; padding-bottom: 14px; border-bottom: 1px solid var(--mg-line); }
.mg-tabs { display: flex; flex: 1; gap: 4px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.mg-tabs::-webkit-scrollbar { display: none; }
.mg-tabs-gap { flex: 1; }
.mg-tabs a { flex: none; padding: 7px 14px; border-radius: 999px; color: var(--mg-mute); font-size: 14.5px; text-decoration: none; white-space: nowrap; }
.mg-tabs a:hover { color: var(--mg-ink); }
.mg-tabs a.on { background: var(--mg-tile); color: var(--mg-ink); font-weight: 700; }
.mg-search { flex: none; display: flex; align-items: center; gap: 8px; width: 230px; padding: 0 14px; border: 1px solid var(--mg-line); border-radius: 999px; color: var(--mg-soft); }
.mg-search svg { flex: none; width: 16px; height: 16px; }
.mg-search input { flex: 1; min-width: 0; padding: 9px 0; border: 0; outline: 0; background: transparent; color: var(--mg-ink); font: inherit; font-size: 14px; }
.mg-search:focus-within { border-color: var(--mg-soft); }

.mg-card { display: block; color: inherit; text-decoration: none; }
.mg-tile { display: grid; place-items: center; aspect-ratio: 4 / 3; margin-bottom: 14px; overflow: hidden; border-radius: 16px; background: var(--mg-tile); }
.mg-tile img { max-width: 74%; max-height: 82%; width: auto; height: auto; object-fit: contain; mix-blend-mode: multiply; transition: transform .25s; }
.mg-tile.is-fill img { width: 100%; height: 100%; max-width: none; max-height: none; object-fit: cover; mix-blend-mode: normal; }
.mg-tile img.mg-ph { width: 64px; height: 64px; opacity: .35; }
.mg-card:hover .mg-tile img { transform: scale(1.03); }
.mg-card-txt { display: block; }
.mg-card-t { margin: 6px 0; color: var(--mg-ink); font-size: 18px; line-height: 1.75; font-weight: 800; }
.mg-card:hover .mg-card-t { color: var(--mg-ac); }
.mg-card-sum { display: -webkit-box; margin: 0 0 8px; overflow: hidden; color: var(--mg-mute); font-size: 14.5px; line-height: 1.95; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.mg-card-meta { display: block; color: var(--mg-soft); font-size: 13px; }

.mg-feat { margin-bottom: 56px; }
.mg-card--big { display: grid; grid-template-columns: 1.15fr 1fr; gap: 44px; align-items: center; }
.mg-card--big .mg-tile { aspect-ratio: 16 / 10; margin: 0; border-radius: 18px; }
.mg-card--big .mg-card-t { margin: 8px 0 12px; font-size: 30px; line-height: 1.65; }
.mg-card--big .mg-card-sum { font-size: 16.5px; line-height: 2; -webkit-line-clamp: 3; margin-bottom: 14px; }

.mg-sec-t { margin: 0 0 22px; color: var(--mg-ink); font-size: 20px; font-weight: 800; }
.mg-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 40px 30px; }
.mg-empty { padding: 50px 0; text-align: center; color: var(--mg-mute); }
.mg-empty h2 { color: var(--mg-ink); font-size: 20px; }
.mg-empty a { color: var(--mg-ac); font-weight: 700; text-decoration: none; }
.mg-pages { display: flex; justify-content: center; gap: 6px; margin-top: 44px; }
.mg-pages a { min-width: 38px; padding: 7px 10px; border-radius: 999px; color: var(--mg-mute); text-align: center; text-decoration: none; }
.mg-pages a.on { background: var(--mg-ink); color: #fff; font-weight: 700; }

/* ── واکنش‌گرا ───────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
    .mg-grid { grid-template-columns: minmax(0, 680px) 180px; gap: 0 40px; }
    .mg-head, .mg-cover { grid-column: 1 / 3; }
    .mg-toc { display: none; }
    .mg-main { grid-column: 1; }
    .mg-side { grid-column: 2; }
    .mg-mtoc { display: block; }
}
@media (max-width: 900px) {
    .mg-main .ba-products .pc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .mg-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 20px; }
}
@media (max-width: 820px) {
    .mg-wrap { padding: 0 16px; }
    .mg-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
    .mg-head, .mg-cover, .mg-main { grid-column: 1; }
    .mg-side { display: none; }
    .mg-head { padding: 18px 0 20px; }
    .mg-crumbs { margin-bottom: 14px; font-size: 12.5px; }
    .mg-head .mg-label { margin-bottom: 4px; font-size: 13px; }
    .mg-h1 { margin-bottom: 10px; font-size: 25px; line-height: 1.7; }
    .mg-dek { margin-bottom: 16px; font-size: 16px; line-height: 1.95; }
    .mg-by { gap: 6px 8px; font-size: 12.5px; }
    .mg-by img { width: 30px; height: 30px; }
    .mg-by-share { display: block; }
    .mg-by .mg-share.sh-btn { width: 34px; height: 34px; }
    .mg-cover { margin: 0 0 22px; aspect-ratio: 16 / 10; border-radius: 14px; }
    .mg-cover img { max-width: 82%; max-height: 88%; }
    .mg-cover.is-fill img { max-width: none; max-height: none; }
    .ba-body { font-size: 16.5px; }
    .ba-body h2 { margin: 36px 0 10px; font-size: 21px; scroll-margin-top: 80px; }
    .ba-body h3 { font-size: 18px; }
    .ba-body .ba-keys { margin-bottom: 26px; padding: 14px 16px; }
    .ba-body .ba-keys ul { font-size: 15px; line-height: 1.95; }
    .ba-body .ba-prods { grid-template-columns: 1fr; }
    .mg-about { font-size: 14px; }

    .mg-top { padding: 22px 0 0; }
    .mg-top h1 { font-size: 28px; }
    .mg-top > p { margin-bottom: 16px; font-size: 14.5px; }
    .mg-bar { gap: 8px; margin-bottom: 22px; padding-bottom: 10px; }
    .mg-tabs a { padding: 6px 12px; font-size: 13.5px; }
    /* ردیف زبانه‌ها افقی اسکرول می‌خورد؛ لبه‌ی چپ محو می‌شود تا معلوم باشد ادامه دارد. */
    .mg-tabs { -webkit-mask-image: linear-gradient(to left, transparent 0, #000 28px); mask-image: linear-gradient(to left, transparent 0, #000 28px); padding-left: 20px; }
    .mg-search { width: 40px; height: 38px; padding: 0 11px; overflow: hidden; transition: width .2s; }
    .mg-search:focus-within { width: 170px; }
    .mg-search input::placeholder { color: transparent; }
    .mg-search:focus-within input::placeholder { color: var(--mg-soft); }
    .mg-feat { margin-bottom: 30px; }
    .mg-card--big { grid-template-columns: 1fr; gap: 14px; }
    .mg-card--big .mg-card-t { margin: 4px 0 6px; font-size: 21px; }
    .mg-card--big .mg-card-sum { font-size: 15px; -webkit-line-clamp: 2; margin-bottom: 8px; }
    .mg-sec-t { margin-bottom: 4px; font-size: 17px; }
    .mg-cards { grid-template-columns: 1fr; gap: 0; }
    .mg-cards .mg-card { display: grid; grid-template-columns: minmax(0, 1fr) 104px; gap: 14px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--mg-tile); }
    .mg-cards .mg-tile { grid-column: 2; grid-row: 1; aspect-ratio: 1; margin: 0; border-radius: 12px; }
    .mg-cards .mg-card-txt { grid-column: 1; grid-row: 1; }
    .mg-cards .mg-card-t { margin: 2px 0 4px; font-size: 15.5px; line-height: 1.8; }
    .mg-cards .mg-card-sum { display: none; }
    .mg-cards .mg-label { font-size: 12.5px; }
    .mg-card-meta { font-size: 12px; }
    .mg-more { padding: 26px 0 40px; }
    .mg-sec-h { margin-bottom: 4px; }
    .mg-sec-h h2 { font-size: 18px; }
}
@media (max-width: 520px) {
    .ba-body .sx-gtable { font-size: 13.5px; }
    .ba-body .sx-gtable th, .ba-body .sx-gtable td { padding: 10px; }
    /* ستون «فروشنده» روی گوشی جا نمی‌شود؛ تعدادش در صفحه‌ی خود محصول هست. */
    .ba-body .sx-gtable .sx-gt-sellers { display: none; }
}
@media (max-width: 360px) {
    .mg-h1 { font-size: 23px; }
    .ba-body .ba-prod-img { width: 70px; height: 70px; }
    .mg-cards .mg-card { grid-template-columns: minmax(0, 1fr) 88px; }
}
