/* ===========================================================================
   صفحهٔ اولِ مجله — `_shared/content/magazine_home.html`. docs/42 §۵.

   مشترکِ هر چهار قالب؛ رنگ از نشانه‌های خودِ قالب (`--theme-color` یا
   `--theme-accent`) با پیش‌فرض. فاصله‌ها روی پلهٔ ۴ پیکسلی‌اند. هیچ نوارِ
   سفیدِ بی‌کار ندارد: سرِ مجله یک نوارِ رنگیِ ملایم است با جست‌وجو و بخش‌ها،
   و ستون‌های کنارِ هم هم‌قد کشیده می‌شوند.
   =========================================================================== */

.mh {
    --mh-brand: var(--theme-color, var(--theme-accent, #0da487));
    --mh-brand-soft: color-mix(in srgb, var(--mh-brand) 10%, #fff);
    --mh-brand-ink: color-mix(in srgb, var(--mh-brand) 62%, #0b1220);
    --mh-brand-strong: color-mix(in srgb, var(--mh-brand) 78%, #0b1220);
    --mh-ink: #0f172a;
    --mh-text: #334155;
    --mh-muted: #64748b;
    --mh-line: #e2e8f0;
    --mh-canvas: #f8fafc;
    --mh-r: 16px;
    --mh-r-sm: 12px;
    --mh-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 10px 28px -18px rgba(15, 23, 42, .28);
    color: var(--mh-text);
    padding-bottom: 56px;
}
.mh svg { width: 1em; height: 1em; fill: currentColor; flex: none; }
.mh__sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.mh-sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* هم‌پهنای ظرفِ صفحه‌های دیگرِ فروشگاه (۱۲۲۰ پیکسل در فست‌کارت) */
.mh-wrap { width: min(100% - 32px, var(--mh-max, 1220px)); margin-inline: auto; }

/* ── سرِ مجله ─────────────────────────────────────────────────────── */
.mh-hero {
    margin-bottom: 32px; padding: 36px 0 28px;
    background:
        radial-gradient(900px 260px at 85% -40%, color-mix(in srgb, var(--mh-brand) 22%, transparent), transparent 70%),
        linear-gradient(180deg, var(--mh-brand-soft), #fff);
    border-bottom: 1px solid var(--mh-line);
}
.mh-hero__inner { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 420px); gap: 16px 32px; align-items: end; }
.mh-hero__kicker {
    display: inline-flex; align-items: center; gap: 6px; margin: 0 0 8px; padding: 4px 12px; border-radius: 999px;
    background: #fff; color: var(--mh-brand-ink); font-size: 13px; font-weight: 700; box-shadow: 0 1px 2px rgba(15, 23, 42, .06);
}
.mh-hero__title { margin: 0; color: var(--mh-ink); font-size: clamp(1.75rem, 1.2rem + 1.8vw, 2.6rem); font-weight: 800; line-height: 1.35; }
.mh-hero__intro { margin: 8px 0 0; max-width: 62ch; color: var(--mh-muted); font-size: 15px; line-height: 1.9; }
.mh-search {
    display: flex; gap: 6px; padding: 6px; border: 1px solid var(--mh-line); border-radius: 14px; background: #fff; box-shadow: var(--mh-shadow);
}
.mh-search:focus-within { border-color: var(--mh-brand); box-shadow: 0 0 0 4px var(--mh-brand-soft); }
.mh-search input { flex: 1; min-width: 0; min-height: 44px; padding: 0 12px; border: 0; background: transparent; color: var(--mh-ink); font: inherit; outline: none; }
.mh-search button {
    display: grid; place-items: center; flex: none; width: 44px; height: 44px; border: 0; border-radius: 10px;
    background: var(--mh-brand-strong); color: #fff; font-size: 18px; cursor: pointer;
}
.mh-rail { grid-column: 1 / -1; display: flex; gap: 8px; padding-bottom: 4px; overflow-x: auto; scrollbar-width: thin; }
.mh-pill {
    flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 14px; border: 1px solid var(--mh-line);
    border-radius: 999px; background: #fff; color: var(--mh-text); font-size: 13.5px; font-weight: 600; text-decoration: none;
    transition: border-color .15s ease, color .15s ease, background-color .15s ease;
}
.mh-pill span { min-width: 22px; padding: 0 6px; border-radius: 999px; background: var(--mh-canvas); color: var(--mh-muted); font-size: 11.5px; text-align: center; }
.mh-pill:hover, .mh-pill:focus-visible { border-color: var(--mh-brand); color: var(--mh-brand-ink); }
.mh-pill--type { border-color: transparent; background: var(--mh-brand-strong); color: #fff; }
.mh-pill--type:hover, .mh-pill--type:focus-visible { background: var(--mh-brand-ink); color: #fff; }

/* ── برچسب، فرا‌داده، پیوندِ کشیده ─────────────────────────────────── */
.mh-chip {
    align-self: flex-start; display: inline-flex; align-items: center; min-height: 24px; padding: 0 10px; border-radius: 999px;
    background: var(--mh-brand-soft); color: var(--mh-brand-ink); font-size: 12px; font-weight: 700;
}
.mh-chip--solid { background: var(--mh-brand-strong); color: #fff; }
.mh-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin: 0; color: var(--mh-muted); font-size: 12.5px; }
.mh-meta > * + *::before { content: "•"; margin-inline-end: 12px; color: #cbd5e1; }
.mh-meta b { color: var(--mh-ink); font-weight: 600; }
.mh-stretch { color: var(--mh-ink); text-decoration: none; }
.mh-stretch::after { content: ""; position: absolute; inset: 0; }
.mh-stretch:hover { color: var(--mh-brand-ink); }
.mh-play {
    position: absolute; inset: 0; margin: auto; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%;
    background: rgba(15, 23, 42, .66); color: #fff; font-size: 22px;
}

/* ── تیترِ اصلی ───────────────────────────────────────────────────── */
.mh-body { display: grid; gap: 40px; }
.mh-front { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 24px; align-items: stretch; }
.mh-lead {
    position: relative; display: grid; grid-template-rows: auto 1fr; overflow: hidden;
    border: 1px solid var(--mh-line); border-radius: var(--mh-r); background: #fff; box-shadow: var(--mh-shadow);
}
.mh-lead__media { position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden; background: var(--mh-canvas); }
.mh-lead__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.mh-lead:hover .mh-lead__media img { transform: scale(1.03); }
.mh-lead__body { display: flex; flex-direction: column; gap: 10px; padding: 20px 24px 24px; }
.mh-lead__title { margin: 0; font-size: clamp(1.25rem, 1rem + .9vw, 1.8rem); font-weight: 800; line-height: 1.5; }
.mh-lead__excerpt { margin: 0; color: var(--mh-muted); font-size: 15px; line-height: 1.9; }
.mh-lead .mh-meta { margin-top: auto; }
/* چهار تیترِ کنار هم‌قدِ تیترِ اصلی کشیده می‌شوند — نه سه کارتِ کوتاه و یک جای خالی */
.mh-headlines { display: grid; grid-auto-rows: 1fr; gap: 12px; margin: 0; padding: 0; list-style: none; }
.mh-row {
    position: relative; display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 14px; align-items: center;
    padding: 12px; border: 1px solid var(--mh-line); border-radius: var(--mh-r-sm); background: #fff;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.mh-row:hover { border-color: color-mix(in srgb, var(--mh-brand) 35%, #fff); box-shadow: var(--mh-shadow); }
.mh-row__media { display: block; height: 100%; min-height: 84px; overflow: hidden; border-radius: 10px; background: var(--mh-canvas); }
.mh-row__media img { width: 100%; height: 100%; object-fit: cover; }
.mh-row__body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.mh-row__title {
    margin: 0; font-size: 14.5px; font-weight: 700; line-height: 1.75;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* ── بخش‌ها ────────────────────────────────────────────────────────── */
.mh-section__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 16px; }
.mh-section__title {
    position: relative; display: inline-flex; align-items: center; gap: 8px; margin: 0; padding-bottom: 10px;
    color: var(--mh-ink); font-size: 1.2rem; font-weight: 800;
}
.mh-section__title::after { content: ""; position: absolute; inset-inline-start: 0; bottom: 0; width: 36px; height: 3px; border-radius: 3px; background: var(--mh-brand); }
.mh-section__title svg { color: var(--mh-brand-ink); }
.mh-more {
    display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: 10px;
    color: var(--mh-brand-ink); font-size: 13.5px; font-weight: 700; text-decoration: none;
}
.mh-more:hover, .mh-more:focus-visible { background: var(--mh-brand-soft); color: var(--mh-brand-ink); }
.mh-split { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; align-items: start; }
.mh-popular { position: sticky; top: 96px; padding: 20px; border: 1px solid var(--mh-line); border-radius: var(--mh-r); background: var(--mh-canvas); }
.mh-popular .mh-section__title { margin-bottom: 14px; }
.mh-ranked { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; counter-reset: mh-rank; }
.mh-ranked li { display: grid; grid-template-columns: 34px minmax(0, 1fr); column-gap: 10px; counter-increment: mh-rank; }
.mh-ranked li::before {
    content: counter(mh-rank, persian); grid-row: span 2; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
    background: #fff; color: var(--mh-brand-ink); font-weight: 800; box-shadow: 0 1px 2px rgba(15, 23, 42, .08);
}
.mh-ranked a { color: var(--mh-ink); font-size: 14px; font-weight: 700; line-height: 1.75; text-decoration: none; }
.mh-ranked a:hover { color: var(--mh-brand-ink); }
.mh-ranked span { color: var(--mh-muted); font-size: 12px; }

.mh-grid { display: grid; gap: 20px; }
/* «تازه‌ترین‌ها» ستونِ خالی نمی‌گذارد: با دو مطلب، دو کارتِ پهن */
.mh-grid--3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
.mh-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.mh-card {
    position: relative; display: flex; flex-direction: column; overflow: hidden;
    border: 1px solid var(--mh-line); border-radius: var(--mh-r); background: #fff;
    transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease;
}
.mh-card:hover { border-color: transparent; box-shadow: 0 14px 34px -18px rgba(15, 23, 42, .35); transform: translateY(-2px); }
.mh-card:focus-within { outline: 2px solid var(--mh-brand); outline-offset: 2px; }
.mh-card__media { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: var(--mh-canvas); }
.mh-card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.mh-card:hover .mh-card__media img { transform: scale(1.04); }
.mh-card__body { display: flex; flex: 1; flex-direction: column; gap: 8px; padding: 14px 16px 16px; }
.mh-card__title {
    margin: 0; font-size: 15px; font-weight: 800; line-height: 1.75;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.mh-card__excerpt {
    margin: 0; color: var(--mh-muted); font-size: 13px; line-height: 1.85;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.mh-card .mh-meta { margin-top: auto; padding-top: 4px; }

/* ویدیوها روی نوارِ تیره، تا بخشِ دیدنی از بخشِ خواندنی جدا باشد */
.mh-videos { padding: 28px; border-radius: 20px; background: #0f172a; }
.mh-videos .mh-section__title { color: #fff; }
.mh-videos .mh-section__title svg { color: var(--mh-brand); }
.mh-videos .mh-more { color: #e2e8f0; }
.mh-videos .mh-more:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.mh-videos .mh-card { border-color: rgba(255, 255, 255, .08); background: #172036; }
.mh-videos .mh-card__title a, .mh-videos .mh-stretch { color: #f1f5f9; }
.mh-videos .mh-card__excerpt, .mh-videos .mh-meta { color: #94a3b8; }
.mh-videos .mh-chip { background: rgba(255, 255, 255, .1); color: #e2e8f0; }

.mh-empty { display: grid; justify-items: center; gap: 8px; padding: 56px 16px; border: 1px dashed var(--mh-line); border-radius: var(--mh-r); text-align: center; }
.mh-empty__icon { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--mh-brand-soft); color: var(--mh-brand-ink); font-size: 28px; }
.mh-empty__title { margin: 4px 0 0; color: var(--mh-ink); font-size: 1.05rem; font-weight: 800; }
.mh-empty__text { margin: 0; color: var(--mh-muted); font-size: 14px; }
.mh-btn {
    display: inline-flex; align-items: center; min-height: 44px; margin-top: 8px; padding: 0 20px; border-radius: 12px;
    background: var(--mh-brand-strong); color: #fff; font-weight: 700; text-decoration: none;
}
.mh-btn:hover { filter: brightness(.94); color: #fff; }

/* ── عرض‌های کوچک‌تر ─────────────────────────────────────────────────── */
@media (max-width: 1199.98px) {
    .mh-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .mh-split { grid-template-columns: minmax(0, 1fr) 280px; }
}
@media (max-width: 991.98px) {
    .mh-hero__inner, .mh-front, .mh-split { grid-template-columns: minmax(0, 1fr); }
    .mh-headlines { grid-auto-rows: auto; }
    .mh-popular { position: static; }
}
@media (max-width: 575.98px) {
    .mh-hero { padding: 24px 0 20px; margin-bottom: 24px; }
    .mh-body { gap: 32px; }
    .mh-grid--4 { grid-template-columns: minmax(0, 1fr); }
    .mh-row { grid-template-columns: 96px minmax(0, 1fr); }
    .mh-lead__body { padding: 16px; }
    .mh-videos { padding: 20px 16px; border-radius: 16px; }
}
@media (prefers-reduced-motion: reduce) {
    .mh-card, .mh-card__media img, .mh-lead__media img, .mh-row { transition: none; }
    .mh-card:hover { transform: none; }
}
