/* =========================================================================
   Манифест · дизайн-система
   Моно-шрифт, почти монохром, 1px-линии. Цвет несёт смысл:
   красный = сигнал / особая причина, голубой и чёрный = шум / общие причины.
   ========================================================================= */

@font-face { font-family: "JetBrains Mono"; src: url("../fonts/JetBrainsMono-Regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("../fonts/JetBrainsMono-Medium.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("../fonts/JetBrainsMono-Bold.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }

:root {
  /* токены (Global Constraints) */
  --ink: #000;
  --bg: #fff;
  --muted: #6b6b6b;        /* не светлее — AA на белом 5,3:1 */
  --hair: #e6e6e6;
  --acid: #bf0909;         /* сигнал */
  --cyan: #1fb6d1;         /* шум: графики, ASCII-поля и слой шума заголовков (denoise.js) */
  /* производные */
  --pale: #f7f7f7;
  --ink-2: #2b2b2b;
  --line: #000;
  --slate: #56657c;        /* шапки карточек; белый текст 5,9:1 */
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);

  --max: 1320px;
  --gutter: clamp(32px, 4.6vw, 64px);
  --header-h: 52px;
  --fs: 15px;
  --lh: 1.72;

  /* пиксельные углы */
  --pxu: 5px;
  --pxu2: 10px;
  --px-clip: polygon(var(--pxu2) 0, calc(100% - var(--pxu2)) 0, calc(100% - var(--pxu2)) var(--pxu), calc(100% - var(--pxu)) var(--pxu), calc(100% - var(--pxu)) var(--pxu2), 100% var(--pxu2), 100% calc(100% - var(--pxu2)), calc(100% - var(--pxu)) calc(100% - var(--pxu2)), calc(100% - var(--pxu)) calc(100% - var(--pxu)), calc(100% - var(--pxu2)) calc(100% - var(--pxu)), calc(100% - var(--pxu2)) 100%, var(--pxu2) 100%, var(--pxu2) calc(100% - var(--pxu)), var(--pxu) calc(100% - var(--pxu)), var(--pxu) calc(100% - var(--pxu2)), 0 calc(100% - var(--pxu2)), 0 var(--pxu2), var(--pxu) var(--pxu2), var(--pxu) var(--pxu), var(--pxu2) var(--pxu));
}

@media (max-width: 640px) {
  :root { --gutter: 16px; --fs: 14px; --lh: 1.68; --header-h: 48px; }
}

/* ---------- база ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 var(--fs)/var(--lh) var(--mono);
  font-feature-settings: "tnum" 1, "zero" 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg, canvas { display: block; max-width: 100%; }
a { color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; text-decoration-color: var(--muted); transition: color .2s var(--ease), text-decoration-color .2s var(--ease); }
a:hover { color: var(--acid); text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--acid); outline-offset: 3px; }

/* общее ASCII-поле (field.js): неподвижный холст под всем содержимым, клики проходят насквозь */
.field { position: fixed; inset: 0 auto auto 0; z-index: -1; pointer-events: none; max-width: none; }
.field[hidden] { display: none; }
/* место для облаков шапки, только когда поле живо (без JS раскладка прежняя) */
html.field-on .hero-more { margin-top: clamp(88px, 10vw, 150px); }
@media (max-width: 960px) {
  html.field-on .hero { padding-top: 104px; }
  html.field-on .hero-grid { row-gap: 120px; }
}
::selection { background: var(--ink); color: var(--bg); }

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); min-width: 0; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -60px; z-index: 100; background: var(--ink); color: var(--bg); padding: 8px 12px; text-decoration: none; }
.skip:focus { top: 8px; color: var(--bg); }

/* ---------- атомы ---------- */

/* метка раздела: красная плашка «NN · {тема}» */
.tag {
  display: inline-block;
  background: var(--acid);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: 6px 9px 5px;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* служебная подпись */
.label {
  font-size: 11px;
  font-weight: 500;
  line-height: 1.45;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--muted);
}

/* статистические подписи: греческие буквы и n не переводим в верхний регистр */
.label.stat { text-transform: none; letter-spacing: .06em; font-size: 12px; }

/* маркер-выделение: белое на чёрном (плашка — фон-градиент, чтобы её можно было «прокатить») */
mark {
  background: linear-gradient(var(--ink), var(--ink)) 0 0 / 100% 100% no-repeat;
  color: var(--bg);
  padding: .1em .32em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

/* реплика в квадратных скобках — авторская ремарка, приглушённо */
.br { color: var(--muted); }
.sig-red { color: var(--acid); }

/* кнопка с пиксельными углами */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .6em;
  min-height: 42px;
  padding: 10px 22px;
  background: var(--ink);
  color: var(--bg);
  font: 500 13px/1.2 var(--mono);
  letter-spacing: .02em;
  text-decoration: none;
  border: 0;
  cursor: pointer;
  clip-path: var(--px-clip);
  transition: background-color .25s var(--ease), transform .25s var(--ease);
}
.btn:hover { background: var(--acid); color: var(--bg); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; background: var(--acid); }
.btn[disabled], .btn[aria-disabled="true"] { background: var(--hair); color: var(--muted); cursor: not-allowed; }
.btn-ghost { background: var(--pale); color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }

/* карточка */
.card { border: 1px solid var(--hair); background: var(--bg); box-shadow: 6px 6px 0 var(--pale); }
.card-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
  background: var(--slate); color: #fff;
  font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  padding: 10px 16px; line-height: 1.4;
}
.card-signal .card-head, .case-signal .card-head { background: var(--ink); }
.card-signal .card-head span:first-child::before, .case-signal .card-head span:first-child::before {
  content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 9px; background: var(--acid); vertical-align: 1px;
}
.card-head > :first-child { min-width: 0; }
.card-head > :last-child { flex: none; text-align: right; }
.card-head > :only-child { flex: 1 1 auto; text-align: left; }
.card-body { padding: 20px 20px 22px; }

/* ---------- шапка сайта ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .96);
  border-bottom: 2px solid var(--line);
}
@supports (backdrop-filter: blur(6px)) { .site-header { background: rgba(255, 255, 255, .86); backdrop-filter: blur(8px); } }
.bar { display: flex; align-items: center; gap: clamp(12px, 1.4vw, 20px); height: var(--header-h); }
.brand {
  flex: none; display: inline-flex; align-items: baseline; gap: 10px;
  font-weight: 700; font-size: 15px; text-decoration: none; letter-spacing: .01em;
}
.brand:hover { color: var(--ink); }
.brand-mark { font-weight: 700; letter-spacing: -.02em; }
.brand-mark::first-letter { color: inherit; }
.brand-label { font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.nav {
  flex: 1 1 auto; min-width: 0;
  /* safe: если ссылки не влезают, выравнивание падает в начало и лишнее уходит вправо, в прокрутку
     (просто flex-end уводит переполнение влево — туда не прокрутить, первая ссылка обрезана) */
  display: flex; gap: 0; justify-content: safe flex-end;
  overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 10px, #000 calc(100% - 20px), transparent);
  mask-image: linear-gradient(90deg, transparent 0, #000 10px, #000 calc(100% - 20px), transparent);
  padding: 0 10px;
}
.nav::-webkit-scrollbar { display: none; }
.nav a {
  flex: none; display: flex; align-items: baseline; gap: 4px;
  padding: 8px 5px 6px;
  font-size: 11.5px; font-weight: 500; line-height: 1.3; white-space: nowrap;
  color: #4a4a4a; text-decoration: none;
  border-bottom: 2px solid transparent;
}
.nav a .n { font-size: 10px; color: var(--muted); letter-spacing: .06em; }
.nav a:hover { color: var(--ink); background: var(--pale); }
.nav a[aria-current="true"] { color: var(--acid); border-bottom-color: var(--acid); font-weight: 700; }
.nav a[aria-current="true"] .n { color: var(--acid); }
.nav a:focus-visible { outline-offset: -2px; }
@media (max-width: 1180px) { .nav { justify-content: flex-start; } }
@media (max-width: 560px) {
  .brand-label { display: none; }
  .bar { gap: 4px; }
}

section { scroll-margin-top: calc(var(--header-h) + 12px); }
[id^="s5-"] { scroll-margin-top: calc(var(--header-h) + 24px); }

/* ---------- 0 · шапка-тезис ---------- */
.hero { padding: clamp(40px, 7vw, 96px) 0 clamp(48px, 7vw, 96px); }
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: clamp(32px, 5vw, 80px);
  align-items: start;
}
.hero-main { padding-top: clamp(0px, 3vw, 40px); }
.hero h1 {
  margin-top: 28px;
  font-size: clamp(30px, 4.5vw, 60px);
  line-height: 1.08;
  font-weight: 700;
  letter-spacing: -.035em;
  text-wrap: balance;
  hyphens: manual;
}
.lede {
  margin-top: 28px; max-width: 58ch;
  font-size: clamp(15px, 1.25vw, 17px); line-height: 1.7; color: var(--ink-2);
}
.hero-actions { margin-top: 36px; display: flex; flex-wrap: wrap; align-items: center; gap: 14px 28px; }
.more { font-size: 13px; font-weight: 500; text-decoration: none; border-bottom: 1px solid var(--hair); padding-bottom: 2px; }
.more:hover { border-color: var(--acid); }

.board { position: relative; }
.board .card-head span:last-child { font-weight: 500; letter-spacing: .08em; text-transform: none; }
.mount-galton { padding: 18px 16px 6px; display: flex; justify-content: center; container-type: inline-size; }
/* сетка 53 × 31 символ (boardGeometry в js/galton.js): canvas и статичный кадр одной формы */
#galton { display: block; width: 100%; aspect-ratio: 53 / 50; }
/* статичный кадр занимает ровно ту же коробку, что и canvas: смена fallback → canvas не сдвигает вёрстку */
.mount-galton .fallback { width: 100%; aspect-ratio: 53 / 50; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.galton-ascii {
  margin: 0;
  /* 53 колонки по 0,62em ≈ 32,9em → шрифт растёт с шириной карточки */
  font: 500 min(15px, 3cqi)/1 var(--mono);
  letter-spacing: .02em;
  color: var(--ink);
  white-space: pre;
}
.galton-ascii .gp { color: var(--muted); font-weight: 700; }  /* гвозди: серый не светлее #6b6b6b */
.galton-ascii .gk { color: var(--ink); }
.galton-ascii .gc { color: var(--cyan); }
.galton-ascii .gr { color: var(--acid); font-weight: 700; }
.galton-ascii .gl { color: var(--muted); }
.board figcaption { padding: 6px 16px 18px; }
.board .thesis { font-size: 15px; }
.caption { margin-top: 10px; font-size: 12px; line-height: 1.6; color: var(--muted); }

.hero-more {
  margin-top: clamp(56px, 7vw, 104px);
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(32px, 5vw, 80px);
}
.questions { border-top: 1px solid var(--line); padding-top: 18px; }
.q-main { margin-top: 12px; font-size: 16px; font-weight: 700; line-height: 1.55; }
.q-list { margin-top: 20px; border-top: 1px solid var(--hair); }
.q-list a {
  display: flex; justify-content: space-between; gap: 16px; align-items: baseline;
  padding: 12px 0; border-bottom: 1px solid var(--hair);
  text-decoration: none; font-size: 14px;
}
.q-list a:hover { background: linear-gradient(90deg, var(--pale), transparent); }
.q-to { flex: none; font-size: 11px; color: var(--muted); letter-spacing: .1em; transition: transform .3s var(--ease), color .3s var(--ease); }
.q-list a:hover .q-to { color: var(--acid); transform: translateX(4px); }

.summary { border-top: 1px solid var(--line); padding-top: 18px; }
.summary-h { font-size: 11px; font-weight: 500; }
.summary-list { margin-top: 18px; display: grid; grid-template-columns: minmax(0, 1fr); }
.summary-list li { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; padding: 14px 0 16px; border-bottom: 1px solid var(--hair); font-size: 13px; line-height: 1.62; }
.summary-list .n { font-size: 11px; color: var(--muted); padding-top: 2px; letter-spacing: .06em; }
.summary-list p { hyphens: auto; }

/* ---------- разделы ---------- */
.sec { padding: clamp(44px, 5.5vw, 80px) 0 clamp(48px, 6vw, 88px); }
.sec-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.sec-pos { flex: none; }
.sec h2 {
  margin-top: 22px;
  font-size: clamp(30px, 4vw, 52px);
  line-height: 1.06;
  font-weight: 700;
  letter-spacing: -.035em;
  text-transform: lowercase;
  text-wrap: balance;
}
.sec-grid {
  margin-top: clamp(32px, 4vw, 56px);
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(32px, 5vw, 80px);
  align-items: start;
}
.sec-aside { position: sticky; top: calc(var(--header-h) + 32px); display: grid; gap: 28px; }
.thesis { font-size: clamp(15px, 1.3vw, 18px); font-weight: 500; line-height: 1.68; }
.thesis mark { padding: .14em .36em; }
.thesis-inline { margin: 8px 0; }
.thesis-note { font-size: 14px; line-height: 1.65; color: var(--ink-2); margin-top: -12px; }
.final-text mark { padding: .08em .3em; }
.aside-lead { font-weight: 700; }

/* ASCII-поле раздела (js/laws.js): сетка 32 × 12 клеток 9 × 12 px; canvas поверх статичного кадра той же формы.
   Шрифт и межбуквенный интервал — от ширины поля (cqi), чтобы <pre> и canvas совпадали клетка в клетку:
   клетка = 100cqi/32, кегль = 4/3 клетки, разрядка = клетка − 0,6 кегля (моноширинный шаг 0,6em). */
.sig { display: grid; gap: 8px; justify-items: start; padding-top: 14px; border-top: 1px solid var(--hair); }
.law-box { position: relative; width: min(100%, 288px); aspect-ratio: 2 / 1; container-type: inline-size; overflow: hidden; cursor: crosshair; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.law-pre { margin: 0; font: 500 4.1667cqi/4.1667cqi var(--mono); letter-spacing: .625cqi; white-space: pre; color: var(--ink); }
.law-cv { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.law-cv[hidden] { display: none; }
.law.is-live .law-pre { visibility: hidden; }
.law-pre .t-m { color: var(--muted); }
.law-pre .t-c { color: var(--cyan); }
.law-pre .t-k { color: var(--ink); }
.law-pre .t-r { color: var(--acid); }
.law figcaption { display: flex; flex-wrap: wrap; gap: 2px 12px; }
.law .law-val { color: var(--ink); font-variant-numeric: tabular-nums; }

/* основной текст */
.prose { max-width: 72ch; display: grid; gap: 18px; hyphens: auto; text-align: left; }
.prose h3 { font-size: 15px; font-weight: 700; line-height: 1.5; margin-top: 18px; }
.prose > h3:first-child { margin-top: 0; }
.prose strong { font-weight: 700; }
.statement { font-size: clamp(16px, 1.35vw, 18px); font-weight: 700; line-height: 1.55; }
.quote { padding-left: 18px; border-left: 2px solid var(--ink); font-style: normal; color: var(--ink-2); }

ul.dash { display: grid; gap: 8px; }
ul.dash > li { position: relative; padding-left: 22px; }
ul.dash > li::before { content: "–"; position: absolute; left: 2px; color: var(--muted); }
ul.dash.cols { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 28px; font-size: 14px; }

/* строки «метка — текст» */
.rows { border-top: 1px solid var(--line); }
.rows .row { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 20px; padding: 14px 0 15px; border-bottom: 1px solid var(--hair); }
.rows dt { padding-top: 3px; }
.rows dd { line-height: 1.65; }
.timeline .row { grid-template-columns: 112px minmax(0, 1fr); }
.timeline dt { font-size: 15px; font-weight: 700; letter-spacing: -.01em; padding-top: 0; color: var(--ink); }
.timeline .row:hover dt { color: var(--acid); }
.axes dt { font-size: 13px; }

/* вопрос → ответ */
.qa { border: 1px solid var(--hair); background: var(--pale); padding: 16px 18px; display: grid; gap: 10px; }
.qa p { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 12px; align-items: baseline; }
.qa-q { font-weight: 700; }
.qa .label { font-size: 10px; }

/* пример */
.example { border-left: 2px solid var(--hair); padding: 2px 0 2px 18px; display: grid; gap: 10px; color: var(--ink-2); font-size: 14px; }
.example p > .label:first-child { margin-right: 10px; }
.example > .label { margin-bottom: -2px; }

/* две ошибки */
.errors { display: grid; gap: 0; border-top: 1px solid var(--line); }
.errors li { display: grid; grid-template-columns: 40px minmax(0, 1fr); padding: 14px 0; border-bottom: 1px solid var(--hair); }
.err-n { font-weight: 700; }
.errors li:first-child .err-n { color: var(--acid); }

/* случаи раздела 3 */
.case { margin: 6px 0; }
.case h3 { margin: 0; }
.case .card-body { display: grid; gap: 14px; }
.case .example { font-size: 13.5px; }

/* цепочка */
.chain { display: grid; gap: 0; counter-reset: ch; }
.chain li { position: relative; padding: 9px 0 9px 34px; }
.chain li::before {
  counter-increment: ch; content: counter(ch);
  position: absolute; left: 0; top: 10px;
  width: 22px; height: 22px; display: grid; place-items: center;
  font-size: 11px; font-weight: 700; border: 1px solid var(--ink); background: var(--bg);
}
.chain li:not(:last-child)::after {
  content: ""; position: absolute; left: 11px; top: 32px; bottom: -10px; border-left: 1px dashed var(--muted);
}

/* поток lean */
.flow { display: flex; flex-wrap: wrap; gap: 8px 0; }
.flow li { display: inline-flex; align-items: center; font-size: 13px; }
.flow li > span { border: 1px solid var(--ink); padding: 4px 10px; }
.flow li:not(:last-child)::after { content: "→"; color: var(--muted); margin: 0 8px; }

/* чипы */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { border: 1px solid var(--ink); padding: 4px 12px; font-size: 13px; font-weight: 500; }

/* следствия раздела 6 */
.cons { display: grid; gap: 0; border-top: 1px solid var(--line); }
.cons > li { padding: 18px 0 20px; border-bottom: 1px solid var(--hair); display: grid; gap: 10px; }
.cons h4 { font-size: 15px; font-weight: 700; line-height: 1.5; }
.cons-n { color: var(--muted); font-weight: 500; margin-right: 6px; }

/* оговорка */
.caveat { border: 1px dashed var(--muted); padding: 20px 22px; display: grid; gap: 14px; font-size: 14px; }
.caveat h3 { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }

/* статичные рисунки */
.figure { border: 1px solid var(--hair); padding: 14px 16px 10px; margin: 6px 0; }
.figure-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.chart-static { width: 100%; height: auto; overflow: visible; }

/* SVG-словарь: классы общие для сигнатур, карты и разделителей */
svg .h { stroke: var(--hair); stroke-width: 1; fill: none; }
svg .lim { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; fill: none; }  /* границы — не сигнал */
svg .ln { stroke: var(--ink); stroke-width: 1; fill: none; stroke-linejoin: round; }
svg .ln.c { stroke: var(--cyan); }
svg .ln.r { stroke: var(--acid); }
svg .cv { stroke: var(--ink); stroke-width: 1.25; fill: none; }
svg .cv.c { stroke: var(--cyan); }
svg .cv.r { stroke: var(--acid); }
svg .dash { stroke-dasharray: 3 3; }
svg .ar { stroke: var(--muted); stroke-width: 1; fill: none; }
svg .dk { fill: var(--ink); }
svg .dc { fill: var(--cyan); }
svg .dc.o { opacity: .55; }
svg .dr { fill: var(--acid); }
svg .ring { fill: none; stroke: var(--acid); stroke-width: 1; }
svg .bk { fill: var(--ink); }
svg .bh { fill: var(--acid); }
svg .sel { fill: none; stroke: var(--ink); stroke-width: 1; stroke-dasharray: 2 3; }
svg .t { font: 500 11px var(--mono); fill: var(--muted); letter-spacing: .06em; }
svg .t.m { fill: var(--muted); }
svg .t.r { fill: var(--acid); font-weight: 700; }

/* ---------- интерактивы ---------- */
.quiz {
  margin-top: clamp(40px, 5vw, 72px);
  background: var(--pale);
  border: 1px solid var(--hair);
  padding: clamp(20px, 3vw, 36px);
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(20px, 5vw, 80px);
}
.quiz-title { margin-top: 10px; font-size: clamp(24px, 2.8vw, 36px); font-weight: 700; letter-spacing: -.03em; line-height: 1.1; }
.mount-quiz { min-width: 0; }
.quiz-q { font-weight: 700; margin-bottom: 14px; }
.fallback p + p { margin-top: 12px; }

/* «предскажи → проверь» */
.quiz:has(.predict) { grid-template-columns: minmax(0, 1fr); gap: clamp(18px, 2.4vw, 28px); }
.mount-quiz { container-type: inline-size; }
.predict { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; }
@container (min-width: 820px) {
  .predict {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    grid-template-rows: auto auto auto 1fr;
    column-gap: clamp(32px, 5vw, 72px);
  }
  .predict > .pr-stage { grid-column: 2; grid-row: 1 / -1; margin-top: 0; }
  .predict > :not(.pr-stage) { grid-column: 1; }
}
.pr-opts { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
/* вариант: пиксельная рамка — чёрная подложка и белая вставка с теми же углами */
.pr-opt { position: relative; isolation: isolate; gap: 10px; padding: 10px 18px 10px 14px; background: var(--ink); color: var(--ink); box-shadow: none; }
.pr-opt::before { content: ""; position: absolute; inset: 1px; z-index: -1; background: var(--bg); clip-path: var(--px-clip); }
.pr-opt:hover, .pr-opt:focus-visible { background: var(--ink); color: var(--bg); }
.pr-opt:hover::before, .pr-opt:focus-visible::before { background: var(--ink); }
.pr-opt:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.pr-box { width: 11px; height: 11px; flex: none; box-shadow: inset 0 0 0 1px currentColor; }
.pr-opt.is-chosen { color: var(--bg); }
.pr-opt.is-chosen::before { background: var(--ink); }
.pr-opt.is-chosen .pr-box { background: currentColor; box-shadow: inset 0 0 0 1px currentColor, inset 0 0 0 3px var(--ink); }
.pr-tag:empty { display: none; }
.pr-tag { font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; padding-left: 10px; margin-left: 2px; box-shadow: inset 1px 0 0 currentColor; }
.pr-opt.is-correct { color: var(--bg); }
.pr-opt.is-correct::before, .pr-opt.is-correct:hover::before { background: var(--ink); }
.pr-opt.is-correct .pr-box { background: currentColor; box-shadow: inset 0 0 0 1px currentColor, inset 0 0 0 3px var(--ink); }
.pr-opt.is-wrong, .pr-opt.is-wrong:hover { color: var(--ink); }
.pr-opt.is-wrong::before, .pr-opt.is-wrong:hover::before { background: var(--bg); }
.pr-opt.is-wrong .pr-label { text-decoration: line-through; text-decoration-thickness: 1px; }
.pr-opt.is-wrong .pr-box { background: none; box-shadow: inset 0 0 0 1px currentColor; }
.pr-opt.is-other { background: var(--hair); color: var(--muted); }
.pr-opt.is-other::before { background: var(--pale); }
/* после проверки ответ можно поменять: у остальных вариантов наведение и фокус — как у обычной кнопки */
.pr-opt.is-other:hover, .pr-opt.is-other:focus-visible { background: var(--ink); color: var(--bg); }
.pr-opt.is-other:hover::before, .pr-opt.is-other:focus-visible::before { background: var(--ink); }
.pr-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: 20px; }
.pr-run { min-width: 132px; justify-content: center; }
.pr-stage { margin-top: 24px; container-type: inline-size; min-width: 0; }
.pr-out:empty { display: none; }
.pr-out { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--ink); align-self: start; }
.pr-error { font-weight: 700; }
.pr-verdict mark { font-weight: 700; margin-right: .2em; }
.pr-sum { margin-top: 10px; }
.pr-concl { margin-top: 14px; display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px; align-items: baseline; }
.pr-concl-t { font-weight: 700; }

/* мишени: рядом; в узком контейнере — друг под другом, мишень слева, цифры справа,
   чтобы обе были на экране, пока ложатся точки */
.funnel { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.fn-target { margin: 0; background: var(--bg); border: 1px solid var(--hair); min-width: 0; display: grid; grid-template-rows: auto 1fr auto; }
.fn-head {
  display: flex; gap: 10px; align-items: baseline;
  background: var(--slate); color: #fff; padding: 9px 12px; min-height: 52px;
  font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; line-height: 1.4;
}
.fn-side { flex: none; font-weight: 500; opacity: .8; }
.fn-canvas { padding: 10px; align-self: center; }
.fn-canvas canvas { display: block; width: 100%; }
.fn-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 2px 12px; padding: 10px 12px 12px; border-top: 1px solid var(--hair); }
.fn-sd { font-size: 20px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fn-meta { font-variant-numeric: tabular-nums; }
@container (max-width: 520px) {
  .funnel { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .fn-target { grid-template-columns: minmax(0, 62fr) minmax(0, 38fr); grid-template-rows: auto auto; }
  .fn-head { grid-column: 1 / -1; min-height: 0; }
  .fn-canvas { padding: 8px; }
  .fn-foot { flex-direction: column; justify-content: center; align-items: flex-start; gap: 6px; border-top: 0; border-left: 1px solid var(--hair); padding: 10px 12px; }
  .fn-sd { font-size: 18px; }
  .fn-sep { display: none; }
  .fn-r95, .fn-n { display: block; }
}

/* точки монтирования: пока fallback виден, пустой canvas не занимает место.
   Виджет при успешной инициализации прячет .fallback (атрибут hidden или класс .is-hidden). */
.fallback[hidden], .fallback.is-hidden { display: none !important; }
/* !important: правила вида #galton { display: block } сильнее по специфичности и показали бы пустой canvas рядом с fallback */
.mount .fallback:not([hidden]):not(.is-hidden) ~ canvas { display: none !important; }

/* ---------- раздел 5: таблица ---------- */
.table-fig { margin-top: clamp(40px, 5vw, 72px); }
.table-cap { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; font-weight: 700; margin-bottom: 16px; }
.compare { width: 100%; border-collapse: collapse; font-size: 13.5px; line-height: 1.55; }
.compare th, .compare td { text-align: left; vertical-align: top; padding: 12px 16px 12px 0; border-bottom: 1px solid var(--hair); }
.compare thead th { font-size: 11px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.compare thead th:last-child { color: var(--ink); }
.compare tbody th { font-weight: 500; color: var(--muted); width: 26%; }
.compare td:last-child { font-weight: 700; }
.compare tbody tr:hover { background: var(--pale); }

/* ---------- раздел 8 ---------- */
.principles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px; border-top: 1px solid var(--line); }
.principles li { border-bottom: 1px solid var(--hair); }
.principles summary {
  list-style: none; cursor: pointer;
  display: grid; grid-template-columns: 30px minmax(0, 1fr) 16px; gap: 10px; align-items: baseline;
  padding: 13px 0; font-weight: 700; font-size: 14px; line-height: 1.45;
}
.principles summary::-webkit-details-marker { display: none; }
.principles summary::after { content: "+"; color: var(--muted); font-weight: 500; text-align: right; transition: transform .3s var(--ease); }
.principles details[open] summary::after { content: "−"; color: var(--acid); }
.principles summary:hover .p-t { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.p-n { font-size: 11px; font-weight: 500; color: var(--muted); letter-spacing: .06em; }
.principles details[open] .p-n { color: var(--acid); }
.principles details p { padding: 0 0 16px 40px; font-size: 13.5px; line-height: 1.62; color: var(--ink-2); }

.pair { margin-top: clamp(40px, 5vw, 64px); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; }
.pair ul.card-body { font-size: 14px; }

.final-q { margin-top: clamp(40px, 5vw, 64px); border-top: 2px solid var(--line); padding-top: 22px; max-width: 980px; }
.final-text { font-size: clamp(17px, 1.7vw, 22px); font-weight: 700; line-height: 1.5; letter-spacing: -.01em; }

/* дерево запусков агента: та же карточка, что у мишеней */
.agent { margin: 0; background: var(--bg); border: 1px solid var(--hair); min-width: 0; }
.ag-head { min-height: 0; }
.ag-canvas { padding: 12px 12px 4px; }
.ag-canvas canvas { display: block; width: 100%; }
.ag-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 0 12px 10px; font-size: 11px; }
.ag-lg { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.ag-lg i { width: 14px; height: 2px; background: currentColor; flex: none; }
.ag-lg-ok i { background: var(--ink); height: 2px; }
.ag-lg-noise i { background: var(--cyan); }
.ag-lg-err i { background: var(--acid); }
.ag-foot { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 0; padding: 10px 12px 4px; border-top: 1px solid var(--hair); }
.ag-ok { font-variant-numeric: tabular-nums; }
.ag-meta { font-variant-numeric: tabular-nums; white-space: nowrap; }
.ag-hist { padding: 0 12px 12px; font-variant-numeric: tabular-nums; }
.ag-hist[hidden] { display: none; }
.ag-foot:has(+ .ag-hist[hidden]) { padding-bottom: 12px; }
@container (max-width: 520px) {
  .ag-canvas { padding: 10px 8px 2px; }
  .ag-legend { padding: 0 8px 8px; }
  .ag-foot { flex-direction: column; align-items: flex-start; gap: 4px; padding: 10px 8px 4px; }
  .ag-sep { display: none; }
  .ag-hist { padding: 0 8px 10px; }
  .ag-ok { font-size: 18px; }
}
/* ---------- разделители-распределения ---------- */
.divider {
  height: 52px;
  background: linear-gradient(var(--hair), var(--hair)) center / 100% 1px no-repeat;
}
.divider.is-drawn { background: none; }
.divider svg { width: 100%; height: 52px; overflow: visible; }
.divider .t { font-size: 10px; }

/* «прорисовка» при появлении: только с JS (класс на <html> ставится до первой отрисовки)
   и без reduced motion; без JS, при reduced motion и в печати — сразу итоговый вид */
@media screen and (prefers-reduced-motion: no-preference) {
  .divider.is-pending .dc, .divider.is-pending .dk {
    transition: transform .55s cubic-bezier(.3, 1.45, .55, 1) calc(var(--d, 0) * 900ms), opacity .2s linear calc(var(--d, 0) * 900ms);
  }
  .divider.is-pending:not(.is-in) .dc, .divider.is-pending:not(.is-in) .dk { transform: translateY(-16px); opacity: 0; }
  .divider.is-pending .cv { stroke-dasharray: 1; transition: stroke-dashoffset 1.3s cubic-bezier(.45, 0, .25, 1) .1s; }
  .divider.is-pending:not(.is-in) .cv { stroke-dashoffset: 1; }
  .divider.is-pending .ln, .divider.is-pending .ar, .divider.is-pending .t { transition: opacity .5s linear .9s; }
  .divider.is-pending:not(.is-in) .ln, .divider.is-pending:not(.is-in) .ar, .divider.is-pending:not(.is-in) .t { opacity: 0; }
  /* особая точка — последней: сначала шум, потом сигнал */
  .divider.is-pending .dr, .divider.is-pending .ring { transform-box: fill-box; transform-origin: center; transition: transform .45s cubic-bezier(.3, 1.6, .5, 1) 1.15s, opacity .15s linear 1.15s; }
  .divider.is-pending .ring { transition-delay: 1.3s; }
  .divider.is-pending:not(.is-in) .dr, .divider.is-pending:not(.is-in) .ring { transform: scale(0); opacity: 0; }
  /* стирание (ушёл вниз при прокрутке вверх, main.js ставит .is-out): та же прорисовка задом наперёд и быстрее (×0,6) —
     сначала гаснет особая точка, потом подписи и ковёр, кривая сматывается, точки уходят справа налево */
  .divider.is-pending.is-out .ring { transition: transform .27s cubic-bezier(.5, 0, .7, -.6) 0s, opacity .09s linear .18s; }
  .divider.is-pending.is-out .dr { transition: transform .27s cubic-bezier(.5, 0, .7, -.6) .09s, opacity .09s linear .27s; }
  .divider.is-pending.is-out .ln, .divider.is-pending.is-out .ar, .divider.is-pending.is-out .t { transition: opacity .3s linear .21s; }
  .divider.is-pending.is-out .cv { transition: stroke-dashoffset .78s cubic-bezier(.75, 0, .55, 1) .21s; }
  .divider.is-pending.is-out .dc, .divider.is-pending.is-out .dk {
    transition: transform .33s cubic-bezier(.45, 0, .7, -.45) calc(720ms - var(--d, 0) * 540ms), opacity .12s linear calc(930ms - var(--d, 0) * 540ms);
  }

  /* тезис-маркер: чёрная плашка прокатывается под текстом слева направо */
  html.js-reveal main p:not(.pr-verdict) > mark {
    transition: background-size .75s cubic-bezier(.65, 0, .25, 1), color .3s linear .3s;
  }
  html.js-reveal main p:not(.pr-verdict) > mark:not(.is-in) {
    background-size: 0 100%; color: var(--ink);
  }
  /* где есть background-clip: text — цвет букв меняется ровно по кромке плашки:
     слой 1 (по тексту) — белое | чёрное со сдвигаемой границей, слой 2 — сама плашка.
     После прокатки JS ставит .is-done и маркер возвращается к обычному стилю (выделение текста и т.п.) */
  @supports ((-webkit-background-clip: text) or (background-clip: text)) { @media (forced-colors: none) {
    html.js-reveal main p:not(.pr-verdict) > mark:not(.is-done) {
      background-image: linear-gradient(90deg, var(--bg) 50%, var(--ink) 50%), linear-gradient(var(--ink), var(--ink));
      background-repeat: no-repeat;
      background-size: 200% 100%, 100% 100%;
      background-position: 0 0, 0 0;
      -webkit-background-clip: text, padding-box;
      background-clip: text, padding-box;
      -webkit-text-fill-color: transparent;
      color: var(--bg);
      transition: background-size .8s cubic-bezier(.65, 0, .25, 1), background-position .8s cubic-bezier(.65, 0, .25, 1);
    }
    html.js-reveal main p:not(.pr-verdict) > mark:not(.is-in) {
      background-size: 200% 100%, 0 100%;
      background-position: 100% 0, 0 0;
    }
  } }
  /* проскочили по якорю — итог сразу, без анимации (маркер получает is-in и is-done разом) */
  html.js-reveal main p:not(.pr-verdict) > mark.is-done { transition: none; }
  /* откат (ушёл вниз при прокрутке вверх, main.js ставит .is-out): та же прокатка назад, ×0,6 по времени и с зеркальной
     кривой; цвет букв (без background-clip) меняется в зеркальный момент */
  html.js-reveal main p:not(.pr-verdict) > mark.is-out {
    transition: background-size .48s cubic-bezier(.75, 0, .35, 1), background-position .48s cubic-bezier(.75, 0, .35, 1), color .18s linear .09s;
  }
  /* перед откатом (main.js): слои прокатки возвращаются в итоговом положении без перехода */
  html.js-reveal main p:not(.pr-verdict) > mark.is-snap { transition: none; }
  .divider.is-instant * { transition: none !important; }
}

/* ASCII-типографика (denoise.js): настоящий текст на время анимации прозрачен, поверх — два слоя-псевдоэлемента
   с пустым альтернативным текстом (`/ ""`): ::before — шум, ::after — уже сошедшиеся символы. Слои абсолютные,
   той же ширины и тем же шрифтом: переносы совпадают, вёрстка не сдвигается. Только где такой content понятен,
   без принудительных цветов и без reduced motion; в печати — обычный текст */
@supports (content: "a" / "") { @media screen and (forced-colors: none) and (prefers-reduced-motion: no-preference) {
  html.dn-pre .hero h1 { color: transparent; }
  .dn { position: relative; color: transparent !important; }
  .dn::before, .dn::after {
    position: absolute; inset: 0; padding: inherit; pointer-events: none; white-space: inherit;
    overflow: visible; text-overflow: clip;
  }
  .dn::before { content: attr(data-dn-b) / ""; color: var(--dn-noise, var(--cyan)); }
  .dn::after { content: attr(data-dn-a) / ""; color: var(--dn-ink, var(--ink)); }
  /* размытие «силуэта» — только у счётчиков */
  .dn-count::after { filter: blur(var(--dn-blur, 0px)); }
} }

/* мерцание кнопок (shimmer.js): клетки вокруг кнопки, один цвет — чернила; слой в координатах документа */
.shimmer { position: absolute; left: 0; top: 0; width: 0; height: 0; z-index: 40; pointer-events: none; }
.sh-c {
  position: absolute; width: 9px; height: 9px; font: 700 10px/9px var(--mono); text-align: center; font-style: normal;
  color: var(--ink); opacity: 0; animation: sh-life var(--life, 2s) linear forwards;
}
.sh-c::before { content: attr(data-g) / ""; }
@keyframes sh-life { 0% { opacity: 0; } 8% { opacity: 1; } 35% { opacity: .85; } 100% { opacity: 0; } }
@media print { .shimmer { display: none; } }

/* полоса прогресса чтения в шапке: S-кривая нормальной CDF */
.progress { flex: none; display: flex; align-items: center; gap: 8px; color: var(--muted); }
/* место под прогресс зарезервировано в разметке (без сдвига ссылок навигации), видно после монтирования */
.progress:not(.is-on) { visibility: hidden; }
.progress svg { display: block; width: 44px; height: 18px; overflow: visible; }
.progress .pg-bg { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 1 2; fill: none; }
.progress .pg-fg { stroke: var(--ink); stroke-width: 1.25; fill: none; }
.progress .pg-dot { fill: var(--ink); }
.progress .pg-p { font-size: 10px; letter-spacing: .04em; white-space: nowrap; width: 54px; font-variant-numeric: tabular-nums; } /* ширина в px: не зависит от того, загрузился ли моноширинный шрифт */
@media (max-width: 560px) { .progress .pg-p { display: none; } .progress svg { width: 32px; } }
@media print { .progress { display: none; } }

/* кнопка «пауза анимаций» (main.js): нажата — все модули в статичном кадре. Место зарезервировано в разметке,
   видна после монтирования (без JS ей нечего останавливать) */
.motion-tg {
  flex: none; width: 28px; height: 28px; padding: 0; border: 0; cursor: pointer;
  display: inline-grid; place-items: center;
  background: var(--pale); color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink);
  clip-path: polygon(4px 0, calc(100% - 4px) 0, calc(100% - 4px) 4px, 100% 4px, 100% calc(100% - 4px), calc(100% - 4px) calc(100% - 4px), calc(100% - 4px) 100%, 4px 100%, 4px calc(100% - 4px), 0 calc(100% - 4px), 0 4px, 4px 4px);
  transition: background-color .2s var(--ease), color .2s var(--ease);
}
.motion-tg:not(.is-on) { visibility: hidden; }
.motion-tg:hover { background: var(--ink); color: var(--bg); }
.motion-tg:focus-visible { outline: none; background: var(--acid); color: #fff; }
.motion-tg[aria-disabled="true"] { cursor: not-allowed; color: var(--muted); box-shadow: inset 0 0 0 1px var(--muted); background: var(--pale); }
/* значок: две полосы — «пауза»; нажата — треугольник «пуск» */
.motion-tg .mt-i { display: block; width: 9px; height: 10px; border-left: 3px solid currentColor; border-right: 3px solid currentColor; }
.motion-tg[aria-pressed="true"] .mt-i { border: 0; width: 9px; height: 10px; background: currentColor; clip-path: polygon(0 0, 100% 50%, 0 100%); }
@media print { .motion-tg { display: none; } }

/* анимации на паузе (кнопка или reduced motion): никаких CSS-переходов и анимаций на странице */
html.motion-off { scroll-behavior: auto; }
html.motion-off *, html.motion-off *::before, html.motion-off *::after { transition: none !important; animation: none !important; }
html.motion-off .sh-c { display: none; }

/* ---------- подвал ---------- */
.site-footer { border-top: 1px solid var(--line); margin-top: clamp(24px, 4vw, 48px); }
.foot { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 12px 24px; padding-top: 28px; padding-bottom: 40px; font-size: 13px; }
.foot-name { font-weight: 700; }
.foot-name .brand-mark { margin-right: 8px; }
.foot-link a { text-decoration-color: var(--hair); }

/* ---------- §6: выбор следующего токена (js/tokens.js) ----------
   Столбики и полоса жребия — моноширинный <pre>, ширина в символах считается в JS от ширины блока.
   Выбранное слово — чёрная плашка; красного нет: выбор из распределения модели — обычный разброс. */
.tokens { margin: 10px 0 6px; }
.mount-tokens { padding: 16px 18px 6px; min-width: 0; container-type: inline-size; }
.tk { display: grid; gap: 12px; min-width: 0; }
.tk-ctl { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tk-ctl-l { margin-right: 6px; }
.tk-t { position: relative; isolation: isolate; min-height: 34px; min-width: 56px; padding: 6px 14px; justify-content: center; background: var(--ink); color: var(--ink); font-variant-numeric: tabular-nums; }
.tk-t::before { content: ""; position: absolute; inset: 1px; z-index: -1; background: var(--bg); clip-path: var(--px-clip); }
.tk-t:hover, .tk-t:focus-visible { background: var(--ink); color: var(--bg); }
.tk-t:hover::before, .tk-t:focus-visible::before { background: var(--ink); }
.tk-t:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.tk-t[aria-pressed="true"] { color: var(--bg); }
.tk-t[aria-pressed="true"]::before { background: var(--ink); }
.tk-say { margin-top: 4px; font: 500 clamp(16px, 1.45vw, 19px)/1.5 var(--mono); letter-spacing: -.01em; min-height: 1.5em; color: var(--ink); hyphens: manual; }
.tk-prompt { color: var(--ink-2); }
.tk-w { font-weight: 700; }
.tk-say .tk-pick { font-weight: 700; background: var(--ink); color: var(--bg); padding: .06em .3em; margin: 0 -.3em; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.tk-cur { color: var(--muted); animation: tk-blink 1s steps(1) infinite; }
@keyframes tk-blink { 50% { opacity: 0; } }
.tk-step { color: var(--muted); }
.tk-pre { margin: 0; font: 500 13px/1.3 var(--mono); letter-spacing: 0; white-space: pre; overflow: hidden; color: var(--ink); }
.tk-pre .tk-m { color: var(--muted); }
.tk-pre .tk-c { color: var(--cyan); }
.tk-pre .tk-k { color: var(--ink); }
.tk-pre .tk-pl { background: var(--ink); color: var(--bg); font-weight: 700; }
.tk-note { font-size: 12px; line-height: 1.55; color: var(--muted); min-height: calc(2 * 1.55em); }
.tk-log { border-top: 1px solid var(--hair); padding-top: 12px; display: grid; gap: 8px; }
.tk-count { font-size: 13px; font-weight: 500; line-height: 24px; height: 24px; }
.tk-wait { color: var(--muted); font-weight: 400; }
.tk-count b { font-size: 1.3em; line-height: 1; font-weight: 700; font-variant-numeric: tabular-nums; }
.tk-list { display: grid; font-size: 12.5px; line-height: 1.7; }
.tk-row { display: grid; grid-template-columns: 3ch minmax(0, 33ch) minmax(0, 1fr); gap: 12px; align-items: baseline; min-height: 1.7em; }
.tk-bar { color: var(--cyan); white-space: pre; letter-spacing: 0; }
.tk-trk { color: var(--muted); }
.tk-n { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.tk-a { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; justify-self: start; max-width: 100%; }
.tk-row.is-empty { border-bottom: 1px dotted var(--hair); }
.tk-more .tk-a { color: var(--muted); }
.tk-row.is-new .tk-a { background: var(--ink); color: var(--bg); padding: 0 .4em; margin-left: -.4em; }
.tk-row.is-new .tk-bar { color: var(--ink); }
.tk-cap { padding: 0 18px 16px; }
.tk-cap .caption { margin-top: 4px; }
.mount-tokens .fallback .tk-pre { font-size: 12px; }
@container (max-width: 420px) {
  .tk-say { min-height: 3em; }
  .tk-row { grid-template-columns: 3ch minmax(0, 1fr); }
  .tk-row .tk-bar { display: none; }
  .tk-pre { font-size: 12px; }
  .tk-note { min-height: calc(3 * 1.55em); }
}
@media (max-width: 640px) {
  .mount-tokens { padding: 14px 12px 4px; }
  .tk-cap { padding: 0 12px 14px; }
}

/* ---------- §5 поток через этапы (flow.js) ---------- */
.flow-fig { margin: 10px 0 6px; }
/* шапка в одну строку при любом варианте — иначе высота карточки прыгает при переключении */
.flow-fig .card-head > :first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.flow-fig .fl-head-t { white-space: nowrap; }
.mount-flow { padding: 16px 18px 6px; min-width: 0; container-type: inline-size; }
.fl { display: grid; gap: 12px; min-width: 0; }
.fl-ctl { display: flex; flex-wrap: wrap; gap: 8px; }
.fl-b { position: relative; isolation: isolate; min-height: 34px; padding: 6px 14px; justify-content: center; background: var(--ink); color: var(--ink); }
.fl-b::before { content: ""; position: absolute; inset: 1px; z-index: -1; background: var(--bg); clip-path: var(--px-clip); }
.fl-b:hover, .fl-b:focus-visible { background: var(--ink); color: var(--bg); }
.fl-b:hover::before, .fl-b:focus-visible::before { background: var(--ink); }
.fl-b:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.fl-b[aria-pressed="true"] { color: var(--bg); }
.fl-b[aria-pressed="true"]::before { background: var(--ink); }
.fl-pre { margin: 0; font: 500 13px/1.3 var(--mono); letter-spacing: 0; white-space: pre; overflow: hidden; color: var(--ink); }
.fl-pre .fl-m { color: var(--muted); }
.fl-pre .fl-c { color: var(--cyan); }
.fl-pre .fl-k { color: var(--ink); }
.fl-pre .fl-pl { background: var(--ink); color: var(--bg); font-weight: 700; }
.fl-note { font-size: 12px; line-height: 1.55; color: var(--muted); min-height: calc(3 * 1.55em); }
.fl-cap { padding: 0 18px 16px; }
.fl-cap .caption { margin-top: 4px; }
.mount-flow .fallback .fl-pre { font-size: 12px; }
.mount-flow .fallback .caption { margin-top: 10px; }
@container (max-width: 520px) {
  .fl-ctl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px; }
  .fl-b { min-height: 30px; padding: 4px 10px; font-size: 12px; line-height: 1.3; text-align: center; }
  .fl-b:last-child { grid-column: 1 / -1; }
  .fl-pre { font-size: 12px; }
  .fl-note { min-height: calc(5 * 1.55em); }
}
@container (max-width: 330px) {
  .fl-pre, .mount-flow .fallback .fl-pre { font-size: 11px; }
}
@media (max-width: 340px) {
  .flow-fig .mount-flow { padding-left: 8px; padding-right: 8px; }
}
@media (max-width: 640px) {
  .mount-flow { padding: 14px 12px 4px; }
  .fl-cap { padding: 0 12px 14px; }
}

/* ---------- адаптив ---------- */
@media (max-width: 960px) {
  .hero-grid, .hero-more, .sec-grid, .quiz { grid-template-columns: minmax(0, 1fr); }
  .sec-aside { position: static; }
  .board { max-width: 560px; }
}
@media (max-width: 640px) {
  .hero-main { padding-top: 0; }
  .hero h1 { margin-top: 22px; }
  .lede { margin-top: 20px; }
  .summary-list { grid-template-columns: minmax(0, 1fr); }
  .rows .row, .timeline .row { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .qa p { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  ul.dash.cols { grid-template-columns: minmax(0, 1fr); }
  .principles { grid-template-columns: minmax(0, 1fr); }
  .principles details p { padding-left: 40px; }
  .pair { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .card { box-shadow: 4px 4px 0 var(--pale); }
  .case .card-head { flex-wrap: wrap; gap: 2px 12px; }
  .case .card-head > :last-child { text-align: left; }
  .tag { white-space: normal; line-height: 1.35; padding: 5px 9px 4px; }
  .chart-static .t { font-size: 20px; }
  .card-body { padding: 16px 16px 18px; }
  .caveat { padding: 16px; }
  .sig { justify-items: stretch; }
  .law-box { width: 100%; }
  .mount-galton { padding: 14px 8px 4px; }

  /* таблица → карточки строк */
  .compare thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .compare, .compare tbody, .compare tr, .compare th, .compare td { display: block; width: 100%; }
  .compare tr { padding: 12px 0; border-bottom: 1px solid var(--hair); }
  .compare tbody th { width: 100%; padding: 0 0 6px; border: 0; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
  .compare td { border: 0; padding: 2px 0; display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 10px; }
  .compare td::before { content: attr(data-h); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding-top: 3px; font-weight: 500; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

@media print {
  /* печать: только текст и статичная графика — без фонового поля, шапки с прогрессом и кнопкой паузы, анимаций */
  .site-header, .divider, .skip, .field, canvas.field, .progress, .motion-tg, .shimmer { display: none !important; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; }
  /* белый текст на плашках (метки, тезисы, шапки карточек, кнопки): фон печатается всегда, иначе текст пропадёт */
  .tag, mark, .card-head, .btn { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  figure, .card, .quiz { break-inside: avoid; }
  h2, h3, h4, .sec-head { break-after: avoid; }
  .sec-aside { position: static; }
  details > p { display: block; }
}

/* плашки под Executive Summary: Деминг и LLM — отдельные врезки, не пункты резюме */
.plaques { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--grid-gap, 24px); margin-top: 40px; }
.plaque .card-head a.q-to { color: inherit; text-decoration: none; letter-spacing: .08em; }
.plaque .card-head a.q-to:hover, .plaque .card-head a.q-to:focus-visible { text-decoration: underline; }
.plaque .card-body { display: grid; gap: 12px; font-size: 13px; line-height: 1.62; }
.plaque .card-body p { hyphens: auto; }
@media (max-width: 760px) { .plaques { grid-template-columns: minmax(0, 1fr); margin-top: 28px; } }
