/* Только заводы: раздел статей. Подключается ПОСЛЕ /assets/css/style.css и живёт на его переменных.
   Идея: статья это рабочие заметки аналитика, прочитанные с маркером в руке.
   Маркер отмечает то, что оставлено: текущий раздел в оглавлении, вводные термины, строку под курсором,
   найденное слово в фильтре. Карандаш вычёркивает только в одном месте: на листе приглашения,
   где список посредников сокращается до производителей. Радиус везде 2px, акцент один: цвет маркера. */

/* ---------- шапка статьи ---------- */
.a-head { padding-top: clamp(24px, 3.2vw, 44px); }
.a-head__in { padding-bottom: clamp(28px, 3.6vw, 52px); border-bottom: 1.5px solid var(--text); }
.a-crumbs { display: flex; align-items: center; gap: 10px; min-width: 0; margin-bottom: clamp(22px, 3.4vw, 48px); font-family: var(--f-mono); font-size: .8rem; line-height: 1.4; letter-spacing: .02em; color: var(--muted); }
.a-crumbs li { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.a-crumbs li + li::before { content: "/"; color: var(--ctl); }
.a-crumbs li:last-child { min-width: 0; }
.a-crumbs li:last-child span { overflow: hidden; text-overflow: ellipsis; }
.a-crumbs a { text-decoration: none; padding: 4px 0; background: linear-gradient(var(--mark), var(--mark)) 0 100% / 0 2px no-repeat; transition: background-size .3s cubic-bezier(.16, 1, .3, 1), color .2s ease; }
.a-crumbs a:hover { color: var(--text); background-size: 100% 2px; }
.a-h1 { font-size: clamp(1.9rem, 1rem + 3.1vw, 3.5rem); line-height: 1.08; letter-spacing: -0.032em; max-width: 21ch; overflow-wrap: break-word; }
.a-meta { margin-top: clamp(20px, 2.4vw, 32px); display: flex; flex-wrap: wrap; align-items: center; gap: 10px 0; font-family: var(--f-mono); font-size: .86rem; line-height: 1.5; color: var(--muted); }
.a-meta li { display: flex; align-items: center; gap: 8px; }
.a-meta li + li { margin-left: 18px; padding-left: 18px; border-left: 1px solid var(--line-strong); }
.a-meta svg { width: 14px; height: 14px; color: var(--accent-text); flex: none; }
.a-meta__v { background: var(--mark); color: var(--on-mark); font-weight: 500; padding: .05em .4em .1em; border-radius: var(--r); }

/* ---------- сетка: оглавление слева, текст справа ---------- */
.a-body { padding-block: clamp(32px, 4.4vw, 64px) var(--sec); }
.a-grid { display: grid; grid-template-columns: minmax(220px, 3fr) minmax(0, 9fr); gap: clamp(32px, 6vw, 104px); align-items: start; }

/* оглавление: строки рабочего листа, маркер стоит на текущем разделе */
.a-toc { position: sticky; top: 92px; max-height: calc(100dvh - 116px); overflow: auto; scrollbar-width: thin; }
.a-toc summary { list-style: none; font-family: var(--f-mono); font-size: .82rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding-bottom: 14px; border-bottom: 1.5px solid var(--text); }
.a-toc summary::-webkit-details-marker { display: none; }
.a-toc__list { counter-reset: toc; }
.a-toc__list li { counter-increment: toc; border-bottom: 1px solid var(--line); }
.a-toc__list a { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 8px; padding: 12px 4px 12px 0; text-decoration: none; font-size: .94rem; line-height: 1.4; color: var(--muted); transition: color .2s ease; }
.a-toc__list a::before { content: counter(toc); font-family: var(--f-mono); font-size: .8rem; line-height: 1.65; color: var(--ctl); }
.a-toc__list a:hover { color: var(--text); }
.a-toc__list a:focus-visible { outline-offset: -2px; }
.a-toc__t { justify-self: start; background: linear-gradient(var(--mark), var(--mark)) 0 50% / 0 100% no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: .06em .3em .1em; margin: -.06em -.3em -.1em; border-radius: var(--r); transition: background-size .45s cubic-bezier(.16, 1, .3, 1), color .25s ease; }
.a-toc__list a.is-current .a-toc__t { background-size: 100% 100%; color: var(--on-mark); }
.a-toc__list a.is-current::before { color: var(--accent-text); }
@media (min-width: 901px) {
  .a-toc summary { pointer-events: none; cursor: default; }
}

/* ---------- текст для длинного чтения ---------- */
.a-prose { min-width: 0; font-size: 1.0938rem; line-height: 1.7; color: var(--text); }
.a-prose > * { max-width: 62ch; }
.a-prose > :first-child { margin-top: 0; }
.a-prose p { margin-top: 18px; text-wrap: pretty; }
.a-prose .prose__lead { max-width: 56ch; padding-left: clamp(16px, 2vw, 26px); border-left: 3px solid var(--mark); font-size: clamp(1.15rem, 1.05rem + .5vw, 1.34rem); line-height: 1.52; letter-spacing: -0.006em; }
.a-prose h2 { counter-increment: h2; margin-top: clamp(48px, 5.6vw, 76px); padding-top: 20px; border-top: 1px solid var(--line-strong); max-width: 30ch; font-size: clamp(1.45rem, 1.15rem + 1.1vw, 2rem); line-height: 1.16; letter-spacing: -0.024em; }
.a-prose { counter-reset: h2; }
.a-prose h2::before { content: counter(h2); display: block; margin-bottom: 10px; font-family: var(--f-mono); font-weight: 400; font-size: .86rem; line-height: 1; letter-spacing: 0; color: var(--accent-text); }
.a-prose h2 + p, .a-prose h2 + ul, .a-prose h2 + ol { margin-top: 22px; }
.a-prose h3 { margin-top: clamp(30px, 3.4vw, 42px); font-size: 1.25rem; }
.a-prose strong, .a-prose b { font-weight: 600; }
/* вводный термин в начале абзаца: проведён маркером (ночью маркер полупрозрачный, чтобы светлый текст читался), как пометка на полях рабочего листа */
.a-prose p > strong:first-child { --swipe: rgba(207, 216, 92, .24); background: linear-gradient(var(--swipe), var(--swipe)) 0 72% / 100% 66% no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 .18em; margin: 0 -.18em; }
html[data-theme="light"] .a-prose p > strong:first-child { --swipe: var(--mark); }
.a-prose a:not(.btn) { color: var(--text); text-decoration-color: var(--accent-text); text-underline-offset: 4px; text-decoration-thickness: 1.5px; }
.a-prose a:not(.btn):hover { color: var(--accent-text); }
.a-prose .han, .a-row .han, .a-toc .han { font-family: var(--f-cjk); font-size: .97em; letter-spacing: .02em; word-break: keep-all; }
.a-prose code { font-family: var(--f-mono); font-size: .88em; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: .12em .36em; overflow-wrap: anywhere; }
.a-prose ul, .a-prose ol { margin-top: 20px; display: grid; gap: 0; border-top: 1px solid var(--line); }
.a-prose li { position: relative; padding: 13px 0 13px 38px; border-bottom: 1px solid var(--line); line-height: 1.55; }
.a-prose ul > li::before { content: ""; position: absolute; left: 0; top: calc(13px + .78em); width: 16px; height: 8px; background: var(--mark); border-radius: 1px; transform: translateY(-50%); }
.a-prose ol { counter-reset: n; }
.a-prose ol > li { counter-increment: n; }
.a-prose ol > li::before { content: counter(n); position: absolute; left: 0; top: 13px; font-family: var(--f-mono); font-size: .9rem; line-height: 1.9; color: var(--accent-text); }
.a-prose blockquote { margin: 26px 0 0; padding: 2px 0 2px 22px; border-left: 3px solid var(--mark); font-family: var(--f-display); font-size: 1.12em; line-height: 1.45; letter-spacing: -0.01em; }
.a-prose blockquote p:first-child { margin-top: 0; }
.a-prose .a-table { max-width: none; margin-top: 24px; overflow-x: auto; }
.a-prose table { border-collapse: collapse; width: 100%; font-size: .97rem; line-height: 1.45; }
.a-prose th { font-family: var(--f-mono); font-weight: 400; font-size: .8rem; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); text-align: left; padding: 10px 18px 10px 0; border-bottom: 1.5px solid var(--text); }
.a-prose td { padding: 12px 18px 12px 0; border-bottom: 1px solid var(--line); color: var(--muted); vertical-align: top; }

/* схема: всегда ночная. Ночью лежит на столе вровень с ним, днём это намеренная тёмная вклейка с тенью листа */
.a-prose .a-fig { max-width: 860px; margin-top: clamp(30px, 3.6vw, 48px); }
.a-fig + p, .a-fig + ul, .a-fig + ol { margin-top: clamp(26px, 3vw, 38px); }
.a-fig__frame { display: block; background: #17222a; border: 1px solid var(--line-strong); border-radius: var(--r); overflow: hidden; }
.a-fig__frame img { width: 100%; height: auto; }
html[data-theme="light"] .a-fig__frame { border-color: #17222a; padding: clamp(5px, .9vw, 10px); box-shadow: var(--paper-shadow); }

/* ---------- приглашение: бумажный лист с загнутым углом, как лист отчёта на главной ---------- */
.a-prose .a-cta__wrap { position: relative; max-width: 860px; margin-top: clamp(60px, 7vw, 104px); }
.a-cta__wrap::before { content: ""; position: absolute; inset: 10px -8px -10px 12px; background: var(--paper-2); border-radius: var(--r); transform: rotate(1deg); opacity: .6; }
html[data-theme="light"] .a-cta__wrap::before { opacity: 1; box-shadow: 0 0 0 1px rgba(20, 26, 30, .06); }
.a-cta { position: relative; background: var(--paper); color: var(--paper-ink); border-radius: var(--r); padding: clamp(24px, 3.6vw, 52px); clip-path: polygon(0 0, calc(100% - 34px) 0, 100% 34px, 100% 100%, 0 100%); }
.a-cta::before { content: ""; position: absolute; right: 0; top: 0; width: 34px; height: 34px; background: linear-gradient(225deg, transparent 50%, var(--paper-2) 50%); box-shadow: -2px 2px 4px -2px rgba(0, 0, 0, .25); }
.a-cta__wrap { filter: drop-shadow(0 24px 40px rgba(0, 0, 0, .28)); }
html[data-theme="light"] .a-cta__wrap { filter: drop-shadow(0 22px 34px rgba(50, 60, 40, .2)); }
.a-cta__in { display: grid; grid-template-columns: minmax(0, 1fr) clamp(132px, 17vw, 200px); gap: clamp(24px, 4vw, 64px); align-items: center; }
.a-prose .a-cta h2 { counter-increment: none; margin: 0; padding: 0; border: 0; max-width: 16ch; font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.4rem); line-height: 1.08; letter-spacing: -0.03em; color: var(--paper-ink); }
.a-prose .a-cta h2::before { content: none; }
.a-prose .a-cta p { margin-top: 16px; max-width: 52ch; font-size: 1rem; line-height: 1.6; color: var(--paper-muted); }
.a-prose .a-cta .btn { margin-top: clamp(22px, 2.6vw, 32px); background: var(--paper-ink); color: var(--paper); }
.a-prose .a-cta .btn:hover { background: #2a343b; }
.a-prose .a-cta .btn:focus-visible { outline-color: var(--paper-ink); }
/* рисунок листа: строки, часть вычеркнута карандашом, три отмечены маркером. Тот же приём, что в шагах на главной */
.a-cta__fig { width: 100%; height: auto; overflow: visible; }
.a-cta__fig .c-row { fill: var(--paper-out); opacity: .5; }
.a-cta__fig .c-ink { fill: var(--paper-ink); }
.a-cta__fig .c-mark { fill: var(--mark); transform-box: fill-box; transform-origin: 0 50%; }
.a-cta__fig .c-cut { stroke: var(--pencil); stroke-width: 1.6; stroke-linecap: round; fill: none; stroke-dasharray: 1; stroke-dashoffset: 0; }
.a-cta__fig.is-wait .c-mark { transform: scaleX(0); }
.a-cta__fig.is-wait .c-cut { stroke-dashoffset: 1; }
.a-cta__fig.is-go .c-mark { transition: transform .5s cubic-bezier(.16, 1, .3, 1); transition-delay: calc(var(--i) * 140ms + 500ms); }
.a-cta__fig.is-go .c-cut { transition: stroke-dashoffset .4s ease-in-out; transition-delay: calc(var(--i) * 110ms); }

/* ---------- строка списка: «Читайте также» и страница раздела ---------- */
.a-rows { counter-reset: row; border-top: 1.5px solid var(--text); }
.a-rows li { counter-increment: row; border-bottom: 1px solid var(--line); }
.a-rows li[hidden] { display: none; }
.a-row { display: grid; grid-template-columns: 30px minmax(0, 5fr) minmax(0, 6fr) 20px; gap: 8px clamp(16px, 2.6vw, 40px); align-items: start; padding-block: clamp(18px, 2vw, 26px); text-decoration: none; }
.a-row::before { content: counter(row); font-family: var(--f-mono); font-size: .86rem; line-height: 1.75; color: var(--ctl); }
.a-row__t { justify-self: start; font-family: var(--f-display); font-weight: 600; font-size: clamp(1.06rem, .98rem + .4vw, 1.25rem); line-height: 1.3; letter-spacing: -0.015em; text-wrap: balance; }
.a-row__t { background-image: linear-gradient(var(--mark), var(--mark)); background-repeat: no-repeat; background-position: 0 50%; background-size: 0 100%; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: .04em .22em .08em; margin: -.04em -.22em -.08em; border-radius: var(--r); transition: background-size .4s cubic-bezier(.16, 1, .3, 1), color .2s ease; }
.a-row__d { color: var(--muted); font-size: .98rem; line-height: 1.52; text-wrap: pretty; }
.a-row__go { width: 18px; height: 18px; margin-top: 5px; color: var(--ctl); justify-self: end; transition: transform .3s cubic-bezier(.16, 1, .3, 1), color .2s ease; }
.a-row:hover .a-row__t, .a-row:focus-visible .a-row__t { background-size: 100% 100%; color: var(--on-mark); }
.a-row:hover .a-row__go { transform: translateX(4px); color: var(--text); }
.a-row:hover::before { color: var(--accent-text); }
.a-row:active { transform: translateY(1px); }
.a-hit { background: var(--mark); color: var(--on-mark); border-radius: 1px; padding: 0 .08em; margin: 0 -.08em; }

.a-more { border-top: 1px solid var(--line); background: var(--bg-2); padding-block: clamp(56px, 7vw, 104px); }
.a-more__h { font-size: clamp(1.5rem, 1.1rem + 1.5vw, 2.2rem); line-height: 1.1; max-width: none; }
.a-more__all { display: inline-block; margin-top: 18px; padding: 6px 0; font-size: .98rem; color: var(--text); text-decoration: underline; text-decoration-color: var(--ctl); text-underline-offset: 6px; text-decoration-thickness: 1px; transition: text-decoration-color .2s ease; }
.a-more__all:hover { text-decoration-color: var(--accent-text); }

/* ---------- страница раздела ---------- */
.a-head--index .a-head__in { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 28px clamp(24px, 5vw, 80px); align-items: end; }
.a-head--index .a-crumbs__nav { grid-column: 1 / -1; }
.a-head--index .a-crumbs { margin-bottom: 0; }
.a-index__h1 { font-size: clamp(2.5rem, 1.2rem + 4.6vw, 4.6rem); line-height: 1.02; letter-spacing: -0.04em; }
.a-index__sub { margin-top: clamp(16px, 2vw, 26px); max-width: 56ch; font-size: clamp(1.0625rem, 1rem + .3vw, 1.2rem); line-height: 1.55; color: var(--muted); }
.a-filter { width: clamp(280px, 27vw, 360px); display: grid; gap: 8px; }
.a-filter[hidden] { display: none; }
.a-filter label { font-size: .95rem; font-weight: 500; }
.a-filter__bar { position: relative; display: flex; align-items: center; background: var(--surface); border: 1px solid var(--ctl); border-radius: var(--r); transition: border-color .2s ease; }
.a-filter__bar:hover { border-color: var(--text); }
.a-filter__bar:focus-within { outline: 2px solid var(--focus); outline-offset: 1px; border-color: transparent; }
.a-filter input { flex: 1; min-width: 0; min-height: 52px; border: 0; background: transparent; padding: 0 14px; font-size: 1.0625rem; color: var(--text); }
.a-filter input:focus { outline: none; }
.a-filter input::-webkit-search-cancel-button { -webkit-appearance: none; }
.a-filter__x { all: unset; box-sizing: border-box; width: 46px; height: 46px; display: grid; place-items: center; cursor: pointer; color: var(--muted); border-radius: var(--r); }
.a-filter__x[hidden] { display: none; }
.a-filter__x:hover { color: var(--text); }
.a-filter__x:focus-visible { outline: 2px solid var(--focus); outline-offset: -5px; }
.a-filter__x svg { width: 14px; height: 14px; }
.a-filter__n { min-height: 1.4em; font-family: var(--f-mono); font-size: .82rem; line-height: 1.4; color: var(--muted); }

.a-topics { position: sticky; top: 92px; }
.a-topics__k { font-family: var(--f-mono); font-size: .82rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding-bottom: 14px; border-bottom: 1.5px solid var(--text); }
.a-topics__list li { border-bottom: 1px solid var(--line); }
.a-topics__list a { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: baseline; padding: 13px 0; text-decoration: none; font-size: .97rem; line-height: 1.35; color: var(--muted); transition: color .2s ease; }
.a-topics__list a:hover { color: var(--text); }
.a-topics__list i { font-style: normal; font-family: var(--f-mono); font-size: .82rem; color: var(--accent-text); }
.a-topics__list a.is-empty { color: var(--ctl); }
.a-topics__list a.is-empty i { color: var(--ctl); }
.a-groups { min-width: 0; }
.a-group { }
.a-group[hidden] { display: none; }
.a-group + .a-group { margin-top: clamp(48px, 6vw, 88px); }
.a-group__h { max-width: none; margin-bottom: clamp(18px, 2vw, 26px); font-size: clamp(1.45rem, 1.15rem + 1.1vw, 2rem); line-height: 1.15; }
.a-none { max-width: 52ch; padding-left: 18px; border-left: 3px solid var(--mark); color: var(--muted); }
.a-none[hidden] { display: none; }

/* ---------- адаптив ---------- */
@media (max-width: 900px) {
  .a-grid { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .a-toc { position: static; max-height: none; overflow: visible; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); }
  .a-toc summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 0 16px; border-bottom: 0; cursor: pointer; color: var(--text); }
  .a-toc summary::after { content: ""; width: 9px; height: 9px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: translateY(-3px) rotate(45deg); transition: transform .25s ease; }
  .a-toc[open] summary::after { transform: translateY(2px) rotate(-135deg); }
  .a-toc[open] summary { border-bottom: 1px solid var(--line); }
  .a-toc__list { padding: 0 16px; }
  .a-toc__list li:last-child { border-bottom: 0; }
  .a-topics { position: static; }
  .a-head--index .a-head__in { grid-template-columns: minmax(0, 1fr); }
  .a-filter { width: 100%; max-width: 440px; }
  .a-more .a-grid { gap: 24px; }
}
@media (max-width: 640px) {
  .a-prose { font-size: 1.0313rem; line-height: 1.68; }
  .a-prose .prose__lead { font-size: 1.125rem; line-height: 1.55; padding-left: 14px; }
  .a-meta li + li { margin-left: 0; padding-left: 0; border-left: 0; }
  .a-meta { flex-direction: column; align-items: flex-start; gap: 8px; }
  .a-prose li { padding-left: 30px; }
  .a-cta__in { grid-template-columns: minmax(0, 1fr); }
  .a-cta__fig { order: -1; max-width: 132px; }
  .a-prose .a-cta .btn { width: 100%; }
  .a-row { grid-template-columns: 24px minmax(0, 1fr) 18px; gap: 6px 10px; }
  .a-row__d { grid-column: 2 / -1; grid-row: 2; }
  .a-row__go { grid-column: 3; grid-row: 1; }
  .a-filter { max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  .a-cta__fig.is-wait .c-mark { transform: none; }
  .a-cta__fig.is-wait .c-cut { stroke-dashoffset: 0; }
}
