/* ──────────────────────────────────────────────────────────────────
   Инфографика-фигуры в статье (нативный HTML, не картинки).
   Единая система: eyebrow-лейбл + primary numbered-chip + тонкие бордеры.
   4 типа: flow (процесс), facts (факторы), cmp (сравнение), check (чек-лист).
   Разметку генерит backend/services/article_figures.py (единый источник).
   ────────────────────────────────────────────────────────────────── */
.afig {
    background: #fff;
    border: 1px solid #E8EDF2;
    border-radius: 14px;
    padding: 26px 28px 24px;
    margin: 32px 0;
    box-shadow: 0 1px 3px rgba(5,10,50,.04);
}
.afig__eyebrow {
    display: flex; align-items: center; gap: 8px;
    font-size: 11.5px; font-weight: 700; letter-spacing: .09em;
    text-transform: uppercase; color: var(--primary-dark, #3A7CAA); margin-bottom: 4px;
}
.afig__eyebrow::before { content: ""; width: 14px; height: 2px; background: var(--primary, #4EA0D2); border-radius: 2px; }
.afig__title { font-size: 19px; font-weight: 700; line-height: 1.3; letter-spacing: -.01em; color: var(--text, #050A32); margin-bottom: 20px; }
.afig__cap { font-size: 13px; color: var(--text-muted, #6B7280); line-height: 1.5; margin-top: 16px; padding-top: 14px; border-top: 1px solid #E8EDF2; }
.afig-chip {
    flex: none; width: 30px; height: 30px; border-radius: 9px;
    background: var(--primary, #4EA0D2); color: #fff; font-weight: 700; font-size: 14px;
    display: flex; align-items: center; justify-content: center;
}

/* flow — схема-процесс */
.afig-flow { display: flex; align-items: stretch; gap: 0; }
.afig-flow__step { flex: 1; background: #F5F9FC; border: 1px solid #E8EDF2; border-radius: 11px; padding: 16px 14px 15px; display: flex; flex-direction: column; gap: 9px; }
.afig-flow__num { width: 26px; height: 26px; border-radius: 8px; background: var(--primary, #4EA0D2); color: #fff; font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.afig-flow__h { font-size: 15px; font-weight: 700; line-height: 1.25; color: var(--text, #050A32); }
.afig-flow__d { font-size: 12.5px; color: var(--text-muted, #6B7280); line-height: 1.45; }
.afig-flow__arrow { flex: none; align-self: center; width: 26px; display: flex; align-items: center; justify-content: center; color: var(--primary, #4EA0D2); font-size: 17px; font-weight: 700; }

/* facts — инфографика факторов */
.afig-facts { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.afig-fact { background: #F5F9FC; border: 1px solid #E8EDF2; border-radius: 11px; padding: 15px 15px 14px; display: flex; flex-direction: column; gap: 8px; }
.afig-fact--sum { background: #EAF4FB; border-color: #D6E9F6; }
.afig-fact__h { font-size: 14.5px; font-weight: 700; line-height: 1.25; color: var(--text, #050A32); }
.afig-fact--sum .afig-fact__h { color: var(--primary-dark, #3A7CAA); }
.afig-fact__d { font-size: 12.5px; color: var(--text-muted, #6B7280); line-height: 1.45; }

/* cmp — сравнение A/B */
.afig-cmp { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.afig-cmp__side { border: 1px solid #E8EDF2; border-radius: 11px; overflow: hidden; }
.afig-cmp__head { padding: 12px 16px; font-size: 15px; font-weight: 700; color: #fff; }
.afig-cmp__side--a .afig-cmp__head { background: var(--primary, #4EA0D2); }
.afig-cmp__side--b .afig-cmp__head { background: var(--primary-dark, #3A7CAA); }
.afig-cmp__body { padding: 14px 16px 15px; display: flex; flex-direction: column; gap: 10px; }
.afig-cmp__row { display: flex; gap: 9px; font-size: 13.5px; line-height: 1.45; color: #374151; }
.afig-cmp__mark { flex: none; font-weight: 700; width: 15px; }
.afig-cmp__mark--y { color: #15803D; }
.afig-cmp__mark--n { color: #B91C1C; }

/* check — чек-лист */
.afig-check { display: flex; flex-direction: column; }
.afig-check__item { display: flex; align-items: flex-start; gap: 13px; padding: 12px 0; border-bottom: 1px solid #E8EDF2; }
.afig-check__item:last-child { border-bottom: 0; }
.afig-check__box { flex: none; width: 22px; height: 22px; border-radius: 6px; background: #EAF4FB; border: 1.5px solid var(--primary, #4EA0D2); display: flex; align-items: center; justify-content: center; margin-top: 1px; }
.afig-check__box svg { width: 12px; height: 12px; stroke: var(--primary-dark, #3A7CAA); stroke-width: 3; fill: none; }
.afig-check__t { font-size: 15px; line-height: 1.5; color: var(--text, #050A32); }

@media (max-width: 640px) {
    .afig { padding: 20px 18px 18px; }
    .afig-flow { flex-direction: column; gap: 8px; }
    .afig-flow__arrow { transform: rotate(90deg); width: auto; height: 20px; }
    .afig-facts { grid-template-columns: 1fr 1fr; }
    .afig-cmp { grid-template-columns: 1fr; }
}

.afig--chart { --chart-columns: minmax(0, 1fr) minmax(0, 1.6fr) 6em; }
.afig--chart .afig__title { margin-bottom: 4px; }
.afig-chart__measure { margin: 0; font-size: 14px; color: var(--text-muted, #475467); }
.afig-chart, .post-content .afig-chart {
    display: grid; gap: 12px; padding: 0; margin: 18px 0 8px; list-style: none;
}
.post-content .afig-chart > .afig-chart__row { padding: 0; margin: 0; }
.post-content .afig-chart > .afig-chart__row::before { content: none; }
.afig-chart .afig-chart__row, .afig-chart__axis {
    display: grid; grid-template-columns: var(--chart-columns); align-items: center; gap: 10px;
}
.afig-chart__label { font-size: 14px; line-height: 1.35; overflow-wrap: anywhere; }
.afig-chart__track { height: 20px; border-radius: 5px; background: #edf4f9; overflow: hidden; }
.afig-chart__bar {
    display: block; height: 100%; border-radius: 5px; background: var(--primary, #2883b7);
}
.afig-chart__value, .afig-chart__axis { font-variant-numeric: tabular-nums; }
.afig-chart__value { text-align: right; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.afig-chart__axis { font-size: 11px; color: var(--text-muted, #475467); }
.afig-chart__axis div { grid-column: 2; display: flex; gap: 3px; justify-content: space-between; }
.afig--chart .afig__cap p { margin: 0 0 4px; }
.afig-chart__details { margin-top: 10px; }
.afig-chart__details summary { color: var(--primary-dark, #116c9a); cursor: pointer; font-weight: 600; }
.afig-chart__details table { margin-top: 10px; }
.afig-chart__details th:last-child, .afig-chart__details td:last-child { text-align: right; }

@media (max-width: 640px) {
    .afig--chart { --chart-columns: minmax(0, 1fr) 6em; }
    .afig-chart .afig-chart__row { gap: 4px 8px; }
    .afig-chart__label { grid-column: 1 / -1; }
    .afig-chart__track, .afig-chart__value { grid-row: 2; }
    .afig-chart__axis div { grid-column: 1; }
    .afig-chart__axis span:not(:first-child):not(:last-child) { display: none; }
}
