/*
 * Блоки «живых» статей внутри .nd-post-text: схемы, таблицы, графики, карточки.
 * Контент пишется готовым HTML (первая строка — <div>, см. portal_publication_markup_needed)
 * и проходит wp_kses_post: без <script>, <svg> и CSS-переменных в style.
 * Инлайн-style — только width/left в процентах у полос графика.
 * Каталог блоков и шаблон разметки — .agents/sections/articles.md.
 */

/* .nd-post-text ограничен 74ch под обычный текст — блокам нужна вся ширина колонки, абзацам оставляем 74ch. */
.nd-post-text:has(> .nd-art) { max-width: none; }
.nd-art > p, .nd-art > section > p { max-width: 74ch; }

.nd-art { display: grid; gap: 28px; max-width: 100%; }
.nd-art > * { margin: 0; min-width: 0; }
.nd-art > section { display: grid; gap: 14px; }
.nd-art > section > * { margin: 0; min-width: 0; }
.nd-art p { margin: 0 0 12px; }
.nd-art p:last-child { margin-bottom: 0; }
html body.nd .nd-post-text .nd-art h2 { margin: 8px 0 0; font: 500 22px/1.27 var(--nd-font); color: var(--nd-text); }
html body.nd .nd-post-text .nd-art h3 { margin: 0 0 8px; font: 500 17px/1.3 var(--nd-font); color: var(--nd-text); }

/* Подпись раздела над заголовком */
.nd-art-eyebrow { display: block; margin-bottom: 6px; font-size: 12px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--nd-accent); }

/* Лид */
html body.nd .nd-post-text .nd-art-lead { font-size: 17px; line-height: 1.55; color: var(--nd-text); }

/* Панель — фон-подложка под схему, таблицу, график */
.nd-art-panel { padding: 20px; border-radius: var(--nd-radius-card); background: var(--nd-neutral); }
.nd-art-cap { margin-top: 10px; font-size: 13px; line-height: 1.45; color: var(--nd-text-3); }

/* Сетки */
.nd-art-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.nd-art-grid > * { min-width: 0; }

/* Большое число / формула */
.nd-art-big { display: block; margin: 4px 0 10px; font-size: 30px; font-weight: 500; line-height: 1.1; color: var(--nd-accent); font-variant-numeric: tabular-nums; }
.nd-art-big--dark { color: var(--nd-dark); }

/* Кариотип: ряд хромосом. Каждая .nd-art-chr — одна копия. */
.nd-art-chroms { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; align-items: end; height: 48px; }
.nd-art-chroms > span { display: flex; justify-content: center; align-items: flex-end; gap: 2px; height: 100%; }
.nd-art-chroms i { display: block; width: 4px; border-radius: 2px; background: var(--nd-accent); }
.nd-art-chroms--dark i { background: var(--nd-dark); }
.nd-art-chroms > span:nth-child(1) i { height: 100%; }
.nd-art-chroms > span:nth-child(2) i { height: 92%; }
.nd-art-chroms > span:nth-child(3) i { height: 86%; }
.nd-art-chroms > span:nth-child(4) i { height: 81%; }
.nd-art-chroms > span:nth-child(5) i { height: 77%; }
.nd-art-chroms > span:nth-child(6) i { height: 73%; }
.nd-art-chroms > span:nth-child(7) i { height: 70%; }
.nd-art-chroms > span:nth-child(8) i { height: 66%; }
.nd-art-chroms > span:nth-child(9) i { height: 63%; }
.nd-art-chroms > span:nth-child(10) i { height: 60%; }
.nd-art-chroms > span:nth-child(11) i { height: 56%; }
.nd-art-chroms > span:nth-child(12) i { height: 52%; }

/* Точки-счётчики (копии гена, баллы) */
.nd-art-dots { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; font-size: 13px; color: var(--nd-text-2); }
.nd-art-dots b { display: inline-block; width: 14px; height: 14px; border-radius: 50%; background: var(--nd-line-2); }
.nd-art-dots b.on { background: var(--nd-accent); }

/* Шаги процесса */
.nd-art-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; counter-reset: nd-art-step; list-style: none; padding: 0; }
.nd-art-steps li { position: relative; padding: 14px 14px 14px 14px; border-radius: var(--nd-radius-card); background: var(--nd-surface); border: 1px solid var(--nd-line-2); counter-increment: nd-art-step; font-weight: 500; color: var(--nd-text); }
.nd-art-steps li::before { content: "Шаг " counter(nd-art-step); display: block; margin-bottom: 4px; font-size: 12px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--nd-accent); }
.nd-art-steps small { display: block; margin-top: 4px; font-size: 13px; font-weight: 400; line-height: 1.4; color: var(--nd-text-2); }

/* Таблица */
.nd-art-table { overflow-x: auto; border-radius: var(--nd-radius-card); border: 1px solid var(--nd-line-2); background: var(--nd-surface); }
.nd-art-table table { width: 100%; min-width: 560px; border-collapse: collapse; font-size: 14px; line-height: 1.45; }
.nd-art-table th, .nd-art-table td { padding: 11px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--nd-line); }
.nd-art-table tr:last-child td { border-bottom: 0; }
.nd-art-table th { background: var(--nd-neutral); font-size: 12px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; color: var(--nd-text-2); }
.nd-art-table td:first-child { font-weight: 500; color: var(--nd-text); }

/* Метки */
.nd-art-tag { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: var(--nd-radius-pill); font-size: 12px; font-weight: 500; text-transform: none; letter-spacing: 0; background: var(--nd-accent-soft); color: var(--nd-accent); }
.nd-art-tag--dark { background: var(--nd-dark); color: #fff; }

/* Карточка (сорт, препарат, объект) */
.nd-art-card { padding: 18px; border-radius: var(--nd-radius-card); background: var(--nd-surface); border: 1px solid var(--nd-line-2); }
.nd-art-card dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 12px 0 0; font-size: 14px; line-height: 1.4; }
.nd-art-card dt { color: var(--nd-text-3); }
.nd-art-card dd { margin: 0; color: var(--nd-text); }
@media (max-width: 420px) { .nd-art-card dl { grid-template-columns: 1fr; gap: 0; } .nd-art-card dd { margin-bottom: 8px; } }

/* Горизонтальные полосы. Шкала — в процентах от максимума оси. */
.nd-art-bars { display: grid; gap: 12px; }
.nd-art-bar { display: grid; grid-template-columns: 140px 1fr; gap: 12px; align-items: center; font-size: 13px; color: var(--nd-text-2); }
.nd-art-bar__track { position: relative; height: 26px; border-radius: 6px; background: var(--nd-surface); }
.nd-art-bar__fill { position: absolute; top: 0; bottom: 0; display: flex; align-items: center; justify-content: flex-end; padding-right: 8px; border-radius: 6px; background: var(--nd-accent); color: #fff; font-size: 12px; font-weight: 500; white-space: nowrap; font-variant-numeric: tabular-nums; }
.nd-art-bar__fill--dark { background: var(--nd-dark); }
.nd-art-bar__fill--soft { background: var(--nd-accent-soft); color: var(--nd-accent); }
.nd-art-axis { display: grid; grid-template-columns: 140px 1fr; gap: 12px; margin-top: 6px; font-size: 12px; color: var(--nd-text-3); font-variant-numeric: tabular-nums; }
.nd-art-axis > span:last-child { display: flex; justify-content: space-between; }
@media (max-width: 520px) { .nd-art-bar, .nd-art-axis { grid-template-columns: 1fr; gap: 4px; } .nd-art-axis > span:first-child { display: none; } }

/* Чек-лист */
.nd-art-check { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.nd-art-check li { position: relative; padding-left: 26px; }
.nd-art-check li::before { content: ""; position: absolute; left: 0; top: 4px; width: 16px; height: 16px; border-radius: 50%; background: var(--nd-accent-soft); }
.nd-art-check li::after { content: ""; position: absolute; left: 5px; top: 8px; width: 6px; height: 4px; border-left: 2px solid var(--nd-accent); border-bottom: 2px solid var(--nd-accent); transform: rotate(-45deg); }

/* Чипы-список */
.nd-art-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.nd-art-chips > * { display: inline-flex; align-items: center; height: 32px; padding: 0 14px; border-radius: var(--nd-radius-pill); border: 1px solid var(--nd-btn-line); background: var(--nd-surface); font-size: 14px; color: var(--nd-text); }
html body.nd .nd-post-text .nd-art-chips a { color: var(--nd-accent); text-decoration: none; }
html body.nd .nd-post-text .nd-art-chips a:hover { border-color: var(--nd-accent); background: var(--nd-accent-soft); }
html body.nd .nd-post-text .nd-art-card h3 a { color: var(--nd-text); text-decoration: none; }
html body.nd .nd-post-text .nd-art-card h3 a:hover { color: var(--nd-accent); }

/* Сравнение «А против Б» */
.nd-art-vs { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; align-items: center; }
.nd-art-vs__mid { font-size: 14px; font-weight: 500; color: var(--nd-text-3); }
@media (max-width: 560px) { .nd-art-vs { grid-template-columns: 1fr; } }

/* Врезка-примечание */
.nd-art-note { padding: 14px 16px; border-radius: var(--nd-radius-card); background: var(--nd-rating-bg); color: #5C4A12; font-size: 14px; line-height: 1.5; }

/* Итог */
.nd-art-final { padding: 22px; border-radius: var(--nd-radius-card); background: var(--nd-dark); color: var(--nd-text-on-dark); }
html body.nd .nd-post-text .nd-art-final h2 { margin-top: 0; color: #fff; }
.nd-art-final p { color: var(--nd-text-on-dark-2); }

/* Переход по якорю (ссылки групп резистентности из карточек препаратов): отступ под sticky-шапку и подсветка цели. */
.nd-art [id] { scroll-margin-top: calc(var(--nd-header-h) + 24px); }
.nd-art :target { animation: nd-art-target 2.4s ease-out; }
.nd-art tr:target > td, .nd-art tr:target > th { background: var(--nd-accent-soft); box-shadow: inset 0 0 0 0 transparent; }
.nd-art tr:target > :first-child { box-shadow: inset 3px 0 0 var(--nd-accent); }
.nd-art h2:target { background: var(--nd-accent-soft); border-radius: 8px; box-shadow: -8px 0 0 var(--nd-accent-soft), 8px 0 0 var(--nd-accent-soft); }
@keyframes nd-art-target { 0% { outline: 2px solid var(--nd-accent); outline-offset: 2px; } 100% { outline: 2px solid transparent; outline-offset: 2px; } }
@media (prefers-reduced-motion: reduce) { .nd-art :target { animation: none; } }
/* ---------- Карточка исследования: проблема → вводные → графики → вывод ----------
 * Единый узнаваемый вид для всех статей. Разметка — .agents/sections/articles.md, «nd-art-study». */
.nd-art-study { display: grid; gap: 12px; padding: 16px; border-radius: var(--nd-radius-card); background: var(--nd-surface); border: 1px solid var(--nd-line-2); border-top: 4px solid var(--nd-accent); color: var(--nd-text); }
.nd-art-study > * { margin: 0; min-width: 0; }
.nd-art-study-head { display: grid; gap: 4px; }
.nd-art-study-tag { justify-self: start; padding: 4px 10px; border-radius: var(--nd-radius-pill); background: var(--nd-accent-soft); color: var(--nd-accent); font: 500 12px/1.2 var(--nd-font); letter-spacing: .04em; }
.nd-art-study--ru { border-top-color: var(--nd-danger); }
.nd-art-study--ru .nd-art-study-tag { background: color-mix(in srgb, var(--nd-danger) 12%, var(--nd-surface)); color: var(--nd-danger); }
html body.nd .nd-post-text .nd-art .nd-art-study h3 { margin: 0; font: 500 17px/1.3 var(--nd-font); color: var(--nd-text); }
.nd-art-study-src { font-size: 13px; line-height: 1.4; color: var(--nd-text-3); }
.nd-art-study-src a { color: var(--nd-accent); }
.nd-art-study-goal { padding-left: 12px; border-left: 3px solid var(--nd-line-2); }
.nd-art-study-goal b, .nd-art-study-out b { display: block; margin-bottom: 2px; font: 500 11px/1.2 var(--nd-font); letter-spacing: .08em; text-transform: uppercase; color: var(--nd-text-3); }
html body.nd .nd-post-text .nd-art .nd-art-study p { margin: 0; font-size: 15px; line-height: 1.5; color: var(--nd-text); }
.nd-art-study-in { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 6px; margin: 0; }
.nd-art-study-in > div { padding: 8px 10px; border-radius: 8px; background: var(--nd-neutral); }
.nd-art-study-in dt { font-size: 11px; line-height: 1.2; color: var(--nd-text-3); }
.nd-art-study-in dd { margin: 2px 0 0; font-size: 14px; font-weight: 500; line-height: 1.3; color: var(--nd-text); }
.nd-art-study-figs { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 10px; }
.nd-art-study-figs > * { min-width: 0; }
.nd-art-study-out { padding: 12px 14px; border-radius: 10px; background: var(--nd-accent-soft); border-left: 4px solid var(--nd-accent); }
.nd-art-study-out b { color: var(--nd-accent); }
html body.nd .nd-post-text .nd-art .nd-art-study-out p { font-size: 16px; font-weight: 500; }
.nd-art-study-out ul { margin: 6px 0 0; padding-left: 18px; font-size: 15px; line-height: 1.45; }
.nd-art-studies { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 10px; }