/* Zamena — современный mobile-first CSS без фронтенд-билда (ТЗ §6: скорость).
   Дизайн-токены + светлая/тёмная темы. Один файл, без зависимостей. */

:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f5f7fa;
  --fg: #141821;
  --fg-soft: #38414f;
  --muted: #69727f;
  --border: #e7e9ee;
  --border-strong: #d4d8e0;
  --accent: #2f5bff;
  --accent-700: #1e44d8;
  --accent-soft: #eef2ff;
  --accent-ink: #ffffff;
  --ok-bg: #e7f6ec;
  --ok-fg: #137a3a;
  --ok-bd: #bfe6cd;
  --bad-bg: #fdeceb;
  --bad-fg: #c5392b;
  --bad-bd: #f4c6c1;

  --max: 940px;
  --read: 720px;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(20, 24, 33, .04), 0 1px 3px rgba(20, 24, 33, .06);
  --shadow-md: 0 4px 12px rgba(20, 24, 33, .08), 0 2px 4px rgba(20, 24, 33, .04);
  --shadow-lg: 0 12px 32px rgba(20, 24, 33, .12);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0f15;
    --surface: #11151d;
    --surface-2: #161b25;
    --fg: #e8ebf1;
    --fg-soft: #c2c8d2;
    --muted: #98a1b0;
    --border: #232a36;
    --border-strong: #2e3745;
    --accent: #6f8dff;
    --accent-700: #5878ff;
    --accent-soft: #18203a;
    --accent-ink: #0c0f15;
    --ok-bg: #122a1c;
    --ok-fg: #59c98a;
    --ok-bd: #1f4733;
    --bad-bg: #2c1614;
    --bad-fg: #e8746b;
    --bad-bd: #492421;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
    --shadow-md: 0 6px 18px rgba(0,0,0,.5);
    --shadow-lg: 0 16px 40px rgba(0,0,0,.6);
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--accent); color: var(--accent-ink); }

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

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

img, svg, table { max-width: 100%; }

/* ── Шапка ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.site-header > * { } /* контейнерим внутренним враппером ниже */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .85rem 1.25rem;
  max-width: var(--max);
  margin: 0 auto;
}
.logo {
  font-weight: 800;
  font-size: 1.3rem;
  letter-spacing: -.02em;
  color: var(--fg);
  display: inline-flex;
  align-items: center;
  gap: .5rem;
}
.logo::before {
  content: "";
  width: .7rem; height: .7rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #7aa2ff);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.logo:hover { text-decoration: none; }
.site-header nav { display: flex; gap: 1.5rem; font-weight: 550; font-size: .98rem; }
.site-header nav a { color: var(--fg-soft); }
.site-header nav a:hover { color: var(--accent); text-decoration: none; }

/* ── Основной контейнер ── */
main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 2.5rem 1.25rem 3rem;
}

/* ── Типографика ── */
h1 {
  font-size: clamp(1.9rem, 1.3rem + 2.4vw, 2.6rem);
  line-height: 1.15;
  letter-spacing: -.03em;
  margin: 0 0 1rem;
  font-weight: 800;
}
h2 {
  font-size: clamp(1.35rem, 1.1rem + 1vw, 1.7rem);
  line-height: 1.25;
  letter-spacing: -.02em;
  margin: 2.6rem 0 1rem;
  font-weight: 750;
}
h3 { font-size: 1.2rem; line-height: 1.3; margin: 1.8rem 0 .6rem; font-weight: 700; letter-spacing: -.01em; }
p { margin: 0 0 1.1rem; }
.tagline { color: var(--muted); font-size: 1.2rem; margin-top: -.4rem; }

/* ── Бейдж реестра ── */
.badge.reestr {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: var(--ok-bg);
  color: var(--ok-fg);
  border: 1px solid var(--ok-bd);
  padding: .35rem .75rem;
  border-radius: 999px;
  font-size: .9rem;
  font-weight: 600;
}
.badge.reestr span { color: var(--muted); font-weight: 500; }

/* Бейдж развёртывания - нейтральный: это факт, а не достоинство,
   поэтому без зелёного акцента реестра. */
.badge.deployment {
  display: inline-flex;
  align-items: center;
  padding: .35rem .75rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: .9rem;
  color: var(--muted);
}

/* ── Кнопки / ссылки ── */
.cta {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  background: var(--accent);
  color: var(--accent-ink);
  padding: .8rem 1.4rem;
  border-radius: var(--radius-sm);
  font-weight: 650;
  letter-spacing: -.01em;
  margin: 1rem 0;
  box-shadow: var(--shadow-sm);
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.cta:hover {
  text-decoration: none;
  background: var(--accent-700);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.cta:active { transform: translateY(0); }
.link { color: var(--muted); word-break: break-all; font-size: .95rem; }

/* ── Таблицы (современный «docs»-стиль: горизонтальные разделители) ── */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: .96rem;
  background: var(--surface);
}
th, td {
  padding: .7rem .85rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
thead th {
  background: var(--surface-2);
  color: var(--fg);
  font-weight: 650;
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  border-bottom: 2px solid var(--border-strong);
  position: sticky;
  top: 0;
}
tbody tr { transition: background .1s ease; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: none; }
.compare td:first-child, .pricing td:first-child, .versus td:first-child { font-weight: 650; }
/* данные сравнения центруем, первый столбец оставляем слева */
.compare td:not(:first-child),
.compare th:not(:first-child),
.versus td:not(:first-child),
.versus th:not(:first-child) { text-align: center; }

/* ── Редакторский текст ── */
.editorial { color: var(--fg-soft); line-height: 1.78; }
.editorial :first-child { margin-top: 0; }
.editorial p { margin: 0 0 1.35rem; }
.editorial h2, .editorial h3 { color: var(--fg); }
.editorial h2 { margin-top: 2.8rem; }
.editorial h3 { margin-top: 2rem; }
.editorial ul, .editorial ol { margin: 0 0 1.4rem; padding-left: 1.3rem; }
.editorial li { margin: .5rem 0; }
.editorial ul li::marker { color: var(--accent); }
.editorial strong { color: var(--fg); font-weight: 700; }
.editorial a { font-weight: 550; }

/* Лид-абзац статьи: крупнее, задаёт ритм и «вход по делу» (как у StormFox). */
.post .editorial > p:first-of-type {
  font-size: 1.2rem;
  line-height: 1.7;
  color: var(--fg);
  margin-bottom: 1.7rem;
}

/* Плюсы/минусы — компактные чек-листы карточками вместо плотного списка. */
.editorial ul.pros, .editorial ul.cons {
  list-style: none;
  padding: 1rem 1.2rem;
  margin: .6rem 0 1.6rem;
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: var(--radius-sm);
}
.editorial ul.pros { background: var(--ok-bg); border-color: var(--ok-bd); border-left-color: var(--ok-fg); }
.editorial ul.cons { background: var(--bad-bg); border-color: var(--bad-bd); border-left-color: var(--bad-fg); }
.editorial ul.pros li, .editorial ul.cons li {
  position: relative;
  padding-left: 1.7rem;
  margin: .5rem 0;
  color: var(--fg);
}
.editorial ul.pros li::marker, .editorial ul.cons li::marker { content: ""; }
.editorial ul.pros li::before, .editorial ul.cons li::before {
  position: absolute; left: 0; top: 0; font-weight: 800;
}
.editorial ul.pros li::before { content: "✓"; color: var(--ok-fg); }
.editorial ul.cons li::before { content: "✕"; color: var(--bad-fg); }
.editorial blockquote {
  margin: 1.4rem 0;
  padding: .9rem 1.2rem;
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  color: var(--fg-soft);
}
.editorial blockquote :last-child { margin-bottom: 0; }
.editorial code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .1rem .4rem;
  font-size: .9em;
}
.editorial hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }

/* ── Статья (пост) ── */
article.post { max-width: var(--read); margin: 0 auto; }
article.post > h1 { margin-bottom: 1.4rem; }
.post-back {
  margin-top: 2.5rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--border);
  font-weight: 550;
}

/* ── Карточки аналогов ── */
.alt-list { display: grid; gap: 1rem; margin-top: 1.5rem; }
.alt-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: box-shadow .15s ease, transform .15s ease, border-color .15s ease;
}
.alt-item:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--border-strong); }
.alt-item h3 { margin-top: 0; }
.alt-item .diff { color: var(--muted); margin-bottom: .6rem; }

/* ── Versus CTA ── */
.versus-cta { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 1.5rem; }

/* ── Витрина материалов /posts/ ── */
.post-group { margin-bottom: 2.5rem; }
.post-group > h2 {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 1.1rem;
}
.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1rem;
}
.post-list li {
  position: relative; /* для растянутой ссылки (кликабельна вся карточка) */
  display: flex;
  flex-direction: column;
  gap: .5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: box-shadow .15s ease, transform .15s ease, border-color .15s ease;
}
.post-list li:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); border-color: var(--accent); }
.post-list li:has(a:focus-visible) { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.post-list li > a {
  font-weight: 700;
  font-size: 1.08rem;
  letter-spacing: -.01em;
  line-height: 1.3;
  color: var(--fg);
}
.post-list li > a:hover { color: var(--accent); text-decoration: none; }
/* растянутая ссылка: невидимый слой заголовочной ссылки покрывает всю карточку,
   поэтому переход срабатывает по клику в любом месте (включая аннотацию). */
.post-list li > a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); z-index: 1; }
.post-list li:hover > a { color: var(--accent); }
.post-excerpt { color: var(--muted); font-size: .92rem; line-height: 1.55; }

/* ── Главная (лендинг) ── */
.hero {
  padding: 1.5rem 0 2.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2.5rem;
}
.hero h1 { margin-bottom: 1rem; max-width: 16ch; }
.hero-sub {
  font-size: clamp(1.05rem, 1rem + .5vw, 1.3rem);
  color: var(--muted);
  max-width: 60ch;
  margin: 0;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1.8rem; }
.cta-ghost {
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--border-strong);
  box-shadow: none;
}
.cta-ghost:hover { background: var(--surface-2); color: var(--accent); border-color: var(--accent); }

.cat-list {
  list-style: none; margin: 0 0 1rem; padding: 0;
  display: flex; flex-wrap: wrap; gap: .6rem;
}
.cat-list a {
  display: inline-block;
  padding: .5rem 1.1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--fg-soft);
  font-weight: 600;
  font-size: .95rem;
}
.cat-list a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

.section-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  margin: 2.6rem 0 1rem;
}
.section-head h2 { margin: 0; }
.section-more { font-weight: 600; white-space: nowrap; }

/* ── Поиск по материалам ── */
.search-wrap { margin: 0 0 1.5rem; }
.search-input {
  width: 100%;
  padding: .85rem 1.1rem;
  font: inherit;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  transition: border-color .12s ease, box-shadow .12s ease;
}
.search-input::placeholder { color: var(--muted); }
.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.search-empty { color: var(--muted); font-size: 1.05rem; }

[hidden] { display: none !important; }

/* ── Хлебные крошки ── */
.breadcrumbs {
  max-width: var(--read);
  margin: 0 auto 1.5rem;
  font-size: .9rem;
  color: var(--muted);
  display: flex; flex-wrap: wrap; gap: .4rem; align-items: center;
}
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs .sep { color: var(--border-strong); }
.breadcrumbs .current { color: var(--fg-soft); }

/* ── CTA-блок в посте ── */
.post-cta {
  margin: 2.8rem 0 0;
  padding: 1.4rem 1.5rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.post-cta h2 { margin: 0 0 1rem; font-size: 1.15rem; }
.cta-row { display: flex; flex-wrap: wrap; gap: .7rem; }
.cta-row .cta { margin: 0; }

/* ── Оглавление поста ── */
.toc {
  margin: 0 0 2.2rem;
  padding: 1.1rem 1.3rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.toc-title {
  margin: 0 0 .6rem;
  font-size: .78rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 700;
}
.toc ul { margin: 0; padding-left: 1.1rem; }
.toc li { margin: .35rem 0; }
.toc a { color: var(--fg-soft); font-weight: 500; }
.toc a:hover { color: var(--accent); }
/* якорь не прячется под липкой шапкой при переходе из оглавления */
.editorial h2, .editorial h3 { scroll-margin-top: 5rem; }

/* ── «Читайте также» ── */
.related { margin-top: 3rem; }
.related h2 { margin-bottom: 1.2rem; }

/* ── Поиск в шапке ── */
.header-search { display: flex; }
.header-search input {
  font: inherit; font-size: .9rem; color: var(--fg);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 999px; padding: .42rem .95rem; width: 9rem;
  transition: width .15s ease, border-color .12s ease, box-shadow .12s ease;
}
.header-search input::placeholder { color: var(--muted); }
.header-search input:focus {
  outline: none; width: 12rem;
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
@media (max-width: 720px) { .header-search { display: none; } }

/* ── Подвал ── */
.site-footer {
  max-width: var(--max);
  margin: 3rem auto 0;
  padding: 1.75rem 1.25rem 2.5rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: .92rem;
}

/* ── Адаптив ── */
@media (max-width: 640px) {
  body { font-size: 16px; }
  main { padding: 1.75rem 1rem 2.5rem; }
  .site-header { padding: .75rem 1rem; }
  .site-header nav { gap: 1.1rem; }
  /* широкие таблицы — горизонтальный скролл */
  table { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
  thead th { position: static; }
}
