/* Общие стили раздела статей. Токены совпадают с лендингом (public/index.html). */
:root {
  --bg: #EDF1F6;
  --surface: #FFFFFF;
  --ink: #0F1E33;
  --ink-2: #33445C;
  --muted: #5B6B82;
  --line: #D6DEE9;
  --tg: #2AABEE;
  --tg-deep: #1580C4;
  --tg-soft: #E3F3FC;
  --signal: #FFE27A;
  --out: #E1F5D3;
  --danger: #C23B3B;

  --display: "Unbounded", "Arial Black", sans-serif;
  --body: "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;

  --wrap: 1160px;
  --read: 720px;
  --gutter: clamp(16px, 4vw, 40px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.6 var(--body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--tg-deep); }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--tg); outline-offset: 3px; border-radius: 6px; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }

/* ——— Шапка и подвал ——— */
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 22px; padding-bottom: 22px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: var(--display); font-weight: 700; font-size: 19px; letter-spacing: -0.03em; }
.logo:hover { color: var(--ink); }
.logo-mark { width: 32px; height: 32px; }
.top-nav { display: flex; align-items: center; gap: 22px; }
.top-nav-link { font-weight: 600; font-size: 15px; color: var(--ink-2); text-decoration: none; }
.top-nav-link:hover, .top-nav-link[aria-current] { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }
.top-link { font-weight: 600; font-size: 15px; text-decoration: none; color: var(--ink); padding: 10px 16px; border-radius: 999px; border: 1.5px solid var(--ink); }
.top-link:hover { background: var(--ink); color: #fff; }

.foot { margin-top: 96px; padding-top: 36px; padding-bottom: 48px; display: flex; flex-wrap: wrap; gap: 12px 32px; justify-content: space-between; color: var(--muted); font-size: 14px; border-top: 1px solid var(--line); }
.foot nav { display: flex; flex-wrap: wrap; gap: 8px 24px; }
.foot a { color: var(--muted); }

.btn {
  appearance: none; border: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font: 600 17px/1 var(--body);
  padding: 18px 26px; border-radius: 14px;
  background: var(--tg); color: #fff; text-decoration: none;
  box-shadow: 0 1px 0 rgba(255,255,255,.35) inset, 0 8px 22px -10px rgba(21,128,196,.8);
  transition: background .15s ease, transform .15s ease;
}
.btn:hover { background: var(--tg-deep); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .65; cursor: progress; }

/* ——— Список статей ——— */
.blog-head { padding-top: clamp(24px, 5vw, 56px); padding-bottom: 40px; max-width: 760px; }
.blog-head h1 { margin: 0; font: 600 clamp(30px, 4vw, 46px)/1.1 var(--display); letter-spacing: -0.02em; }
.blog-head p { margin: 18px 0 0; font-size: 18px; color: var(--ink-2); }
.posts { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 24px; }
.post-card { display: flex; flex-direction: column; height: 100%; background: var(--surface); border-radius: 20px; box-shadow: 0 1px 0 var(--line); overflow: hidden; text-decoration: none; color: var(--ink); transition: box-shadow .2s ease, transform .2s ease; }
.post-card:hover { color: var(--ink); box-shadow: 0 1px 0 var(--line), 0 24px 40px -28px rgba(15,30,51,.45); transform: translateY(-2px); }
.post-card img { width: 100%; height: auto; aspect-ratio: 1200 / 630; object-fit: cover; background: var(--tg-soft); }
.post-card-body { padding: 22px 24px 26px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.post-card h2 { margin: 0; font: 600 20px/1.25 var(--display); letter-spacing: -0.01em; }
.post-card p { margin: 0; color: var(--muted); font-size: 16px; }
.post-meta { margin-top: auto; padding-top: 6px; font-size: 14px; color: var(--muted); }

/* ——— Статья ——— */
.crumbs { padding-top: 8px; font-size: 14px; color: var(--muted); }
.crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.crumbs li:not(:last-child)::after { content: "/"; margin-left: 6px; color: var(--line); }
.crumbs a { color: var(--muted); }

.article { max-width: var(--read); margin: 0 auto; }
.article-head { padding-top: 28px; }
.article h1 { margin: 0; font: 600 clamp(28px, 4.2vw, 44px)/1.12 var(--display); letter-spacing: -0.02em; }
.article-lead { margin: 22px 0 0; font-size: clamp(18px, 2vw, 20px); line-height: 1.55; color: var(--ink-2); }
.article-meta { margin-top: 18px; font-size: 14px; color: var(--muted); }

.prose { margin-top: 40px; font-size: 18px; line-height: 1.7; }
.prose > * + * { margin-top: 1.1em; }
.prose p, .prose ul, .prose ol { margin-bottom: 0; }
.prose h2 { margin: 2.2em 0 0; font: 600 clamp(23px, 2.8vw, 30px)/1.2 var(--display); letter-spacing: -0.02em; scroll-margin-top: 24px; }
.prose h3 { margin: 1.8em 0 0; font: 600 21px/1.3 var(--body); scroll-margin-top: 24px; }
.prose h2 + *, .prose h3 + * { margin-top: .6em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: .45em; }
.prose li::marker { color: var(--tg-deep); font-weight: 600; }
.prose strong { font-weight: 600; }
.prose figure { margin-left: 0; margin-right: 0; }

.toc { margin-top: 36px; padding: 22px 26px; background: var(--surface); border-radius: 18px; box-shadow: 0 1px 0 var(--line); }
.toc b { font-size: 15px; }
.toc ol { margin: 10px 0 0; padding-left: 1.2em; font-size: 16px; line-height: 1.5; }
.toc li + li { margin-top: 6px; }
.toc a { color: var(--ink-2); text-decoration: none; }
.toc a:hover { color: var(--tg-deep); text-decoration: underline; }

.table-wrap { overflow-x: auto; border-radius: 16px; background: var(--surface); box-shadow: 0 1px 0 var(--line); }
.prose table { width: 100%; border-collapse: collapse; font-size: 16px; line-height: 1.45; min-width: 520px; }
.prose th, .prose td { padding: 14px 18px; text-align: left; vertical-align: top; border-top: 1px solid var(--line); }
.prose thead th { border-top: 0; background: #F6F8FB; font-size: 14px; color: var(--muted); font-weight: 600; }
.prose thead th.us { background: #D2ECFA; color: var(--ink); }
.prose td.us { background: var(--tg-soft); }
.prose tbody th { font-weight: 600; width: 30%; }

.note { padding: 18px 22px; border-radius: 16px; background: var(--surface); box-shadow: inset 4px 0 0 var(--tg); font-size: 17px; }
.note.warn { box-shadow: inset 4px 0 0 var(--signal); }
.note p { margin: 0; }
.note p + p { margin-top: .6em; }

/* Схема синхронизации */
.sync { padding: 22px; border-radius: 18px; background: var(--surface); box-shadow: 0 1px 0 var(--line); display: grid; gap: 14px; }
.sync-row { display: grid; grid-template-columns: minmax(0, 1fr) 44px minmax(0, 1fr); align-items: center; gap: 10px; }
.sync-node { padding: 12px 14px; border-radius: 12px; font-size: 15px; line-height: 1.35; background: #F1F4F8; }
.sync-node b { display: block; font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 2px; }
.sync-node.crm { background: var(--tg-soft); }
.sync-arrow { height: 2px; background: var(--tg); position: relative; }
.sync-arrow::after { content: ""; position: absolute; right: -1px; top: -5px; border: 6px solid transparent; border-left: 8px solid var(--tg); border-right: 0; }
.sync figcaption { font-size: 14px; color: var(--muted); margin-top: 4px; }

/* Шаги подключения */
.howto { list-style: none; padding: 0 !important; counter-reset: s; display: grid; gap: 0; }
.howto > li { counter-increment: s; position: relative; padding: 0 0 28px 64px; margin: 0 !important; }
.howto > li::before {
  content: counter(s); position: absolute; left: 0; top: 0;
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  background: var(--ink); color: #fff; font: 600 17px/1 var(--display);
}
.howto > li:not(:last-child)::after { content: ""; position: absolute; left: 21px; top: 50px; bottom: 6px; width: 2px; background: repeating-linear-gradient(180deg, var(--tg) 0 8px, transparent 8px 14px); }
.howto h3 { margin: 8px 0 0 !important; font: 600 20px/1.35 var(--body); }
.howto p { margin: 6px 0 0; }

/* Блок с призывом */
.cta { margin-top: 2.4em; padding: clamp(24px, 4vw, 36px); border-radius: 22px; background: var(--ink); color: #fff; display: grid; gap: 14px; }
.cta h2, .cta .cta-title { margin: 0; font: 600 clamp(22px, 2.6vw, 28px)/1.2 var(--display); letter-spacing: -0.02em; color: #fff; }
.cta p { margin: 0; color: #B9C6D8; font-size: 17px; }
.cta .btn { justify-self: start; margin-top: 6px; }

/* FAQ */
.faq-list details { border-top: 1px solid var(--line); }
.faq-list details:last-child { border-bottom: 1px solid var(--line); }
.faq-list summary { list-style: none; cursor: pointer; padding: 18px 40px 18px 0; font-weight: 600; font-size: 18px; position: relative; }
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after { content: ""; position: absolute; right: 6px; top: 50%; width: 11px; height: 11px; margin-top: -8px; border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink); transform: rotate(45deg); transition: transform .2s ease; }
.faq-list details[open] summary::after { transform: rotate(-135deg); margin-top: -2px; }
.faq-list details p { margin: 0 0 20px; color: var(--ink-2); }

/* ——— Комментарии ——— */
.comments { max-width: var(--read); margin: 80px auto 0; }
.comments h2 { margin: 0; font: 600 clamp(22px, 2.6vw, 28px)/1.2 var(--display); letter-spacing: -0.02em; }
.comment-list { list-style: none; margin: 24px 0 0; padding: 0; display: grid; gap: 14px; }
.comment { padding: 18px 20px; border-radius: 16px; background: var(--surface); box-shadow: 0 1px 0 var(--line); }
.comment-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.comment-head b { font-weight: 600; }
.comment-head time { font-size: 14px; color: var(--muted); }
.comment p { margin: 8px 0 0; white-space: pre-line; overflow-wrap: anywhere; }
.comments-empty { margin: 16px 0 0; color: var(--muted); }

.comment-form { margin-top: 28px; padding: clamp(20px, 3vw, 28px); border-radius: 20px; background: var(--surface); box-shadow: 0 1px 0 var(--line); }
.comment-form h3 { margin: 0; font: 600 19px/1.3 var(--body); }
.field-row { margin-top: 16px; }
.field-row label { display: block; font-weight: 600; font-size: 15px; margin-bottom: 7px; }
.field-row input, .field-row textarea {
  width: 100%; font: 400 17px/1.45 var(--body); color: var(--ink);
  padding: 13px 15px; border-radius: 12px; border: 1.5px solid var(--line); background: #F8FAFC;
}
.field-row textarea { min-height: 130px; resize: vertical; }
.field-row input:focus, .field-row textarea:focus { outline: none; border-color: var(--tg); background: #fff; box-shadow: 0 0 0 4px var(--tg-soft); }
.field-row [aria-invalid="true"] { border-color: var(--danger); }
.field-error { margin: 6px 0 0; font-size: 14px; color: var(--danger); display: none; }
.field-row [aria-invalid="true"] ~ .field-error { display: block; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.form-foot { margin-top: 18px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; }
.form-note { margin: 0; font-size: 13.5px; color: var(--muted); max-width: 30em; }
.form-status { margin: 12px 0 0; font-size: 15px; }
.form-status.ok { color: #2F6B14; }
.form-status.err { color: var(--danger); }

@media (max-width: 640px) {
  body { font-size: 16px; }
  .top-nav { gap: 14px; }
  .top-link { padding: 8px 12px; font-size: 14px; }
  .prose { font-size: 17px; }
  .sync-row { grid-template-columns: 1fr; gap: 6px; }
  .sync-arrow { width: 2px; height: 18px; justify-self: center; }
  .sync-arrow::after { right: -5px; top: auto; bottom: -1px; border: 6px solid transparent; border-top: 8px solid var(--tg); border-bottom: 0; }
  .howto > li { padding-left: 56px; }
}

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

/* The approved product name must fit on small screens. */
.top { flex-wrap: wrap; }
.logo { font-family: var(--body); font-size: clamp(17px, 2.5vw, 22px); line-height: 1.3; }
.logo-mark { flex-shrink: 0; }
.top-nav { flex-wrap: wrap; }
