/* Статьи блога в двух стилях; стиль выбирается за каждой статьёй
 * (scripts/blog-articles.py, поле "style").
 *
 * .art-dark  — тёмный, одна колонка и большая обложка (референсы 1001, PolyAI);
 * .art-light — светлый редакционный, колонка автора и оглавления слева
 *              (референсы Baseten Beam, Cerebras).
 *
 * Общие компоненты (графики, таблица, код, проверка текста) берут цвета из
 * переменных --a-*, которые каждый стиль задаёт сам. Подключается после
 * rd.css: шапка, подвал, шрифты и кнопки — оттуда.
 */

/* ---------- Шапка без дрожания ----------
 * В rd.css шапка липкая, но стоит в потоке и при прокрутке больше 24 px
 * сжимается (отступ сверху и высота «пилюли»). Страница от этого
 * поднимается, браузер удерживает текст на месте и отматывает прокрутку
 * назад, шапка снова растёт — и так по кругу: панель дрожит у порога.
 * Здесь высота шапки постоянная, сжимается только «пилюля» внутри, а
 * прозрачная часть под ней пропускает щелчки к тексту. */
.art-dark .rd-header, .art-light .rd-header { height: calc(clamp(14px, calc(4.2vw / var(--z, 1)), 60px) + 89px); pointer-events: none; }
.art-dark .rd-nav, .art-light .rd-nav { pointer-events: auto; }
@media (max-width: 860px) {
  .art-dark .rd-header, .art-light .rd-header { height: calc(clamp(14px, calc(4.2vw / var(--z, 1)), 60px) + 68px); }
}

/* ---------- Переменные вариантов ---------- */
.art-dark {
  --a-ink: var(--ink);
  --a-text: rgba(232, 239, 255, .86);
  --a-muted: rgba(220, 230, 255, .58);
  --a-accent: var(--accent);
  --a-link: var(--accent-ink);
  --a-step: #07142e;
  --a-step-2: #0b1a38;
  --a-track: rgba(169, 198, 255, .08);
  --a-bar: rgba(169, 198, 255, .3);
  --a-line: rgba(220, 230, 255, .1);
  --a-code: #020a18;
  --a-field: #020a18;
  --a-field-line: rgba(220, 230, 255, .16);
}
.art-light {
  --a-ink: #0b1730;
  --a-text: #1f2b45;
  --a-muted: #5d6b86;
  --a-accent: #1f5fd6;
  --a-link: #1f5fd6;
  --a-step: #e7edf8;
  --a-step-2: #dde5f4;
  --a-track: #e3e9f4;
  --a-bar: #b7c6e4;
  --a-line: #d9e1ef;
  --a-code: #0b1730;
  --a-field: #fff;
  --a-field-line: #c5d1e6;
}

/* ---------- Общая типографика статьи ---------- */
.art { color: var(--a-text); }
.art h1, .art h2, .art h3 { color: var(--a-ink); font-weight: 400; }
.art a { color: var(--a-link); text-decoration-thickness: 1px; text-underline-offset: .2em; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); transition: text-decoration-color .2s var(--ease); }
.art a:hover { text-decoration-color: currentColor; }
.art-dark ::selection { background: rgba(77, 141, 255, .45); color: #fff; }
.art-light ::selection { background: #cddcfa; color: var(--a-ink); }
.art time, .ch-val, .tbl td, .side-date { font-family: var(--f-num); font-variant-numeric: tabular-nums; }

.art-body > p, .art-body > ul, .art-body > ol { font-size: 20px; line-height: 1.6; font-weight: 300; }
.art-body > p + p { margin-top: 20px; }
.art-body > ul, .art-body > ol { margin: 20px 0 0; padding-left: 24px; display: grid; gap: 12px; }
.art-body > ul + p, .art-body > ol + p { margin-top: 24px; }
.art-body li::marker { color: var(--a-accent); font-family: var(--f-num); }
.art-body h2 { font-size: clamp(28px, calc(2.5vw / var(--z, 1)), 36px); line-height: 1.15; letter-spacing: -.02em; margin: clamp(64px, calc(7vw / var(--z, 1)), 96px) 0 24px; scroll-margin-top: 140px; }
.art-body > h3 { margin: 40px 0 12px; font-size: 24px; line-height: 1.25; letter-spacing: -.01em; }
.art-body > h2 + h3 { margin-top: 8px; }

.art-ava { border-radius: 50%; object-fit: cover; object-position: center 18%; background: var(--a-step); flex: none; }
.art-by { display: flex; align-items: center; gap: 14px; }
.art-by .art-ava { width: 48px; height: 48px; }
.art-by b { display: block; font-weight: 400; font-size: 17px; color: var(--a-ink); }
.art-by span { display: block; font-size: 15px; color: var(--a-muted); }

/* ---------- Графики-столбики ---------- */
.ch { margin: 40px 0; }
.ch-title { font-size: 20px; color: var(--a-ink); font-weight: 400; margin-bottom: 24px; }
.ch-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.ch-row { display: grid; grid-template-columns: minmax(150px, 32%) minmax(0, 1fr) 96px; align-items: center; gap: 20px; min-height: 34px; }
.ch-name { font-size: 17px; line-height: 1.3; color: var(--a-muted); }
.ch-track { height: 14px; border-radius: 7px; background: var(--a-track); overflow: hidden; }
.ch-bar { display: block; height: 100%; width: calc(var(--v) * 100%); border-radius: 7px; background: var(--a-bar); transform-origin: left center; }
.ch-val { font-size: 17px; color: var(--a-muted); text-align: right; white-space: nowrap; }
.ch-row.is-hi .ch-name, .ch-row.is-hi .ch-val { color: var(--a-ink); }
.ch-row.is-hi .ch-bar { background: var(--a-accent); }
.ch-note { margin-top: 16px; font-size: 15px; color: var(--a-muted); }

/* ---------- Таблица с сортировкой ---------- */
.tbl-wrap { margin: 40px 0 32px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: thin; scrollbar-color: var(--a-bar) transparent; }
.tbl-wrap:focus-visible { outline: 2px solid var(--a-accent); outline-offset: 4px; }
.tbl { width: 100%; min-width: 720px; border-collapse: collapse; font-size: 17px; }
.tbl caption { caption-side: top; text-align: left; font-size: 20px; color: var(--a-ink); padding-bottom: 20px; }
.tbl th, .tbl td { padding: 14px 16px; text-align: right; border-bottom: 1px solid var(--a-line); white-space: nowrap; }
.tbl th:first-child { text-align: left; padding-left: 0; }
.tbl tbody th { font-weight: 300; color: var(--a-ink); }
.tbl td { color: var(--a-text); font-weight: 300; }
.tbl thead th { padding-top: 0; font-weight: 300; }
.tbl thead button { appearance: none; border: 0; background: none; padding: 6px 0; font: inherit; font-size: 15px; color: var(--a-muted); cursor: pointer; text-align: inherit; }
.tbl thead button:hover, .tbl thead [aria-sort] button { color: var(--a-ink); }
.tbl thead [aria-sort] button { text-decoration: underline; text-decoration-color: var(--a-accent); text-decoration-thickness: 2px; text-underline-offset: 6px; }
.tbl thead button:focus-visible { outline: 2px solid var(--a-accent); outline-offset: 2px; border-radius: 4px; }
.tbl tbody tr:nth-child(-n+2) th, .tbl tbody tr:nth-child(-n+2) td { color: var(--a-ink); }
.tbl-note { margin-top: -16px !important; font-size: 15px !important; color: var(--a-muted); }
/* Таблица сравнения: текст в ячейках переносится, лучшее значение выделено цветом. */
.tbl-cmp { min-width: 640px; }
.tbl-cmp th, .tbl-cmp td { white-space: normal; vertical-align: top; }
.tbl-wide td:last-child { text-align: left; color: var(--a-muted); font-size: 15px; line-height: 1.45; min-width: 220px; }
.tbl-cmp thead th { text-align: right; font-size: 15px; color: var(--a-muted); }
.tbl-cmp thead th:first-child, .tbl-wide thead th:last-child { text-align: left; }
.tbl-cmp td.is-best { color: var(--a-accent); font-weight: 400; }

/* ---------- Код ---------- */
.code { margin: 24px 0; border-radius: 20px; background: var(--a-code); overflow: hidden; }
.code-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 16px 0 28px; font-size: 15px; color: rgba(220, 230, 255, .5); }
.code-copy { appearance: none; border: 0; background: rgba(169, 198, 255, .1); padding: 8px 14px; font: inherit; color: #c9dbff; cursor: pointer; border-radius: 999px; transition: background-color .2s var(--ease), color .2s var(--ease); }
.code-copy:hover { background: rgba(169, 198, 255, .2); color: #fff; }
.code-copy:focus-visible { outline: 2px solid #a9c6ff; }
.code-copy.is-done { color: #9fe3b8; }
/* Длинная команда переносится, а не прячется за полосой прокрутки;
 * «Скопировать» берёт исходный текст без переносов. */
.code pre { margin: 0; padding: 14px 28px 26px; }
.code code { display: block; font-family: ui-monospace, "Cascadia Code", "Cascadia Mono", Consolas, "Liberation Mono", monospace; font-size: 15px; line-height: 1.7; color: #dbe6ff; white-space: pre-wrap; overflow-wrap: anywhere; tab-size: 2; }

/* ---------- Проверка текста ---------- */
.checker { margin: 40px 0; padding: clamp(24px, calc(3vw / var(--z, 1)), 36px); border-radius: 24px; background: var(--a-step); }
.checker[hidden] { display: none; }
.checker h3 { font-size: 24px; letter-spacing: -.01em; }
.checker > p { margin-top: 10px; font-size: 17px; line-height: 1.5; color: var(--a-muted); max-width: 620px; }
.ck-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.checker textarea { display: block; width: 100%; margin-top: 20px; min-height: 150px; padding: 16px 18px; border-radius: 16px; border: 1px solid var(--a-field-line); background: var(--a-field); color: var(--a-ink); font: 300 17px/1.5 var(--f-text); resize: vertical; }
.checker textarea:focus { outline: 2px solid var(--a-accent); outline-offset: 1px; border-color: transparent; }
.ck-out { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; margin-top: 16px; }
.ck-res { font-size: 17px; color: var(--a-text); }
.checker.has-marks .ck-res { color: var(--a-ink); font-weight: 400; }
.ck-btn { min-height: 52px; padding: 0 24px; border: 0; border-radius: 999px; background: var(--a-accent); color: #fff; font: 300 17px/1 var(--f-text); cursor: pointer; transition: background-color .2s var(--ease), transform .15s var(--ease), opacity .2s var(--ease); }
.ck-btn:hover:not(:disabled) { background: #3a7bff; }
.ck-btn:active:not(:disabled) { transform: scale(.97); }
.ck-btn:disabled { background: var(--a-step-2); color: var(--a-text); cursor: default; }
.ck-btn:focus-visible { outline: 2px solid var(--a-ink); outline-offset: 3px; }

/* ---------- Определения, шаги, вердикт, предупреждение ---------- */
.terms { margin: 24px 0 0; display: grid; gap: 28px; }
.terms dt { font-size: 20px; color: var(--a-ink); }
.terms dd { margin: 8px 0 0; font-size: 20px; line-height: 1.6; font-weight: 300; }
.verdict { margin: 8px 0 0; display: grid; gap: 40px; }
.verdict > div { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 40px; }
.verdict dt { font-size: 24px; line-height: 1.2; letter-spacing: -.01em; color: var(--a-ink); }
.verdict dd { margin: 0; font-size: 20px; line-height: 1.6; font-weight: 300; }
.warn { padding: 20px 24px; border-radius: 18px; background: var(--a-step); }
.shot { margin: 8px 0 32px; }
.shot img { display: block; width: 100%; height: auto; border-radius: 16px; background: var(--a-step); }
.shot figcaption { margin-top: 12px; font-size: 15px; color: var(--a-muted); }
.a-more { margin-top: 56px !important; }
.a-more a { font-size: 20px; }

/* ---------- Автор и «Ещё в блоге» ---------- */
.art-author { display: flex; align-items: center; gap: 24px; margin-top: 96px; }
.art-author .art-ava { width: 88px; height: 88px; }
.art-author b { display: block; font-size: 24px; font-weight: 400; color: var(--a-ink); }
.art-author span { display: block; margin-top: 2px; font-size: 17px; color: var(--a-muted); }
.art-author a { display: inline-block; margin-top: 8px; font-size: 17px; }
.art-next { margin-top: clamp(96px, calc(10vw / var(--z, 1)), 160px); }
.art-next h2 { font-size: clamp(28px, calc(2.5vw / var(--z, 1)), 36px); letter-spacing: -.02em; }
.art-next ul { list-style: none; margin: 32px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 40px; }
.art-next a { display: grid; align-content: start; gap: 12px; text-decoration: none; }
.art-next .bl-cover { margin-bottom: 8px; border-radius: 14px; }
.art-next .bl-img { transition: transform .6s var(--ease-out); }
.art-next a:hover .bl-img, .art-next a:focus-visible .bl-img { transform: scale(1.03); }
.art-next time { font-size: 15px; color: var(--a-muted); }
.next-title { font-size: 24px; line-height: 1.3; letter-spacing: -.01em; color: var(--a-ink); transition: color .2s var(--ease); }
.art-next a:hover .next-title, .art-next a:focus-visible .next-title { color: var(--a-link); }

/* ---------- Появление при прокрутке ---------- */
.rv-on [data-rv] { opacity: 0; translate: 0 24px; transition: opacity .7s var(--ease-out), translate .7s var(--ease-out); }
.rv-on [data-rv].is-in { opacity: 1; translate: 0 0; }
.rv-on .ch .ch-bar { transform: scaleX(0); transition: transform 1s var(--ease-out) calc(var(--i, 0) * 70ms); }
.rv-on .ch.is-in .ch-bar { transform: none; }
.rv-on .ch .ch-val { opacity: 0; transition: opacity .5s var(--ease) calc(var(--i, 0) * 70ms + .4s); }
.rv-on .ch.is-in .ch-val { opacity: 1; }

/* =========================================================== Вариант 1 */
.art-dark .art-head { padding-top: clamp(48px, calc(6vw / var(--z, 1)), 88px); }
.art-dark .art-back { display: inline-block; font-size: 18px; color: var(--a-muted); text-decoration: none; }
.art-dark .art-back:hover { color: var(--a-ink); }
.art-dark .art-head h1 { margin-top: 28px; max-width: 1120px; font-size: clamp(34px, calc(3.6vw / var(--z, 1)), 52px); line-height: 1.1; letter-spacing: -.025em; }
.art-dark .art-lead { margin-top: 24px; max-width: 780px; font-size: var(--fs-lead); line-height: 1.45; color: var(--a-muted); }
.art-dark .art-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 48px; margin-top: 40px; font-size: 17px; color: var(--a-muted); }
.art-dark .art-cover { position: relative; margin-top: clamp(40px, calc(5vw / var(--z, 1)), 64px); aspect-ratio: 1200 / 500; border-radius: 28px; overflow: hidden; background: #0b1834; }
.art-dark .art-cover .bl-cover { position: absolute; inset: 0; aspect-ratio: auto; border-radius: 0; }
@media (min-width: 761px) {
  /* Плашка с логотипом на широкой обложке: размеры от экрана, а не от ширины обложки. */
  .art-dark .art-cover .bl-box { inset: 32% 30%; }
  .art-dark .art-cover .bl-lock { gap: 22px; }
  .art-dark .art-cover .bl-logo { font-size: clamp(28px, calc(2.6vw / var(--z, 1)), 40px); }
  .art-dark .art-cover .bl-sep { height: clamp(36px, calc(3.4vw / var(--z, 1)), 52px); }
  .art-dark .art-cover .bl-tag { font-size: clamp(13px, calc(1.1vw / var(--z, 1)), 17px); }
}

/* Колонка текста 760 и «широкие» вставки 1000 на одной сетке. */
.art-dark .art-body {
  display: grid;
  grid-template-columns: [full-start] minmax(24px, 1fr) [wide-start] minmax(0, 120px) [text-start] min(760px, 100% - 48px) [text-end] minmax(0, 120px) [wide-end] minmax(24px, 1fr) [full-end];
  margin-top: clamp(64px, calc(7vw / var(--z, 1)), 104px);
}
.art-dark .art-body > * { grid-column: text; }
.art-dark .art-body > .ch, .art-dark .art-body > .tbl-wrap, .art-dark .art-body > .verdict, .art-dark .art-body > .checker { grid-column: wide; }
.art-dark .art-body > .stmt { grid-column: full; }
.art-dark .stmt { margin: 64px 0; padding: clamp(56px, calc(7vw / var(--z, 1)), 104px) max(24px, calc((100% - 1000px) / 2)); background: var(--a-step); }
.art-dark .stmt p { max-width: 900px; font-size: clamp(24px, calc(2.5vw / var(--z, 1)), 36px); line-height: 1.25; letter-spacing: -.015em; font-weight: 300; color: var(--a-ink); }
.art-dark .verdict > div { padding-top: 0; }
.art-dark .art-foot { width: min(1000px, calc(100% - 48px)); margin-inline: auto; }
.art-dark .art-foot .art-author { width: min(760px, 100%); margin-inline: auto; }

/* =========================================================== Вариант 2 */
body.art-light { background: #f5f7fb; color: var(--a-text); color-scheme: light; }
.art-light .rd-bg { display: none; }
.art-light .rd-nav, .art-light .rd-header.is-scrolled .rd-nav { background: #04122b; border-color: transparent; box-shadow: none; }
.art-light .rd-footer { background: #010f23; margin-top: clamp(96px, calc(10vw / var(--z, 1)), 160px); padding-top: 64px; }
.art-light .art-head { padding-top: clamp(56px, calc(6vw / var(--z, 1)), 96px); }
.art-light .art-head h1 { max-width: 1200px; font-size: clamp(36px, calc(3.9vw / var(--z, 1)), 56px); line-height: 1.04; letter-spacing: -.035em; }
.art-light .art-lead { margin-top: 28px; max-width: 820px; font-size: var(--fs-lead); line-height: 1.45; font-weight: 300; color: #3d4b67; }

.art-light .art-grid { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: clamp(40px, calc(6vw / var(--z, 1)), 96px); align-items: start; margin-top: clamp(56px, calc(6vw / var(--z, 1)), 88px); }
.art-light .art-side { position: sticky; top: 132px; display: grid; gap: 32px; font-size: 16px; }
.art-light .side-block h2 { margin: 0 0 10px; font-size: 15px; font-weight: 400; color: var(--a-muted); letter-spacing: 0; }
.art-light .side-block p { color: var(--a-ink); }
.art-light .side-row { display: grid; gap: 20px; }
.art-light .side-date { color: var(--a-accent) !important; }
.art-light .side-toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.art-light .side-toc a { display: block; padding: 6px 0; color: var(--a-muted); text-decoration: none; line-height: 1.35; transition: color .2s var(--ease); }
.art-light .side-toc a:hover { color: var(--a-ink); }
.art-light .side-toc a[aria-current] { color: var(--a-accent); }
.art-light .side-share { display: grid; justify-items: start; gap: 4px; }
.art-light .side-share a, .art-light .side-share button { padding: 4px 0; font: inherit; font-size: 16px; color: var(--a-link); background: none; border: 0; cursor: pointer; text-decoration: none; }
.art-light .side-share a:hover, .art-light .side-share button:hover { text-decoration: underline; }
.art-light .side-share button.is-done { color: var(--a-ink); }

.art-light .art-body { max-width: 840px; }
.art-light .art-body > p, .art-light .art-body > ul, .art-light .art-body > ol, .art-light .art-body > .terms, .art-light .art-body > .shot { max-width: 760px; }
.art-light .art-body > p, .art-light .art-body > ul, .art-light .art-body > ol { line-height: 1.65; }
.art-light .art-short { margin-bottom: 48px; padding: 32px 36px; border-radius: 20px; background: var(--a-step); }
.art-light .art-short h2 { margin: 0 0 16px; font-size: 24px; letter-spacing: 0; }
.art-light .art-short ul { margin: 0; padding-left: 22px; display: grid; gap: 10px; font-size: 20px; line-height: 1.55; font-weight: 300; }
.art-light .art-short li::marker { color: var(--a-accent); }
.art-light .stmt { margin: 48px 0; padding: clamp(36px, calc(4vw / var(--z, 1)), 56px); border-radius: 24px; background: #04122b; }
.art-light .stmt p { font-size: clamp(24px, calc(2.5vw / var(--z, 1)), 36px); line-height: 1.25; letter-spacing: -.015em; font-weight: 300; color: #f5f9ff; }
.art-light .verdict > div { grid-template-columns: minmax(0, 240px) minmax(0, 1fr); }
.art-light .verdict dt { font-size: 24px; }
.art-light .tbl thead th { background: none; }
.art-light .art-next { margin-top: clamp(96px, calc(10vw / var(--z, 1)), 140px); }

/* ---------- Адаптив ---------- */
@media (max-width: 1100px) {
  .art-light .art-grid { grid-template-columns: minmax(0, 1fr); }
  .art-light .art-side { position: static; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); align-items: start; }
  .art-light .side-toc { display: none; }
  .art-light .art-body { max-width: none; }
}
@media (max-width: 860px) {
  .verdict > div, .art-light .verdict > div { grid-template-columns: 1fr; gap: 10px; }
  .art-next ul { grid-template-columns: 1fr; gap: 28px; }
}
@media (max-width: 760px) {
  .art-body > p, .art-body > ul, .art-body > ol, .art-light .art-body > p, .art-light .art-body > ul, .art-light .art-body > ol, .terms dd, .verdict dd, .art-light .art-short ul { font-size: 17px; }
  .art-dark .art-head h1 { font-size: 30px; }
  .art-light .art-head h1 { font-size: 32px; }
  .art-dark .stmt p, .art-light .stmt p { font-size: 22px; }
  .tbl { min-width: 0; font-size: 15px; }
  .tbl[data-sort] th:nth-child(3), .tbl[data-sort] td:nth-child(3), .tbl[data-sort] th:nth-child(4), .tbl[data-sort] td:nth-child(4) { display: none; }
  .tbl th, .tbl td { padding: 12px 8px; white-space: normal; }
  .tbl-cmp { min-width: 0; font-size: 14px; }
  .tbl-cmp.tbl-wide { min-width: 560px; }
  .tbl thead button { font-size: 14px; }
  .ch-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name val" "track track"; gap: 6px 12px; }
  .ch-name { grid-area: name; font-size: 16px; }
  .ch-val { grid-area: val; font-size: 15px; }
  .ch-track { grid-area: track; height: 10px; }
  .ch-rows { gap: 16px; }
  .art-dark .art-cover { aspect-ratio: 4 / 3; border-radius: 20px; }
  .art-dark .art-cover .bl-box { inset: 30% 10%; }
  .art-dark .art-meta { gap: 12px 28px; font-size: 16px; }
  .art-light .art-side { grid-template-columns: 1fr 1fr; gap: 24px; }
  .art-light .art-side > .side-block:first-child { grid-column: 1 / -1; }
  .art-light .side-row { grid-column: 1 / -1; }
  .art-light .side-share { gap: 0; }
  .art-light .side-share a, .art-light .side-share button { padding: 11px 0; }
  .art-light .art-short { padding: 24px 22px; }
  .art-author { align-items: flex-start; }
  .art-author .art-ava { width: 64px; height: 64px; }
  .code code { font-size: 13.5px; }
  .ck-btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .rv-on [data-rv], .rv-on .ch .ch-bar, .rv-on .ch .ch-val { opacity: 1; translate: none; transform: none; transition: none; }
}
