/* Анимации сайта (assets/motion.js): появление блоков при прокрутке, «набегание» цифр, вход первого экрана,
 * рост столбиков и шагов, мягкое «дыхание» свечения, микроанимации наведения.
 * Всё включается только с классом .motion-ok на <html> (inline-скрипт в <head>, functions.php) — его нет,
 * если в системе включено «Уменьшить движение» или выключен JS. */
:root { --ease-out: cubic-bezier(.2, .7, .2, 1); }

/* ---------- Появление блоков при прокрутке (.rv ставит motion.js; задержка --rv-d — «волна» в сетках) ---------- */
.motion-ok .rv { transition: opacity .7s var(--ease-out), transform .7s var(--ease-out); transition-delay: var(--rv-d, 0ms); }
.motion-ok .rv:not(.is-in) { opacity: 0; transform: translateY(28px); }
.motion-ok .rv.rv--left:not(.is-in) { transform: translateX(-32px); }
.motion-ok .rv.rv--right:not(.is-in) { transform: translateX(32px); }
.motion-ok .rv.rv--zoom:not(.is-in) { transform: scale(.96); }
.motion-ok .rv.is-in { opacity: 1; transform: none; }
/* после появления возвращаем «родные» переходы наведения карточек */
.motion-ok .rv-done { transition-delay: 0ms; }
.motion-ok .crow.rv-done, .motion-ok .num.rv-done { transition: transform .2s, box-shadow .2s; }
@media (max-width: 767px) {
	.motion-ok .rv:not(.is-in), .motion-ok .rv.rv--left:not(.is-in), .motion-ok .rv.rv--right:not(.is-in) { transform: translateY(18px); }
}

/* ---------- Цифры, которые «набегают»: до старта счётчика не показываем, чтобы не мигало итоговое число ---------- */
.motion-ok :is(.kpi b, .ach__item b, .stat b, .num > b, .crow__metric b, .ad__stats b, .bar b, .metric--big b) { opacity: 0; font-variant-numeric: tabular-nums; }
.motion-ok .cnt-ready { opacity: 1 !important; transition: opacity .3s ease; }

/* ---------- Первый экран: плашка, заголовок, текст, вкладки, панель, цифры — по очереди ---------- */
@keyframes nkd-up { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }
@keyframes nkd-fade { from { opacity: 0; } to { opacity: 1; } }
.motion-ok .hero__top > * { animation: nkd-up .8s var(--ease-out) both; }
.motion-ok .hero__top > :nth-child(2) { animation-delay: .08s; }
.motion-ok .hero__top > :nth-child(3) { animation-delay: .16s; }
.motion-ok .tabs > * { animation: nkd-up .7s var(--ease-out) both; }
.motion-ok .tabs > :nth-child(1) { animation-delay: .24s; }
.motion-ok .tabs > :nth-child(2) { animation-delay: .29s; }
.motion-ok .tabs > :nth-child(3) { animation-delay: .34s; }
.motion-ok .tabs > :nth-child(4) { animation-delay: .39s; }
.motion-ok .tabs > :nth-child(n+5) { animation-delay: .44s; }
.motion-ok .hero > .wrap > .answer:not([hidden]) { animation: nkd-up .8s .45s var(--ease-out) both; }
.motion-ok .hero.is-switched > .wrap > .answer:not([hidden]) { animation: nkd-up .45s var(--ease-out) both; }
.motion-ok .hero .stats { animation: nkd-up .8s .55s var(--ease-out) both; }
/* сетка фона проявляется, свечение медленно «дышит» */
.motion-ok .hero.grid::before { animation: nkd-fade 1.4s ease both; }
@keyframes nkd-breathe { 0%, 100% { transform: translate(0, 0) scale(1); opacity: 1; } 50% { transform: translate(24px, 18px) scale(1.08); opacity: .75; } }
.motion-ok .glow::after { animation: nkd-breathe 14s ease-in-out infinite; }
.motion-ok .glow--right::after { animation-duration: 17s; animation-direction: reverse; }
.motion-ok .glow--left::after { animation-duration: 19s; }
/* зелёная точка в плашке — тихий пульс «на связи» */
@keyframes nkd-ping { 0% { box-shadow: 0 0 0 0 rgba(38, 224, 138, .5); } 70%, 100% { box-shadow: 0 0 0 9px rgba(38, 224, 138, 0); } }
.motion-ok .chip .dot { animation: nkd-ping 2.4s ease-out infinite; }

/* ---------- Реклама: столбики заявок растут по очереди, путь клиента загорается шаг за шагом ---------- */
.motion-ok .bars .bar i { transform: scaleY(0); transform-origin: bottom center; transition: transform .9s var(--ease-out); transition-delay: calc(var(--i, 0) * 110ms + .1s); }
.motion-ok .bars.is-on .bar i { transform: none; }
.motion-ok .bars .bar b { opacity: 0; transition: opacity .4s ease; transition-delay: calc(var(--i, 0) * 110ms + .5s); }
.motion-ok .bars.is-on .bar b { opacity: 1; }
.motion-ok .flow > * { opacity: 0; transform: translateX(-10px); transition: opacity .45s ease, transform .45s var(--ease-out), background-color .4s ease; transition-delay: calc(var(--i, 0) * 140ms + .1s); }
.motion-ok .flow.is-on > * { opacity: 1; transform: none; }
.motion-ok .flow .flow__st.is-last { background: var(--night); color: var(--cyan); transition-delay: calc(var(--i, 0) * 140ms + .1s), calc(var(--i, 0) * 140ms + .1s), calc(var(--i, 0) * 140ms + .45s); }
.motion-ok .flow.is-on .flow__st.is-last { background: var(--blue); color: var(--white); }

/* ---------- Полный цикл: номер шага выезжает следом за карточкой ---------- */
.motion-ok .step.rv .step__n { display: inline-block; transition: transform .6s var(--ease-out), opacity .6s ease; transition-delay: calc(var(--rv-d, 0ms) + .25s); }
.motion-ok .step.rv:not(.is-in) .step__n { opacity: 0; transform: translateX(-12px); }

/* ---------- Кейсы: выгоды проявляются после карточки ---------- */
.motion-ok .crow.rv .crow__gain > li { transition: opacity .5s ease, transform .5s var(--ease-out); }
.motion-ok .crow.rv:not(.is-in) .crow__gain > li { opacity: 0; transform: translateY(8px); }
.motion-ok .crow.rv .crow__gain > :nth-child(1) { transition-delay: .25s; }
.motion-ok .crow.rv .crow__gain > :nth-child(2) { transition-delay: .32s; }
.motion-ok .crow.rv .crow__gain > :nth-child(3) { transition-delay: .39s; }
.motion-ok .crow.rv .crow__gain > :nth-child(n+4) { transition-delay: .46s; }

/* ---------- Наведение ---------- */
@media (hover: hover) {
	.motion-ok .tab .ico, .motion-ok .flow__st .ico { transition: transform .3s var(--ease-out); }
	.motion-ok .tab:hover .ico { transform: scale(1.12) rotate(-6deg); }
	.motion-ok .ad { transition: transform .3s var(--ease-out), border-color .3s ease; }
	.motion-ok .ad.rv-done:hover, .motion-ok .ad:not(.rv):hover { transform: translateY(-3px); border-color: rgba(0, 196, 255, .35); }
	.motion-ok .step.rv-done, .motion-ok .step:not(.rv) { transition: transform .3s var(--ease-out), border-color .3s ease; }
	.motion-ok .step.rv-done:hover, .motion-ok .step:not(.rv):hover { transform: translateY(-3px); border-color: rgba(0, 196, 255, .45); }
	/* карточки кейсов и цифр: подъём при наведении и после анимации появления (правило .rv.is-in иначе перебивает) */
	.motion-ok :is(.crow, .num):is(.rv-done, :not(.rv)):hover { transform: translateY(-3px); }
	.motion-ok .btn--primary { background-size: 160% 100%; background-position: 0 0; transition: background-position .5s ease, filter .2s, transform .2s; }
	.motion-ok .btn--primary:hover { background-position: 100% 0; }
}

/* ---------- Кейс: первый экран въезжает, график растёт ---------- */
.motion-ok .case-hero__l > * { animation: nkd-up .8s var(--ease-out) both; }
.motion-ok .case-hero__l > :nth-child(2) { animation-delay: .08s; }
.motion-ok .case-hero__l > :nth-child(3) { animation-delay: .16s; }
.motion-ok .case-hero__l > :nth-child(n+4) { animation-delay: .24s; }
.motion-ok .case-hero__img { animation: nkd-up .9s .2s var(--ease-out) both; }
.motion-ok .case-hero .kpis { animation: nkd-up .8s .35s var(--ease-out) both; }

/* ---------- Этапы: импульс бежит по линиям от первого шага к последнему ---------- */
@keyframes nkd-run-x { 0% { background-position: 100% 0; } 20%, 100% { background-position: 0 0; } }
@keyframes nkd-run-y { 0% { background-position: 0 100%; } 20%, 100% { background-position: 0 0; } }
.motion-ok :is(.steps>.step, .path>.path__st):not(:last-child)::after {
	background: linear-gradient(90deg, rgba(0,196,255,.22) 0 38%, #00C4FF 50%, rgba(0,196,255,.22) 62% 100%);
	background-size: 300% 100%; animation-name: nkd-run-x; animation-duration: 3.5s; animation-timing-function: linear; animation-iteration-count: infinite;
}
.motion-ok :is(.steps>.step, .path>.path__st):nth-child(2):not(:last-child)::after { animation-delay: .7s; }
.motion-ok :is(.steps>.step, .path>.path__st):nth-child(3):not(:last-child)::after { animation-delay: 1.4s; }
.motion-ok :is(.steps>.step, .path>.path__st):nth-child(4):not(:last-child)::after { animation-delay: 2.1s; }
.motion-ok :is(.steps>.step, .path>.path__st):nth-child(n+5):not(:last-child)::after { animation-delay: 2.8s; }
@media (max-width:1100px) {
	.motion-ok .path>.path__st:not(:last-child)::after { background: linear-gradient(180deg, rgba(0,196,255,.22) 0 38%, #00C4FF 50%, rgba(0,196,255,.22) 62% 100%); background-size: 100% 300%; animation-name: nkd-run-y; }
}
@media (max-width:640px) {
	.motion-ok .steps>.step:not(:last-child)::after { background: linear-gradient(180deg, rgba(0,196,255,.22) 0 38%, #00C4FF 50%, rgba(0,196,255,.22) 62% 100%); background-size: 100% 300%; animation-name: nkd-run-y; }
}
/* стрелки в «Пути клиента» (реклама на главной) и в воронке кейса — подталкиваются по очереди */
@keyframes nkd-nudge-x { 0%, 22%, 100% { transform: none; color: var(--soft); } 11% { transform: translateX(5px); color: var(--cyan); } }
@keyframes nkd-nudge-y { 0%, 22%, 100% { transform: none; } 11% { transform: translateY(5px); color: var(--blue); } }
.motion-ok .flow.is-on .flow__arr { animation: nkd-nudge-x 3.2s ease-in-out infinite; animation-delay: calc(var(--i, 0) * 280ms + 1s); }
.motion-ok .funnel__arr { animation: nkd-nudge-y 3.2s ease-in-out infinite; }
.motion-ok .funnel__arr:nth-of-type(2) { animation-delay: .7s; }
.motion-ok .funnel__arr:nth-of-type(3) { animation-delay: 1.4s; }