/* ─────────────────────────────────────────────────────────────────────────
   Оформление инфо-статей (/stati/). Самодостаточно: переменные темы
   подхватываются, если есть, иначе работают фолбэки — у тем 002–015
   именование другое, а выглядеть статьи должны везде одинаково.
   ───────────────────────────────────────────────────────────────────────── */
.article-body {
    --art-accent: var(--primary, #2f6fb5);
    --art-accent-soft: var(--primary-dark, #24578f);
    --art-ok: var(--accent, #2dc475);
    --art-warn: #e8873a;
    --art-danger: #d9534f;
    --art-border: var(--border, #e3e8f0);
    --art-card: var(--bg-card, #ffffff);
    --art-subtle: var(--bg-subtle, #f7f9fc);
    --art-muted: var(--text-muted, #5d6b7a);
    --art-radius: var(--radius, 10px);

    font-size: 17px;
    line-height: 1.75;
    color: #1f2933;
    max-width: 100%;
}

/* Заголовок статьи. Свой класс, а не ui.cls.h1: тот у тем рассчитан на hero-блок
   с картинкой (в theme_001 это 52px), а у статьи обложки нет. */
.article-title {
    font-size: 2.15em;
    line-height: 1.2;
    font-weight: 800;
    letter-spacing: -.02em;
    margin: 0 0 .55em;
    color: #16202b;
}
.article-date {
    display: block;
    margin: -.2em 0 1.6em;
    font-size: .85em;
    color: var(--art-muted);
}

/* ─── Хаб /stati/: карточки статей ──────────────────────────────────────── */
.article-list__lead { margin: -.3em 0 1.8em; color: #5d6b7a; font-size: 1.05em; }
.article-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 18px;
    margin-bottom: 40px;
}
.article-card {
    display: flex;
    flex-direction: column;
    padding: 22px 24px;
    background: var(--bg-card, #fff);
    border: 1px solid var(--border, #e3e8f0);
    border-radius: var(--radius, 10px);
    text-decoration: none !important;
    color: inherit;
    transition: border-color .15s, box-shadow .15s, transform .15s;
}
.article-card:hover {
    border-color: var(--primary, #2f6fb5);
    box-shadow: 0 8px 22px rgba(0, 0, 0, .06);
    transform: translateY(-2px);
}
.article-card__title {
    font-weight: 700;
    font-size: 1.1em;
    line-height: 1.35;
    margin-bottom: .5em;
    color: #16202b;
}
.article-card__desc {
    flex: 1;
    margin: 0 0 1em;
    font-size: .92em;
    line-height: 1.55;
    color: #5d6b7a;
}
.article-card__more {
    align-self: flex-start;
    font-size: .88em;
    font-weight: 700;
    color: var(--primary, #2f6fb5);
}
.article-card:hover .article-card__more { text-decoration: underline; }

.article-all-link {
    display: inline-block;
    padding: 11px 26px;
    border: 1px solid var(--primary, #2f6fb5);
    border-radius: var(--radius, 10px);
    color: var(--primary, #2f6fb5);
    font-weight: 700;
    text-decoration: none;
}
.article-all-link:hover { background: var(--primary, #2f6fb5); color: #fff; }

.article-body > * + * { margin-top: 1.15em; }
.article-body h2 { font-size: 1.55em; line-height: 1.25; margin: 1.9em 0 .6em; }
.article-body h3 { font-size: 1.22em; line-height: 1.3; margin: 1.5em 0 .5em; }
.article-body a { color: var(--art-accent); text-decoration: underline; text-underline-offset: 2px; }
.article-body a:hover { color: var(--art-accent-soft); }
.article-body ul, .article-body ol { padding-left: 1.4em; }
.article-body li + li { margin-top: .45em; }
.article-body img { max-width: 100%; height: auto; border-radius: var(--art-radius); }

/* ─── Врезка эксперта ───────────────────────────────────────────────────── */
.expert-box {
    margin: 2.4em 0;
    background: var(--art-card);
    border: 1px solid var(--art-border);
    border-radius: var(--art-radius);
    overflow: hidden;
}
.expert-box__header {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 20px 22px;
    background: var(--art-subtle);
    border-bottom: 1px solid var(--art-border);
}
.expert-box__avatar {
    flex: 0 0 68px;
    width: 68px; height: 68px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--art-border);
}
.expert-box__avatar img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 0; }
.expert-box__label {
    display: inline-block;
    font-size: .72em; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
    color: var(--art-accent);
    margin-bottom: 3px;
}
.expert-box__name { font-weight: 700; font-size: 1.02em; }
.expert-box__role { font-size: .88em; color: var(--art-muted); }
.expert-box__body { padding: 20px 22px; font-style: italic; }
.expert-box__body > *:first-child { margin-top: 0; }

/* ─── Цитата / CTA ──────────────────────────────────────────────────────── */
.post-quote {
    margin: 2.2em 0;
    padding: 20px 24px 20px 26px;
    border-left: 4px solid var(--art-accent);
    background: var(--art-subtle);
    border-radius: 0 var(--art-radius) var(--art-radius) 0;
    font-size: 1.05em;
}
.post-quote > *:first-child { margin-top: 0; }
.post-quote > *:last-child { margin-bottom: 0; }

/* ─── Блоки внимания ────────────────────────────────────────────────────── */
.callout {
    position: relative;
    margin: 2em 0;
    padding: 18px 22px 18px 56px;
    border: 1px solid var(--art-border);
    border-left: 4px solid var(--art-accent);
    border-radius: var(--art-radius);
    background: var(--art-card);
}
.callout::before {
    position: absolute;
    left: 20px; top: 17px;
    font-size: 1.25em; line-height: 1;
    content: "i";
    font-weight: 700;
    color: var(--art-accent);
}
.callout__title { font-weight: 700; margin-bottom: .3em; }
.callout > *:last-child { margin-bottom: 0; }

.callout--tip { border-left-color: var(--art-ok); background: rgba(45, 196, 117, .06); }
.callout--tip::before { content: "\2713"; color: var(--art-ok); }

.callout--warning { border-left-color: var(--art-warn); background: rgba(232, 135, 58, .07); }
.callout--warning::before { content: "!"; color: var(--art-warn); }

.callout--danger { border-left-color: var(--art-danger); background: rgba(217, 83, 79, .07); }
.callout--danger::before { content: "\26A0"; color: var(--art-danger); }

/* ─── Таблицы: скроллятся, а на телефоне разбираются в карточки ─────────── */
.post-table-wrap { margin: 2em 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.post-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .95em;
    background: var(--art-card);
}
.post-table th, .post-table td {
    padding: 11px 14px;
    border: 1px solid var(--art-border);
    text-align: left;
    vertical-align: top;
}
.post-table th { background: var(--art-subtle); font-weight: 700; white-space: nowrap; }
.post-table tbody tr:nth-child(even) td { background: rgba(0, 0, 0, .015); }

/* Голая таблица без обёртки всё равно не должна ломать страницу */
.article-body > .post-table { display: block; overflow-x: auto; }

@media (max-width: 640px) {
    /* data-label проставляет движок при рендере — авторам про это думать не нужно */
    .post-table.is-stacked thead { display: none; }
    .post-table.is-stacked, .post-table.is-stacked tbody,
    .post-table.is-stacked tr, .post-table.is-stacked td { display: block; width: 100%; }
    .post-table.is-stacked tr {
        margin-bottom: 14px;
        border: 1px solid var(--art-border);
        border-radius: var(--art-radius);
        overflow: hidden;
    }
    .post-table.is-stacked td { border: 0; border-bottom: 1px solid var(--art-border); padding: 10px 14px; }
    .post-table.is-stacked td:last-child { border-bottom: 0; }
    .post-table.is-stacked td::before {
        content: attr(data-label);
        display: block;
        font-size: .78em; font-weight: 700; text-transform: uppercase;
        letter-spacing: .03em; color: var(--art-muted);
        margin-bottom: 3px;
    }
}

/* ─── FAQ ───────────────────────────────────────────────────────────────── */
.faq-box { margin: 1em 0; border: 1px solid var(--art-border); border-radius: var(--art-radius); background: var(--art-card); }
.faq-box + .faq-box { margin-top: .7em; }
.faq-box__q { padding: 15px 20px; font-weight: 700; }
.faq-box__a { padding: 0 20px 16px; color: var(--art-muted); }
.faq-box__a > *:first-child { margin-top: 0; }

/* ─── Оглавление «В этой статье» ────────────────────────────────────────── */
.article-toc {
    margin: 2em 0;
    padding: 18px 22px;
    background: var(--art-subtle);
    border: 1px solid var(--art-border);
    border-radius: var(--art-radius);
}
.article-toc__title { font-weight: 700; margin-bottom: .5em; }
.article-toc ul { margin: 0; padding-left: 1.2em; }
.article-toc li + li { margin-top: .35em; }
.article-toc a { color: inherit; text-decoration: none; border-bottom: 1px dotted var(--art-accent); }
.article-toc a:hover { color: var(--art-accent); border-bottom-style: solid; }

/* Якорь не должен уезжать под шапку, и переход — плавный */
.article-body h2[id] { scroll-margin-top: 90px; }
@media (prefers-reduced-motion: no-preference) {
    html:has(.article-body) { scroll-behavior: smooth; }
}

/* ─── Промо-блок внутри статьи (подставляется движком по <!--promo:*-->) ── */
.article-promo { margin: 2.4em 0; }
.article-promo__lead { font-weight: 700; margin-bottom: .7em; }

@media (max-width: 640px) {
    .article-body { font-size: 16px; }
    .expert-box__header { flex-direction: column; align-items: flex-start; gap: 12px; }
    .callout { padding: 16px 18px 16px 50px; }
}
