/* Движение на лендингах /<имя>-view — общие стили, рядом общий скрипт lp-motion.js (там же описана разметка).
   Четыре части: окно чата с примерами и меняющаяся строка заголовка, бегущие вопросы, история по прокрутке
   со схемой входа, две дорожки. Всё, что зависит от классов is-*, без скрипта остаётся в готовом виде.
   Двигаются только transform и opacity.

   Цвета, шрифты и кривая — переменные страницы: --bg, --surface, --surface-2, --line, --line-strong, --text,
   --text-2, --text-3, --accent, --accent-hover, --accent-ink, --accent-soft, --accent-soft-ink, --on-accent,
   --press, --sheet, --error (отказ), --ok («пустили»), --photo (стол под «фото»), --mono, --ease. Необязательные:
   --btn, --btn-hover, --on-btn — цвет кнопки отправки, если кнопки страницы не акцентного цвета;
   --header-h — высота шапки, под которой на узком экране прилипает схема входа (по умолчанию 56px). */

[hidden] {
  display: none !important;
}
/* Листы частей — тот же «лист», что у страницы. */
.demo-win,
.gate,
.lane {
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--sheet);
}

/* --- строка заголовка --- */
/* Третья строка заголовка: фраза меняется вместе с примером в окне чата. Старая и новая стоят в одной ячейке. */
.rotor {
  display: grid;
  justify-items: start;
  color: var(--accent-ink);
  white-space: nowrap;
}
.rotor-word {
  grid-area: 1 / 1;
}
.rotor-word::after {
  content: '';
  display: inline-block;
  width: 3px;
  height: 0.86em;
  margin-left: 6px;
  vertical-align: -0.06em;
  border-radius: 1px;
  background: var(--accent);
  animation: blink 1.1s steps(1) infinite;
}
.rotor-ch {
  display: inline-block;
  animation: letter-in 420ms var(--ease) both;
  animation-delay: calc(var(--i) * 18ms);
}
.rotor-word.is-out {
  animation: word-out 240ms var(--ease) forwards;
}
.rotor-word.is-out::after {
  display: none;
}
@keyframes letter-in {
  from {
    opacity: 0;
    transform: translateY(0.4em);
  }
}
@keyframes word-out {
  to {
    opacity: 0;
    transform: translateY(-0.3em);
  }
}
@keyframes blink {
  50% {
    opacity: 0;
  }
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}
@keyframes fade {
  from {
    opacity: 0;
  }
}

/* --- окно чата --- */
/* Высота переписки постоянная: ответ растёт, страница не прыгает. */
.demo {
  margin: 0;
  min-width: 0;
}
.demo-win {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.demo-bar {
  display: flex;
  gap: 4px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}
.demo-tab {
  position: relative;
  height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text-3);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  transition:
    color 150ms var(--ease),
    background-color 150ms var(--ease);
}
.demo-tab:hover {
  background: var(--press);
  color: var(--text);
}
.demo-tab[aria-pressed='true'] {
  color: var(--text);
}
/* Полоска под вкладкой — сколько осталось до следующего примера. */
.demo-tab i {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 2px;
  height: 2px;
  border-radius: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
}
.demo-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 336px;
  padding: 20px;
  overflow: hidden;
  font-size: 15px;
  transition: opacity 220ms var(--ease);
}
.demo-body.is-leaving {
  opacity: 0;
}
.msg {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.msg-user {
  align-self: flex-end;
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--surface-2);
}
.msg-user.is-new {
  animation: rise 320ms var(--ease) both;
}
.msg-ai {
  min-height: 24px;
  color: var(--text);
}
.msg-ai .w {
  animation: fade 260ms var(--ease) both;
}
.msg-code {
  margin: 0;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--surface-2);
  font: 13px/20px var(--mono);
  white-space: pre;
  overflow: hidden;
}
.msg-user .msg-code {
  background: var(--surface);
}
.msg-file {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 8px 8px;
  border-radius: 8px;
  background: var(--surface);
}
.msg-file-ico {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-soft-ink);
  font-size: 11px;
  font-weight: 600;
}
.msg-file-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.3;
}
.msg-file-name {
  font-size: 14px;
  font-weight: 500;
}
.msg-file-meta {
  color: var(--text-3);
  font-size: 13px;
}
/* Готовый файл в ответе нейросети: карточка с рамкой и «Скачать». */
.msg-ai .msg-file {
  align-self: flex-start;
  max-width: 100%;
  border: 1px solid var(--line-strong);
}
.msg-file-get {
  margin-left: 8px;
  padding-left: 12px;
  border-left: 1px solid var(--line);
  color: var(--accent-ink);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}
/* «Фото» чека: бумага на столе. Бумага светлая в обеих темах — это снимок, а не часть интерфейса. */
.msg-photo {
  width: 208px;
  max-width: 100%;
  padding: 12px 20px;
  border-radius: 8px;
  background: var(--photo);
}
.receipt {
  display: flex;
  flex-direction: column;
  padding: 8px 10px;
  background: #fbfaf6;
  color: #2a2d33;
  font: 11px/16px var(--mono);
  box-shadow: 0 1px 2px rgba(20, 26, 36, 0.18);
  transform: rotate(-2deg);
}
.receipt-head {
  margin-bottom: 4px;
  text-align: center;
}
.receipt-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-variant-numeric: tabular-nums;
}
.receipt-row:last-child {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px dashed rgba(42, 45, 51, 0.4);
  font-weight: 600;
}
/* «Фото» страницы учебника: печатный текст на бумаге. */
.textbook {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  background: #fbfaf6;
  color: #2a2d33;
  font: 13px/18px Georgia, 'Times New Roman', serif;
  box-shadow: 0 1px 2px rgba(20, 26, 36, 0.18);
  transform: rotate(1.5deg);
}
.textbook span:last-child {
  font-size: 16px;
  line-height: 22px;
  text-align: center;
}
.caret {
  display: inline-block;
  width: 2px;
  height: 1em;
  margin-left: 2px;
  vertical-align: -0.14em;
  border-radius: 1px;
  background: var(--accent);
  animation: blink 1.1s steps(1) infinite;
}

.demo-input {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 16px 16px;
  padding: 6px 6px 6px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  transition: border-color 150ms var(--ease);
}
.demo-input:focus-within {
  border-color: var(--accent);
}
.demo-input input {
  flex: 1;
  min-width: 0;
  height: 32px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 16px;
  outline: none;
}
.demo-input input::placeholder {
  color: var(--text-3);
  opacity: 1;
}
.demo-input.is-ghost input::placeholder {
  color: transparent;
}
/* Вопрос примера печатается поверх пустого поля; длинный прижат к правому краю, виден его конец. */
.demo-ghost {
  position: absolute;
  inset: 0 52px 0 16px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  overflow: hidden;
  white-space: nowrap;
  pointer-events: none;
}
.demo-ghost span {
  flex: none;
  min-width: 100%;
}
.demo-ghost span:not(:empty)::after {
  content: '';
  display: inline-block;
  width: 2px;
  height: 1.1em;
  margin-left: 2px;
  vertical-align: -0.2em;
  border-radius: 1px;
  background: var(--accent);
}
.demo-send {
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--btn, var(--accent));
  color: var(--on-btn, var(--on-accent));
  transition:
    background-color 150ms var(--ease),
    transform 120ms var(--ease);
}
.demo-send:hover {
  background: var(--btn-hover, var(--accent-hover));
}
.demo-send svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
}
.demo-send:active,
.demo-send.is-pressed {
  transform: scale(0.92);
}
.demo-cap {
  margin-top: 12px;
  color: var(--text-3);
  font-size: 14px;
}

/* --- бегущие вопросы --- */
/* Две строки «таблеток» во всю ширину окна, навстречу друг другу. Пока скрипт не дописал вторую копию ряда
   (нет скрипта или движение отключено в системе), вопросы просто стоят в несколько строк. */
.ticker {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0 calc(50% - 50vw);
  padding: 8px 0 40px;
}
.ticker-row {
  display: flex;
  overflow: hidden;
}
.ticker-track {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px 0;
  margin: 0;
  padding: 4px 16px;
  list-style: none;
}
.ticker-track li {
  flex: none;
  padding-right: 12px;
}
.ticker-track a {
  display: block;
  padding: 12px 24px;
  border-radius: 26px;
  background: var(--surface);
  box-shadow: var(--sheet);
  color: var(--text-2);
  font-size: clamp(17px, 2vw, 22px);
  line-height: 28px;
  text-decoration: none;
  white-space: nowrap;
  transition:
    color 150ms var(--ease),
    background-color 150ms var(--ease);
}
.ticker-track a:hover {
  background: var(--accent-soft);
  color: var(--accent-soft-ink);
}
.ticker-row.is-ready {
  -webkit-mask-image: linear-gradient(to right, transparent, #000 10%, #000 90%, transparent);
  mask-image: linear-gradient(to right, transparent, #000 10%, #000 90%, transparent);
}
.ticker-row.is-ready .ticker-track {
  flex: none;
  flex-wrap: nowrap;
  justify-content: flex-start;
  padding: 4px 0;
  animation: ticker 60s linear infinite;
}
.ticker-row-back.is-ready .ticker-track {
  animation-direction: reverse;
}
.ticker:hover .ticker-track,
.ticker:focus-within .ticker-track {
  animation-play-state: paused;
}
@keyframes ticker {
  to {
    transform: translateX(-50%);
  }
}

/* --- история по прокрутке: «не пускают — пускают» --- */
/* Слева шаги, справа схема входа — она прилипает и меняется вместе с шагом у середины экрана (lp-motion.js ставит
   is-active шагу, is-on строкам схемы, is-open — когда дошли до чата без VPN). Без скрипта (нет is-live):
   шаги идут обычным текстом, схема показывает три отказа. */
.story {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 400px);
  gap: 48px;
  align-items: start;
}
.story-steps {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
}
.story-step {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding: 20px 0;
}
.story-step h3,
.story-step h2 {
  font-size: clamp(24px, 3vw, 32px);
  line-height: 1.2;
}
.story-step p {
  max-width: 520px;
  color: var(--text-2);
  font-size: 18px;
}
.story-step .honest {
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent-soft-ink);
  font-size: 15px;
}
.story-step > a {
  margin-top: 4px;
}
.story.is-live .story-step {
  justify-content: center;
  min-height: 56vh;
  transition: opacity 300ms var(--ease);
}
.story.is-live .story-step:not(.is-active) {
  opacity: 0.3;
}
.story-stage {
  position: sticky;
  top: calc(50vh - 150px);
  margin: 0;
}
.story-steps p,
.gate p {
  margin: 0;
}

/* Схема входа: два слоя в одной ячейке — «не пускают» и «пускают». Красный — только у отказов. */
.gate {
  display: grid;
  padding: 24px;
}
.gate-pane {
  grid-area: 1 / 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition:
    opacity 300ms var(--ease),
    transform 300ms var(--ease);
}
.gate-yes {
  align-self: center;
  opacity: 0;
  transform: translateY(8px);
}
.gate.is-open .gate-yes {
  opacity: 1;
  transform: none;
  transition-delay: 160ms;
}
.gate.is-open .gate-no {
  opacity: 0;
  transform: translateY(-8px);
}
.gate-title {
  color: var(--text-3);
  font-size: 14px;
}
.gate-rows {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.gate-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 4px 12px;
  align-items: center;
}
.gate-label {
  color: var(--text-2);
  font-size: 14px;
}
.gate-field {
  display: flex;
  align-items: center;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--error);
  border-radius: 10px;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.gate-yes .gate-field {
  border-color: var(--line-strong);
}
.gate-verdict {
  grid-column: 2;
  height: 20px;
  color: var(--error);
  font-size: 13px;
  line-height: 20px;
}
.gate-code {
  display: flex;
  gap: 6px;
}
.gate-code b {
  display: grid;
  place-items: center;
  width: 32px;
  height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.gate-in {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ok);
  font-size: 15px;
  font-weight: 500;
}
.gate-in::before {
  content: '';
  width: 12px;
  height: 7px;
  margin: 0 2px 4px;
  border-left: 2px solid var(--ok);
  border-bottom: 2px solid var(--ok);
  transform: rotate(-45deg);
}
/* Живая схема. Все три поля заполнены с самого начала, телефон уже с отказом (у него нет data-at). Карта и VPN
   получают отказ на своём шаге: поле краснеет, вздрагивает, под ним появляется причина. Прокрутили назад —
   отказ снимается без задержки. */
.gate.is-live .gate-no .gate-field {
  transition: border-color 200ms var(--ease) 150ms;
}
.gate.is-live .gate-no .gate-verdict {
  transition:
    opacity 200ms var(--ease) 150ms,
    transform 200ms var(--ease) 150ms;
}
.gate.is-live .gate-no .gate-row.is-on .gate-field {
  animation: refuse 360ms var(--ease) 150ms;
}
.gate.is-live .gate-no .gate-row[data-at]:not(.is-on) .gate-field {
  border-color: var(--line-strong);
  transition-delay: 0s;
}
.gate.is-live .gate-no .gate-row[data-at]:not(.is-on) .gate-verdict {
  opacity: 0;
  transform: translateY(-4px);
  transition-delay: 0s;
}
@keyframes refuse {
  25% {
    transform: translateX(-4px);
  }
  60% {
    transform: translateX(3px);
  }
  85% {
    transform: translateX(-1px);
  }
}
/* Вход по коду: почта, шесть цифр по одной, «вы в чате». */
.gate.is-live .gate-yes .gate-field,
.gate.is-live .gate-code b {
  color: transparent;
  transition: color 160ms var(--ease);
}
.gate.is-live .gate-in {
  opacity: 0;
  transition: opacity 240ms var(--ease);
}
.gate.is-live.is-open .gate-yes .gate-field,
.gate.is-live.is-open .gate-code b {
  color: var(--text);
  transition-delay: 400ms;
}
.gate.is-live.is-open .gate-code b:nth-child(1) {
  transition-delay: 800ms;
}
.gate.is-live.is-open .gate-code b:nth-child(2) {
  transition-delay: 920ms;
}
.gate.is-live.is-open .gate-code b:nth-child(3) {
  transition-delay: 1040ms;
}
.gate.is-live.is-open .gate-code b:nth-child(4) {
  transition-delay: 1160ms;
}
.gate.is-live.is-open .gate-code b:nth-child(5) {
  transition-delay: 1280ms;
}
.gate.is-live.is-open .gate-code b:nth-child(6) {
  transition-delay: 1400ms;
}
.gate.is-live.is-open .gate-in {
  opacity: 1;
  transition-delay: 1700ms;
}

/* --- две дорожки --- */
/* Шаги — точки с линией вниз к следующей. lp-motion.js: is-armed — всё погашено и ждёт; is-on — шаг пройден;
   is-going — линия от него тянется к следующему за время --seg (у медленной дорожки оно больше);
   is-finished — дорожка пройдена. Без скрипта всё видно готовым. */
.race {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}
.lane {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 24px;
  --dot: var(--text-3);
}
.lane-fast {
  --dot: var(--accent);
}
.lane-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.lane-head h3,
.lane-count {
  margin: 0;
}
.lane-head h3 {
  font-size: 17px;
  line-height: 1.3;
}
.lane-count {
  min-height: 22px;
  color: var(--text-3);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.lane-fast.is-finished .lane-count {
  color: var(--accent-ink);
}
.lane-steps {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.lane-steps li {
  position: relative;
  padding-left: 32px;
  transition: opacity 300ms var(--ease);
}
.lane-steps h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
  line-height: 24px;
}
.lane-steps p {
  margin: 4px 0 0;
  color: var(--text-2);
  font-size: 15px;
}
.lane-steps li::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--dot);
  transition: transform 300ms var(--ease);
}
.lane-steps li::after {
  content: '';
  position: absolute;
  left: 9px;
  top: 22px;
  bottom: -22px;
  width: 2px;
  border-radius: 1px;
  background: var(--dot);
  transform-origin: top;
  transition: transform var(--seg, 0ms) linear;
}
.lane-steps li:last-child::after {
  display: none;
}
.lane-cta {
  align-self: flex-start;
  transition:
    background-color 150ms var(--ease),
    opacity 300ms var(--ease);
}
.race.is-armed .lane-steps li:not(.is-on) {
  opacity: 0.36;
}
.race.is-armed .lane-steps li:not(.is-on)::before {
  transform: scale(0.6);
}
.race.is-armed .lane-steps li:not(.is-going)::after {
  transform: scaleY(0);
}
.race.is-armed .lane:not(.is-finished) .lane-cta {
  opacity: 0.36;
}
.race.is-reset .lane-steps li,
.race.is-reset .lane-steps li::before,
.race.is-reset .lane-steps li::after,
.race.is-reset .lane-cta {
  transition: none;
}
.race-again {
  height: 36px;
  margin-top: 12px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--text-2);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 150ms var(--ease);
}
.race-again:hover {
  background: var(--press);
}

/* --- узкие экраны --- */
@media (max-width: 960px) {
  /* Схема входа — сверху и прилипает под шапкой, шаги прокручиваются под ней. */
  .story {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
  .story-stage {
    order: -1;
    top: var(--header-h, 56px);
    z-index: 2;
    padding: 8px 0;
    background: var(--bg);
  }
  .gate {
    padding: 16px;
  }
  .gate-pane {
    gap: 12px;
  }
  .gate-rows {
    gap: 8px;
  }
  .gate-row {
    gap: 0 12px;
  }
  .gate-field {
    height: 32px;
  }
  .gate-code b {
    width: 28px;
    height: 32px;
  }
  .story.is-live .story-step {
    min-height: 48vh;
  }
}
@media (max-width: 720px) {
  /* Дорожки друг под другом; у медленной остаются только названия шагов — обе видны на одном экране. */
  .race {
    grid-template-columns: minmax(0, 1fr);
  }
  .lane-slow .lane-steps p {
    display: none;
  }
}
@media (max-width: 600px) {
  .story-step p {
    font-size: 17px;
  }
  .demo-body {
    height: 364px;
    padding: 16px;
  }
  .demo-input {
    margin: 4px 12px 12px;
  }
  .demo-bar {
    padding: 8px;
  }
  .demo-tab {
    padding: 0 10px;
  }
  .demo-tab i {
    left: 10px;
    right: 10px;
  }
  .ticker {
    padding-bottom: 28px;
  }
  .ticker-track a {
    padding: 10px 20px;
  }
  .lane {
    padding: 20px;
  }
}

/* Движение отключено в системе: без переходов и анимаций. Состояния те же, просто меняются сразу. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
