/* РКО Индекс — стили издания.
   Без внешних шрифтов и зависимостей: системный стек грузится мгновенно,
   а для справочника с большими таблицами скорость важнее типографики. */

:root {
  --bg: #ffffff;
  --bg-soft: #f6f7f9;
  --bg-sunken: #eef0f4;
  --text: #16191d;
  --text-muted: #5a6472;
  --border: #dde1e7;
  --accent: #1a4fd6;
  --accent-soft: #eaf0ff;
  --warn: #8a5300;
  --warn-soft: #fff5e0;
  --ok: #17603a;
  --ok-soft: #e8f6ee;
  --radius: 8px;
  --wrap: 1120px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #14171c;
    --bg-soft: #1b1f26;
    --bg-sunken: #21262f;
    --text: #e8ebf0;
    --text-muted: #9aa5b4;
    --border: #2d3441;
    --accent: #7ba4ff;
    --accent-soft: #1b2740;
    --warn: #f0c070;
    --warn-soft: #2e2416;
    --ok: #74d3a0;
    --ok-soft: #14291f;
  }
}

:root[data-theme='dark'] {
  --bg: #14171c;
  --bg-soft: #1b1f26;
  --bg-sunken: #21262f;
  --text: #e8ebf0;
  --text-muted: #9aa5b4;
  --border: #2d3441;
  --accent: #7ba4ff;
  --accent-soft: #1b2740;
  --warn: #f0c070;
  --warn-soft: #2e2416;
  --ok: #74d3a0;
  --ok-soft: #14291f;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.65 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    'Helvetica Neue', Arial, sans-serif;
  font-feature-settings: 'liga' 1, 'kern' 1;
}

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: 16px; top: 8px; z-index: 10;
  background: var(--accent); color: #fff;
  padding: 8px 14px; border-radius: var(--radius);
}

/* ---------- Шапка ---------- */

.header {
  border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
  position: sticky; top: 0; z-index: 5;
}

/* Шапка липкая, поэтому переход по якорю — на заголовок раздела или на
   строку таблицы из цитаты — иначе прятал бы цель под шапкой. */
html { scroll-padding-top: 76px; }
.header__inner {
  display: flex; align-items: center; gap: 24px;
  min-height: 60px; flex-wrap: wrap;
}
.logo { display: flex; align-items: baseline; gap: 6px; text-decoration: none; color: var(--text); }
.logo__mark {
  background: var(--accent); color: #fff;
  font-weight: 700; font-size: 14px; letter-spacing: .04em;
  padding: 3px 7px; border-radius: 5px;
}
.logo__text { font-weight: 600; }

.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a {
  color: var(--text-muted); text-decoration: none;
  padding: 6px 10px; border-radius: 6px; font-size: 15px;
}
.nav a:hover { background: var(--bg-sunken); color: var(--text); }
.nav a[aria-current] { color: var(--accent); background: var(--accent-soft); font-weight: 600; }

/* ---------- Текст ---------- */

main { padding: 24px 16px 64px; }
.article { max-width: 100%; }

h1 { font-size: clamp(27px, 4vw, 38px); line-height: 1.2; margin: 8px 0 12px; letter-spacing: -.015em; }
h2 { font-size: clamp(21px, 2.6vw, 27px); line-height: 1.25; margin: 44px 0 14px; letter-spacing: -.01em; }
h3 { font-size: 19px; margin: 30px 0 10px; }
h4 { font-size: 17px; margin: 24px 0 8px; }

.anchor {
  color: var(--border); text-decoration: none;
  margin-left: 8px; font-weight: 400; opacity: 0;
  transition: opacity .12s;
}
h2:hover .anchor, h3:hover .anchor, h4:hover .anchor { opacity: 1; }
.anchor:hover { color: var(--accent); }

p { margin: 0 0 15px; }
.lead { font-size: 19px; color: var(--text-muted); margin-bottom: 18px; }

a { color: var(--accent); text-underline-offset: 2px; }

ul, ol { margin: 0 0 16px; padding-left: 22px; }
li { margin-bottom: 7px; }

code {
  background: var(--bg-sunken); padding: 1px 5px;
  border-radius: 4px; font-size: .9em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
pre {
  background: var(--bg-sunken); padding: 14px; border-radius: var(--radius);
  overflow-x: auto; border: 1px solid var(--border);
}
pre code { background: none; padding: 0; }

blockquote {
  margin: 0 0 16px; padding: 2px 0 2px 16px;
  border-left: 3px solid var(--border); color: var(--text-muted);
}

hr { border: 0; border-top: 1px solid var(--border); margin: 32px 0; }

/* ---------- Метаданные ---------- */

.breadcrumbs { font-size: 14px; color: var(--text-muted); margin: 4px 0 4px; }
.breadcrumbs ol { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.breadcrumbs li + li::before { content: '/'; margin-right: 6px; color: var(--border); }
.breadcrumbs a { color: var(--text-muted); }

.byline {
  display: flex; flex-wrap: wrap; gap: 6px 18px;
  font-size: 14px; color: var(--text-muted);
  padding: 10px 0 14px; border-bottom: 1px solid var(--border); margin-bottom: 22px;
}
.byline__author { font-weight: 600; color: var(--text); }

.badge {
  display: inline-block; font-size: 11px; font-weight: 600;
  padding: 1px 6px; border-radius: 4px; vertical-align: middle;
  text-transform: uppercase; letter-spacing: .03em;
}
.badge--warn { background: var(--warn-soft); color: var(--warn); }

/* ---------- Содержание ---------- */

.toc {
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 20px; margin: 0 0 28px;
}
.toc__title { font-size: 14px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-muted); margin: 0 0 8px; }
.toc ol { margin: 0; padding-left: 20px; columns: 2; column-gap: 32px; }
.toc li { margin-bottom: 4px; break-inside: avoid; }
@media (max-width: 720px) { .toc ol { columns: 1; } }

/* ---------- Таблицы ---------- */

.table-scroll {
  overflow-x: auto; margin: 0 0 24px;
  border: 1px solid var(--border); border-radius: var(--radius);
  -webkit-overflow-scrolling: touch;
}
table { border-collapse: collapse; width: 100%; font-size: 15px; }
thead th {
  background: var(--bg-sunken); text-align: left;
  font-weight: 600; font-size: 13px; line-height: 1.35;
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; white-space: nowrap;
}
tbody th, tbody td {
  padding: 9px 12px; border-bottom: 1px solid var(--border);
  vertical-align: top;
}
tbody th { text-align: left; font-weight: 600; white-space: nowrap; }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--bg-soft); }

/* Строка, на которую пришли по якорю из цитаты, выгрузки API или
   разметки JSON-LD. Без подсветки ссылка на конкретное предложение
   выглядит как ссылка на страницу целиком. */
tbody tr:target {
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
}

.ta-right { text-align: right; }
.ta-center { text-align: center; }
th.ta-right, td.ta-right { font-variant-numeric: tabular-nums; }

/* ---------- Выноски ---------- */

.callout {
  border: 1px solid var(--border); border-left-width: 3px;
  border-radius: var(--radius); padding: 14px 18px; margin: 0 0 24px;
  background: var(--bg-soft);
}
.callout > :last-child { margin-bottom: 0; }
.callout__label {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; margin: 0 0 6px; color: var(--text-muted);
}
.callout--answer {
  border-left-color: var(--accent); background: var(--accent-soft);
  font-size: 17px;
}
.callout--answer .callout__label { color: var(--accent); }
.callout--warning { border-left-color: var(--warn); background: var(--warn-soft); }
.callout--warning .callout__label { color: var(--warn); }
.callout--data { border-left-color: var(--ok); background: var(--ok-soft); }
.callout--data .callout__label { color: var(--ok); }
.callout--note { border-left-color: var(--text-muted); }
.callout--law { border-left-color: var(--text-muted); font-size: 15px; }

/* ---------- FAQ ---------- */

.faq { margin-top: 44px; }
.faq__item {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 16px; margin-bottom: 8px; background: var(--bg-soft);
}
.faq__item summary { cursor: pointer; font-weight: 600; }
.faq__item[open] summary { margin-bottom: 8px; }
.faq__item p { margin: 0; color: var(--text-muted); }

/* ---------- Машиночитаемые версии ---------- */

.machine {
  margin-top: 44px; padding: 18px 20px;
  border: 1px dashed var(--border); border-radius: var(--radius);
  background: var(--bg-soft);
}
.machine h2 {
  font-size: 14px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-muted); margin: 0 0 10px;
}
.machine ul { margin: 0 0 10px; }
.machine__note { font-size: 13px; color: var(--text-muted); margin: 0; }

/* ---------- Подвал ---------- */

.footer {
  border-top: 1px solid var(--border); background: var(--bg-soft);
  padding: 32px 0 48px; margin-top: 64px; font-size: 14px;
  color: var(--text-muted);
}
.footer__disclaimer { max-width: 760px; }
.footer__nav { display: flex; flex-wrap: wrap; gap: 16px; margin: 16px 0; }
.footer__copy { margin: 0; }

@media (max-width: 640px) {
  body { font-size: 16px; }
  .header__inner { min-height: 52px; gap: 12px; }
  table { font-size: 14px; }
  thead th, tbody th, tbody td { padding: 8px 10px; }
}

/* ---------- Раскрытие аффилированности ---------- */

.disclosure {
  background: var(--accent-soft);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
  padding: 7px 0;
}
.disclosure a { color: var(--accent); }
