/* Красные кеды · раздел «Автоматизация и ИИ» (#ai, surface-night)
   Цифровое направление в мире бренда: связи на схеме — шнурки, события — наконечники,
   подписи — mono, как на бирке коробки. Цвета только из токенов, все селекторы с префиксом .ai */

.ai { position: relative; }

/* ── Шапка раздела ─────────────────────────────────────────────── */
.ai__labels { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; min-width: 0; }
.ai__labels .tag__name { line-height: 1.25; }
.ai__new {
  display: inline-flex; align-items: center; gap: 9px;
  min-height: 30px; padding: 0 13px;
  border: 1.5px solid var(--red);
  border-radius: var(--r-pill);
  font-family: var(--f-mono); font-size: var(--fs-label); font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; line-height: 1;
  color: var(--s-fg);
}
.ai__new-led { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--red); animation: ai-blink 2.4s steps(1, end) infinite; }
@keyframes ai-blink { 50% { opacity: .25; } }
/* длинное слово «АВТОМАТИЗАЦИЯ» не должно вылезать за край на 360 px */
.ai__head .section-head__text { grid-template-columns: minmax(0, 1fr); }
.ai__head .h2 { font-size: min(var(--fs-h2), 7vw); }
@media (max-width: 1099px) {
  .ai__head { grid-template-columns: minmax(0, 1fr); }
  .ai__labels { flex-direction: row; flex-wrap: wrap; align-items: center; }
}

/* ── Блок 1: демонстрация ──────────────────────────────────────── */
.ai__demo {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(40px, 6vw, 56px);
  align-items: center;
}
@media (min-width: 900px) {
  .ai__demo { grid-template-columns: minmax(0, 320px) minmax(0, 1fr); gap: clamp(28px, 4vw, 64px); }
}
@media (min-width: 1100px) {
  .ai__demo { grid-template-columns: minmax(0, 360px) minmax(0, 1fr); }
}

.ai__phone-col { display: flex; flex-direction: column; align-items: center; gap: 20px; min-width: 0; }
.ai__note {
  max-width: 36ch;
  text-align: center;
  font-family: var(--f-mono); font-size: var(--fs-label); font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; line-height: 1.55;
  color: var(--s-muted);
}

/* Телефон: настоящий CSS 3D. Толщина корпуса — слои по оси Z, поворот от прокрутки и курсора (ai.js) */
.ai__device { width: 100%; max-width: 360px; perspective: 1500px; perspective-origin: 50% 35%; }
.ai__phone {
  --ai-rx: 0deg; --ai-ry: 0deg; --ai-g: 0;
  position: relative;
  padding: 9px;
  border-radius: 46px;
  background: var(--ink);
  box-shadow: inset 0 0 0 1.5px var(--wall-line);
  transform: rotateX(var(--ai-rx)) rotateY(var(--ai-ry));
  transform-style: preserve-3d;
}
/* боковые кнопки */
.ai__phone::before, .ai__phone::after {
  content: ""; position: absolute; width: 3px; border-radius: 2px; background: var(--wall-line);
  transform: translateZ(-6px);
}
.ai__phone::before { right: -2px; top: 24%; height: 70px; }
.ai__phone::after { left: -2px; top: 19%; height: 44px; }
.ai__phone-depth { position: absolute; inset: 0; border-radius: inherit; transform-style: preserve-3d; pointer-events: none; }
.ai__phone-depth i { position: absolute; inset: 0; border-radius: inherit; background: var(--wall-line); }
.ai__phone-depth i:nth-child(1) { transform: translateZ(-3px); }
.ai__phone-depth i:nth-child(2) { transform: translateZ(-6px); }
.ai__phone-depth i:nth-child(3) { transform: translateZ(-9px); }
.ai__phone-depth i:nth-child(4) { transform: translateZ(-12px); background: var(--wall-2); }

.ai__screen {
  position: relative;
  overflow: hidden;
  border-radius: 37px;
  background: var(--wall);
  transform: translateZ(1px);
}
/* блик стекла едет вместе с поворотом */
.ai__screen::after {
  content: ""; position: absolute; inset: -10% -70%; z-index: 3; pointer-events: none;
  background: linear-gradient(105deg, transparent 40%, color-mix(in srgb, var(--paper) 5%, transparent) 48%, transparent 56%);
  transform: translateX(calc(var(--ai-g) * 26%));
}

.ai__status {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  height: 40px; padding: 4px 20px 0 26px;
  font-size: .8125rem; font-weight: 600; color: var(--on-dark);
}
.ai__status-time { justify-self: start; }
.ai__island { width: 84px; height: 24px; border-radius: var(--r-pill); background: var(--ink); }
.ai__status-icons { justify-self: end; display: flex; align-items: center; gap: 5px; }
.ai__status-icons svg:first-child { width: 15px; height: 11px; }
.ai__status-icons svg:last-child { width: 23px; height: 11px; }

.ai__chat { display: flex; flex-direction: column; }
.ai__chat-head {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px 12px;
  border-bottom: 1px solid var(--wall-line);
}
.ai__chat-ava { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--red); }
.ai__chat-ava img { width: 22px; height: 22px; }
.ai__chat-meta { min-width: 0; }
.ai__chat-title { font-size: .875rem; font-weight: 600; line-height: 1.25; color: var(--on-dark); }
.ai__chat-sub {
  display: flex; align-items: center; gap: 6px; margin-top: 2px;
  font-family: var(--f-mono); font-size: .6875rem; line-height: 1.3; color: var(--on-dark-muted);
}
.ai__chat-dot { flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--red); }

.ai__chat-body { position: relative; padding: 14px 12px 12px; }
.ai__msgs { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.ai__msg {
  display: flex; flex-direction: column; max-width: 86%;
  transition: opacity .45s var(--ease-out), transform .55s var(--ease-out);
}
.ai__msg--client { align-self: flex-start; align-items: flex-start; }
.ai__msg--bot { align-self: flex-end; align-items: flex-end; }
.ai__bubble {
  padding: 9px 13px 10px;
  border-radius: 18px;
  font-size: .90625rem; line-height: 1.42;
}
.ai__msg--client .ai__bubble { background: var(--wall-2); border: 1px solid var(--wall-line); border-bottom-left-radius: 6px; color: var(--on-dark); }
.ai__msg--bot .ai__bubble { background: var(--paper); color: var(--ink); border-bottom-right-radius: 6px; }
.ai__msg-who { margin-top: 4px; font-family: var(--f-mono); font-size: .625rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--on-dark-muted); }

.ai__event {
  align-self: center;
  display: flex; align-items: flex-start; gap: 8px;
  max-width: 94%;
  margin-top: 6px;
  padding: 9px 12px;
  border: 1px solid var(--red);
  border-radius: 10px;
  font-family: var(--f-mono); font-size: .6875rem; font-weight: 600;
  letter-spacing: .05em; text-transform: uppercase; line-height: 1.45;
  color: var(--on-dark);
  transition: opacity .45s var(--ease-out), transform .55s var(--ease-out);
}
.ai__event-led { flex: none; width: 7px; height: 7px; margin-top: .4em; border-radius: 50%; background: var(--red); }
.ai__event.is-ping { animation: ai-event 1.1s var(--ease-out) 1; }
@keyframes ai-event {
  0% { background-color: color-mix(in srgb, var(--red) 34%, transparent); }
  100% { background-color: transparent; }
}

/* переигровка: ещё не «пришедшие» сообщения прозрачны, место под них сохраняется — без сдвига вёрстки */
.ai__chat.is-replay .ai__msg:not(.is-shown),
.ai__chat.is-replay .ai__event:not(.is-shown) { opacity: 0; transform: translateY(10px); }

.ai__typing {
  position: absolute; left: 12px; top: 14px; z-index: 2;
  display: none; align-items: center; gap: 8px;
}
.ai__typing.is-on { display: flex; }
.ai__typing.is-bot { left: auto; right: 12px; flex-direction: row-reverse; }
.ai__typing-dots {
  display: inline-flex; gap: 4px; align-items: center;
  padding: 12px 14px; border-radius: 18px;
  background: var(--wall-2); border: 1px solid var(--wall-line);
}
.ai__typing.is-bot .ai__typing-dots { background: var(--paper); border-color: var(--paper); }
.ai__typing-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--on-dark-muted); animation: ai-dot 1.1s ease-in-out infinite; }
.ai__typing.is-bot .ai__typing-dots i { background: var(--muted); }
.ai__typing-dots i:nth-child(2) { animation-delay: .16s; }
.ai__typing-dots i:nth-child(3) { animation-delay: .32s; }
@keyframes ai-dot { 0%, 70%, 100% { opacity: .3; } 30% { opacity: 1; } }
.ai__typing-text { font-family: var(--f-mono); font-size: .625rem; color: var(--on-dark-muted); }

.ai__chat-input {
  display: flex; align-items: center; gap: 10px;
  margin: 2px 12px 14px;
  padding: 5px 5px 5px 16px;
  border: 1px solid var(--wall-line); border-radius: var(--r-pill);
  font-size: .875rem; color: var(--on-dark-muted);
}
.ai__chat-send { margin-left: auto; flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--red); color: var(--paper); }
.ai__chat-send svg { width: 16px; height: 16px; }

.ai__phone-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px; }
.ai__replay-icon { width: 18px; height: 18px; flex: none; }
/* на телефоне главная кнопка во всю ширину под телефоном, «Повторить» под ней */
@media (max-width: 559px) {
  .ai__phone-actions { width: 100%; max-width: 360px; }
  .ai__phone-link { flex: 1 1 100%; }
}

/* Схема связки: тёмная плата с сеткой точек */
.ai__board {
  display: flex; flex-direction: column; min-width: 0;
  border: 1.5px solid var(--wall-line);
  border-radius: var(--r-m);
  background: var(--ink);
  overflow: hidden;
}
.ai__board-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px;
  padding: 14px clamp(16px, 2.4vw, 24px);
  border-bottom: 1.5px solid var(--wall-line);
  font-family: var(--f-mono); font-size: var(--fs-label); font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; line-height: 1.3;
}
.ai__board-title { color: var(--on-dark-muted); }
.ai__board-status { display: inline-flex; align-items: center; gap: 8px; color: var(--on-dark); }
.ai__board-led { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--red); }

.ai__flow {
  position: relative;
  padding: clamp(28px, 3.4vw, 44px) clamp(14px, 2.4vw, 28px);
  background-image: radial-gradient(circle, var(--wall-2) 1.2px, transparent 1.7px);
  background-size: 22px 22px;
  background-position: 11px 11px;
}
.ai__flow-list { position: relative; z-index: 1; list-style: none; }
.ai__node { min-width: 0; }

/* Узел — клавиша: лицо + выдавленный бортик снизу */
.ai__node-tile { position: relative; display: block; flex: none; width: 52px; height: 52px; }
.ai__node-tile::before {
  content: ""; position: absolute; inset: 0;
  border-radius: 15px;
  background: var(--wall);
  border: 1.5px solid var(--wall-line);
  transform: translateY(5px);
}
.ai__node-face {
  position: relative;
  display: grid; place-items: center;
  width: 100%; height: 100%;
  border-radius: 15px;
  background: var(--wall-2);
  border: 1.5px solid var(--wall-line);
  color: var(--on-dark);
  transition: transform .22s var(--ease-out), border-color .35s, color .35s, background-color .35s;
}
.ai__node-face svg { width: 24px; height: 24px; }
.ai__node--core .ai__node-tile { width: 62px; height: 62px; }
.ai__node--core .ai__node-tile::before { border-radius: 18px; background: color-mix(in srgb, var(--red) 52%, var(--ink)); border-color: color-mix(in srgb, var(--red) 52%, var(--ink)); }
.ai__node--core .ai__node-face { border-radius: 18px; background: var(--red); border-color: var(--red); }
.ai__node--core .ai__node-face img { width: 36px; height: 36px; }
.ai__node.is-hot .ai__node-face { border-color: var(--red); }
.ai__node.is-hot:not(.ai__node--core) .ai__node-face { color: var(--red); }
.ai__node.is-ping .ai__node-face { transform: translateY(4px); }
.ai__node.is-busy .ai__node-face { animation: ai-busy .5s var(--ease-io) infinite alternate; }
@keyframes ai-busy { to { transform: translateY(4px); } }
.ai__node-label { display: block; font-size: .8125rem; font-weight: 600; line-height: 1.25; color: var(--on-dark); overflow-wrap: break-word; }
.ai__node-badge {
  position: absolute; z-index: 2; top: -9px; right: -11px;
  min-width: 24px; height: 24px; padding: 0 6px;
  border: 2px solid var(--ink);
  border-radius: var(--r-pill);
  background: var(--paper); color: var(--ink);
  font-size: .75rem; font-weight: 700; line-height: 20px; text-align: center;
  transition: transform .4s var(--ease-out);
}
.ai__flow.is-replay .ai__node:not(.has-badge) .ai__node-badge { transform: scale(0); }

/* Без JS: аккуратный вертикальный список */
.ai__flow:not(.is-live) .ai__flow-list { display: grid; gap: 16px; }
.ai__flow:not(.is-live) .ai__node { display: flex; align-items: center; gap: 14px; }

/* JS: горизонтальная схема (широкий контейнер) */
.ai__flow.is-live .ai__flow-list { display: grid; }
.ai__flow[data-layout="h"] .ai__flow-list {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-template-rows: repeat(3, auto);
  column-gap: clamp(10px, 1.6vw, 22px);
  row-gap: 18px;
  align-items: center;
}
.ai__flow[data-layout="h"] .ai__node { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.ai__flow[data-layout="h"] [data-node="ig"] { grid-area: 1 / 1; }
.ai__flow[data-layout="h"] [data-node="tg"] { grid-area: 2 / 1; }
.ai__flow[data-layout="h"] [data-node="web"] { grid-area: 3 / 1; }
.ai__flow[data-layout="h"] [data-node="ai"] { grid-area: 1 / 2 / 4 / 3; }
.ai__flow[data-layout="h"] [data-node="crm"] { grid-area: 1 / 3 / 4 / 4; translate: 0 -26px; }
.ai__flow[data-layout="h"] [data-node="mgr"] { grid-area: 1 / 4 / 4 / 5; translate: 0 26px; }
.ai__flow[data-layout="h"] [data-node="cal"] { grid-area: 1 / 5 / 4 / 6; }

/* JS: вертикальная схема (телефон, узкая колонка) — плитки на одной оси, подписи справа */
.ai__flow[data-layout="v"] .ai__flow-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: 10px;
  row-gap: 40px;
}
.ai__flow[data-layout="v"] .ai__node--src { display: flex; flex-direction: column-reverse; align-items: center; gap: 10px; text-align: center; }
.ai__flow[data-layout="v"] .ai__node:not(.ai__node--src) {
  grid-column: 1 / -1;
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center; column-gap: 14px;
}
.ai__flow[data-layout="v"] .ai__node:not(.ai__node--src) .ai__node-tile { grid-column: 2; }
.ai__flow[data-layout="v"] .ai__node:not(.ai__node--src) .ai__node-label { grid-column: 3; text-align: left; }
.ai__flow[data-layout="v"] [data-node="crm"] { margin-top: 18px; translate: -14px 0; }
.ai__flow[data-layout="v"] [data-node="mgr"] { translate: 14px 0; }

/* Шнурки (SVG рисует ai.js) */
.ai__flow-svg { position: absolute; left: 0; top: 0; z-index: 0; overflow: visible; pointer-events: none; }
.ai__lace-out { fill: none; stroke: var(--ink); stroke-width: 10; }
.ai__lace-core { fill: none; stroke: color-mix(in srgb, var(--on-dark) 20%, var(--ink)); stroke-width: 3.5; transition: stroke .4s; }
.ai__edge.is-active .ai__lace-core { stroke: color-mix(in srgb, var(--on-dark) 42%, var(--ink)); }
.ai__lace-hot { fill: none; stroke: var(--red); stroke-width: 3.5; }
.ai__pulse-trail { fill: none; stroke: var(--paper); stroke-width: 3.5; stroke-linecap: round; }
.ai__aglet rect { fill: var(--ink); stroke: var(--paper); stroke-width: 1.5; }
.ai__aglet .ai__aglet-ring { fill: var(--paper); stroke: none; }

/* Журнал событий */
.ai__log {
  list-style: none;
  padding: 6px clamp(16px, 2.4vw, 24px) 12px;
  border-top: 1.5px solid var(--wall-line);
  font-family: var(--f-mono); font-size: .6875rem; letter-spacing: .03em; line-height: 1.45;
}
.ai__log li {
  display: grid; grid-template-columns: 2.4em minmax(0, 1fr) auto; gap: 2px 12px; align-items: baseline;
  padding: 7px 0;
  border-bottom: 1px dashed var(--wall-line);
  color: var(--on-dark-muted);
  transition: opacity .35s;
}
.ai__log li:last-child { border-bottom: 0; }
.ai__log-route { color: var(--on-dark); font-weight: 600; }
.ai__log-what { text-align: right; }
.ai__log li.is-current .ai__log-n { color: var(--red); font-weight: 600; }
.ai__board.is-replay .ai__log li:not(.is-done) { opacity: .28; }
/* на телефоне журнал повторяет чат и схему — убираем, раздел становится короче */
@media (max-width: 639px) { .ai__log { display: none; } }

/* ── Блок 2: что настраиваем ───────────────────────────────────── */
.ai > .wrap > .ai__block { margin-top: clamp(88px, 10vw, 144px); }
.ai__block-head { display: flex; align-items: center; gap: clamp(16px, 2.4vw, 28px); margin-bottom: clamp(28px, 3.6vw, 48px); }
.ai__block-title {
  font-family: var(--f-display); font-weight: 900; text-transform: uppercase;
  font-size: clamp(1.5rem, 2.8vw, 2.5rem); line-height: 1; letter-spacing: -0.015em;
  color: var(--s-fg);
}
/* линейка-шнурок с наконечником на конце */
.ai__block-rule { position: relative; flex: 1 1 auto; min-width: 40px; height: 3px; border-radius: 2px; background: var(--wall-line); margin-right: 22px; }
.ai__block-rule::after {
  content: ""; position: absolute; right: -22px; top: 50%;
  width: 24px; height: 9px; margin-top: -4.5px;
  border-radius: var(--r-pill);
  background: var(--ink);
  border: 1.5px solid var(--on-dark-muted);
}

.ai__cards { list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(12px, 1.4vw, 20px); }
.ai__cards-item { display: flex; min-width: 0; }
.ai__card {
  --ai-cx: 0deg; --ai-cy: 0deg;
  position: relative;
  display: flex; flex-direction: column; gap: 14px;
  width: 100%; min-width: 0;
  padding: clamp(22px, 2.4vw, 32px);
  border: 1.5px solid var(--wall-line);
  border-radius: var(--r-m);
  background: var(--wall-2);
  transform: perspective(1000px) rotateX(var(--ai-cx)) rotateY(var(--ai-cy));
  transition: transform .5s var(--ease-out), border-color .25s;
}
.ai__card:hover { border-color: color-mix(in srgb, var(--on-dark) 32%, var(--wall-line)); }
.ai__card-icon {
  display: grid; place-items: center;
  width: 52px; height: 52px; margin-bottom: 6px;
  border-radius: 14px;
  background: var(--wall);
  border: 1.5px solid var(--wall-line);
  color: var(--on-dark);
  transition: transform .35s var(--ease-out);
}
.ai__card:hover .ai__card-icon { transform: translateY(-3px); }
.ai__card-icon svg { width: 26px; height: 26px; }
.ai__ic-accent { stroke: var(--red); }
.ai__ic-dot { fill: var(--red); stroke: none; }
.ai__card-title { color: var(--on-dark); }
.ai__card-text { font-size: 1rem; line-height: 1.55; color: var(--on-dark-muted); }
.ai__card-tags {
  margin-top: auto; padding-top: 16px;
  border-top: 1px solid var(--wall-line);
  font-family: var(--f-mono); font-size: .6875rem; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; line-height: 1.5;
  color: var(--on-dark-muted);
}

.ai__shots { margin-top: 4px; }
.ai__shots-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ai__shot {
  width: 100%; height: auto; aspect-ratio: 4 / 5; object-fit: cover;
  border-radius: var(--r-s);
  background: var(--wall);
  transition: transform .55s var(--ease-out);
}
.ai__card--content:hover .ai__shot:nth-child(1) { transform: translateY(-4px) rotate(-2.5deg); }
.ai__card--content:hover .ai__shot:nth-child(2) { transform: translateY(-8px); }
.ai__card--content:hover .ai__shot:nth-child(3) { transform: translateY(-4px) rotate(2.5deg); }
.ai__shots-cap {
  display: flex; align-items: center; gap: 8px; margin-top: 12px;
  font-family: var(--f-mono); font-size: .6875rem; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; line-height: 1.4;
  color: var(--on-dark);
}
.ai__shots-cap svg { flex: none; width: 13px; height: 13px; fill: var(--red); }

@media (max-width: 1023px) { .ai__cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Телефон: лента со snap, как у «Услуг». Навигацию под лентой показывает ai.js (.has-rail) */
.ai__rail-nav { display: none; }
@media (max-width: 639px) {
  .ai__cards {
    display: flex;
    gap: 12px;
    margin-inline: calc(-1 * var(--gutter));
    padding: 4px var(--gutter) 8px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: var(--gutter);
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .ai__cards::-webkit-scrollbar { display: none; }
  .ai__cards:focus-visible { outline-offset: -3px; border-radius: var(--r-m); }
  .ai__cards-item { flex: 0 0 min(84%, 330px); scroll-snap-align: start; }
  /* в ленте карточки не «всплывают» по одной: за краем экрана они висели бы сдвинутыми */
  .js .ai__cards-item[data-reveal]:not(.is-in) { transform: none; }

  .ai.has-rail .ai__rail-nav { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
  .ai__rail-arrow {
    flex: none;
    display: inline-grid; place-items: center;
    width: 44px; height: 44px; padding: 0;
    border: 1.5px solid var(--s-fg);
    border-radius: 50%;
    background: transparent;
    color: var(--s-fg);
    transition: background-color .2s, color .2s, opacity .2s;
    -webkit-tap-highlight-color: transparent;
  }
  .ai__rail-arrow svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
  .ai__rail-arrow:active { background: var(--s-fg); color: var(--s-bg); }
  .ai__rail-arrow[aria-disabled="true"] { opacity: .32; }
  .ai__rail-progress { position: relative; flex: 1; height: 4px; border-radius: 4px; background: var(--s-line); overflow: hidden; }
  .ai__rail-bar {
    --p: 0; --thumb: .2;
    position: absolute; left: 0; top: 0; bottom: 0;
    width: calc(var(--thumb) * 100%);
    border-radius: inherit;
    background: var(--red);
    transform: translateX(calc(var(--p) * (100% / var(--thumb) - 100%)));
  }
  .ai__rail-count {
    flex: none;
    font-family: var(--f-mono); font-size: var(--fs-label); font-weight: 600;
    letter-spacing: .08em; font-variant-numeric: tabular-nums;
    color: var(--s-fg);
  }
}

/* ── Блок 3: как работаем + CTA ────────────────────────────────── */
.ai__how {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  grid-template-areas:
    "title steps"
    "note  steps"
    "cta   steps"
    ".     steps";
  grid-template-rows: auto auto auto 1fr;
  column-gap: clamp(32px, 5vw, 96px);
  row-gap: 22px;
  align-items: start;
}
.ai__how-title { grid-area: title; }
.ai__how-note { grid-area: note; max-width: 40ch; color: var(--s-muted); }
.ai__how-cta { grid-area: cta; }
.ai__steps { grid-area: steps; list-style: none; border-top: 1.5px solid var(--wall-line); }
.ai__step {
  display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center;
  gap: clamp(18px, 3vw, 40px);
  padding: clamp(20px, 2.6vw, 30px) 0;
  border-bottom: 1.5px solid var(--wall-line);
}
.ai__step-num {
  min-width: 1.5em;
  font-family: var(--f-display); font-weight: 900;
  font-size: clamp(2.5rem, 5vw, 4.25rem); line-height: .85; letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  color: var(--red);
}
.ai__step-title {
  font-family: var(--f-display); font-weight: 700;
  font-size: var(--fs-h3); line-height: 1.2;
  color: var(--on-dark);
  text-wrap: balance;
}
@media (max-width: 860px) {
  .ai__how {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "title" "steps" "note" "cta";
    grid-template-rows: none;
  }
  .ai__how-note { margin-top: 10px; }
}

/* Пауза CSS-анимаций, пока раздел вне экрана (класс ставит ai.js) */
.ai:not(.is-onscreen) .ai__new-led,
.ai:not(.is-onscreen) .ai__typing-dots i,
.ai:not(.is-onscreen) .ai__node.is-busy .ai__node-face { animation-play-state: paused; }

@media (prefers-reduced-motion: reduce) {
  .ai__phone { transform: none; }
  .ai__phone-depth, .ai__phone::before, .ai__phone::after, .ai__screen::after { display: none; }
  .ai__card { transform: none; }
}
