/* Лендинг и страница демо: одна палитра, светлая и тёмная темы.

   Светлая: фон #f6f7f9, поверхности #ffffff, текст #161a23, акцент #3358d4.
   Тёмная:  фон #0f1218, поверхности #171b23, текст #e8ebf1, акцент #7a9bff. */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #161a23;
  --muted: #5d6577;
  --accent: #3358d4;
  --accent-soft: #e8edfb;
  --border: #e3e6ec;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1218;
    --surface: #171b23;
    --text: #e8ebf1;
    --muted: #9aa3b5;
    --accent: #7a9bff;
    --accent-soft: #232a3a;
    --border: #2a3040;
  }
}

:root[data-theme="dark"] {
  --bg: #0f1218;
  --surface: #171b23;
  --text: #e8ebf1;
  --muted: #9aa3b5;
  --accent: #7a9bff;
  --accent-soft: #232a3a;
  --border: #2a3040;
}

:root[data-theme="light"] {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #161a23;
  --muted: #5d6577;
  --accent: #3358d4;
  --accent-soft: #e8edfb;
  --border: #e3e6ec;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 -apple-system, "Segoe UI", Roboto, sans-serif;
}

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

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

/* Шапка: знак-башня, разделы, CTA. На лендинге шапка липкая. */
.topbar-band {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 14px 0;
}
/* Размеры шапки — как у Протокола: при переключении продуктов знак и
   переключатель остаются на месте. */
.topbar.wrap { max-width: 1080px; padding: 0 16px; height: 56px; gap: 12px; }
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
/* Знак семейства: «БАСТИОН» мелко над названием продукта (как у Протокола). */
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--text); white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand-mark { width: 28px; height: 28px; flex: none; }
.brand-mark .tower { fill: var(--accent); }
.brand-mark .gate { fill: var(--bg); }
.brand-mark .window { fill: #c2410c; }
:root[data-theme="dark"] .brand-mark .window { fill: #fb923c; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand-mark .window { fill: #fb923c; }
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-family {
  font-size: 10px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--muted);
}
/* Ширина подписи — как у «Протокола», чтобы переключатель продуктов стоял
   на одном месте на обоих сайтах. */
.brand-name { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; min-width: 4.75em; }
@media (max-width: 640px) { .brand-name { font-size: 16px; } }
.top-nav { display: flex; align-items: center; gap: 4px; }
.top-nav a { font-size: 14px; white-space: nowrap; }
.top-nav .nav-link { color: var(--muted); padding: 7px 12px; border-radius: 8px; }
.top-nav .nav-link:hover { color: var(--text); background: var(--accent-soft); text-decoration: none; }
.top-nav .cta-sm { margin-left: 8px; }
@media (max-width: 1060px) { .top-nav .nav-link { display: none; } }
/* Телефон: знак, переключатель продуктов; «Запросить цену» — сразу под шапкой. */
@media (max-width: 520px) { .top-nav .cta-sm { display: none; } }
@media (max-width: 380px) {
  .topbar.wrap, .topbar-left { gap: 8px; }
  .brand { gap: 8px; }
  .brand-name { font-size: 15px; }
}

/* Переключатель продуктов «Бастиона»: одинаковый на сайтах Чата и Протокола. */
.bx-products{display:inline-flex;align-items:center;gap:2px;padding:3px;border-radius:999px;background:var(--bx-track);border:1px solid var(--bx-line);flex:none}
.bx-product{padding:5px 14px;border-radius:999px;font-size:14px;font-weight:600;line-height:1.3;color:var(--bx-muted);text-decoration:none;white-space:nowrap}
.bx-product:hover{color:var(--bx-ink);text-decoration:none}
.bx-product[aria-current="page"]{background:var(--bx-active);color:var(--bx-active-ink);box-shadow:0 1px 2px rgba(16,24,40,.08)}
:root{--bx-track:#eef0f4;--bx-line:#e3e6ec;--bx-muted:#5d6577;--bx-ink:#161a23;--bx-active:#ffffff;--bx-active-ink:#3358d4}
@media (prefers-color-scheme: dark){:root:not([data-theme="light"]){--bx-track:#1d222c;--bx-line:#2a3040;--bx-muted:#9aa3b5;--bx-ink:#e8ebf1;--bx-active:#2a3142;--bx-active-ink:#a9bfff}}
:root[data-theme="dark"]{--bx-track:#1d222c;--bx-line:#2a3040;--bx-muted:#9aa3b5;--bx-ink:#e8ebf1;--bx-active:#2a3142;--bx-active-ink:#a9bfff}
@media (max-width:640px){.bx-product{padding:5px 10px;font-size:13px}}

.hero { padding: 72px 20px 48px; text-align: center; }
.eyebrow {
  display: inline-block; margin: 0 0 18px; padding: 6px 14px;
  border-radius: 999px; background: var(--accent-soft); color: var(--accent);
  font-size: 14px; font-weight: 600;
}
.hero h1 {
  font-size: 44px; line-height: 1.15; margin: 0 auto 16px; font-weight: 700;
  max-width: 820px; letter-spacing: -0.01em;
}
.hero p.lead {
  font-size: 19px; color: var(--muted); max-width: 660px; margin: 0 auto 28px;
}
@media (max-width: 640px) {
  .hero { padding: 40px 20px 32px; }
  .hero h1 { font-size: 30px; }
  .hero p.lead { font-size: 17px; }
}

.stats {
  list-style: none; margin: 40px auto 0; padding: 0; max-width: 960px;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; text-align: left;
}
.stats li {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 16px;
}
.stats b { display: block; font-size: 16px; margin-bottom: 2px; }
.stats span { color: var(--muted); font-size: 14px; line-height: 1.4; }
@media (max-width: 860px) { .stats { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 420px) { .stats { grid-template-columns: 1fr; } }

/* Секции: обычные и «полоса» с подложкой поверхности. */
.section { padding: 56px 20px; }
.band { background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.band > .wrap { padding-top: 48px; padding-bottom: 48px; }
.section h2, .band h2, .final h2 { font-size: 30px; line-height: 1.2; margin: 0 0 10px; }
.sub { color: var(--muted); font-size: 16px; max-width: 720px; margin: 0 0 24px; }
.more { margin: 8px 0 0; font-size: 15px; }
@media (max-width: 640px) {
  .section { padding: 40px 20px; }
  .section h2, .band h2, .final h2 { font-size: 24px; }
}

.ask { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(300px, 1.2fr); gap: 24px; align-items: center; }
.ask .sub { margin: 0; }
.ask-chips { justify-content: flex-start; }
.ask-chips .chip { font-size: 14px; padding: 9px 14px; }
@media (max-width: 860px) { .ask { grid-template-columns: 1fr; } }

/* Демо админ-кабинета: заголовок с кнопкой, вкладки, снимок экрана. */
.admin-head { display: flex; gap: 24px; align-items: flex-end; justify-content: space-between; margin-bottom: 20px; }
.admin-head .sub { margin: 0; }
.admin-head .cta { flex: none; }
@media (max-width: 860px) { .admin-head { flex-direction: column; align-items: flex-start; } }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tab {
  font: inherit; font-size: 14px; padding: 8px 14px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--border); background: var(--bg); color: var(--muted);
}
.tab:hover { color: var(--text); border-color: var(--accent); }
.tab[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
:root[data-theme="dark"] .tab[aria-selected="true"] { color: #0f1218; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tab[aria-selected="true"] { color: #0f1218; } }
.shot { margin: 0; }
.shot[hidden] { display: none; }
.shot img {
  display: block; width: 100%; height: auto; border-radius: 12px;
  border: 1px solid var(--border); box-shadow: 0 12px 40px rgba(16, 24, 40, .12);
  background: var(--bg);
}
.shot figcaption { color: var(--muted); font-size: 14px; margin-top: 10px; }

.steps {
  list-style: none; counter-reset: step; padding: 0; margin: 8px 0 0;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
}
.steps li {
  counter-increment: step; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 18px; position: relative;
}
.steps li::before {
  content: counter(step); display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft);
  color: var(--accent); font-weight: 700; font-size: 14px; margin-bottom: 10px;
}
.steps b { display: block; margin-bottom: 4px; }
.steps span { color: var(--muted); font-size: 14px; }
@media (max-width: 860px) { .steps { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .steps { grid-template-columns: 1fr; } }

.channels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.channel { border: 1px solid var(--border); border-radius: 12px; padding: 18px; background: var(--bg); }
.channel h3 { margin: 0 0 6px; font-size: 17px; }
.channel p { margin: 0; color: var(--muted); font-size: 14px; }
@media (max-width: 760px) { .channels { grid-template-columns: 1fr; } }

.faq { display: grid; gap: 10px; max-width: 820px; }
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px 18px; }
.faq summary { cursor: pointer; font-weight: 600; list-style: none; position: relative; padding-right: 24px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 0; top: -2px; font-size: 20px; color: var(--muted); }
.faq details[open] summary::after { content: "–"; }
.faq details p { margin: 10px 0 0; color: var(--muted); font-size: 15px; }

.final { text-align: center; padding: 56px 20px 24px; }
.final h2 { margin-bottom: 20px; }
.cta {
  display: inline-block; background: var(--accent); color: #ffffff;
  padding: 12px 28px; border-radius: 8px; font-weight: 600; font-size: 16px;
  border: none; cursor: pointer; font: inherit;
}
.cta:hover { text-decoration: none; opacity: 0.92; }
:root[data-theme="dark"] .cta, :root[data-theme="dark"] .btn-send { color: #0f1218; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .cta, :root:not([data-theme="light"]) .btn-send { color: #0f1218; }
}
.cta-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.cta-ghost {
  display: inline-block; padding: 12px 28px; border-radius: 8px; font-weight: 600;
  border: 1px solid var(--border); color: var(--text); background: var(--surface);
}
.cta-ghost:hover { text-decoration: none; border-color: var(--accent); }

.features {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 16px; padding: 8px 0 0;
}
@media (max-width: 860px) { .features { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .features { grid-template-columns: 1fr; } }
.feature {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 20px;
}
.feature h3 { margin: 0 0 8px; font-size: 17px; }
.feature p { margin: 0; color: var(--muted); font-size: 14px; }

.how { padding: 24px 0 48px; }
.how h2 { font-size: 26px; margin: 0 0 16px; }
.how ol { color: var(--muted); padding-left: 22px; }
.how li { margin-bottom: 8px; }
.how code {
  background: var(--accent-soft); border-radius: 4px; padding: 2px 6px;
  font-size: 13px;
}

.snippet {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px 20px; margin: 20px 0; overflow-x: auto;
}
.snippet pre { margin: 0; font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; }

.demo-cards {
  display: grid; grid-template-columns: 1fr;
  gap: 20px; padding: 24px 0;
}
.demo-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 20px;
  display: grid; grid-template-columns: minmax(230px, 300px) minmax(340px, 1fr);
  gap: 20px; align-items: start;
}
.demo-card h3 { margin: 0 0 8px; font-size: 18px; }
.demo-card p { margin: 0 0 12px; color: var(--muted); font-size: 14px; }

/* Лендинг: три песочницы в ряд, в карточке — заголовок, вопросы, чат. */
.demo-cards.grid3 { grid-template-columns: repeat(3, 1fr); gap: 16px; padding: 8px 0 0; }
.grid3 .demo-card { grid-template-columns: 1fr; gap: 12px; padding: 16px; align-content: start; }
.grid3 .demo-card .chips { gap: 6px; }
.grid3 .demo-card .chip { font-size: 12.5px; padding: 6px 10px; }
.grid3 .chat-frame { height: 460px; }
@media (max-width: 1000px) { .demo-cards.grid3 { grid-template-columns: 1fr; } .grid3 .chat-frame { height: 440px; } }

/* На узких экранах карточка складывается в колонку: текст, затем чат. */
@media (max-width: 860px) {
  .demo-card { grid-template-columns: 1fr; }
}

.chat-frame {
  border: 1px solid var(--border); border-radius: 8px; height: 480px;
  background: var(--bg); overflow: hidden; position: relative;
}
.chat-frame iframe { width: 100%; height: 100%; border: none; display: block; }
@media (max-width: 860px) {
  .chat-frame { height: 420px; }
}

.mini-chat { display: flex; flex-direction: column; gap: 8px; }
.mini-log {
  height: 220px; overflow-y: auto; background: var(--bg);
  border: 1px solid var(--border); border-radius: 8px; padding: 10px;
  display: flex; flex-direction: column; gap: 8px; font-size: 14px;
}
.mini-msg { max-width: 90%; padding: 6px 10px; border-radius: 8px; white-space: pre-wrap; }
.mini-user { align-self: flex-end; background: var(--accent); color: #fff; }
.mini-bot { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); }
.mini-src { display: block; margin-top: 4px; font-size: 11px; color: var(--muted); }
.mini-row { display: flex; gap: 8px; }
.mini-row input {
  flex: 1; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text); font: inherit;
}
.btn-send {
  padding: 8px 14px; border: none; border-radius: 8px; background: var(--accent);
  color: #fff; cursor: pointer; font: inherit;
}

/* Вопрос-кнопки на карточках демо. */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 7px 12px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--text); font: inherit; font-size: 13px;
  cursor: pointer; text-align: left;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }

.cta-sm { padding: 8px 16px; font-size: 14px; border-radius: 7px; }

/* Страницы документов (/privacy/, /terms/): узкая колонка читаемого текста. */
.doc { max-width: 720px; margin: 0 auto; padding: 32px 0 24px; }
.doc h1 { font-size: 30px; margin: 0 0 8px; }
.doc h2 { font-size: 20px; margin: 28px 0 8px; }
.doc p, .doc li { color: var(--muted); font-size: 15px; }
.doc ul, .doc ol { padding-left: 22px; }
.doc-note { font-size: 14px; color: var(--muted); }

.footer {
  border-top: 1px solid var(--border); margin-top: 32px; padding: 32px 0 48px;
}
/* Лендинг: подвал — полоса на всю ширину, справа внизу живёт виджет. */
body > .footer { padding-bottom: 96px; }
.foot-grid {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 24px;
}
@media (max-width: 700px) { .foot-grid { grid-template-columns: 1fr; } }
.foot-brand { font-weight: 700; margin-bottom: 6px; }
.foot-h { font-weight: 600; margin-bottom: 6px; font-size: 14px; }
.footer p { margin: 0 0 6px; color: var(--muted); font-size: 14px; }
.foot-copy { margin-top: 24px; font-size: 13px; color: var(--muted); }

/* Якоря под липкой шапкой не прячутся. */
section[id] { scroll-margin-top: 72px; }

/* Телефон: кнопки первого экрана и финала — одной ширины, в колонку. */
@media (max-width: 640px) {
  .hero .cta-row, .final .cta-row { flex-direction: column; align-items: stretch; max-width: 360px; margin: 0 auto; }
  .hero .cta-row > a, .final .cta-row > a { text-align: center; }
}

/* «Запросить цену»: текст слева, форма заявки справа; на телефоне — колонкой. */
.request { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: start; }
.request-points { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.request-points li { position: relative; padding-left: 28px; }
.request-points li::before {
  content: "✓"; position: absolute; left: 0; top: 2px; width: 20px; height: 20px;
  border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  font-size: 12px; font-weight: 700; line-height: 20px; text-align: center;
}
.request-form {
  display: grid; gap: 14px; padding: 24px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
}
.request-form label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; }
.request-form .opt { color: var(--muted); font-weight: 400; }
.request-form input, .request-form textarea {
  width: 100%; padding: 10px 12px; font: inherit; font-weight: 400; color: var(--text);
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px; resize: vertical;
}
.request-form input:focus, .request-form textarea:focus {
  outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent);
}
.request-form input[aria-invalid="true"] { border-color: #d9534f; }
.request-form button.cta { justify-self: start; font-weight: 600; }
.request-form button.cta:disabled { opacity: 0.6; cursor: default; }
.request-note { margin: 0; font-size: 13px; color: var(--muted); }
.request-status { margin: 0; font-size: 15px; font-weight: 600; }
.request-status:empty { display: none; }
.request-status.ok { color: #2e9e5b; }
.request-status.err { color: #d9534f; }
@media (max-width: 760px) {
  .request { grid-template-columns: 1fr; gap: 20px; }
  .request-form { padding: 18px; }
  .request-form button.cta { justify-self: stretch; text-align: center; }
}


/* «Ещё в семействе «Бастион»»: карточка соседнего продукта. */
.family-card {
  display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center;
  padding: 28px; border-radius: 16px; background: var(--surface);
  border: 1px solid var(--border);
}
.family-card h3 { margin: 0 0 6px; font-size: 22px; }
.family-card .family-kicker {
  margin: 0 0 6px; font-size: 12px; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--accent);
}
.family-card p { margin: 0; color: var(--muted); max-width: 640px; }
@media (max-width: 760px) {
  .family-card { grid-template-columns: 1fr; padding: 20px; }
  .family-card .cta { text-align: center; }
}
