/* motion-v2, слой 2 «кино»: фотореалистичный кадр кассы + движение кодом (transform/opacity).
   Заменяет слой scrolly из v1 (CSS-3D касса отклонена). Только токены сайта (style.css / theme-dark.css),
   литералов цвета нет: маски через именованный black. Включается классами из automation-cine.js. */

.auto-body {
  --am-ease-cine: cubic-bezier(.16, 1, .3, 1);   /* expo-out: медленный «киношный» выход */
  --am-ease-io: cubic-bezier(.65, 0, .35, 1);
}

/* ---------- A. Тёмный остров = значения [data-theme="dark"] сайта, включённые локально ---------- */
:is(.am-dark, html.am-pre .auto-hero) {
  --bg: #0a0a0a; --bg-2: #111111; --surface: #1a1a1a; --surface-2: #222222; --line: #2e2e2e;
  --text: #f5f5f7; --text-secondary: #a1a1a6; --text-tertiary: #8e8e93; --muted: var(--text-secondary);
  --accent-ink: #ff8f5c; --eng-blue: #4a9eff; --eng-blue-dim: rgba(74, 158, 255, 0.12); --call: #30d158;
  --field-border: #8e8e93; --shadow-card: none;
  --btn-ghost-bg: transparent; --btn-ghost-border: rgba(255, 255, 255, 0.22);
  --btn-ghost-hover-bg: rgba(255, 255, 255, 0.08); --btn-ghost-hover-border: rgba(255, 255, 255, 0.32);
  color: var(--text);
  background:
    radial-gradient(55% 70% at 78% 42%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 64%),
    radial-gradient(45% 55% at 4% 100%, color-mix(in srgb, var(--eng-blue) 12%, transparent), transparent 70%),
    var(--bg) !important;
  border-color: var(--line) !important;
}
.am-dark::after, html.am-pre .auto-hero::after { opacity: .3; }
.am-dark .breadcrumbs, .am-dark .breadcrumbs a, html.am-pre .auto-hero .breadcrumbs, html.am-pre .auto-hero .breadcrumbs a { color: var(--text-secondary); }
.am-dark .auto-lead, .am-dark p, html.am-pre .auto-hero .auto-lead, html.am-pre .auto-hero p { color: var(--text-secondary); }
.am-dark h1, .am-dark h2, .am-dark h3, .am-dark strong, html.am-pre .auto-hero h1, html.am-pre .auto-hero h2, html.am-pre .auto-hero h3, html.am-pre .auto-hero strong { color: var(--text); }
.am-dark .auto-eyebrow, html.am-pre .auto-hero .auto-eyebrow { background: color-mix(in srgb, var(--surface) 80%, transparent); }
.am-dark .auto-facts li, html.am-pre .auto-hero .auto-facts li { background: color-mix(in srgb, var(--surface) 72%, transparent); border-color: var(--line); }
.am-dark .auto-switch__a, html.am-pre .auto-hero .auto-switch__a { color: var(--text); border-color: var(--line); background: color-mix(in srgb, var(--surface) 70%, transparent); }
.am-dark .auto-switch__a.is-on, html.am-pre .auto-hero .auto-switch__a.is-on { background: var(--text); color: var(--bg); border-color: var(--text); }
/* фокус варианта A (2px #9a3412) + светлый ореол, чтобы кольцо читалось и на тёмном */
html body.auto-body .am-dark :is(.btn, a, summary, button):focus-visible {
  outline: 2px solid var(--accent-ink-strong); outline-offset: 2px; box-shadow: 0 0 0 6px var(--text);
}
/* хвост H1 — акцентом сайта (на тёмном 6.9:1), без подчёркивания слоя 1 */
.am-dark h1 .am-hl, html.am-pre .auto-hero h1 .am-hl { color: var(--accent); }
.am-dark h1 .am-hl::after { display: none; }

/* ---------- B. H1/H2 из масок: каждое слово в своей «щели» ---------- */
.am-w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .12em; margin-bottom: -.12em; }
.am-mask .am-w > span { display: inline-block; transform: translate3d(0, 112%, 0); transition: transform .85s var(--am-ease-cine); transition-delay: calc(var(--wi) * 30ms); }
.am-mask.am-in .am-w > span, .am-mask.is-visible .am-w > span { transform: none; }
/* до запуска скрипта H1 не мигает (в генераторе слова отдаются сразу размеченными) */
.am-pre .auto-hero h1 { animation: am-pre-show 0s linear 1.4s both; }
@keyframes am-pre-show { from { opacity: 0; } to { opacity: 1; } }

/* ---------- C. Кадр: контейнер → фото+экран (зум) → HUD (без зума) ---------- */
.cine-frame { container-type: size; position: relative; isolation: isolate; pointer-events: none; --z: 0; --zk: .15; }
.cine-box, .cine-hud { position: absolute; inset: 0; margin: auto;
  width: min(100cqw, calc(100cqh * var(--ar))); height: min(100cqh, calc(100cqw / var(--ar))); }
/* камера: заметный наезд 1 → 1.25 (мобильный 1 → 1.18) + сдвиг; внутри — медленный дрейф «с рук» */
.cine-box { transform-origin: var(--ox) var(--oy);
  transform: translate3d(calc(var(--z) * var(--ctx, .8%)), calc(var(--z) * var(--cty, -2%)), 0) scale(calc(1 + var(--z) * var(--zk))); }
.cine-cam { position: absolute; inset: 0; transform-origin: var(--ox) var(--oy); }
.cine-photo { z-index: 0; }
.cine-hud { z-index: 3; }
/* cover: кадр заполняет рамку, центр экрана держится в кадре */
.cine-frame--cover .cine-box {
  --W: max(100cqw, calc(100cqh * var(--ar))); --H: max(100cqh, calc(100cqw / var(--ar)));
  width: var(--W); height: var(--H); margin: 0; right: auto; bottom: auto;
  left: clamp(calc(100cqw - var(--W)), calc(50cqw - var(--fx) * var(--W)), 0px);
  top: clamp(calc(100cqh - var(--H)), calc(50cqh - var(--fy) * var(--H)), 0px);
}
.cine-photo, .cine-photo picture, .cine-photo img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.cine-photo img { object-fit: cover; }
/* края кадра растворяются в тёмном острове (фото уже тёмное по краям) */
.cine-frame--contain .cine-photo {
  -webkit-mask-image: linear-gradient(90deg, transparent, black 16%, black 90%, transparent), linear-gradient(180deg, transparent, black 9%, black 86%, transparent);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(90deg, transparent, black 16%, black 90%, transparent), linear-gradient(180deg, transparent, black 9%, black 86%, transparent);
  mask-composite: intersect;
}
/* ambient-свечение #ff6b2c (--accent): «дышит» за кадром и мягко поверх стекла */
.cine-glow { position: absolute; left: var(--ox); top: var(--oy); width: 78cqw; aspect-ratio: 1; margin: -39cqw 0 0 -39cqw; border-radius: 50%; z-index: -1;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 34%, transparent), color-mix(in srgb, var(--accent) 8%, transparent) 60%, transparent);
  opacity: .7; transform: translate3d(calc(var(--z) * -5%), calc(var(--z) * 4%), 0) scale(calc(.9 + var(--z) * .25)); }
.cine-glow2 { position: absolute; left: 56%; top: 46%; width: 70%; aspect-ratio: 1; margin: -35% 0 0 -35%; border-radius: 50%; mix-blend-mode: screen;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 30%, transparent), transparent); opacity: .25; }
@media (prefers-reduced-motion: no-preference) {
  .cine-glow { animation: cine-breathe 7s ease-in-out infinite alternate; }
  .cine-glow2 { animation: cine-breathe2 5.5s ease-in-out infinite alternate; }
  .cine-cam { animation: cine-drift 13s ease-in-out infinite alternate; }
  .cine-slot { animation: cine-slot 1.1s ease-in-out infinite alternate; }
  .am-off .cine-glow, .am-off .cine-glow2, .am-off .cine-cam, .am-off .cine-slot { animation-play-state: paused; }
}
@keyframes cine-breathe { from { opacity: .5; transform: scale(calc(.88 + var(--z) * .25)); } to { opacity: .95; transform: scale(calc(1.04 + var(--z) * .25)); } }
@keyframes cine-drift { from { transform: translate3d(-.5%, .35%, 0) rotate(-.25deg); } to { transform: translate3d(.5%, -.35%, 0) rotate(.2deg); } }
@keyframes cine-slot { from { filter: brightness(.85); } to { filter: brightness(1.25); } }
@keyframes cine-breathe2 { from { opacity: .12; } to { opacity: .42; } }

/* щель принтера: раскаляется, пока из неё идёт чек */
.cine-slot { position: absolute; z-index: 2; width: var(--sw, 7%); height: 1%; margin: 0; transform: translate3d(-50%, -50%, 0); border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--accent) 12%, color-mix(in srgb, var(--accent) 55%, var(--text)) 50%, var(--accent) 88%, transparent);
  box-shadow: 0 0 10px 3px color-mix(in srgb, var(--accent) 80%, transparent), 0 0 34px 12px color-mix(in srgb, var(--accent) 38%, transparent), 0 -18px 40px 6px color-mix(in srgb, var(--accent) 22%, transparent);
  mix-blend-mode: screen; opacity: clamp(0, calc(var(--e, 0) * 5), 1); }
/* бумага: matrix3d из JS кладёт низ листа на щель, верх уходит в перспективу; overflow — сама щель */
.cine-paper { --paper: var(--text); --am-ok-ink: color-mix(in srgb, var(--call) 75%, var(--text-on-light)); position: absolute; left: 0; top: 0; z-index: 1; transform-origin: 0 0; overflow: hidden; backface-visibility: hidden; }
.cine-paper__in { --text: var(--text-on-light); --line: color-mix(in srgb, var(--text-on-light) 22%, transparent); --call: var(--am-ok-ink);
  height: 100%; box-sizing: border-box; padding: 16px 14px; color: var(--text-on-light); font-family: var(--font-mono); font-size: 15px; line-height: 1.3;
  background: linear-gradient(0deg, color-mix(in srgb, var(--bg) 55%, transparent), transparent 24%),
    linear-gradient(90deg, color-mix(in srgb, var(--bg) 22%, transparent), transparent 18%, transparent 80%, color-mix(in srgb, var(--bg) 26%, transparent)),
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 16%, transparent), transparent 60%), var(--paper);
  transform: translate3d(0, calc((1 - var(--e, 0)) * 100%), 0); }
.cine-paper__in h4, .cine-paper__in .r, .cine-paper__in .tot { display: flex; justify-content: space-between; gap: 6px; margin: 0 0 9px; font-size: 15px; color: var(--text-on-light); }
.cine-paper__in small { color: color-mix(in srgb, var(--text-on-light) 60%, transparent); font-size: 12px; }
.cine-paper__in .tot { margin: 12px 0 0; padding-top: 10px; border-top: 2px dashed var(--line); font-weight: 700; }
.cine-paper__in .ok { color: var(--call); }
.cine-paper__in * { animation: none !important; }

/* ---------- D. Экран терминала: matrix3d из JS совмещает слой с четырьмя углами стекла ---------- */
.cine-screen { position: absolute; left: 0; top: 0; z-index: 3; transform-origin: 0 0; backface-visibility: hidden; font-family: var(--font-sans); overflow: hidden; border-radius: 9px; }
/* интерфейс заполняет стекло до рамки — край к краю, без «плавающей» подложки */
.cine-ui { position: absolute; inset: 2.6% 2.4%; border-radius: 5px; padding: 18px 16px 14px; display: flex; flex-direction: column; justify-content: center; gap: 8px;
  background: radial-gradient(120% 90% at 50% 40%, color-mix(in srgb, var(--surface) 70%, var(--bg)), var(--bg));
  box-shadow: inset 0 0 28px 6px color-mix(in srgb, black 55%, transparent);
  opacity: var(--e, 0); }
/* стекло: блик по диагонали едет против камеры + верхний отсвет и виньетка */
.cine-glass { position: absolute; inset: -10% -70%; pointer-events: none; mix-blend-mode: screen;
  background: linear-gradient(110deg, transparent 40%, color-mix(in srgb, var(--text) 13%, transparent) 46.5%, color-mix(in srgb, var(--text) 4%, transparent) 50%, transparent 56%),
    linear-gradient(180deg, color-mix(in srgb, var(--text) 9%, transparent), transparent 22%);
  transform: translate3d(calc(8% - var(--z) * 22%), 0, 0); }
.cine-ui__bar { position: absolute; left: 18px; top: 12px; display: flex; gap: 6px; }
.cine-ui__bar i { width: 7px; height: 7px; border-radius: 50%; background: color-mix(in srgb, var(--text) 22%, transparent); }
.cine-ui__bar i:first-child { background: var(--accent); }
.cine-card { --e: 0; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--surface) 72%, transparent); border: 1px solid color-mix(in srgb, var(--text) 10%, transparent); color: var(--text);
  box-shadow: 0 0 22px color-mix(in srgb, var(--accent) calc(var(--e) * 12%), transparent);
  opacity: var(--e); transform: translate3d(0, calc((1 - var(--e)) * 26px), 0) scale(calc(.93 + var(--e) * .07)); }
.cine-card__ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.cine-card svg, .cine-code svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.cine-card b { display: block; font-size: 19px; line-height: 1.15; font-weight: 700; letter-spacing: -.01em; }
.cine-card small { display: block; margin-top: 2px; font-family: var(--font-mono); font-size: 12px; color: var(--text-secondary); white-space: nowrap; }
.cine-card__ok { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--call); color: var(--bg);
  transform: scale(clamp(0, calc(var(--e) * 1.6 - .6), 1)); }
.cine-card__ok svg { width: 16px; height: 16px; stroke-width: 3; }
/* портретный экран (мобильный): крупнее шрифт, иконка уходит — читается на 390 px */
.cine-frame--port .cine-ui { padding: 30px 14px 14px; gap: 12px; }
.cine-frame--port .cine-card { grid-template-columns: minmax(0, 1fr) auto; padding: 14px; }
.cine-frame--port .cine-card__ico { display: none; }
.cine-frame--port .cine-card b { font-size: 25px; }
.cine-frame--port .cine-card small { font-size: 16px; white-space: normal; }
.cine-frame--port .cine-card__ok { width: 32px; height: 32px; }

/* ---------- E. HUD: узлы (мобильный) и итог ---------- */
.cine-nodes { position: absolute; left: 3%; right: 3%; top: 5.5%; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.cine-nodes span { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px 6px 10px; border-radius: 999px; font-size: 13px; line-height: 1.2; white-space: nowrap;
  color: var(--text); background: var(--surface); border: 1px solid var(--line);
  --o: clamp(0, calc((var(--e, 0) - var(--n) * .15) * 4), 1); opacity: var(--o); transform: translate3d(0, calc((1 - var(--o)) * 10px), 0); }
.cine-nodes span::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--call); }
.cine-done { position: absolute; left: 50%; top: 88%; padding: 7px 14px; border-radius: 999px; white-space: nowrap;
  font-family: var(--font-mono); font-size: var(--fs-xs); letter-spacing: .08em; font-weight: 700; background: var(--accent); color: var(--text-on-light);
  opacity: var(--e, 0); transform: translate3d(-50%, calc((1 - var(--e, 0)) * 12px), 0); }
.cine-done--box { left: 85.5%; top: 34%; font-size: 12px; box-shadow: 0 0 30px color-mix(in srgb, var(--accent) 45%, transparent); }

/* ---------- F. Хаб: закреплённый hero ---------- */
.am-cine { --hh: var(--am-hh, 56px); }
.am-cine .stage--hub,
html.am-pre .auto-hero:has(.stage--hub) .stage--hub { display: none !important; } /* am-pre: не резервируем CSS-схему — кадр уже в .cine-photo-src */
.am-cine.is-desk { padding: 0 !important; overflow: clip !important; }
.am-cine.is-desk .cine-pin { position: sticky; top: var(--hh); height: calc(100svh - var(--hh)); display: flex; align-items: center; }
.am-cine.is-desk .cine-frame { --ox: 32% !important; --oy: 40% !important; position: absolute; top: 0; bottom: 0; right: 0; width: min(70vw, 1400px); }
.am-cine.is-desk .auto-hero__grid { position: relative; z-index: 2; display: block; width: 100%; }
.am-cine.is-desk .auto-hero__grid > div:first-child { max-width: min(480px, 38vw); }
.am-cine.is-desk h1 { font-size: clamp(30px, 3.1vw, 46px) !important; margin-bottom: var(--space-3) !important; }
.am-cine.is-desk .auto-lead { font-size: var(--fs-base); }
/* CTA героя: перенос по ширине — nowrap ломал подписи на 1024–1440 (хаб и /novyj/) */
.am-cine.is-desk .auto-actions { margin: var(--space-3) 0; flex-wrap: wrap; gap: var(--space-2); }
.am-cine.is-desk .auto-actions .btn { padding-inline: var(--space-4); min-width: 0; white-space: normal; text-wrap: balance; }
.am-cine.is-desk .auto-facts { margin: var(--space-3) 0 var(--space-2); gap: var(--space-2); }
.am-cine.is-desk .auto-facts li { padding: var(--space-2) var(--space-3); }
.am-cine.is-desk .auto-facts .am-ico { width: 32px; height: 32px; margin-bottom: var(--space-1); }
.am-cine.is-desk .auto-facts strong { font-size: 18px; }
.am-cine.is-desk .auto-note { margin: 0; }
/* мобильный и планшет (<1024): текст героя, затем закреплённый кадр 9:16 */
.am-cine.is-mob { padding-bottom: 0 !important; }
.am-cine .cine-m { position: relative; margin-top: var(--space-4); }
.am-cine .cine-sticky { position: sticky; top: var(--hh); height: calc(100svh - var(--hh) - 72px); min-height: 480px; }   /* 72px: липкая панель «Айрату» снизу */
@media (max-width: 1023px) {
  .am-cine .cine-sticky { height: min(42vh, 320px); min-height: 220px; }
  /* У1: одна компактная полоса чипов сверху (без wrap в 4 ряда) — экранные подписи остаются видны */
  .am-cine.is-mob .cine-hud .cine-nodes {
    top: 3%; left: 2%; right: 2%; bottom: auto;
    flex-wrap: nowrap; justify-content: flex-start; gap: 6px;
    overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none;
    -webkit-overflow-scrolling: touch; max-height: 28px;
  }
  .am-cine.is-mob .cine-hud .cine-nodes::-webkit-scrollbar { display: none; }
  .am-cine.is-mob .cine-hud .cine-nodes span {
    flex: none; font-size: 11px; line-height: 1.1; padding: 4px 8px 4px 7px; gap: 5px;
  }
  .am-cine.is-mob .cine-hud .cine-nodes span::before { width: 5px; height: 5px; }
  .am-cine.is-mob .cine-hud .cine-done { display: none; }
}
.am-cine .cine-sticky .cine-frame { position: absolute; inset: 0; --cty: -.5%; --ctx: 0%; }
.cine-space { display: block; pointer-events: none; }

/* ---------- G. База решений: кадр в рамке, коды на экране ---------- */
.am-res .cine-frame--card { position: relative; width: 100%; aspect-ratio: 16 / 9; margin: var(--space-4) 0 var(--space-3); border-radius: var(--radius-lg); overflow: hidden;
  border: 1px solid var(--line); background: var(--bg); --zk: .14; }
.am-res .cine-frame--card .cine-glow { display: none; }
@media (min-width: 1024px) {
  .am-res > .container { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); column-gap: var(--space-6); align-items: center; }
  .am-res > .container > * { grid-column: 1; }
  .am-res > .container > .cine-frame--card { grid-column: 2; grid-row: 1 / span 4; margin: var(--space-4) 0; aspect-ratio: 4 / 3; }
}
.cine-ui--codes { justify-content: center; gap: 12px; padding: 30px 26px 22px; }
.cine-code { display: flex; align-items: center; gap: 14px; padding: 10px 14px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--line);
  opacity: 0; transform: translate3d(-18px, 0, 0); transition: opacity .7s var(--am-ease-cine), transform .9s var(--am-ease-cine); transition-delay: calc(.35s + var(--n) * .22s); }
.cine-code b { font-family: var(--font-mono); font-size: 30px; line-height: 1; font-weight: 700; color: var(--text); }
.cine-code--word { min-width: 0; }
.cine-code--word .cine-card__ico { flex: none; }
.cine-code--word b { font-family: var(--font-sans); font-size: 18px; line-height: 1.25; font-weight: 600; min-width: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cine-code .cine-card__ico { width: 40px; height: 40px; }
.cine-frame--card.is-in .cine-ui { opacity: 1; transition: opacity .6s var(--am-ease-cine); }
.cine-frame--card .cine-ui { opacity: 0; }
.cine-frame--card.is-in .cine-code { opacity: 1; transform: none; }
.cine-scan { position: absolute; left: 4%; right: 4%; top: 8%; height: 3px; border-radius: 2px; background: var(--accent); box-shadow: 0 0 16px var(--accent); opacity: 0; }
@media (prefers-reduced-motion: no-preference) {
  .cine-frame--card.is-in .cine-scan { animation: cine-scan 2.4s var(--am-ease-io) 1.3s 2 both; }
}
@keyframes cine-scan { 0% { opacity: 0; transform: translate3d(0, 0, 0); } 12%, 88% { opacity: .9; } 100% { opacity: 0; transform: translate3d(0, 250px, 0); } }

/* ---------- H. Горизонтальные шаги — только десктоп (класс .am-h ставит JS при ширине ≥1024) ---------- */
.am-h { padding: 0 !important; position: relative; overflow: clip !important; }
.am-h > .container { position: sticky; top: var(--am-hh, 56px); height: calc(100svh - var(--am-hh, 56px)); display: flex; flex-direction: column; justify-content: center; gap: var(--space-4); }
.am-h h2 { margin-bottom: var(--space-2) !important; }
.am-h .am-steps { display: flex !important; flex-wrap: nowrap; gap: var(--space-4); width: max-content; transform: translate3d(calc(var(--hp, 0) * var(--dist, 0) * -1px), 0, 0); will-change: transform; position: relative; }
/* одна линия на всю ленту, включая шаги 5–6; заливка растёт вместе с --hp */
.am-h .am-steps::before, .am-h .am-steps::after {
  display: block !important; content: ""; position: absolute; left: 0; bottom: auto; width: auto; transform: none;
  top: calc(clamp(64px, 7vw, 104px) + var(--space-2)); height: 2px; border-radius: 2px; z-index: 0;
}
.am-h .am-steps::before { right: 0; background: var(--line); }
.am-h .am-steps::after { right: auto; width: calc(var(--hp, 0) * 100%); background: var(--accent); transform-origin: 0 50%; }
.am-h .am-step { width: min(400px, 34vw); grid-template-columns: 1fr; opacity: .4; transform: scale(.96); transition: opacity .6s var(--am-ease-cine), transform .6s var(--am-ease-cine); }
.am-h .am-step.is-on { opacity: 1; transform: none; }
.am-h .am-step__n { width: auto; height: auto; border: 0; background: none; place-items: start; font-size: clamp(64px, 7vw, 104px); line-height: .9; color: transparent;
  -webkit-text-stroke: 1.5px var(--accent); }
.am-h .am-step.is-on .am-step__n { color: var(--accent); }
.am-h .am-step__n::after,
.am-h .am-step:nth-child(3)::after,
.am-h .am-step:nth-child(6)::before { display: none !important; }
.am-h .am-step { container-type: normal; position: relative; z-index: 1; }
.am-h .am-step__card { min-height: 200px; font-size: var(--fs-base); padding: var(--space-4); background: color-mix(in srgb, var(--surface) 72%, transparent); border-color: var(--line); }
.am-h .auto-note { margin: 0; }
.am-hbar, .am-h .am-hbar { display: none; }
.am-h .am-rv { opacity: 1 !important; transform: none !important; }
/* мобильный: вертикальная линия слоя 1; номер шага — в своей колонке 44px, ничего не вылезает */
@media (max-width: 1023px) {
  /* секция шагов — свой stacking context: линия и номера не выходят за неё и не протыкают соседей */
  .auto-block:has(> .container > .am-steps), #process { position: relative; isolation: isolate; z-index: 0; overflow: clip; }
  .am-steps { overflow: visible; padding-right: 2px; isolation: isolate; }
  .am-steps::before, .am-steps::after { z-index: 0; bottom: 34px; }
  .am-step { z-index: 1; }
  .am-step__n { z-index: 2; }
  .am-step__card { min-width: 0; position: relative; z-index: 1; }
  /* карточки шагов проявляются на месте — без сдвига под линию */
  .am-js .am-steps .am-rv { transform: none; }
}

/* ---------- I. Светлые секции: мягкое свечение в палитре сайта вместо однотонного фона ---------- */
.auto-body .auto-block:not(.am-dark) { isolation: isolate; }
.auto-body .auto-block:not(.am-dark)::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(42% 60% at 100% 0%, var(--am-accent-soft), transparent 70%),
    radial-gradient(38% 55% at 0% 100%, var(--am-blue-soft), transparent 72%); }
.auto-body .auto-block:not(.am-dark):nth-of-type(even)::before {
  background:
    radial-gradient(42% 60% at 0% 0%, var(--am-blue-soft), transparent 70%),
    radial-gradient(38% 55% at 100% 100%, var(--am-accent-soft), transparent 72%); }

/* ---------- J. Фото Айрата: зум внутри рамки; bento-наклон за курсором ---------- */
.am-frame { display: inline-block; flex: none; border-radius: 50%; overflow: hidden; box-shadow: 0 0 0 4px var(--surface), 0 0 0 5px var(--line); }
.am-frame img { box-shadow: none !important; display: block; }
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .am-frame img { animation: am-zoom linear both; animation-timeline: view(); animation-range: entry 0% cover 55%; }
  }
}
@keyframes am-zoom { from { transform: scale(1.25); } to { transform: scale(1); } }
@media (hover: hover) and (pointer: fine) {
  .am-tilt { transform: perspective(900px) rotateX(var(--tx, 0deg)) rotateY(var(--ty, 0deg)) translateY(-3px) !important; transition: transform .25s var(--am-ease-cine) !important; }
}
/* bento: волна появления в кинематографичном темпе */
@media (prefers-reduced-motion: no-preference) {
  .am-js .am-rv { transition-duration: .8s; transition-timing-function: var(--am-ease-cine); transition-delay: calc(var(--i, 0) * 90ms); }
}

/* ---------- K. Без движения: статичный финальный кадр, без закреплений ---------- */
@media (prefers-reduced-motion: reduce) {
  .cine-box { transform: none !important; }
  .cine-glow, .cine-glow2 { animation: none !important; }
  .am-mask .am-w > span { transform: none !important; transition: none !important; }
  .cine-code { transition: none !important; }
  .am-pre .auto-hero h1 { animation: none; }
}

/* ---------- L. Липкая панель на узких экранах: «Айрату» сжимается до аватара, кнопка не обрезается ---------- */
@media (max-width: 374px) {
  .am-airat-call { padding-right: 4px; }
  .am-airat-call > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

/* ---------- M. Узкий десктоп 1024–1199: факты списком, чтобы слова не рвались ---------- */
@media (min-width: 1024px) and (max-width: 1199px) {
  .am-cine.is-desk .auto-facts { grid-template-columns: 1fr; gap: var(--space-1); }
  .am-cine.is-desk .auto-facts li { display: grid; grid-template-columns: auto auto minmax(0, 1fr); align-items: center; column-gap: var(--space-2); padding: 6px var(--space-2); }
  .am-cine.is-desk .auto-facts li .am-ico { margin: 0; width: 28px; height: 28px; }
  .am-cine.is-desk .auto-facts strong { font-size: 16px; white-space: nowrap; }
  .am-cine.is-desk .auto-facts li > span:not(.am-ico) { font-size: 13px; }
}

/* ---------- N. Резерв места до запуска скрипта (html.am-pre ставится инлайном в <head>): CLS = 0.
   В генераторе эти классы и кадр будут в разметке сразу, тогда блок не нужен. ---------- */
@media (min-width: 1024px) {
  html.am-pre .auto-hero:has(.stage--hub) { padding: 0 !important; display: flex; align-items: center; height: calc(100svh - var(--header-h)); overflow: clip; }
  html.am-pre .auto-hero:has(.stage--hub) .stage--hub { display: none !important; }
  html.am-pre .auto-hero:has(.stage--hub) .auto-hero__grid { display: block; width: 100%; position: relative; z-index: 2; }
  html.am-pre .auto-hero:has(.stage--hub) .auto-hero__grid > div:first-child { max-width: min(480px, 38vw); }
  html.am-pre .auto-hero:has(.stage--hub) h1 { font-size: clamp(30px, 3.1vw, 46px) !important; margin-bottom: var(--space-3) !important; }
  html.am-pre .auto-hero:has(.stage--hub) .auto-lead { font-size: var(--fs-base); }
  html.am-pre .auto-hero:has(.stage--hub) .auto-actions { margin: var(--space-3) 0; flex-wrap: wrap; gap: var(--space-2); }
  html.am-pre .auto-hero:has(.stage--hub) .auto-actions .btn { padding-inline: var(--space-4); min-width: 0; white-space: normal; text-wrap: balance; }
  html.am-pre .auto-hero:has(.stage--hub) .auto-facts { margin: var(--space-3) 0 var(--space-2); gap: var(--space-2); }
  html.am-pre .auto-hero:has(.stage--hub) .auto-facts li { padding: var(--space-2) var(--space-3); }
  html.am-pre .auto-hero:has(.stage--hub) .auto-facts strong { font-size: 18px; }
  html.am-pre .auto-hero:has(.stage--hub) .auto-note { margin: 0; }
  /* :where не поднимает специфичность — иначе плейсхолдер перебивает кадр базы решений и герой схлопывается. */
  html.am-pre .auto-hero:not(:has(.stage--hub)) > .container:where(:not(.auto-hero__grid):not(.project-hero__inner)) { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); column-gap: var(--space-6); align-items: center; }
  html.am-pre .auto-hero:not(:has(.stage--hub)) > .container:where(:not(.auto-hero__grid):not(.project-hero__inner)) > * { grid-column: 1; }
  html.am-pre .auto-hero:not(:has(.stage--hub)) > .container:where(:not(.auto-hero__grid):not(.project-hero__inner))::after { content: ""; grid-column: 2; grid-row: 1 / span 4; margin: var(--space-4) 0; aspect-ratio: 4 / 3; }
}
@media (min-width: 1024px) and (max-width: 1199px) {
  html.am-pre .auto-hero:has(.stage--hub) .auto-facts { grid-template-columns: 1fr; gap: var(--space-1); }
  html.am-pre .auto-hero:has(.stage--hub) .auto-facts li { display: grid; grid-template-columns: auto auto minmax(0, 1fr); align-items: center; column-gap: var(--space-2); padding: 6px var(--space-2); }
  html.am-pre .auto-hero:has(.stage--hub) .auto-facts strong { font-size: 16px; white-space: nowrap; }
}
@media (max-width: 1023px) {
  html.am-pre .auto-hero:not(:has(.stage--hub)) .auto-lead::after { content: ""; display: block; aspect-ratio: 16 / 9; margin: var(--space-4) 0 var(--space-3); }
}

/* подчёркивание H2 рисуется после того, как слова поднялись из маски */
@media (prefers-reduced-motion: no-preference) { .am-js .auto-block h2.am-mask::after { transition-delay: .55s; } }

/* ---------- O. v2.1: правки повторного ревью ---------- */
/* (а) чек — живой HTML-текст в масштабе, близком к 1:1, чтобы растр был таким же чётким, как экран */
.cine-paper__in { padding: 9px 8px; font-size: 8.5px; line-height: 1.25; font-weight: 600; letter-spacing: 0; -webkit-font-smoothing: antialiased; }
.cine-paper__in h4, .cine-paper__in .r, .cine-paper__in .tot { font-size: 8.5px; margin: 0 0 5px; gap: 3px; white-space: nowrap; }
.cine-paper__in h4 { font-size: 9.5px; font-weight: 700; }
.cine-paper__in small { display: none; }
.cine-paper__in .tot { font-size: 9.5px; margin-top: 7px; padding-top: 6px; border-top-width: 1px; }
.cine-frame--port .cine-paper__in { padding: 7px 6px; font-size: 7px; }
.cine-frame--port .cine-paper__in h4, .cine-frame--port .cine-paper__in .r { font-size: 7px; margin-bottom: 3px; }
.cine-frame--port .cine-paper__in .tot { font-size: 7.5px; margin-top: 4px; padding-top: 4px; }

/* кнопки героя: обе залитые (вариант A); главная — «Подобрать решение» первой и жирнее, у звонка — иконка телефона сайта */
.am-call { gap: 8px; }
.auto-hero .auto-actions .btn--primary:not(.am-call) { font-weight: 700; }

/* (б) мягкий переход из тёмного героя в светлую секцию: светлая «губа» со скруглением и оранжевым отсветом наезжает снизу */
:root { --am-page-bg: var(--bg); }
.am-dark.auto-hero { position: relative; }
.am-dark.auto-hero::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 36px; z-index: 5; pointer-events: none;
  background: var(--am-page-bg); border-radius: 36px 36px 0 0;
  box-shadow: 0 -18px 48px -12px color-mix(in srgb, var(--accent) 30%, transparent), 0 -1px 0 color-mix(in srgb, var(--accent) 22%, transparent); }
@media (max-width: 1023px) { .am-dark.auto-hero::after { height: 24px; border-radius: 24px 24px 0 0; } }

/* (в) липкая нижняя панель: выезд + фейд */
html.am-pre .sticky-cta { transform: translate3d(0, 110%, 0); opacity: 0; }
.sticky-cta.am-sc { transition: transform .55s var(--am-ease-cine), opacity .45s var(--am-ease-cine) !important; }
.sticky-cta.am-sc.am-sc-hide { transform: translate3d(0, 110%, 0) !important; opacity: 0 !important; pointer-events: none; }

/* (г) мобильные шаги: воздух после шага 6, линия догоняет прокрутку мягко */
@media (max-width: 1023px) {
  .am-steps { margin-bottom: var(--space-6) !important; }
  .am-steps::after { transition: transform .45s var(--am-ease-cine); background: linear-gradient(180deg, var(--accent), var(--accent) 85%, color-mix(in srgb, var(--accent) 30%, transparent)); }
}

/* (д) база решений: меню разделов — в одну строку с горизонтальной прокруткой на мобильном; закреплённая копия под шапкой */
@media (max-width: 1023px) {
  .auto-body .auto-switch { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity;
    margin-inline: 0; max-width: 100%; padding-inline: 0; scroll-padding-inline: var(--space-4);
    -webkit-mask-image: linear-gradient(90deg, transparent, black 16px, black calc(100% - 24px), transparent); mask-image: linear-gradient(90deg, transparent, black 16px, black calc(100% - 24px), transparent); }
  .auto-body .auto-switch::-webkit-scrollbar { display: none; }
  .auto-body .auto-switch__a { flex: none; white-space: nowrap; scroll-snap-align: start; }
}
.am-switchbar { position: fixed; left: 0; right: 0; top: var(--header-h, 56px); z-index: 90; background: color-mix(in srgb, var(--bg) 94%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
  transform: translate3d(0, -110%, 0); opacity: 0; visibility: hidden;
  transition: transform .45s var(--am-ease-cine), opacity .3s var(--am-ease-cine), visibility 0s .45s, background .45s var(--am-ease-cine), border-color .45s var(--am-ease-cine), color .35s linear; }
.am-switchbar.is-on { transform: none; opacity: 1; visibility: visible;
  transition: transform .45s var(--am-ease-cine), opacity .3s var(--am-ease-cine), visibility 0s, background .45s var(--am-ease-cine), border-color .45s var(--am-ease-cine), color .35s linear; }
.am-switchbar .auto-switch { margin: 0 !important; padding-block: var(--space-2); flex-wrap: nowrap; overflow-x: auto; }
.am-switchbar .auto-switch__a { color: var(--text); border-color: var(--line); background: color-mix(in srgb, var(--surface) 70%, transparent);
  transition: background .45s var(--am-ease-cine), color .35s linear, border-color .45s var(--am-ease-cine); }
.am-switchbar .auto-switch__a.is-on { background: var(--text); color: var(--bg); border-color: var(--text); }
/* над светлой частью страницы бар совпадает с шапкой, без сэндвича белое → тёмное → белое */
.am-switchbar.am-dark.is-light {
  --bg: unset; --bg-2: unset; --surface: unset; --surface-2: unset; --line: unset;
  --text: unset; --text-secondary: unset; --text-tertiary: unset; --muted: unset;
  --accent-ink: unset; --eng-blue: unset; --eng-blue-dim: unset; --call: unset;
  --field-border: unset; --shadow-card: unset;
  --btn-ghost-bg: unset; --btn-ghost-border: unset; --btn-ghost-hover-bg: unset; --btn-ghost-hover-border: unset;
  color: var(--text);
  background: color-mix(in srgb, var(--header-glass-solid) 94%, transparent) !important;
  border-bottom-color: var(--header-border);
}
@media (max-width: 899px) {
  html.am-swon .auto-body [data-auto-search-root] > .auto-field { top: calc(var(--header-h) + var(--am-swh, 52px)); transition: top .45s var(--am-ease-cine); }
}

/* (ж) поле поиска: больше воздуха слева */
.auto-body [data-auto-search-root] > .auto-field input { padding-left: 54px; }
.auto-body [data-auto-search-root] > .auto-field::after { left: 20px; }

/* (и) мобильный кадр: принтер целиком в кадре — кадр чуть уже, наезд мягче и правее */
.am-cine .cine-sticky .cine-frame { inset: 0 4%; --ox: 58% !important; --oy: 50% !important; }

@media (prefers-reduced-motion: reduce) {
  .sticky-cta.am-sc, .am-switchbar, .am-switchbar.is-on, .am-steps::after { transition: none !important; }
  .am-switchbar .auto-switch { scroll-behavior: auto; }
}
/* база решений: «губа» не накрывает меню разделов. Не на героях программ и подстраниц — там этой подушки нет после запуска скрипта. */
:is(.am-res, html.am-pre .auto-hero:not(:has(.stage--hub))) > .container:where(:not(.auto-hero__grid):not(.project-hero__inner)) { padding-bottom: 28px; }
/* (з) низкий экран (1280×640 и т.п.): колонка героя ужимается, чтобы целиком влезать под шапку — крошки не уходят под неё */
@media (min-width: 1024px) and (max-height: 760px) {
  :is(.am-cine.is-desk, html.am-pre .auto-hero:has(.stage--hub)) h1 { font-size: clamp(28px, 2.6vw, 38px) !important; margin-bottom: var(--space-2) !important; }
  :is(.am-cine.is-desk, html.am-pre .auto-hero:has(.stage--hub)) .auto-lead { font-size: var(--fs-sm, 14px); line-height: 1.45; margin-bottom: 0; }
  :is(.am-cine.is-desk, html.am-pre .auto-hero:has(.stage--hub)) .breadcrumbs { margin-bottom: var(--space-1); }
  :is(.am-cine.is-desk, html.am-pre .auto-hero:has(.stage--hub)) .auto-actions { margin: var(--space-2) 0 !important; }
  :is(.am-cine.is-desk, html.am-pre .auto-hero:has(.stage--hub)) .auto-facts { gap: var(--space-2); }
  :is(.am-cine.is-desk, html.am-pre .auto-hero:has(.stage--hub)) .auto-facts > * { padding: var(--space-2) !important; }
}
/* база решений: карточки решений до JS не рисуются (слой 1 достраивает в них бейджи и чипы) — сдвиг не виден и не считается в CLS */
html.am-pre [data-auto-search-root] > :not(.auto-field):not(h2):not(p):not(.cine-photo-src) { visibility: hidden; }

/* фото героя в разметке: без am-pre (нет JS) его нет, кадр не резервируется */
html:not(.am-pre) .cine-photo-src,
.cine-photo-src:not(:has(picture)) { display: none; }
/* страница программы: кадр остаётся в колонке героя, JS не собирает пин-сцену */
html.am-js .auto-hero.am-dark:not(:has(.stage--hub)):not(:has([data-auto-search-root])) .cine-photo-src {
  display: block; position: relative; overflow: hidden; border-radius: var(--radius-lg);
  aspect-ratio: 16 / 9; margin: var(--space-4) 0 var(--space-3);
}
html.am-js .auto-hero.am-dark:not(:has(.stage--hub)) .cine-photo-src picture,
html.am-js .auto-hero.am-dark:not(:has(.stage--hub)) .cine-photo-src img {
  display: block; width: 100%; height: 100%; object-fit: cover;
}
@media (min-width: 1024px) {
  html.am-js .auto-hero.am-dark:not(:has(.stage--hub)):not(:has([data-auto-search-root])) .cine-photo-src {
    grid-column: 2; grid-row: 1 / span 4; margin: var(--space-4) 0;
  }
}
html.am-pre .cine-photo-src picture,
html.am-pre .cine-photo-src img { display: block; width: 100%; height: 100%; object-fit: cover; }
@media (min-width: 1024px) {
  html.am-pre .auto-hero:has(.stage--hub) .cine-photo-src {
    position: absolute; top: 0; bottom: 0; right: 0; width: min(70vw, 1400px); z-index: 0;
    pointer-events: none; overflow: hidden;
  }
  html.am-pre .auto-hero:not(:has(.stage--hub)) .cine-photo-src {
    grid-column: 2; grid-row: 1 / span 4; margin: var(--space-4) 0; aspect-ratio: 4 / 3;
    position: relative; overflow: hidden; border-radius: var(--radius-lg);
  }
  html.am-pre .auto-hero__grid .cine-photo-src { aspect-ratio: 16 / 9; align-self: start; }
html.am-pre .auto-hero .auto-facts li::before {
  content: ""; display: inline-flex; width: 40px; height: 40px; margin-bottom: var(--space-2); vertical-align: baseline;
}
/* иконка факта приходит из motion.js раньше, чем cine.js снимает am-pre: плейсхолдер в этот кадр не занимает вторую ячейку сетки */
html.am-pre .auto-hero .auto-facts li:has(.am-ico)::before { content: none; }
  html.am-pre .auto-hero:not(:has(.stage--hub)) > .container::after { content: none; }
}
@media (max-width: 1023px) {
  /* поиск сразу под меню разделов, поле целиком над липкой панелью */
  .am-res { padding-bottom: 0 !important; }
  :is(.am-res, html.am-pre .auto-hero:not(:has(.stage--hub))) > .container { padding-bottom: 8px; }
  .auto-body #search.auto-block { padding-top: var(--space-3); }
  /* Высота как у .cine-sticky + .cine-space после JS — иначе CLS ~0.058 на 390 */
  html.am-pre .auto-hero:has(.stage--hub) .cine-photo-src {
    position: relative; width: min(92%, 420px); margin: var(--space-4) auto 0;
    height: min(42vh, 320px); min-height: 220px; aspect-ratio: auto; overflow: hidden;
  }
  html.am-pre .auto-hero:has(.stage--hub) > .cine-space {
    display: block; height: 25vh; pointer-events: none;
  }
  html.am-pre .auto-hero:not(:has(.stage--hub)) .cine-photo-src {
    aspect-ratio: 16 / 9; margin: var(--space-4) 0 var(--space-3); position: relative; overflow: hidden; border-radius: var(--radius-lg);
  }
  html.am-pre .auto-hero:not(:has(.stage--hub)) .auto-lead::after { content: none; }
}
