/* Главная: первый блок «ручное КП → kptp.ru» (скролл-история) и блок «ИИ и интеграции».
   Префиксы hs- и ai- — чтобы не пересекаться с глобальным [class*="__container"] и .btn шаблона. */
.page--home {
  --hs-primary: #008AFF;
  --hs-primary-hover: #0070D6;
  --hs-primary-soft: #CCE8FF;
  --hs-ink: #313132;
  --hs-muted: #6B6B70;
  --hs-surface: #F6F7F8;
  --hs-border: #E3E3E3;
  --hs-danger: #E5484D;
  --hs-danger-soft: #FDE8E8;
  --hs-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .06);
  /* зона сцены, свободная от фиксированной шапки (76px) и нижней шкалы — в ней центрируются оффер и панель */
  --hs-top: 88px;
  --hs-bottom: 72px;
}

/* sticky не работает внутри overflow:hidden — на главной обрезаем только по горизонтали */
.wrapper > main.page--home {
  overflow: visible;
  overflow-x: clip;
}
.intro.intro--home {
  padding-top: 96px;
}

/* ---------- кнопки ---------- */
.hs-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  padding: 0 22px;
  border-radius: 8px;
  border: 1px solid transparent;
  font: 600 16px/1 Inter, sans-serif;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.hs-btn:focus-visible { outline: 3px solid var(--hs-primary-soft); outline-offset: 2px; }
.hs-btn--primary { background: var(--hs-primary); color: #fff; }
.hs-btn--primary:hover { background: var(--hs-primary-hover); color: #fff; }
.hs-btn--secondary { background: #fff; color: var(--hs-ink); border-color: var(--hs-border); }
.hs-btn--secondary:hover { border-color: #c9c9cc; color: var(--hs-ink); }

/* ---------- сцена ---------- */
.hs {
  position: relative;
  height: 640vh;
  background: #F6F0E8;
  color: var(--hs-ink);
  font-family: Inter, system-ui, sans-serif;
}
.hs__stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  background: #F6F0E8;
}
.hs__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.hs__ui {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.hs__inner {
  position: relative;
  height: 100%;
  max-width: 1260px;
  margin: 0 auto;
  padding: 0 30px;
  box-sizing: border-box;
}
.hs__ui a { pointer-events: auto; }

/* первый экран */
.hs-hero {
  position: absolute;
  left: 30px;
  top: var(--hs-top);
  bottom: var(--hs-bottom);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  max-width: 540px;
  transition: opacity .35s, transform .35s;
}
.hs-hero.is-hidden { opacity: 0; transform: translateY(-24px); }
.hs-hero.is-hidden a { pointer-events: none; }
.hs-hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
  padding: 6px 14px 6px 8px;
  border: 1px solid var(--hs-border);
  border-radius: 999px;
  background: #fff;
  color: var(--hs-ink);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}
.hs-hero__badge b {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--hs-primary-soft);
  color: var(--hs-primary-hover);
  font-size: 12px;
  font-weight: 600;
}
.hs-hero__title {
  margin: 0;
  font-size: clamp(36px, 4.4vw, 56px);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -.02em;
  color: var(--hs-ink);
}
.hs-hero__title em { font-style: normal; color: var(--hs-primary); }
.hs-hero__text {
  max-width: 480px;
  margin: 20px 0 0;
  font-size: 19px;
  line-height: 1.6;
  color: var(--hs-muted);
}
.hs-hero__cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.hs-hero__note { margin-top: 14px; font-size: 14px; color: var(--hs-muted); }

.hs-hint {
  position: absolute;
  left: 50%;
  bottom: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transform: translateX(-50%);
  font-size: 13px;
  font-weight: 500;
  color: var(--hs-muted);
  transition: opacity .3s;
}
.hs-hint.is-hidden { opacity: 0; }
.hs-hint i {
  position: relative;
  width: 22px;
  height: 34px;
  border: 2px solid #b9bcc2;
  border-radius: 12px;
}
.hs-hint i::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 6px;
  width: 4px;
  height: 7px;
  margin-left: -2px;
  border-radius: 2px;
  background: #9a9ea6;
  animation: hs-wheel 1.6s ease-in-out infinite;
}
@keyframes hs-wheel {
  0% { opacity: 0; transform: translateY(0); }
  30% { opacity: 1; }
  100% { opacity: 0; transform: translateY(10px); }
}

/* панель «боль → решение» */
.hs-panel {
  position: absolute;
  left: 30px;
  top: var(--hs-top);
  bottom: var(--hs-bottom);
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 440px;
  opacity: 0;
  transition: opacity .35s;
}
.hs-panel.is-visible { opacity: 1; }
.hs-panel__card {
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: 20px;
  background: rgba(255, 255, 255, .78);
  box-shadow: var(--hs-shadow);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  backdrop-filter: blur(16px) saturate(160%);
}
.hs-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  transition: background .3s, color .3s;
}
.hs-chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.hs-chip[data-tone="pain"] { background: var(--hs-danger-soft); color: var(--hs-danger); }
.hs-chip[data-tone="turn"] { background: #EDEBFF; color: #5B4BDB; }
.hs-chip[data-tone="gain"] { background: var(--hs-primary-soft); color: var(--hs-primary-hover); }
.hs-panel__title {
  min-height: 2.4em;
  margin: 14px 0 20px;
  font-size: 26px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -.02em;
  color: var(--hs-ink);
}
.hs-pairs { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.hs-pair {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 12px;
  padding: 10px;
  border-radius: 12px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .35s, transform .35s, background .3s;
}
.hs-pair::before { display: none; }
.hs-pair.is-in { opacity: 1; transform: none; }
.hs-pair.is-active { background: rgba(255, 255, 255, .9); }
.hs-pair__icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--hs-danger-soft);
  color: var(--hs-danger);
  transition: background .3s, color .3s, transform .4s;
}
.hs-pair__icon svg { width: 14px; height: 14px; }
.hs-pair__icon .hs-i-ok { display: none; }
.hs-pair.is-solved .hs-pair__icon { background: var(--hs-primary); color: #fff; transform: rotate(360deg); }
.hs-pair.is-solved .hs-pair__icon .hs-i-ok { display: block; }
.hs-pair.is-solved .hs-pair__icon .hs-i-x { display: none; }
.hs-pair__faces { position: relative; min-height: 46px; }
.hs-face { transition: opacity .35s, transform .35s; }
.hs-face__t { font-size: 16px; font-weight: 600; line-height: 1.35; color: var(--hs-ink); }
.hs-face__d { margin-top: 2px; font-size: 14px; line-height: 1.45; color: var(--hs-muted); }
.hs-face--pain .hs-face__t { position: relative; display: inline; }
.hs-face--pain .hs-face__t::after {
  content: "";
  position: absolute;
  left: 0;
  top: 55%;
  width: 0;
  height: 2px;
  background: var(--hs-danger);
  transition: width .35s;
}
.hs-face--gain { position: absolute; inset: 0; opacity: 0; transform: translateY(10px); }
.hs-pair.is-solved .hs-face--pain .hs-face__t::after { width: 100%; }
.hs-pair.is-solved .hs-face--pain { opacity: 0; transform: translateY(-10px); transition-delay: .25s; }
.hs-pair.is-solved .hs-face--gain { opacity: 1; transform: none; transition-delay: .3s; }
.hs-panel__cta {
  display: flex;
  gap: 12px;
  max-height: 0;
  margin-top: 20px;
  overflow: hidden;
  opacity: 0;
  transition: max-height .4s, opacity .4s;
}
.hs-panel__cta { flex-wrap: wrap; }
.hs-panel__cta .hs-btn { flex: 1 1 auto; padding: 0 16px; font-size: 15px; }
.hs-panel.is-final .hs-panel__cta { max-height: 120px; opacity: 1; }

.hs-panel__note {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  font-size: 13px;
  text-align: center;
  color: var(--hs-muted);
  transition: max-height .4s, opacity .4s, margin .4s;
}
.hs-panel.is-final .hs-panel__note { max-height: 40px; margin-top: 12px; opacity: 1; }

/* «Как это работает»: пока робот собирается, список пар уступает место трём шагам.
   Оба списка в одной ячейке грида — высота панели не прыгает. */
.hs-panel__body { display: grid; }
.hs-panel__body > ol { grid-area: 1 / 1; transition: opacity .35s, transform .35s; }
.hs-steps {
  display: grid;
  gap: 12px;
  align-content: center;
  margin: 0;
  padding: 0;
  list-style: none;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
}
.hs-step { display: grid; grid-template-columns: 32px 1fr; gap: 12px; padding: 10px; }
.hs-step::before { display: none; }
.hs-step__n {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #EDEBFF;
  color: #5B4BDB;
  font-size: 15px;
  font-weight: 700;
}
.hs-panel.is-turn .hs-pairs { opacity: 0; transform: translateY(-10px); }
.hs-panel.is-turn .hs-steps { opacity: 1; transform: none; }

/* Превью интерфейса к каждому «решению» — только на широком экране, справа от ролика */
.hs-shots { display: none; }
@media (min-width: 1200px) {
  .hs-shots {
    display: block;
    position: absolute;
    right: 24px;
    top: 13%;
    width: 248px;
  }
}
.hs-shot {
  position: absolute;
  inset: 0 0 auto;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: 16px;
  background: rgba(255, 255, 255, .86);
  box-shadow: var(--hs-shadow);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  font-size: 13px;
  opacity: 0;
  transform: translateY(12px) scale(.98);
  transition: opacity .35s, transform .35s;
}
.hs-shot.is-active { opacity: 1; transform: none; }
.hs-shot__t {
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--hs-primary);
}
.hs-shot__row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-top: 1px solid var(--hs-border);
  color: var(--hs-muted);
}
.hs-shot__row b { font-weight: 600; color: var(--hs-ink); white-space: nowrap; }
.hs-shot__row--sum b { color: var(--hs-primary); font-size: 14px; }
.hs-shot__search, .hs-shot__link {
  margin-bottom: 8px;
  padding: 8px 10px;
  border: 1px solid var(--hs-border);
  border-radius: 8px;
  background: #fff;
  color: var(--hs-ink);
}
.hs-shot__search::before { content: "⌕ "; color: var(--hs-muted); }
.hs-shot__link::before { content: "🔒 "; }
.hs-shot__gantt { position: relative; height: 54px; margin-bottom: 8px; }
.hs-shot__gantt i {
  position: absolute;
  left: var(--s);
  width: var(--w);
  height: 12px;
  border-radius: 6px;
  background: var(--hs-primary);
}
.hs-shot__gantt i:nth-child(1) { top: 2px; opacity: .55; }
.hs-shot__gantt i:nth-child(2) { top: 21px; }
.hs-shot__gantt i:nth-child(3) { top: 40px; opacity: .75; }
.hs-shot__tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.hs-shot__tags span {
  padding: 4px 10px;
  border: 1px solid var(--hs-border);
  border-radius: 999px;
  background: #fff;
  color: var(--hs-muted);
}
.hs-shot__tags .is-on { border-color: var(--hs-primary); background: var(--hs-primary-soft); color: var(--hs-primary-hover); }

/* Плашка доверия: живые цифры из базы */
.hs-proof {
  position: absolute;
  left: 30px;
  bottom: 28px;
  display: flex;
  align-items: center;
  gap: 28px;
  font-size: 13px;
  color: var(--hs-muted);
  opacity: 0;
  transition: opacity .3s;
}
.hs-proof.is-visible { opacity: 1; }
.hs-proof__n b { margin-right: 6px; font-size: 17px; font-weight: 700; color: var(--hs-ink); }
.hs-proof__int { padding-left: 28px; border-left: 1px solid rgba(0, 0, 0, .1); font-weight: 600; }
@media (max-height: 820px) and (min-width: 960px) {
  .hs-proof { display: none; }
}

.hs-rail {
  position: absolute;
  right: 30px;
  bottom: 32px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  transition: opacity .3s;
}
.hs-rail.is-visible { opacity: 1; }
.hs-rail__track {
  position: relative;
  width: 220px;
  height: 4px;
  overflow: hidden;
  border-radius: 4px;
  background: rgba(0, 0, 0, .08);
}
.hs-rail__fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: linear-gradient(90deg, var(--hs-danger), #7a5cf0 50%, var(--hs-primary));
}
.hs-rail__a { color: var(--hs-danger); }
.hs-rail__b { display: block; height: 14px; width: auto; }

/* ---------- ИИ и интеграции ---------- */
.ai-block {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 64px;
  align-items: center;
  margin: 96px 0;
  color: var(--hs-ink);
  font-family: Inter, system-ui, sans-serif;
  scroll-margin-top: 96px;
}
.ai-block__eyebrow { margin-bottom: 16px; font-size: 14px; font-weight: 600; color: var(--hs-primary); }
.ai-block__title {
  margin: 0;
  font-size: clamp(30px, 3.4vw, 40px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -.02em;
  color: var(--hs-ink);
}
.ai-block__lead { margin: 16px 0 0; font-size: 18px; line-height: 1.6; color: var(--hs-muted); }
.ai-block__clients { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.ai-block__client {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--hs-border);
  border-radius: 999px;
  background: #fff;
  font-size: 14px;
  font-weight: 500;
  color: var(--hs-ink);
}
.ai-block__client svg, .ai-chat__app svg { flex: none; width: 18px; height: 18px; }
.ai-chat__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -4px 0 4px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--hs-border);
  font-size: 13px;
}
.ai-chat__app { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--hs-ink); }
.ai-chat__conn { display: inline-flex; align-items: center; gap: 6px; color: var(--hs-muted); }
.ai-chat__conn i { width: 8px; height: 8px; border-radius: 50%; background: #3DD68C; box-shadow: 0 0 0 3px rgba(61, 214, 140, .2); }
.ai-block__list { display: grid; gap: 14px; margin: 28px 0 0; padding: 0; list-style: none; }
.ai-block__list li { display: flex; gap: 12px; font-size: 16px; line-height: 1.5; }
.ai-block__list li::before { display: none; }
.ai-block__list svg { flex: none; width: 22px; height: 22px; margin-top: 1px; color: var(--hs-primary); }
.ai-block__cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }

.ai-chat {
  display: grid;
  gap: 14px;
  padding: 24px;
  border: 1px solid var(--hs-border);
  border-radius: 20px;
  background: #fff;
  box-shadow: var(--hs-shadow);
}
.ai-chat__msg { max-width: 88%; padding: 12px 16px; border-radius: 16px; font-size: 15px; line-height: 1.5; }
.ai-chat__msg--user { justify-self: end; border-bottom-right-radius: 4px; background: var(--hs-ink); color: #fff; }
.ai-chat__msg--ai { border-bottom-left-radius: 4px; background: var(--hs-surface); }
.ai-chat__msg--tool { display: flex; align-items: center; gap: 8px; padding: 0 4px; font-size: 13px; color: var(--hs-muted); }
.ai-chat__msg--tool code {
  padding: 1px 6px;
  border: 1px solid var(--hs-border);
  border-radius: 6px;
  background: var(--hs-surface);
  font-size: 12px;
}
.ai-chat__kp {
  display: grid;
  gap: 4px;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--hs-border);
  border-radius: 10px;
  background: #fff;
  font-size: 14px;
}
.ai-chat__kp div { display: flex; justify-content: space-between; gap: 12px; }
.ai-chat__kp .ai-chat__sum { margin-top: 2px; padding-top: 6px; border-top: 1px solid var(--hs-border); }

/* ---------- адаптив ---------- */
/* Невысокое окно на десктопе (ноутбуки 13", панель закладок): сжимаем оффер и панель по вертикали,
   описания пунктов — только у активного, как на мобильном */
@media (min-width: 960px) and (max-height: 820px) {
  .hs-hero__badge { margin-bottom: 16px; }
  .hs-hero__title { font-size: clamp(34px, 3.8vw, 48px); }
  .hs-hero__text { margin-top: 14px; font-size: 17px; line-height: 1.5; }
  .hs-hero__cta { margin-top: 24px; }
  .hs-hint { display: none; }
  .hs-panel__card { padding: 20px 24px; }
  .hs-panel__title { min-height: 0; margin: 10px 0 12px; font-size: 22px; }
  .hs-pair { padding: 7px 10px; }
  .hs-pair__faces { min-height: 22px; }
  .hs-face__d { display: none; }
  .hs-pair.is-active .hs-face__d { display: block; }
  .hs-pair.is-active .hs-pair__faces { min-height: 44px; }
  .hs-step { padding: 6px 10px; }
  .hs-step .hs-face__d { display: block; }
  .hs-panel__cta { margin-top: 14px; }
  .hs-panel__cta .hs-btn { height: 44px; }
}
@media (min-width: 960px) and (max-height: 640px) {
  .page--home { --hs-top: 80px; --hs-bottom: 56px; }
  .hs-hero__badge, .hs-hero__note { display: none; }
  .hs-hero__title { font-size: clamp(30px, 3.2vw, 40px); }
  .hs-hero__text { font-size: 16px; }
  .hs-panel__title { margin: 8px 0; font-size: 20px; }
  .hs-pair { padding: 5px 8px; }
  .hs-rail { bottom: 20px; }
  .hs-panel__cta .hs-btn--secondary { display: none; }
}
@media (max-width: 959px) {
  .hs { height: 560vh; }
  .hs__inner { padding: 0 16px; }
  .hs-hero { left: 16px; right: 16px; top: auto; bottom: 40px; max-width: none; align-items: stretch; transform: none; }
  .hs-hero.is-hidden { transform: translateY(-16px); }
  .hs-hero__badge, .hs-hero__note, .hs-hint { display: none; }
  .hs-hero__title { font-size: 32px; }
  .hs-hero__text { margin-top: 12px; font-size: 16px; }
  .hs-hero__cta { margin-top: 20px; }
  .hs-hero__cta .hs-btn { flex: 1; }
  .hs-panel { left: 12px; right: 12px; top: auto; bottom: 56px; width: auto; transform: none; }
  .hs-panel__card { padding: 18px; }
  .hs-panel__title { min-height: 0; margin: 10px 0; font-size: 20px; }
  .hs-pair { grid-template-columns: 24px 1fr; gap: 10px; padding: 6px 8px; }
  .hs-pair__icon { width: 24px; height: 24px; }
  .hs-pair__faces { min-height: 22px; }
  .hs-face__t { font-size: 15px; }
  .hs-face__d { display: none; }
  .hs-pair.is-active .hs-face__d { display: block; }
  .hs-pair.is-active .hs-pair__faces { min-height: 44px; }
  .hs-panel__cta .hs-btn { flex: 1; }
  .hs-panel__cta .hs-btn--secondary { display: none; }
  .hs-rail { left: 16px; right: 16px; bottom: 20px; justify-content: center; }
  .hs-proof { display: none; }
  .hs-step { padding: 4px 8px; }
  .hs-step .hs-face__d { display: block; }
  .hs-rail__track { flex: 1; max-width: 260px; }

  .ai-block { grid-template-columns: 1fr; gap: 40px; margin: 64px 0; }
}
@media (max-width: 480px) {
  .ai-block__cta .hs-btn { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .hs *, .hs *::before, .hs *::after { transition-duration: .01ms !important; animation: none !important; }
}
