/*
 * Движение публичного сайта и кабинетов (03.11.2026, промт
 * docs/prompts/SITE_ANIMATIONS.md). Тот же язык, что у админки
 * (конец public/admin.css, блок «Движение» в admin-v2/src/styles.css):
 * одна кривая, до 450 мс, двигаются только transform и opacity.
 *
 * Отдельный файл, а не продолжение styles.css: его подключает и старая
 * админка, у которой своё движение. Этот файл подключает только
 * src/views/layout.js.
 *
 * Чего здесь нет намеренно:
 *  - заголовок героя не начинается с прозрачности — это самый крупный
 *    элемент первого экрана (LCP), его отрисовку нельзя откладывать;
 *  - бесконечных циклов — отвлекают и сажают батарею;
 *  - сдвигов по горизонтали у блоков на всю ширину — на 375 px они дают
 *    горизонтальную прокрутку.
 */
:root { --m-ease: cubic-bezier(.22, 1, .36, 1); }

/* ── Вход страницы. Первый блок (обычно герой или заголовок) только
   сдвигается, остальное ещё и проявляется. ── */
main > :first-child { animation: m-rise .42s var(--m-ease) backwards; }
main > :not(:first-child) { animation: m-in .45s var(--m-ease) backwards; animation-delay: .05s; }
@keyframes m-rise { from { transform: translateY(8px); } to { transform: none; } }
@keyframes m-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* Герой: цифры доверия и кнопки — лёгкой волной после заголовка. */
.hero-cta, .instant-drop, .hero-trust { animation: m-in .42s var(--m-ease) backwards; }
.hero-cta { animation-delay: .06s; }
.instant-drop { animation-delay: .1s; }
.hero-trust { animation-delay: .14s; }
.hero-trust > * { animation: m-in .4s var(--m-ease) backwards; }
.hero-trust > :nth-child(2) { animation-delay: .18s; }
.hero-trust > :nth-child(3) { animation-delay: .22s; }
.hero-trust > :nth-child(4) { animation-delay: .26s; }
.hero::before { animation: m-glow .9s ease-out backwards; }
@keyframes m-glow { from { opacity: 0; } to { opacity: 1; } }

/* ── Проявление при прокрутке. Где браузер не знает view(), блоки просто
   стоят на месте — никакого «пустого места, пока не прокрутишь». Диапазон
   заканчивается на входе в экран: то, что видно сразу, уже проявлено. ── */
@supports (animation-timeline: view()) {
  main section:not(:first-child),
  .grid-2 > .card, .grid-3 > .card, .grid-4 > .card, .grid-4 > .metric,
  .order-card, .company-card, .faq details {
    animation: m-reveal linear backwards;
    animation-timeline: view();
    animation-range: entry 0% entry 70%;
  }
  @keyframes m-reveal { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
}

/* ── Наведение и нажатие ── */
.order-card, .company-card { transition: border-color .18s, box-shadow .22s var(--m-ease), transform .22s var(--m-ease); }
.order-card:hover, .company-card:hover { transform: translateY(-2px); border-color: var(--line-2); box-shadow: var(--shadow); }
.card-hover { transition: border-color .18s, box-shadow .22s var(--m-ease), transform .22s var(--m-ease); }
.btn { transition: background-color .15s, border-color .15s, color .15s, filter .15s, box-shadow .2s, transform .12s var(--m-ease); }
.btn:active { transform: scale(.97); }
.btn-primary:hover { box-shadow: 0 8px 22px -12px color-mix(in srgb, var(--accent) 70%, transparent); }
.chip { transition: background-color .15s, border-color .15s, color .15s, transform .12s var(--m-ease); }
.chip:active { transform: scale(.96); }
.oc-title a, .ftr a, .nav a { transition: color .15s; }

/* ── Появления: меню, ответы FAQ, предупреждения, результат оценки ── */
.menu[open] > .menu-body { animation: m-pop .2s var(--m-ease) backwards; transform-origin: top right; }
.nav-more[open] > .menu-body { transform-origin: top left; }
.nav-mobile:not([hidden]) { animation: m-drop .26s var(--m-ease) backwards; }
.faq details[open] > :not(summary) { animation: m-drop .28s var(--m-ease) backwards; }
.alert { animation: m-drop .3s var(--m-ease) backwards; }
.instant-res:not([hidden]) { animation: m-pop .32s var(--m-ease) backwards; transform-origin: top center; }
@keyframes m-pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes m-drop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* Поле в фокусе подсвечивается плавно. */
input, select, textarea { transition: border-color .15s, box-shadow .2s var(--m-ease), background-color .15s; }

/* Уведомление о cookie появляется снизу — один раз, без мигания. */
.cookie-note:not([hidden]) { animation: m-in .35s var(--m-ease) .4s backwards; }

/* ── Кому движение мешает — без него; на бумаге — тоже. ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
