/* ==========================================================
 * /tpl/26/css/kb.css — оформление статьи.
 * Правила перенесены из hesk.css + hesk_inline.css один в один,
 * без скелета HESK (.ticket, .contr, звёзды, голосование).
 * ========================================================== */

@layer article {

  /* ---------- Текст ----------
     Заголовки — Segoe UI, текст статьи — Open Sans. */
  .kb-article h1,
  .kb-article h2,
  .kb-article h3,
  .kb-article h4,
  .kb-article h5 { font-family: var(--f-ui); }

  .kb-article a { color: var(--c-link); text-decoration: underline; }
  .kb-article a:hover { color: var(--c-link-hover); text-decoration: none; }
  .kb-article .link { color: #1776ea; text-decoration: underline; }

  .kb-article ul { list-style: disc; }
  .kb-article ol { list-style: decimal; }
  .kb-article li { line-height: 2; margin-bottom: 1em; }
  .kb-article li:last-child { margin-bottom: 0; }
  .kb-article li > ul,
  .kb-article li > ol { margin-top: 1em; }

  .kb-article hr { border: 0; border-top: 1px solid var(--c-rule); margin: 3em 0; }

  /* hesk.css: code — серый фон, скруглённый */
  .kb-article code {
    font-family: var(--f-mono);
    font-size: .9em;
    background: #e8e8e8;
    border-radius: 3px;
    padding: .1rem .3rem;
    overflow-wrap: break-word;
  }

  /* hesk.css: pre переносит длинные строки, а не прокручивается */
  .kb-article pre {
    font-family: var(--f-mono);
    font-size: .85rem;
    line-height: 1.55;
    background: var(--c-paper-alt);
    border-left: 4px solid var(--c-rule);
    border-radius: 0 var(--radius) var(--radius) 0;
    padding: 1.2em 1.4em;
    margin: 2em 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-width: 100%;
  }
  .kb-article pre code { background: none; padding: 0; font-size: inherit; }

  /* ---------- Шаги (замена p.firstcap) ---------- */
  .kb-article ol.kb-steps {
    list-style: none;
    counter-reset: step;
    padding-left: 0;
  }
  .kb-article .kb-steps > li {
    counter-increment: step;
    position: relative;
    padding-left: 2.8rem;
    margin-bottom: 1.8em;
  }
  /* Вложенные в шаг блоки: код остаётся в колонке текста,
     иллюстрации и видео выходят на всю ширину статьи */
  .kb-article .kb-steps > li > pre { margin: 1.2em 0; }
  .kb-article .kb-steps > li > figure { margin-left: -2.8rem; width: calc(100% + 2.8rem); }
  .kb-article .kb-steps > li > :last-child { margin-bottom: 0; }
  .kb-article .kb-steps > li::before {
    content: counter(step) ".";
    position: absolute;
    left: 0;
    top: -.1em;
    width: 2rem;
    text-align: right;
    font-family: var(--f-ui);
    font-size: 1.5rem;
    font-weight: 200;
    color: var(--c-accent);
  }

  /* hesk.css: p.firstcap — буквица 30px, оранжевая, с выносом влево.
     clear обязателен: без него короткий абзац не закрывает float,
     и следующий пункт уезжает вправо лесенкой. */
  .kb-article p.firstcap,
  .kb-article p.dropcap { clear: both; }

  .kb-article p.firstcap::first-letter,
  .kb-article p.dropcap::first-letter {
    font: 30px var(--f-ui);
    font-weight: 200;
    color: var(--c-accent);
    float: left;
    margin: 0 20px;
  }

  /* ---------- Врезки ----------
     hesk.css: padding 28px, margin 32px 0, border-left 5px, тень.
     Подъём при наведении убран — в тексте статьи он мешает. */
  .kb-article .card,
  .kb-article .scenario,
  .kb-article .expert-box {
    background: var(--c-paper-alt);
    padding: 28px;
    margin: 32px 0;
    border-left: 5px solid var(--c-accent);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
  }
  .kb-article .scenario   { border-left-color: var(--c-teal); }
  .kb-article .expert-box { border-left-color: var(--c-blue); }

  .kb-article .card > :first-child,
  .kb-article .scenario > :first-child,
  .kb-article .expert-box > :first-child { margin-top: 0; }
  .kb-article .card > :last-child,
  .kb-article .scenario > :last-child,
  .kb-article .expert-box > :last-child { margin-bottom: 0; }

  .kb-article .card h3,
  .kb-article .scenario h2,
  .kb-article .scenario h3,
  .kb-article .expert-box h3 { margin-top: 0; }
  .kb-article .scenario h2,
  .kb-article .scenario h3 { color: var(--c-teal-deep); }
  .kb-article .expert-box h3 { color: var(--c-blue-deep); }

  /* hesk.css: .expert-name — серый курсив, отбивка 20px */
  .kb-article .expert-name {
    color: var(--c-ink-soft);
    font-size: .95rem;
    font-style: italic;
    margin-bottom: 20px;
  }

  /* hesk.css: .method-box — голубой фон без полосы слева */
  .kb-article .method-box {
    background: #f0f7ff;
    padding: 15px;
    border-radius: 4px;
    margin: 15px 0;
  }
  .kb-article .method-box h4 { margin: 0 0 8px; font-weight: 600; color: #0066cc; }
  .kb-article .method-box > :last-child { margin-bottom: 0; }

  /* hesk.css: .note — пунктирная рамка, толстая полоса слева */
  .kb-article .note {
    font-size: 90%;
    border: dashed 1px #f35924;
    border-left: solid var(--c-note) 5px;
    background: var(--c-note-bg);
    margin: 40px 40px 60px;
    padding: 15px;
  }
  /* Сноска — это разрыв мысли, поэтому отбивается от текста
     так же щедро, как блочный .note (в hesk.css было 10px и она липла). */
  .kb-article p.note {
    border: 0;
    border-left: 5px solid var(--c-note);
    background: var(--c-note-bg);
    margin: 2.5em 30px 3em;
    padding: 15px 20px;
    font-size: .9rem;
  }
  .kb-article .note > :first-child { margin-top: 0; }
  .kb-article .note > :last-child { margin-bottom: 0; }

  .kb-article .legal-box {
    margin-top: 2em;
    padding: 1em 1.2em;
    border-left: 4px solid #ccc;
    background: #f9f9f9;
    border-radius: 6px;
    font-size: .85em;
    color: #555;
    line-height: 1.4;
  }
  .kb-article .legal-box p { margin: 0; font-size: inherit; }

  .kb-article blockquote {
    border-left: 4px solid var(--c-teal);
    padding-left: 1.5em;
    margin: 2em 0;
    font-style: italic;
    color: var(--c-ink-soft);
  }
  .kb-article blockquote footer {
    margin-top: .6em;
    font-style: normal;
    font-size: .85rem;
    text-align: right;
  }

  /* ---------- FAQ ----------
     hesk.css: рамка #e9eaec, шапка #fafafa, треугольник слева, плюс справа. */
  .kb-article .dropout {
    border: 1px solid #e9eaec;
    border-radius: 3px;
    margin-bottom: 12px;
    background: var(--c-paper);
    overflow: hidden;
  }

  .kb-article .dropout > summary {
    display: block;
    list-style: none;
    position: relative;
    padding: 16px 50px 16px 44px;
    cursor: pointer;
    background: #fafafa;
    font-weight: 600;
    color: #1776ea;
    line-height: 1.4;
    transition: background-color .2s, color .2s;
  }
  .kb-article .dropout > summary::-webkit-details-marker { display: none; }
  .kb-article .dropout > summary span { text-decoration: underline; }

  .kb-article .dropout > summary::before {
    content: "\25B6";
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: .8em;
    color: #1776ea;
  }
  .kb-article .dropout > summary::after {
    content: "+";
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5em;
    font-weight: 700;
    line-height: 1;
    color: #1776ea;
  }

  .kb-article .dropout[open] > summary {
    background: #e9eaec;
    border-radius: 3px 3px 0 0;
    color: var(--c-blue);
  }
  .kb-article .dropout[open] > summary::before { content: "\25BC"; color: var(--c-blue); }
  .kb-article .dropout[open] > summary::after  { content: "\2212"; color: var(--c-blue); }

  /* Заголовок внутри summary — строка аккордеона */
  .kb-article .dropout > summary h3,
  .kb-article .dropout > summary h4 {
    display: inline;
    margin: 0;
    font: inherit;
    color: inherit;
    text-decoration: underline;
  }

  .kb-article .dropout-content { padding: 20px 16px; }
  .kb-article .dropout-content > :first-child { margin-top: 0; }
  .kb-article .dropout-content > :last-child { margin-bottom: 0; }

  /* ---------- Скриншоты ----------
     hesk.css: img.shot — 400px, курсор лупы; зум через модалку в js.js */
  /* Пока src не подставлен, картинка держит место — иначе страница прыгает.
     opacity:0 из hesk.css не переношу: без JS изображение пропадало бы совсем. */
  .kb-article img.lazy {
    min-height: 100px;
    background: var(--c-paper-alt) url("/img/placeholder.webp") center center no-repeat;
  }

  .kb-article .win-shadow { filter: drop-shadow(0 4px 12px rgba(0, 0, 0, .55)); }

  .kb-article img.shot {
    max-width: 400px;
    width: auto;
    cursor: zoom-in;
  }

  /* ---------- Таблицы ----------
     Оранжевая рамка и полоса слева — от .browser-default table;
     геометрия и кегли — от .tblfrmt. Подсветка идёт по нечётным
     КОЛОНКАМ, как в оригинале, а не по строкам. */
  .kb-table-scroll { overflow-x: auto; margin: 2em 0; max-width: 100%; }

  .kb-article table {
    width: 95%;
    max-width: 100%;
    margin: 2em auto;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    font-size: 1rem;
    border: dashed 1px #f35924;
    border-left: solid var(--c-accent) 5px;
  }
  .kb-article figure > table { margin: 0 auto; }
  .kb-table-scroll > table { margin: 0 auto; }

  .kb-article thead th {
    padding: 8px;
    font-size: .8em;
    font-weight: 700;
    color: #1a2b3c;
    text-align: center;
    background: var(--c-paper);
    border-bottom: 1px solid var(--c-rule);
    border-right: 1px solid var(--c-rule);
  }
  .kb-article thead th:last-child { border-right: 0; }

  .kb-article tbody td {
    padding: 8px 10px;
    font-size: .9em;
    vertical-align: middle;
    text-align: center;
    line-height: 1.6;
    border-bottom: 1px solid var(--c-rule);
  }
  .kb-article tbody td:nth-child(odd) { background: var(--c-table-alt); }

  .kb-article .first-col-bg tbody td:first-child {
    background: var(--c-table-alt);
    padding-left: 10px;
    text-align: left;
    font-weight: 700;
    font-size: .8em;
    color: #1a2b3c;
  }
  .kb-article tr.left > td { text-align: left; }
  .kb-article td.cntr { text-align: center; }
  .kb-article td.wht { background: var(--c-paper); }
  .kb-article td.gry { background: var(--c-table-alt); }

  /* ---------- Карточки продуктов ---------- */
  .kb-article .tool-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
    gap: 24px;
    margin: 20px 0;
  }
  .kb-article .tool-card {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--c-rule);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--c-paper);
    box-shadow: 0 2px 6px rgba(0, 0, 0, .08);
    margin: 0;
  }
  .kb-article .tool-card img { width: 100%; height: auto; display: block; }
  .kb-article .tool-card figcaption {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    padding: 0 16px 16px;
    text-align: center;
  }
  .kb-article .tool-card h4 { margin: 0 0 6px; font-size: 1.15rem; text-align: center; }
  .kb-article .tool-card .description {
    margin: 0 0 16px;
    font-size: .95rem;
    color: #555;
    line-height: 1.4;
  }
  .kb-article .meta-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px 20px;
    margin-top: auto;
  }
  .kb-article .meta-line .btn {
    padding: 8px 16px;
    background: var(--c-teal);
    color: #fff;
    border-radius: 8px;
    font-size: .95rem;
    text-decoration: none;
    white-space: nowrap;
  }
  .kb-article .meta-line .btn:hover { background: var(--c-teal-deep); color: #fff; }
  .kb-article .version-info { font-size: .9rem; color: #777; }

  /* ---------- Блок автора ----------
     Геометрия из исходной разметки: 90% по центру, отступ 45px. */
  .kb-author {
    width: 90%;
    background: #e9f1f7;
    border: 1px solid #92afc5;
    padding: 20px;
    margin: 45px auto;
    font-family: var(--f-read);
    font-size: .95rem;
    line-height: 1.8;
    color: var(--c-ink);
  }
  .kb-author h2 {
    margin: 0 0 1em;
    font-size: 1.45rem;
    font-weight: 300;
    color: var(--c-accent);
  }
  .kb-author__row { display: flex; gap: 15px; flex-wrap: wrap; align-items: flex-start; }
  .kb-author__pic { flex-shrink: 0; width: 64px; height: 64px; border-radius: 50%; }
  .kb-author__text { flex: 1; min-width: 260px; }
  .kb-author p { margin: 0 0 .9em; line-height: 1.8; }
  .kb-author p:last-child { margin-bottom: 0; }

  .kb-author__links { display: flex; gap: .5rem; align-items: center; margin-top: 1.2em; }
  .kb-author__links a { display: inline-flex; border: 0; text-decoration: none; }
  .kb-author__links img { display: block; }

  /* ---------- Адаптив (hesk.css) ---------- */
  @media screen and (max-width: 1020px) {
    .kb-article img { max-width: 100%; }
  }
  @media screen and (max-width: 40rem) {
    .kb-article .note { margin: 30px 0 40px; }
    .kb-article table { width: 100%; display: block; overflow-x: auto; }
    .kb-author { width: 100%; }
    .kb-author__row { flex-direction: column; }
  }
}

@layer utilities {
  /* Модалка картинки — разметку создаёт js.js (как на сайте).
     На сайте оформление берётся из overlay.css, у полигона своё. */
  .modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(0, 0, 0, .75);
    overflow: auto;
  }
  .modal-content {
    position: relative;
    max-width: 95vw;
    margin: 3vh auto;
    text-align: center;
  }
  .modal-image { max-width: 95vw; max-height: 90vh; width: auto; height: auto; }
  .modal .close-btn {
    position: fixed;
    top: 1rem;
    right: 1rem;
    width: 2.5rem;
    height: 2.5rem;
    border: 0;
    border-radius: var(--radius);
    background: var(--c-accent);
    color: #fff;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
  }

  .visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .text-center { text-align: center; }
  .font110 { font-size: 110%; font-weight: 600; }
}