/* BrainOS: стиль из Figma «Готово · Сайт · brainos.ai-khan.uz», токены брендбука AI Khan 2026 */
:root {
  --ink: #0e1716;
  --graphite: #5b6472;
  --line: #d9dee3;
  --paper: #f4f6f7;
  --white: #ffffff;
  --primary: #0e5e55;
  --deep: #003d3a;
  --step-900: #0e2321;
  --accent: #2a9078;
  --link: #1f7a66;
  --tint50: #e6f4f1;
  --tint100: #bfe3db;
  --tint300: #7cc4b4;

  --font-display: "Unbounded", sans-serif;
  --font-body: "Montserrat", sans-serif;
  --font-alt: "Montserrat Alternates", sans-serif;

  --container: 1160px;
  --gutter: max(20px, calc((100% - var(--container)) / 2));
  --radius-card: 16px;
  --radius-btn: 10px;
  --header-h: 90px;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }

body {
  margin: 0;
  background: var(--white);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, p, ul, ol { margin: 0; }
a { color: inherit; text-decoration: none; }
img { display: block; }

.section { padding: 96px var(--gutter); }
.section--paper { background: var(--paper); }
.section--deep { background: var(--deep); }

.eyebrow {
  font-family: var(--font-alt);
  font-weight: 500;
  font-size: 13px;
  line-height: 1.5;
  letter-spacing: 0.78px;
  text-transform: uppercase;
  color: var(--primary);
}
.section--deep .eyebrow { color: var(--tint300); }

.section-head { display: flex; flex-direction: column; gap: 14px; margin-bottom: 44px; }
.section-title { font-family: var(--font-display); font-weight: 600; font-size: 38px; line-height: 1.15; max-width: 760px; }
.section--deep .section-title { color: var(--white); }
.section-lead { font-size: 18px; line-height: 1.55; color: var(--graphite); max-width: 680px; }

/* Название продукта: первая часть SemiBold, вторая Light в цвете Primary */
.brand-name { font-family: var(--font-alt); font-weight: 600; line-height: normal; }
.brand-name span { font-weight: 300; color: var(--primary); }

/* Кнопки */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 16px;
  line-height: normal;
  padding: 14px 24px;
  white-space: nowrap;
  transition: background-color .15s, border-color .15s;
}
.btn--s { font-size: 14px; padding: 10px 16px; }
.btn--primary { background: var(--primary); color: var(--white); }
.btn--primary:hover { background: var(--deep); }
.btn--ghost { border: 1.5px solid var(--line); padding: 12.5px 22.5px; color: var(--ink); }
.btn--ghost:hover { border-color: var(--primary); }
.btn--ondark { background: var(--tint300); color: var(--ink); }
.btn--ondark:hover { background: var(--tint100); }
a:focus-visible,
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.chip {
  display: inline-flex;
  align-self: flex-start;
  padding: 5px 12px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 12px;
  line-height: normal;
  background: var(--tint50);
  color: var(--deep);
}
.chip--muted { background: none; border: 1px solid var(--line); color: var(--graphite); }

/* Пилюли со списком модулей и интеграций */
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pills span {
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  font-weight: 500;
  font-size: 14px;
  line-height: 1.5;
}

/* Списки с маркером-квадратом */
.dot-list { display: flex; flex-direction: column; gap: 10px; padding: 0; list-style: none; }
.dot-list li { display: flex; align-items: center; gap: 10px; font-size: 15px; line-height: 1.5; }
.dot-list li::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 2px; background: var(--accent); }

/* Шапка */
.header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px var(--gutter);
  background: var(--white);
  border-bottom: 1px solid var(--line);
}
.logo { display: flex; flex-direction: column; white-space: nowrap; }
.logo .brand-name { font-size: 26px; color: var(--ink); }
.logo small { font-family: var(--font-alt); font-weight: 500; font-size: 11px; line-height: 1.5; color: var(--graphite); }
.nav { display: flex; align-items: center; gap: 30px; font-weight: 500; font-size: 15px; line-height: 1.5; white-space: nowrap; }
.nav a:hover { color: var(--primary); }
.nav a[aria-current="page"] { font-weight: 600; color: var(--primary); }
.header-actions { display: flex; align-items: center; gap: 16px; }

/* Переключатель языка: в макете не отрисован, временное решение в токенах бренда */
.lang { position: relative; }
.lang summary {
  list-style: none;
  cursor: pointer;
  padding: 8px 2px;
  font-family: var(--font-alt);
  font-weight: 500;
  font-size: 13px;
  line-height: 1.5;
  color: var(--graphite);
}
.lang summary::-webkit-details-marker { display: none; }
.lang summary:hover { color: var(--primary); }
.lang div {
  position: absolute;
  inset-inline-end: 0;
  top: calc(100% + 6px);
  display: flex;
  flex-direction: column;
  min-width: 96px;
  padding: 6px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(13, 23, 23, 0.08);
}
.lang a { padding: 6px 10px; border-radius: 8px; font-family: var(--font-alt); font-weight: 500; font-size: 13px; line-height: 1.5; }
.lang a:hover { background: var(--tint50); color: var(--deep); }

/* Главная: первый экран */
.hero { display: flex; align-items: center; gap: 72px; padding: 80px var(--gutter) 88px; }
.hero-copy { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 22px; }
.hero-title { font-family: var(--font-display); font-weight: 600; font-size: 50px; line-height: 1.08; }
.hero-lead { font-size: 19px; line-height: 1.55; color: var(--graphite); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-note { font-size: 14px; line-height: 1.5; color: var(--graphite); }

/* Пример переписки с ботом */
.chat { flex: none; width: 430px; background: var(--paper); border: 1px solid var(--line); border-radius: 24px; overflow: hidden; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; background: var(--white); }
.chat-avatar { display: flex; align-items: center; justify-content: center; flex: none; width: 40px; height: 40px; border-radius: 20px; background: var(--primary); }
.chat-avatar img { width: 18.18px; height: 20px; }
.chat-head p { font-weight: 600; font-size: 15px; line-height: 1.5; }
.chat-head small { display: block; font-size: 12px; line-height: 1.5; color: var(--graphite); }
.chat-body { display: flex; flex-direction: column; gap: 12px; padding: 20px 20px 24px; }
.msg { max-width: 320px; padding: 12px 14px; border-radius: 16px; font-size: 14px; line-height: 1.5; }
.msg--out { align-self: flex-end; width: 248px; background: var(--primary); color: var(--white); }
.msg--in { align-self: flex-start; width: 320px; background: var(--white); border: 1px solid var(--line); }
.msg dl { display: grid; grid-template-columns: 70px auto; gap: 4px 8px; margin: 6px 0 0; font-size: 12px; }
.msg dt { color: var(--graphite); }
.msg dd { margin: 0; font-weight: 600; }

/* Главная: для кого */
.audience { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.audience div { display: flex; flex-direction: column; gap: 14px; min-height: 196px; padding: 26px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-card); }
.audience div::before { content: ""; width: 24px; height: 3px; background: var(--accent); }
.audience p { font-size: 16px; line-height: 1.55; }

/* Главная: модули */
.modules { display: grid; grid-template-columns: repeat(5, 1fr); gap: 20px; margin-bottom: 20px; }
.module { display: flex; flex-direction: column; gap: 10px; min-height: 224px; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius-card); }
.module h3 { font-family: var(--font-display); font-weight: 500; font-size: 20px; line-height: 1.5; }
.module code { font-family: var(--font-alt); font-weight: 500; font-size: 13px; line-height: 1.5; color: var(--primary); }
.module p { font-size: 15px; line-height: 1.55; color: var(--graphite); }
.extras { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.extras > div { display: flex; flex-direction: column; gap: 16px; padding: 28px; border-radius: var(--radius-card); background: var(--paper); }
.extras > div:first-child { background: var(--tint50); }
.extras h3 { font-family: var(--font-display); font-weight: 500; font-size: 20px; line-height: 1.5; }

/* Главная: шаги */
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.step { display: flex; flex-direction: column; gap: 12px; padding: 28px; border-radius: var(--radius-card); background: var(--step-900); }
.step b { font-family: var(--font-display); font-weight: 600; font-size: 44px; line-height: 1.5; color: var(--tint300); }
.step h3 { font-family: var(--font-display); font-weight: 500; font-size: 20px; line-height: 1.5; color: var(--white); }
.step p { font-size: 15px; line-height: 1.55; color: var(--tint100); }

/* Главная: тарифы */
.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.plan { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; min-height: 434px; padding: 32px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-card); }
.plan h3 { font-family: var(--font-alt); font-weight: 600; font-size: 22px; line-height: 1.5; color: var(--primary); }
.plan-price { font-family: var(--font-display); font-weight: 600; font-size: 44px; line-height: 1.5; }
.plan-period { font-size: 14px; line-height: 1.5; color: var(--graphite); }
.plan .dot-list { padding: 8px 0; }
.plan .btn { margin-top: auto; }
.plan--featured { background: var(--primary); border-color: var(--primary); color: var(--white); }
.plan--featured h3 { color: var(--tint300); }
.plan--featured .plan-period { color: var(--tint100); }
.plan--featured .dot-list li::before { background: var(--tint300); }

/* Подвал */
.footer { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 40px var(--gutter); background: var(--paper); font-size: 14px; line-height: 1.5; }
.footer-brand { display: flex; flex-direction: column; gap: 8px; }
.footer-brand img { width: 105.16px; height: 18px; }
.footer-brand small { font-size: 13px; color: var(--graphite); }
.footer-nav { display: flex; flex-wrap: wrap; gap: 24px; font-weight: 500; }
.footer-nav a:hover,
.footer-contacts a:hover { color: var(--primary); }
.footer-contacts { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.footer-contacts a:first-child { font-weight: 600; }
.footer-contacts a:last-child { color: var(--graphite); }

/* Заголовок внутренних страниц */
.page-head { display: flex; flex-direction: column; gap: 14px; padding: 64px var(--gutter) 56px; background: var(--paper); }
.page-head h1 { font-family: var(--font-display); font-weight: 600; font-size: 44px; line-height: 1.12; }
.page-head .lead { font-size: 19px; line-height: 1.5; color: var(--graphite); }
.page-meta { display: flex; flex-wrap: wrap; gap: 4px 24px; font-size: 14px; line-height: 1.5; color: var(--graphite); }

/* Раскладка «оглавление + содержимое» */
.page-body { display: flex; gap: 56px; align-items: flex-start; padding: 56px var(--gutter) 96px; }
.toc {
  position: sticky;
  top: calc(var(--header-h) + 16px);
  flex: none;
  width: 300px;
  max-height: calc(100vh - var(--header-h) - 32px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  line-height: 1.5;
}
.toc a { display: flex; gap: 10px; padding: 7px 10px; border-radius: 8px; font-size: 14px; }
.toc a span { flex: none; width: 20px; font-family: var(--font-alt); font-weight: 500; font-size: 12px; line-height: 21px; color: var(--primary); }
.toc a:hover { background: var(--paper); }
.toc a.is-active { background: var(--tint50); font-weight: 600; color: var(--deep); }
.toc--simple { width: 260px; gap: 6px; padding: 20px; }
.toc--simple > p { font-family: var(--font-alt); font-weight: 600; font-size: 13px; color: var(--graphite); }
.toc--simple a { padding: 8px 12px; font-weight: 500; font-size: 15px; }
.page-content { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 48px; }

/* Юридический документ */
.doc-note { display: flex; flex-direction: column; gap: 8px; padding: 20px 22px; border-radius: 12px; background: var(--tint50); font-size: 14px; line-height: 1.55; color: var(--deep); }
.doc-section { display: flex; flex-direction: column; gap: 14px; font-size: 16px; line-height: 1.65; color: var(--graphite); }
.doc-section h2 { display: flex; align-items: baseline; gap: 14px; font-family: var(--font-display); font-weight: 600; font-size: 24px; line-height: 1.5; color: var(--ink); }
.doc-section h2 span { flex: none; font-weight: 500; font-size: 16px; color: var(--primary); }
.doc-section h3 { margin-top: 6px; font-family: var(--font-display); font-weight: 500; font-size: 17px; line-height: 1.5; color: var(--ink); }
.doc-section ul,
.doc-section ol { display: flex; flex-direction: column; gap: 6px; padding-inline-start: 22px; }
.doc-section li::marker { color: var(--accent); }
.doc-section strong { font-weight: 600; color: var(--ink); }
.doc-section a { color: var(--link); text-decoration: underline; text-underline-offset: 2px; }
.doc-section code { padding: 1px 6px; border-radius: 6px; background: var(--paper); font-size: 14px; color: var(--primary); }
.doc-section .doc-content { display: contents; }
.doc-content > .doc-content { display: contents; }
.page-content.doc { gap: 36px; }

/* Таблицы в макете: шапка Tint 50, строки через линию */
.table { width: 100%; border: 1px solid var(--line); border-radius: 12px; border-collapse: separate; border-spacing: 0; overflow: hidden; font-size: 15px; line-height: 1.5; }
.table th,
.table td { padding: 12px 18px; text-align: start; vertical-align: top; border-bottom: 1px solid var(--line); }
.table tr:last-child td { border-bottom: 0; }
.table th { background: var(--tint50); font-weight: 600; color: var(--ink); }
.table td { background: var(--white); color: var(--graphite); }
.table td:first-child { width: 220px; font-weight: 600; color: var(--ink); }
.table--commands td:first-child { width: 160px; color: var(--primary); }

/* Инструкция */
.guide-section { display: flex; flex-direction: column; gap: 20px; }
.guide-section > header { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.guide-section h2 { font-family: var(--font-display); font-weight: 600; font-size: 28px; line-height: 1.5; }
.guide-section > p { font-size: 16px; line-height: 1.55; color: var(--graphite); }
.guide-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.guide-card { display: flex; flex-direction: column; gap: 8px; padding: 22px; background: var(--white); border: 1px solid var(--line); border-radius: 14px; }
.guide-card header { display: flex; align-items: center; gap: 10px; }
.guide-card h3 { font-family: var(--font-display); font-weight: 500; font-size: 18px; line-height: 1.5; }
.guide-card p { font-size: 15px; line-height: 1.55; color: var(--graphite); }
.tag { padding: 3px 8px; border-radius: 6px; font-weight: 500; font-size: 12px; line-height: 1.5; }
.tag--code { background: var(--paper); color: var(--primary); }
.tag--say { background: var(--tint50); color: var(--deep); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }

.guide-note { font-size: 14px; line-height: 1.55; color: var(--graphite); }

/* «Подробнее» в карточке модуля: полный текст и таблица примеров из прежней инструкции */
.guide-more { margin-top: 4px; border-top: 1px solid var(--line); }
.guide-more summary {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-top: 12px;
  list-style: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.5;
  color: var(--link);
}
.guide-more summary::-webkit-details-marker { display: none; }
.guide-more summary::after {
  content: "";
  width: 7px;
  height: 7px;
  margin-top: -3px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  transition: transform .15s;
}
.guide-more[open] summary::after { margin-top: 3px; transform: rotate(-135deg); }
.guide-more summary:hover { color: var(--primary); }
.guide-more-body { display: flex; flex-direction: column; gap: 10px; padding-top: 12px; font-size: 14px; line-height: 1.55; color: var(--graphite); }
.guide-more-body strong { font-weight: 600; color: var(--ink); }
.guide-more-body code { padding: 1px 6px; border-radius: 6px; background: var(--tint50); font-family: var(--font-body); font-size: 13px; color: var(--deep); }
.guide-more-body ul { display: flex; flex-direction: column; gap: 4px; padding-inline-start: 18px; }
.guide-more-body li::marker { color: var(--accent); }
.table--examples { font-size: 13px; }
.table--examples th,
.table--examples td { padding: 9px 12px; }
.table--examples td:first-child { width: 110px; }
.table--examples td code { display: inline-block; margin: 2px 0; }

/* Об авторе */
.about { display: flex; align-items: center; gap: 72px; padding: 96px var(--gutter); }
.about-mark { display: flex; align-items: center; justify-content: center; flex: none; width: 360px; height: 360px; border-radius: 24px; background: var(--deep); }
.about-mark img { width: 181.82px; height: 200px; }
.about-text { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 20px; }
.about-text h1 { font-family: var(--font-display); font-weight: 600; font-size: 44px; line-height: 1.12; }
.about-text > p:not(.eyebrow) { font-size: 18px; line-height: 1.6; color: var(--graphite); }
.about-contacts { display: flex; flex-direction: column; gap: 10px; width: 100%; padding-top: 20px; border-top: 1px solid var(--line); line-height: 1.5; }
.about-contacts div { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; }
.about-contacts span { flex: none; width: 90px; font-family: var(--font-alt); font-weight: 500; font-size: 14px; color: var(--graphite); }
.about-contacts a { font-weight: 600; font-size: 20px; }
.about-contacts a:hover { color: var(--primary); }
.about-actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* Арабский: письмо справа налево. Разрядка ломает связное письмо, поэтому её убираем */
[dir="rtl"] .eyebrow { letter-spacing: 0; }
[dir="rtl"] .msg dl { direction: rtl; }
[dir="rtl"] .brand-name,
[dir="rtl"] .logo,
[dir="rtl"] .footer-contacts a,
[dir="rtl"] .about-contacts a,
[dir="rtl"] .module code { direction: ltr; unicode-bidi: isolate; }

/* Планшет */
@media (max-width: 1180px) {
  .nav { gap: 18px; }
  .hero { gap: 40px; }
  .hero-title { font-size: 42px; }
  .chat { width: 380px; }
  .msg--in { width: 290px; }
  .audience { grid-template-columns: repeat(2, 1fr); }
  .modules { grid-template-columns: repeat(3, 1fr); }
  .steps { grid-template-columns: repeat(2, 1fr); }
  .about { gap: 48px; }
  .about-mark { width: 300px; height: 300px; }
  .about-mark img { width: 150px; height: 165px; }
}

@media (max-width: 960px) {
  :root { --header-h: 74px; }
  .nav { display: none; }
  .header { padding-top: 14px; padding-bottom: 14px; }
  .hero { flex-direction: column; align-items: stretch; padding-top: 48px; padding-bottom: 64px; }
  .chat { width: 100%; max-width: 430px; align-self: center; }
  .extras,
  .plans { grid-template-columns: 1fr; }
  .plan { min-height: 0; }
  .page-body { flex-direction: column; gap: 32px; }
  .toc { position: static; width: 100%; max-height: none; }
  .guide-cards { grid-template-columns: 1fr; }
  .about { flex-direction: column; align-items: flex-start; }
  .footer { flex-direction: column; align-items: flex-start; }
  .footer-contacts { align-items: flex-start; }
}

/* Телефон */
@media (max-width: 600px) {
  .section { padding-top: 64px; padding-bottom: 64px; }
  .logo .brand-name { font-size: 22px; }
  .header-actions .btn { padding: 8px 12px; font-size: 13px; }
  .hero-title { font-size: 32px; }
  .hero-lead { font-size: 17px; }
  .msg--out { width: auto; max-width: 80%; }
  .msg--in { width: auto; max-width: 92%; }
  .section-title,
  .page-head h1,
  .about-text h1 { font-size: 28px; }
  .section-lead,
  .page-head .lead { font-size: 16px; }
  .audience,
  .modules,
  .steps { grid-template-columns: 1fr; }
  .audience div,
  .module { min-height: 0; }
  .page-head { padding-top: 40px; padding-bottom: 36px; }
  .page-body { padding-top: 32px; padding-bottom: 64px; }
  .doc-section h2 { font-size: 20px; }
  .guide-section h2 { font-size: 22px; }
  .table { display: block; overflow-x: auto; }
  .table td:first-child { width: auto; min-width: 120px; }
  .about { padding-top: 48px; padding-bottom: 64px; }
  .about-mark { width: 100%; height: 220px; }
  .about-mark img { width: 100px; height: 110px; }
  .about-contacts a { font-size: 17px; word-break: break-all; }
}
