/* Ассистент на сайте: вход (док на мобильном, кнопка в подвале на десктопе)
   и сама панель разговора. Переменные и шкалы — общие с index.html. */

/* ── Вход: кнопка в подвале, десктоп ─────────────────────────────── */

/* Полоса с кнопкой стоит над подвалом — выше его линии. */
.ai-footer-bar {
  position: relative;
  z-index: 5;
  display: flex;
  justify-content: center;
  padding-block-end: 1.35rem;   /* воздух между кнопкой и линией подвала */
}

.ai-footer-btn {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  height: 3rem;
  padding: 0 1.75rem;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--brand);
  color: #14100b;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 10px 26px rgba(249, 137, 19, .28);
  transition: background .25s, box-shadow .25s, transform .18s;
}
.ai-footer-btn:hover { background: #ffa338; box-shadow: 0 12px 30px rgba(249, 137, 19, .4); }
.ai-footer-btn:active { transform: translateY(1px); }
.ai-footer-btn:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

/* Тот же строй, что у дока на телефоне: иконка и подпись, одинаковый кегль. */
.ai-footer-btn svg { width: 1.2rem; height: 1.2rem; fill: currentColor; }
.ai-footer-btn span {
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
}

/* ── Вход: нависающий док, мобильный ─────────────────────────────── */

.ai-dock {
  position: fixed;
  inset-inline: 0;
  bottom: calc(env(safe-area-inset-bottom, 0px) + .9rem);
  z-index: 60;
  display: none;                       /* включается медиазапросом ниже */
  justify-content: center;
  pointer-events: none;                /* кликается только сама таблетка */
}

.ai-dock-pill {
  pointer-events: auto;
  display: flex;
  align-items: stretch;
  gap: .35rem;
  padding: .4rem;
  border: 1px solid var(--line-2);
  border-radius: var(--r-pill);
  background: rgba(18, 18, 22, .55);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .45);
}

/* Браузеры без стекла: та же форма, сплошная подложка. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .ai-dock-pill { background: rgba(14, 14, 18, .96); }
}

/* Кнопка = иконка и подпись под ней. */
.ai-dock-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .15rem;
  min-width: 5.6rem;
  min-height: var(--tap);
  padding: .5rem 1rem .45rem;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: var(--t-xs);
  letter-spacing: .02em;
  cursor: pointer;
  transition: background .25s, color .25s;
}
.ai-dock-btn svg { width: 1.45rem; height: 1.45rem; fill: currentColor; }

/* «ИИ» стоит над словом «Ассистент» и написано, как вывеска на первом экране:
   плотные буквы с разрядкой и мягким свечением. Шрифт свой, ничего не подгружаем. */
.ai-mark {
  font-family: 'Inter Tight', 'Inter', system-ui, sans-serif;
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: .06em;
  text-shadow: 0 0 12px rgba(255, 190, 120, .55), 0 0 26px rgba(249, 137, 19, .35);
}

.ai-dock-btn span {
  font-size: .68rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  opacity: .92;
}
.ai-dock-btn:active { background: rgba(255, 255, 255, .06); }

.ai-dock-btn.is-lang { min-width: 4.2rem; padding-inline: .5rem; color: var(--dim); }
.ai-dock-btn.is-lang span { font-size: .7rem; letter-spacing: .08em; }

/* Выбор языка — короткий список над доком. */
.ai-langs {
  pointer-events: auto;
  position: absolute;
  bottom: calc(100% + .5rem);
  inset-inline-start: 0;
  display: flex;
  flex-direction: column;
  gap: .15rem;
  padding: .35rem;
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  background: rgba(18, 18, 22, .92);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}
.ai-langs[hidden] { display: none; }
.ai-lang {
  display: block;
  text-decoration: none;
  min-height: 2.25rem;
  line-height: 2.25rem;
  padding: 0 1rem;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: var(--t-sm);
  text-align: start;
  cursor: pointer;
}
.ai-lang:hover { background: rgba(255, 255, 255, .07); }
.ai-lang.is-current { color: var(--brand); }



.ai-dock-btn.is-main {
  background: var(--brand);
  color: #0b0b0d;
  box-shadow: 0 8px 22px rgba(249, 137, 19, .32);
}
.ai-dock-btn.is-main:active { background: #e87f10; }

/* Открыт раздел — кнопка в подвале не показывается: она налезала на нижние карточки. */
body.is-open .ai-footer-bar { display: none; }

/* Док — только на телефоне; на десктопе вход в ассистента живёт в подвале. */
@media (max-width: 699px) {
  .ai-dock { display: flex; }
  .ai-footer-bar { display: none; }

  /* Док виден всегда — это единственная навигация на телефоне.
     Чтобы он не накрывал содержимое, снизу добавляется место под него. */
  body.is-open .deck { padding-bottom: 7.5rem; }
  .sheet { padding-bottom: 7rem; }
}

/* ── Панель разговора ────────────────────────────────────────────── */

.ai-panel {
  position: fixed;
  inset-block: 0;
  inset-inline-end: 0;
  z-index: 80;
  width: min(28rem, 100vw);
  display: flex;
  flex-direction: column;
  background: rgba(12, 12, 15, .92);
  backdrop-filter: blur(28px) saturate(140%);
  -webkit-backdrop-filter: blur(28px) saturate(140%);
  border-inline-start: 1px solid var(--line);
  transform: translateX(102%);
  transition: transform .32s cubic-bezier(.22, .8, .3, 1);
  visibility: hidden;
}
.ai-panel.is-open { transform: none; visibility: visible; }
.ai-panel[dir="rtl"] { transform: translateX(-102%); }
.ai-panel[dir="rtl"].is-open { transform: none; }

/* Шапки у панели нет: разговор начинается сразу. Закрыть — плавающий крестик,
   он висит поверх переписки и не занимает строку. */
.ai-close {
  position: absolute;
  inset-block-start: var(--s3);
  inset-inline-end: var(--s3);
  z-index: 2;
  width: var(--tap); height: var(--tap);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: rgba(18, 18, 22, .72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
}
.ai-close:hover { border-color: var(--brand-line); color: #fff; }

.ai-log {
  flex: 1;
  padding-block-start: calc(var(--tap) + var(--s3));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--s4);
  display: flex;
  flex-direction: column;
  gap: var(--s3);
}

.ai-msg {
  max-width: 88%;
  padding: .7rem .9rem;
  border-radius: var(--r-md);
  font-size: var(--t-sm);
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.ai-msg.is-bot  {
  align-self: flex-start;
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--line);
  border-start-start-radius: var(--r-sm);   /* «хвостик» к своей стороне */
}
.ai-msg.is-user {
  align-self: flex-end;
  background: rgba(249, 137, 19, .14);
  border: 1px solid var(--brand-line);
  border-start-end-radius: var(--r-sm);
}
.ai-msg[dir="rtl"] { text-align: start; }

/* Ответ живого человека из Telegram — отличается от машинного, чтобы не путать. */
.ai-msg.is-human {
  background: rgba(37, 211, 102, .1);
  border-color: rgba(37, 211, 102, .35);
}
.ai-from {
  display: block;
  margin-block-end: .3rem;
  color: #25D366;
  font-size: var(--t-xs);
  letter-spacing: .02em;
}

/* Разметка внутри ответа: абзацы дышат, списки читаются, ссылки видно. */
.ai-msg { --lead: 1.55; line-height: var(--lead); }
.ai-msg b { color: #fff; font-weight: 600; }
.ai-msg i { font-style: normal; color: var(--dim); }

.ai-msg a {
  color: var(--brand);
  text-decoration: underline;
  text-decoration-color: rgba(249, 137, 19, .45);
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
}
.ai-msg a:hover { text-decoration-color: var(--brand); }

/* Пустая строка между абзацами и заметный отступ у пунктов списка —
   без этого ответ выглядит одним полотном. */
.ai-msg .ai-p  { display: block; margin-block-start: .55rem; }
.ai-msg .ai-li {
  display: block;
  padding-inline-start: 1rem;
  text-indent: -1rem;
  margin-block-start: .25rem;
}

.ai-chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.ai-chip {
  padding: .45rem .75rem;
  border: 1px solid var(--line-2);
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--dim);
  font-size: var(--t-xs);
  cursor: pointer;
}
.ai-chip:hover { color: var(--text); border-color: var(--brand-line); }

.ai-typing { display: inline-flex; gap: .25rem; }
.ai-typing i {
  width: .35rem; height: .35rem; border-radius: 50%;
  background: var(--muted);
  animation: ai-dot 1.1s infinite ease-in-out;
}
.ai-typing i:nth-child(2) { animation-delay: .15s; }
.ai-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes ai-dot { 0%, 60%, 100% { opacity: .25; } 30% { opacity: 1; } }

.ai-foot {
  border-top: 1px solid var(--line);
  padding: var(--s3) var(--s4) calc(var(--s4) + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: var(--s2);
}
.ai-form { display: flex; gap: var(--s2); align-items: flex-end; }
.ai-input {
  flex: 1;
  min-height: var(--tap);
  max-height: 7rem;
  padding: .7rem .9rem;
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, .04);
  color: var(--text);
  font: inherit;
  font-size: var(--t-sm);
  resize: none;
}
.ai-input:focus { outline: 2px solid var(--brand-line); outline-offset: 1px; }
.ai-send {
  width: var(--tap); height: var(--tap);
  border: 0; border-radius: var(--r-md);
  background: var(--brand); color: #0b0b0d;
  cursor: pointer;
}
.ai-send:disabled { opacity: .45; cursor: default; }
.ai-send svg { width: 1.2rem; height: 1.2rem; fill: currentColor; }

.ai-wa {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 2.25rem;
  color: var(--muted);
  font-size: var(--t-xs);
  text-decoration: none;
}
.ai-wa:hover { color: var(--text); }
.ai-wa svg { width: 1rem; height: 1rem; fill: #25D366; }

/* Панель не накрывает страницу: на широком экране сцена ужимается на её ширину. */
/* На десктопе разговор открывается окном по центру, поверх вывески:
   решение владельца 20.08.2026 — «блок поверх лого, а не сбоку». */
@media (min-width: 700px) {
  .ai-panel {
    inset: auto;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -46%) scale(.98);
    width: min(34rem, 92vw);
    height: min(40rem, 82dvh);
    border: 1px solid var(--line-2);
    border-radius: var(--r-lg);
    box-shadow: 0 32px 80px rgba(0, 0, 0, .6);
    opacity: 0;
    transition: opacity .24s, transform .28s cubic-bezier(.22, .8, .3, 1);
  }
  .ai-panel.is-open { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  .ai-panel[dir="rtl"] { transform: translate(-50%, -46%) scale(.98); }

  /* Крестик раздела остаётся доступен поверх затемнения. */
  body.ai-open .deck-close { z-index: 90; }
}

@media (max-width: 699px) {
  body.ai-open { overflow: hidden; }
}

.ai-scrim {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(0, 0, 0, .5);
  opacity: 0; visibility: hidden;
  transition: opacity .3s;
}
.ai-scrim.is-open { opacity: 1; visibility: visible; }

@media (max-width: 699px) {
  .ai-panel { width: 100vw; border-inline-start: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .ai-panel, .ai-scrim { transition: none; }
  .ai-dock-main { transition: none; }
  .ai-typing i { animation: none; }
}

/* Кнопка «Меню» со сцены на мобильном не нужна: её роль забрала правая кнопка дока.
   Правило идёт после index.html в каскаде, поэтому перебивает display:inline-flex. */
@media (max-width: 699px) {
  .menu-toggle { display: none !important; }
  .stage { padding-bottom: 6rem; }
}



/* Цели касания на телефоне добираем невидимой областью вокруг ссылки,
   а не высотой: у иконок соцсетей своя круглая геометрия, и min-height
   превращал их в овалы. */
@media (max-width: 699px) {
  .sheet .sheet-legal a { min-height: 2.75rem; display: inline-flex; align-items: center; }
}

/* Языки в подвале: один кружок с кодом, список открывается по нажатию. */
.legal { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }

.lang-pick { position: relative; display: inline-flex; }

.lang-now {
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: var(--t-xs);
  letter-spacing: .04em;
  cursor: pointer;
  transition: color .25s, border-color .25s;
}
.lang-now:hover,
.lang-now[aria-expanded="true"] { color: var(--brand); border-color: var(--brand-line); }

.lang-menu {
  position: absolute;
  bottom: calc(100% + .4rem);
  inset-inline-start: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: .15rem;
  padding: .3rem;
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  background: rgba(18, 18, 22, .96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.lang-menu[hidden] { display: none; }
.lang-menu a {
  padding: .4rem .9rem;
  border-radius: var(--r-sm);
  font-size: var(--t-xs);
  white-space: nowrap;
  color: var(--dim);
}
.lang-menu a:hover { background: rgba(255, 255, 255, .07); color: var(--text); }
.lang-menu a[aria-current] { color: var(--brand); }

/* Счётчик работ и кнопки в карточках были ссылками, а стали button —
   браузер рисует им свой белый фон. Возвращаем вид карточки. */
.tile .count,
.card .cta,
.tile .cta,
.plan .join,
.feature-head .cta {
  font: inherit;
  color: inherit;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
}

.tile .count.is-demo { color: var(--dim); font-size: var(--t-sm); }
.tile .count.is-demo:hover { color: var(--text); border-color: var(--brand-line); }

/* Место под док, чтобы последняя карточка не уезжала под него. */
@media (max-width: 699px) {
  .deck.as-grid, .deck.as-mosaic, .deck.as-feature, .deck { padding-bottom: 7.5rem; }
}
