/*
 * 8.5.0 — مجلهٔ علمی طب‌تاک. پایه: landing.css (متغیرهای --tl-*، سربرگ و پانویس).
 * 8.5.4 — چیدمان مجلهٔ خبری علمی: تایپوگرافی و خط‌های نازک، بدون کارت، سایه، گرادیان و برچسب‌های رنگی.
 */
.mg { --mg-ink:#13253d; --mg-text:#2f3a45; --mg-muted:#6b7785; --mg-line:#dde8f3; --mg-rule:#cbd2d9; --mg-int:#0f8577; --mg-ext:#1f67ed; background:#fff; }
.mg .mg-main { display:block; padding-bottom:72px; }
:where(.mg) :is(h1,h2,h3,p,ul,ol,li,figure,figcaption,blockquote) { margin:0; }
.mg .tl-footer { margin-top:0; border-top:1px solid var(--mg-line); }

/* ---------- اجزای مشترک ---------- */
.mg .mg-kicker { display:inline-block; color:var(--mg-ext)!important; font-size:13px; font-weight:700; line-height:1.6; text-decoration:none; }
.mg .mg-kicker.is-internal { color:var(--mg-int)!important; }
.mg .mg-kicker:hover { text-decoration:underline; text-underline-offset:3px; }
.mg .mg-story-title { color:var(--mg-ink); font-weight:800; }
.mg .mg-story-title a { color:inherit; text-decoration:none; }
.mg .mg-story-title a:hover { color:var(--mg-ext); }
.mg .mg-standfirst { color:var(--mg-text); line-height:1.95; }
.mg .mg-dateline { display:flex; flex-wrap:wrap; gap:6px; color:var(--mg-muted); font-size:13px; line-height:1.7; }
.mg .mg-story-img { display:block; overflow:hidden; border-radius:4px; background:#f4f7fa; }
.mg .mg-story-img img { display:block; width:100%; height:100%; object-fit:cover; transition:opacity .2s; }
.mg .mg-story-img:hover img { opacity:.9; }
.mg .mg-story-text { display:grid; align-content:start; gap:6px; }
.mg .mg-rule-title { padding-top:12px; border-top:2px solid var(--mg-rule); color:var(--mg-ink); font-size:18px; font-weight:800; line-height:1.6; }

/* ---------- سرتیتر بخش ---------- */
.mg .mg-masthead { display:flex; flex-wrap:wrap; align-items:flex-end; justify-content:space-between; gap:16px 32px; padding:44px 0 14px; border-bottom:2px solid var(--mg-rule); } /* 8.5.8 — طوسی و نازک */
.mg .mg-masthead h1 { color:var(--mg-ink); font-size:clamp(30px,3.6vw,42px); font-weight:800; line-height:1.3; }
.mg .mg-masthead p { margin-top:6px; color:var(--mg-muted); font-size:15px; line-height:1.8; }
.mg .mg-sections { display:flex; flex-wrap:wrap; gap:4px 22px; }
.mg .mg-sections a { padding:4px 0; color:var(--mg-text); font-size:15px; font-weight:700; text-decoration:none; }
.mg .mg-sections a:hover { color:var(--mg-ext); }
.mg .mg-sections a[aria-current="page"] { color:var(--mg-ext); text-decoration:underline; text-decoration-thickness:2px; text-underline-offset:10px; }

/* ---------- مطلب اصلی + ستون کناری ---------- */
.mg .mg-top { display:grid; grid-template-columns:minmax(0,2fr) minmax(0,1fr); gap:0 40px; padding-top:28px; }
.mg .mg-top-side { display:grid; align-content:start; padding-right:40px; border-right:1px solid var(--mg-line); }
.mg .mg-story.is-lead { display:grid; gap:18px; }
.mg .mg-story.is-lead .mg-story-img { aspect-ratio:16/9; }
.mg .mg-story.is-lead .mg-story-text { gap:8px; }
.mg .mg-story.is-lead .mg-story-title { font-size:clamp(24px,2.5vw,31px); line-height:1.55; }
.mg .mg-story.is-lead .mg-standfirst { font-size:17px; }
.mg .mg-story.is-side { display:grid; grid-template-columns:minmax(0,1fr) 112px; grid-template-areas:"text img"; gap:16px; padding:18px 0; border-bottom:1px solid var(--mg-line); }
.mg .mg-story.is-side:first-child { padding-top:0; }
.mg .mg-story.is-side:last-child { border-bottom:0; }
.mg .mg-story.is-side .mg-story-text { grid-area:text; }
.mg .mg-story.is-side .mg-story-img { grid-area:img; aspect-ratio:4/3; }
.mg .mg-story.is-side .mg-story-title { font-size:16.5px; line-height:1.75; }

/* ---------- فهرست ردیفی ---------- */
.mg .mg-latest { margin-top:56px; }
.mg .mg-latest.is-plain { margin-top:4px; } /* 8.5.6 — فهرست بخش: مستقیم زیر خط سرتیتر */
.mg .mg-latest.is-plain .mg-story.is-row:first-of-type { padding-top:28px; }
.mg .mg-story.is-row { display:grid; grid-template-columns:300px minmax(0,1fr); gap:28px; padding:24px 0; border-bottom:1px solid var(--mg-line); }
.mg .mg-story.is-row .mg-story-img { aspect-ratio:16/10; }
.mg .mg-story.is-row .mg-story-title { font-size:21px; line-height:1.6; }
.mg .mg-story.is-row .mg-standfirst { font-size:15.5px; }
.mg .mg-empty { padding:48px 0; color:var(--mg-muted); }
.mg .mg-empty a { color:var(--mg-ext); }
.mg .mg-pages { display:flex; flex-wrap:wrap; justify-content:center; gap:6px; margin-top:40px; }
.mg .mg-pages :is(a, span) { display:inline-flex; align-items:center; justify-content:center; min-width:40px; min-height:40px; padding:0 12px; border:1px solid var(--mg-line); border-radius:4px; color:var(--mg-ink); font-weight:600; text-decoration:none; }
.mg .mg-pages a:hover { border-color:var(--mg-ext); color:var(--mg-ext); }
.mg .mg-pages .current { border-color:var(--mg-ink); background:var(--mg-ink); color:#fff; }

/* ---------- صفحهٔ مطلب ---------- */
.mg .mg-progress { position:fixed; z-index:70; top:0; right:0; left:0; height:3px; background:var(--mg-ext); transform:scaleX(0); transform-origin:100% 50%; pointer-events:none; }
@supports (animation-timeline: scroll()) {
    .mg .mg-progress { animation:mg-progress linear both; animation-timeline:scroll(root block); }
    @keyframes mg-progress { to { transform:scaleX(1); } }
}
@supports not (animation-timeline: scroll()) { .mg .mg-progress { display:none; } }

.mg .mg-article-head { display:grid; gap:12px; max-width:808px; padding-top:48px; padding-bottom:28px; }
.mg .mg-article-head h1 { color:var(--mg-ink); font-size:clamp(28px,3.6vw,40px); font-weight:800; line-height:1.5; }
.mg .mg-article-standfirst { color:#4a5663; font-size:clamp(17px,1.7vw,19.5px); line-height:2; }
.mg .mg-byline { display:flex; flex-wrap:wrap; gap:4px 18px; margin-top:10px; padding:12px 0; border-top:1px solid var(--mg-line); border-bottom:1px solid var(--mg-line); color:var(--mg-muted); font-size:13.5px; line-height:1.8; }
.mg .mg-byline-name { color:var(--mg-ink); font-weight:700; }

.mg .mg-figure { max-width:1048px; }
.mg .mg-figure img { display:block; width:100%; height:auto; border-radius:4px; background:#f4f7fa; }
.mg .mg-figure figcaption { margin-top:8px; color:var(--mg-muted); font-size:12.5px; }

.mg .mg-article-body { max-width:768px; padding-top:36px; }
.mg .mg-body { color:var(--mg-text); font-size:18px; line-height:2.1; }
.mg .mg-body > * + * { margin-top:22px; }
.mg .mg-body h2 { margin-top:44px; color:var(--mg-ink); font-size:23px; font-weight:800; line-height:1.6; scroll-margin-top:96px; }
.mg .mg-body h3 { margin-top:32px; color:var(--mg-ink); font-size:19.5px; font-weight:800; line-height:1.6; }
.mg .mg-body h2 + *, .mg .mg-body h3 + * { margin-top:12px; }
.mg .mg-body ul, .mg .mg-body ol { display:grid; gap:10px; padding-right:22px; }
.mg .mg-body li::marker { color:var(--mg-muted); }
.mg .mg-body strong { color:var(--mg-ink); font-weight:800; }
.mg .mg-body a { color:var(--mg-ext); text-decoration:underline; text-decoration-thickness:1px; text-underline-offset:4px; }
.mg .mg-body blockquote { padding:2px 20px 2px 0; border-right:3px solid var(--mg-ink); color:var(--mg-ink); font-size:20px; font-weight:600; line-height:1.9; }
.mg .mg-body img { max-width:100%; height:auto; border-radius:4px; }
.mg .mg-body figcaption { margin-top:8px; color:var(--mg-muted); font-size:13px; }
.mg .mg-body table { width:100%; border-collapse:collapse; font-size:15px; }
.mg .mg-body :is(th,td) { padding:10px 12px; border-bottom:1px solid var(--mg-line); text-align:right; }

.mg .mg-refs { margin-top:48px; padding-top:14px; border-top:1px solid var(--mg-ink); scroll-margin-top:96px; }
.mg .mg-refs h2 { color:var(--mg-ink); font-size:16px; font-weight:800; }
.mg .mg-refs ol { display:grid; gap:8px; margin-top:12px; padding-left:20px; color:var(--mg-text); font-family:"Inter",Arial,sans-serif; font-size:13.5px; line-height:1.75; text-align:left; }
.mg .mg-refs li::marker { color:var(--mg-muted); }
.mg .mg-refs a { color:var(--mg-ext); overflow-wrap:anywhere; text-decoration:none; }
.mg .mg-refs a:hover { text-decoration:underline; }

.mg .mg-about { display:flex; align-items:flex-start; gap:14px; margin-top:36px; padding:18px 0; border-top:1px solid var(--mg-line); border-bottom:1px solid var(--mg-line); }
.mg .mg-about img { flex:none; width:36px; height:auto; margin-top:6px; }
.mg .mg-about p { color:var(--mg-text); font-size:15px; line-height:2; }
.mg .mg-about b { color:var(--mg-ink); }
.mg .mg-about a { color:var(--mg-ext); font-weight:700; text-decoration:none; white-space:nowrap; }
.mg .mg-about a:hover { text-decoration:underline; }

.mg .mg-related { margin-top:64px; }
.mg .mg-tiles { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:32px; margin-top:20px; }
.mg .mg-story.is-tile { display:grid; align-content:start; gap:14px; }
.mg .mg-story.is-tile .mg-story-img { aspect-ratio:16/10; }
.mg .mg-story.is-tile .mg-story-title { font-size:17.5px; line-height:1.7; }

/* سربرگ: پیوند فعال */
.mg .tl-nav a[aria-current="page"] { color:var(--tl-blue); }
.mg .tl-nav a[aria-current="page"]::after { transform:scaleX(1); }

/* ---------- واکنش‌گرا ---------- */
@media (max-width:1024px) {
    .mg .mg-top { grid-template-columns:1fr; }
    .mg .mg-top-side { margin-top:28px; padding:20px 0 0; border-top:1px solid var(--mg-line); border-right:0; }
    .mg .mg-story.is-side:first-child { padding-top:0; }
}
@media (max-width:700px) {
    .mg .mg-main { padding-bottom:48px; }
    .mg .mg-masthead { display:grid; gap:14px; padding-top:28px; }
    .mg .mg-masthead p { font-size:14px; }
    .mg .mg-sections { gap:4px 18px; }
    .mg .mg-sections a { font-size:14.5px; }
    .mg .mg-sections a[aria-current="page"] { text-underline-offset:8px; }
    .mg .mg-top { padding-top:20px; }
    .mg .mg-story.is-lead { gap:14px; }
    .mg .mg-story.is-lead .mg-story-title { font-size:22px; }
    .mg .mg-story.is-lead .mg-standfirst { font-size:15.5px; }
    .mg .mg-story.is-side { grid-template-columns:minmax(0,1fr) 96px; gap:14px; }
    .mg .mg-story.is-side .mg-story-title { font-size:15.5px; }
    .mg .mg-latest { margin-top:40px; }
    .mg .mg-story.is-row { grid-template-columns:minmax(0,1fr) 110px; grid-template-areas:"text img"; gap:14px; padding:18px 0; }
    .mg .mg-story.is-row .mg-story-text { grid-area:text; }
    .mg .mg-story.is-row .mg-story-img { grid-area:img; aspect-ratio:4/3; }
    .mg .mg-story.is-row .mg-story-title { font-size:16px; line-height:1.75; }
    .mg .mg-story.is-row .mg-standfirst { display:none; }
    .mg .mg-article-head { padding-top:28px; padding-bottom:20px; }
    .mg .mg-figure { padding:0!important; }
    .mg .mg-figure img { border-radius:0; }
    .mg .mg-figure figcaption { padding:0 16px; }
    .mg .mg-article-body { padding-top:24px; }
    .mg .mg-body { font-size:16.5px; line-height:2.05; }
    .mg .mg-body h2 { margin-top:36px; font-size:20px; }
    .mg .mg-related { margin-top:48px; }
    .mg .mg-tiles { grid-template-columns:1fr; gap:0; margin-top:4px; }
    .mg .mg-story.is-tile { grid-template-columns:minmax(0,1fr) 110px; grid-template-areas:"text img"; gap:14px; padding:16px 0; border-bottom:1px solid var(--mg-line); }
    .mg .mg-story.is-tile .mg-story-text { grid-area:text; }
    .mg .mg-story.is-tile .mg-story-img { grid-area:img; aspect-ratio:4/3; }
    .mg .mg-story.is-tile .mg-story-title { font-size:15.5px; }
}
@media (prefers-reduced-motion:reduce) { .mg .mg-progress { display:none; } }
