/* Первый экран главной AppFox: «Лиса из граней» (вариант 2 серии hero-4) и строка телефона и почты в мобильной шапке.
   Префикс h4- (на сайте не занят). Ставится поверх стилей нынешнего первого экрана (.hv-*, .hx-*).
   Начальные состояния движения только под html.h4-js (класс ставит строка в <head>): без скрипта экран сразу готов.
   При «меньше движения» в системе экран сразу в конечном виде. */

/* ---------- общие: лиса из логотипа по частям ---------- */
.h4-fox { display: block; overflow: visible; }
.h4-fox .h4f, .h4-fox .h4f-eye { transform-box: fill-box; transform-origin: 50% 50%; }
.h4-fox .h4f-ear-l { transform-origin: 30% 100%; }
.h4-fox .h4f-ear-r { transform-origin: 70% 100%; }
@keyframes h4Blink { 0%, 100% { transform: none; } 45%, 55% { transform: scaleY(.12); } }
@keyframes h4EarL { 0%, 100% { transform: none; } 35% { transform: rotate(-12deg); } 70% { transform: rotate(4deg); } }
@keyframes h4EarR { 0%, 100% { transform: none; } 35% { transform: rotate(12deg); } 70% { transform: rotate(-4deg); } }
@keyframes h4Pop { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: none; } }

/* ---------- телефон и почта в шапке на телефоне и планшете (просьба 25.11) ----------
   Строка под логотипом в фиксированной шапке сайта. Вверху страницы видна, при прокрутке вниз сворачивается, при прокрутке
   вверх появляется (класс h4-kont-skryt на шапке ставит hero-4.js). На ПК (от 992 px) телефон и почта уже есть в шапке. */
.h4-kont { display: none; }
@media (max-width: 991px) {
  .h4-kont { display: flex; align-items: center; justify-content: center; gap: 8px 32px; height: 32px; padding: 0 15px 1px; overflow: hidden; border-top: 1px solid #F2EEEA; background: #fff; transition: height .3s ease, opacity .25s ease, border-color .3s ease; }
  .h4-kont__link { display: inline-flex; align-items: center; gap: 6px; font: 500 14px/1 Ubuntu, sans-serif; color: #1F2124 !important; text-decoration: none; white-space: nowrap; }
  .h4-kont__link svg { flex: none; width: 16px; height: 16px; fill: #F3712F; }
  .h4-kont__link:active span { color: #D85A1C; }
  .header.h4-kont-skryt .h4-kont { height: 0; padding-bottom: 0; border-top-width: 0; opacity: 0; }
  /* первый экран ниже на высоту строки */
  .hv.h4 { padding-top: 117px; }
}
@media (max-width: 767px) { .h4-kont { justify-content: space-between; } }
@media (max-width: 359px) {
  .h4-kont { padding: 0 12px 1px; }
  .h4-kont__link { gap: 5px; font-size: 13px; }
  .h4-kont__link svg { width: 14px; height: 14px; }
}

/* =====================================================================
   2 · Лиса из граней
   ===================================================================== */
.h4-2__card { position: relative; display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr); column-gap: 40px; padding: 46px 56px 26px; border-radius: 28px; overflow: hidden; background: #fff; box-shadow: var(--shadow); }
.h4-2__card::before { content: ""; position: absolute; right: -180px; top: -260px; width: 900px; height: 820px; border-radius: 50%; background: radial-gradient(closest-side, rgba(255, 170, 51, .30), rgba(255, 170, 51, 0)); pointer-events: none; }
.h4-2__card > * { position: relative; }
.h4-2__text { padding-top: 4px; }
.h4-2 h1.hv-h1 { margin-top: 22px; }
.h4-2 .hv-title { margin-top: 12px; font-size: 48px; line-height: 1.08; }
.h4-2 .hv-lead { max-width: 560px; margin: 22px 0 0; font-size: 21px; }
.h4-2 .hv-actions { margin-top: 28px; }
.h4-2 .hx-rr-line { margin-top: 18px; margin-left: -6px; }

/* знак: тёплый круг как у иконок «Ценностей», лиса из граней логотипа */
.h4-2__vis { display: flex; flex-direction: column; align-items: center; }
.h4-2__stage { position: relative; display: grid; place-items: center; width: 330px; height: 300px; margin-top: -6px; perspective: 900px; cursor: default; }
.h4-2__halo { position: absolute; left: 50%; top: 50%; width: 300px; height: 300px; margin: -150px 0 0 -150px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #FFF1E4 0%, #FFE3CC 70%); }
.h4-2__halo::after { content: ""; position: absolute; inset: -16px; border-radius: 50%; border: 1px dashed #F7CDB0; }
.h4-2__tilt { position: relative; display: block; width: 250px; transform-style: preserve-3d; will-change: transform; transition: transform .35s cubic-bezier(.2, .7, .2, 1); }
.h4-2__fox { width: 100%; height: auto; filter: drop-shadow(0 22px 22px rgba(154, 74, 28, .25)); }
.h4-2__fox .h4f, .h4-2__fox .h4f-eye { transition: transform .35s cubic-bezier(.2, .7, .2, 1); }
/* карточка сроков наезжает на низ знака */
.h4-2__speed { position: relative; z-index: 2; width: 100%; max-width: 470px; margin-top: -34px; padding: 16px 20px 14px; border-radius: 20px; background: #fff; box-shadow: 0 18px 40px -20px rgba(154, 74, 28, .45), 0 0 0 1px #FFE7D6; }
.h4-2 .hx-race { max-width: none; margin: 0; gap: 6px; }
.h4-2 .hx-race__row { grid-template-columns: 118px minmax(0, 1fr); gap: 12px; }
.h4-2 .hx-race__bar { height: 24px; }
.h4-2 .hx-race__bar b { font-size: 13px; }
.h4-2 .hx-how { max-width: none; margin-top: 10px; padding-top: 10px; border-top: 1px dashed #F3D9C6; font-size: 13.5px; line-height: 1.55; }
.h4-2__foot { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 34px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }

/* сборка: грани слетаются одновременно (этапы параллельно), потом глаза; --tg начало сборки. Сдвиги граней в единицах
   рисунка логотипа (56×50), а не в пикселях экрана: на любом размере знака разлёт один и тот же */
.h4-2 { --tg: .25s; }
.h4-2__fox .h4f-ear-l { --fx: -16px; --fy: -14px; --fr: -24deg; --z: .06s; --dz: 1.6px; }
.h4-2__fox .h4f-ear-r { --fx: 16px; --fy: -14px; --fr: 24deg; --z: .02s; --dz: 1.6px; }
.h4-2__fox .h4f-face-l { --fx: -20px; --fy: 2px; --fr: -10deg; --z: 0s; --dz: .45px; }
.h4-2__fox .h4f-face-r { --fx: 20px; --fy: 2px; --fr: 10deg; --z: .04s; --dz: .45px; }
.h4-2__fox .h4f-cheek-l { --fx: -14px; --fy: 16px; --fr: 14deg; --z: .1s; --dz: 1px; }
.h4-2__fox .h4f-cheek-r { --fx: 14px; --fy: 16px; --fr: -14deg; --z: .08s; --dz: 1px; }
.h4-js .h4-2 .h4-2__fox .h4f { opacity: 0; }
.h4-js .h4-2 .h4-2__fox .h4f-eye { opacity: 0; transform: scale(0); }
.h4-2.h4-go .h4-2__fox .h4f { animation: h4Facet 1s cubic-bezier(.2, 1.25, .35, 1) both; animation-delay: calc(var(--tg) + var(--z, 0s)); }
@keyframes h4Facet { from { opacity: 0; transform: translate(var(--fx), var(--fy)) rotate(var(--fr)) scale(.7); } 30% { opacity: 1; } to { opacity: 1; transform: none; } }
.h4-2.h4-go .h4-2__fox .h4f-eye-x { animation: h4Eye .4s cubic-bezier(.3, 1.6, .5, 1) calc(var(--tg) + 1s) both; }
.h4-2.h4-go .h4-2__fox .h4f-eye-o { animation: h4Eye .4s cubic-bezier(.3, 1.6, .5, 1) calc(var(--tg) + 1.1s) both, h4Blink .32s ease-in-out calc(var(--tg) + 1.75s); }
@keyframes h4Eye { from { opacity: 0; transform: scale(0); } to { opacity: 1; transform: none; } }
.h4-2.h4-go .h4-2__halo { animation: h4Halo .9s cubic-bezier(.2, .7, .2, 1) calc(var(--tg) - .1s) both; }
@keyframes h4Halo { from { opacity: 0; transform: scale(.8); } to { opacity: 1; transform: none; } }
/* полосы сроков в карточке: как на сайте, после сборки знака */
.h4-2 .hx-race__row:first-child .hx-race__bar i { animation-delay: calc(var(--tg) + 1.05s); }
.h4-2 .hx-race__row--af .hx-race__bar i { animation-delay: calc(var(--tg) + 1.25s); }
/* после сборки (класс is-ready от скрипта) грани слушают курсор: каждая сдвигается на свою глубину */
.h4-2.is-ready .h4-2__fox .h4f { animation: none; opacity: 1; transform: translate(calc(var(--mx, 0) * var(--dz, .6px)), calc(var(--my, 0) * var(--dz, .6px))); }
.h4-2.is-ready .h4-2__fox .h4f-eye { animation: none; opacity: 1; transform: translate(calc(var(--mx, 0) * .4px), calc(var(--my, 0) * .3px)); }
.h4-2.is-ready .h4-2__tilt { transform: rotateY(calc(var(--mx, 0) * 12deg)) rotateX(calc(var(--my, 0) * -9deg)); }
/* после сборки лиса не замирает (просьба Валентина 25.11 «оживи слегка статичную картинку после главной анимации»):
   парит в воздухе, раз в цикл подмигивает глазом «○» с наклоном головы и поводит ушами. Движение через отдельные
   свойства translate, rotate, scale: они складываются с transform, который двигает грани за курсором */
.h4-2__fox { transform-origin: 50% 80%; }
.h4-2.is-ready .h4-2__fox { animation: h4IdleFloat 2.8s ease-in-out .3s infinite alternate, h4IdleTilt 6s ease-in-out .3s infinite; }
.h4-2.is-ready .h4-2__fox .h4f-eye-o { animation: h4IdleWink 6s ease-in-out .3s infinite; }
.h4-2.is-ready .h4-2__fox .h4f-ear-r { animation: h4IdleEarR 6s ease-in-out .3s infinite; }
.h4-2.is-ready .h4-2__fox .h4f-ear-l { animation: h4IdleEarL 6s ease-in-out .3s infinite; }
@keyframes h4IdleFloat { from { translate: 0 0; } to { translate: 0 -3%; } }
@keyframes h4IdleTilt { 0%, 6%, 20%, 100% { rotate: 0deg; } 10%, 15% { rotate: 3deg; } }
@keyframes h4IdleWink { 0%, 8%, 16%, 80%, 83%, 86%, 100% { scale: 1 1; } 10.5%, 13.5% { scale: 1 .1; } 81.5%, 84.5% { scale: 1 .12; } }
/* уши: тёмная грань уха вздрагивает на 6°; больше видно как шип, отходящий от головы (проверено кадрами 25.11) */
@keyframes h4IdleEarR { 0%, 8%, 15.5%, 52%, 60%, 100% { rotate: 0deg; } 10.5% { rotate: 6deg; } 13% { rotate: -2deg; } 54.5% { rotate: 6deg; } 57% { rotate: -2.5deg; } }
@keyframes h4IdleEarL { 0%, 44%, 52%, 100% { rotate: 0deg; } 46.5% { rotate: -6deg; } 49% { rotate: 2.5deg; } }
/* касание на телефоне: грани расходятся и собираются, глаз моргает */
.h4-2.is-ready.is-shake .h4-2__fox .h4f { animation: h4Shake .6s cubic-bezier(.3, 1.4, .5, 1) both; }
.h4-2.is-ready.is-shake .h4-2__fox .h4f-eye-o { animation: h4Blink .32s ease-in-out .15s both; }
@keyframes h4Shake { 40% { transform: translate(calc(var(--fx) * .12), calc(var(--fy) * .12)) rotate(calc(var(--fr) * .3)); } 100% { transform: none; } }

@media (max-width: 1199px) {
  .h4-2__card { grid-template-columns: minmax(0, 1fr) 300px; column-gap: 24px; padding: 36px 32px 24px; }
  .h4-2 .hv-title { font-size: 40px; }
  .h4-2__stage { width: 280px; height: 260px; }
  .h4-2__halo { width: 250px; height: 250px; margin: -125px 0 0 -125px; }
  .h4-2__tilt { width: 210px; }
  .h4-2 .hx-race__row { grid-template-columns: 1fr; gap: 0; }
}
/* телефон и планшет до 991 px (в две колонки заголовок не помещается): знак сверху по центру, под ним тексты, кнопки,
   карточка сроков */
@media (max-width: 991px) {
  .h4-2__card { display: flex; flex-direction: column; padding: 18px 16px 20px; border-radius: 20px; }
  .h4-2__card::before { right: -300px; top: -380px; }
  .h4-2__text, .h4-2__vis { display: contents; }
  .h4-2__stage { order: -1; align-self: center; width: 128px; height: 116px; margin: 0 0 10px; }
  .h4-2__halo { width: 112px; height: 112px; margin: -56px 0 0 -56px; }
  .h4-2__halo::after { inset: -7px; }
  .h4-2__tilt { width: 86px; }
  .h4-2__fox { filter: drop-shadow(0 8px 8px rgba(154, 74, 28, .25)); }
  .h4-2 .hv-kicker { align-self: flex-start; }
  .h4-2 h1.hv-h1 { margin-top: 18px; }
  .h4-2 .hv-title { margin-top: 10px; font-size: 30px; line-height: 1.12; }
  .h4-2 .hv-title .hx-mark { white-space: normal; }
  .h4-2 .hv-lead { margin-top: 14px; font-size: 18px; }
  .h4-2 .hv-actions { margin-top: 20px; }
  .h4-2__speed { order: 1; max-width: none; margin-top: 18px; padding: 12px 14px; border-radius: 18px; }
  .h4-2 .hx-race__row { grid-template-columns: 1fr; gap: 0; }
  .h4-2 .hx-race__name { font-size: 12.5px; }
  .h4-2 .hx-race__bar b { font-size: 12px; }
  .h4-2 .hx-rr-line { order: 2; align-self: center; margin: 16px 0 0; }
  .h4-2__foot { order: 3; flex-direction: column; gap: 14px; margin-top: 18px; padding-top: 18px; }
}

/* планшет 768–991: варианты 2 и 3 в одну колонку, но крупнее телефона */
@media (min-width: 768px) and (max-width: 991px) {
  .h4-2__card { padding: 32px 36px 26px; border-radius: 26px; }
  .h4-2 .hv-title { font-size: 44px; }
  .h4-2 .hv-title .hx-mark { white-space: nowrap; }
  .h4-2 .hv-lead { font-size: 21px; }
  .h4-2__stage { width: 190px; height: 172px; }
  .h4-2__halo { width: 168px; height: 168px; margin: -84px 0 0 -84px; }
  .h4-2__tilt { width: 130px; }
  .h4-2__speed { max-width: 560px; align-self: flex-start; width: 100%; }
  .h4-2 .hx-rr-line { align-self: flex-start; margin-left: -6px; }
  .h4-2__foot { flex-direction: row; justify-content: space-between; }
}

/* низкий телефон (360x640, 320x568): плотнее набор, кнопки сразу под подзаголовком, чтобы «Оставить заявку» была
   в первом экране выше нижней панели сайта */
@media (max-width: 767px) and (max-height: 720px) {
  .h4 .hv-kicker { padding: 6px 12px 6px 10px; font-size: 12px; }
  .h4 h1.hv-h1 { margin-top: 12px; font-size: 12.5px; }
  .h4 .hv-title { margin-top: 8px; font-size: 26px; }
  .h4 .hv-lead { margin-top: 10px; font-size: 16px; }
  .h4 .hv-actions { margin-top: 14px; gap: 8px; }
  .h4 .hv-actions .hv-btn { padding: 11px 18px; font-size: 16px; }
  .h4-2__card { padding-top: 16px; }
  .h4-2__stage { width: 96px; height: 88px; margin-bottom: 6px; }
  .h4-2__halo { width: 84px; height: 84px; margin: -42px 0 0 -42px; }
  .h4-2__tilt { width: 64px; }
}
@media (max-width: 359px) and (max-height: 720px) {
  .h4 .hv-title { font-size: 24px; }
  .h4 .hv-kicker { font-size: 11.5px; }
  /* 320x568: строка контактов в шапке опустила экран на 32 px, знак и отступы второго варианта меньше */
  .h4-2__card { padding-top: 10px; }
  .h4-2__stage { width: 58px; height: 52px; margin-bottom: 0; }
  .h4-2__halo { width: 50px; height: 50px; margin: -25px 0 0 -25px; }
  .h4-2__halo::after { inset: -4px; }
  .h4-2__tilt { width: 38px; }
  .h4-2 h1.hv-h1 { margin-top: 8px; }
  .h4-2 .hv-lead { margin-top: 8px; }
}

/* меньше движения: всё сразу в конечном виде. В макете класс h4-motion (ставит строка в <head>) это снимает, чтобы
   движение было видно и на машине с выключенными эффектами анимации */
@media (prefers-reduced-motion: reduce) {
  html:not(.h4-motion) .h4 *, html:not(.h4-motion) .h4 *::before, html:not(.h4-motion) .h4 *::after, html:not(.h4-motion) .h4-logo * { animation-duration: .001s !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: .001s !important; }
}
