/* =========================================================
   Анимации интерфейса. Подключается ПОСЛЕ theme.css.
   Всё отключается при prefers-reduced-motion.
   ========================================================= */

/* ---------- Появление блоков при прокрутке ---------- */
html.motion-ready .mo-reveal {
  opacity: 0;
  translate: 0 22px;
  scale: 0.985;
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
    translate 0.7s cubic-bezier(0.22, 1, 0.36, 1),
    scale 0.7s cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: var(--mo-delay, 0ms);
}
html.motion-ready .mo-reveal.mo-in {
  opacity: 1;
  translate: 0 0;
  scale: 1;
}

/* ---------- Шапка: тень при прокрутке ---------- */
header {
  transition: box-shadow 0.3s ease, background-color 0.3s ease;
}
header.mo-scrolled {
  box-shadow: 0 8px 24px -12px rgba(0, 0, 0, 0.35);
}

/* ---------- Кнопки: нажатие и волна ---------- */
.btn, .nav-cta, .tariff-pill, .compare-tab, .tab, .tab-btn, .download-btn,
button.primary, button.danger, button[type="submit"], .theme-toggle {
  transition-property: background-color, border-color, color, transform, box-shadow;
  transition-duration: 0.18s;
  transition-timing-function: ease;
}
.btn:active, .nav-cta:active, .tariff-pill:active, .compare-tab:active, .tab:active,
.tab-btn:active, .download-btn:active, button.primary:active, button.danger:active,
button[type="submit"]:active, .theme-toggle:active {
  transform: scale(0.96);
}
.btn-primary:hover, .nav-cta:not(.nav-cta--ghost):hover {
  box-shadow: 0 8px 22px -10px var(--brand);
}

.mo-ripple-host { overflow: hidden; isolation: isolate; }
.mo-ripple-host.mo-ripple-static { position: relative; }
.mo-ripple {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  background: currentColor;
  opacity: 0.22;
  transform: scale(0);
  animation: mo-ripple 0.6s ease-out forwards;
  z-index: -1;
}
@keyframes mo-ripple {
  to { transform: scale(1); opacity: 0; }
}

/* ---------- Стрелки «тянутся» вперёд при наведении ---------- */
.btn svg.arrow, .contact-links a .go svg {
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.btn:hover svg.arrow, .contact-links a:hover .go svg {
  transform: translateX(4px);
}

/* ---------- Карточки приподнимаются при наведении ---------- */
.step, .about-feature, .meta-card, .contact-links a, .stat, .sub-card, .ref-card {
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.25s ease,
    border-color 0.2s ease, background-color 0.2s ease;
}
@media (hover: hover) {
  .step:hover, .about-feature:hover, .meta-card:hover, .contact-links a:hover,
  .stat:hover, .sub-card:hover, .ref-card:hover {
    transform: translateY(-3px);
    border-color: var(--line-strong);
    box-shadow: 0 14px 30px -18px rgba(0, 0, 0, 0.45);
  }
  .about-feature:hover .ico, .contact-links a:hover .ico {
    transform: rotate(-8deg) scale(1.08);
  }
  .step:hover .num { transform: scale(1.12); }
}
.about-feature .ico, .contact-links a .ico, .step .num {
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ---------- Номера шагов «выпрыгивают» при появлении ---------- */
html.motion-ready .step.mo-reveal .num { scale: 0.4; opacity: 0; }
html.motion-ready .step.mo-reveal.mo-in .num {
  animation: mo-pop 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) calc(var(--mo-delay, 0ms) + 0.2s) both;
}
@keyframes mo-pop {
  from { scale: 0.4; opacity: 0; }
  to   { scale: 1; opacity: 1; }
}

/* ---------- Пульсирующий индикатор «онлайн» ---------- */
.pill .live { position: relative; }
.pill .live::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: inherit;
  animation: mo-ping 1.8s cubic-bezier(0, 0, 0.2, 1) infinite;
}
@keyframes mo-ping {
  75%, 100% { transform: scale(2.6); opacity: 0; }
}

/* ---------- Картинка тарифа мягко «парит» ---------- */
.tariff-figure { animation: mo-float 5s ease-in-out infinite; }
@keyframes mo-float {
  0%, 100% { translate: 0 0; }
  50%      { translate: 0 -8px; }
}

/* ---------- Вкладки, панели, FAQ ---------- */
.compare-panel.active,
.grid .panel.cabinet-panel-active,
.panel.active {
  animation: mo-fade-up 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.compare-panel.active .compare-row {
  animation: mo-fade-up 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.compare-panel.active .compare-row:nth-child(2) { animation-delay: 0.05s; }
.compare-panel.active .compare-row:nth-child(3) { animation-delay: 0.1s; }
.compare-panel.active .compare-row:nth-child(4) { animation-delay: 0.15s; }
.compare-panel.active .compare-row:nth-child(5) { animation-delay: 0.2s; }
.compare-panel.active .compare-icon.yes {
  animation: mo-pop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) 0.15s both;
}

.faq-item { transition: border-color 0.2s ease, background-color 0.2s ease; }
.faq-question span:last-child {
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.2s ease;
}
.faq-item.active .faq-question span:last-child { transform: rotate(135deg); }
.faq-item.active .faq-answer {
  animation: mo-fade-down 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes mo-fade-up {
  from { opacity: 0; translate: 0 10px; }
  to   { opacity: 1; translate: 0 0; }
}
@keyframes mo-fade-down {
  from { opacity: 0; translate: 0 -6px; }
  to   { opacity: 1; translate: 0 0; }
}

/* ---------- Смена данных тарифа: лёгкий сдвиг вместе с fade ---------- */
.tariff-title, .tariff-tagline, .price strong {
  transition: opacity 0.2s ease, translate 0.25s ease;
}
.tariff-title.fade, .tariff-tagline.fade, .price strong.fade { translate: 0 6px; }

/* ---------- Без анимаций для тех, кто их отключил ---------- */
@media (prefers-reduced-motion: reduce) {
  html.motion-ready .mo-reveal { opacity: 1; translate: none; scale: none; }
  .tariff-figure, .pill .live::after, .mo-ripple,
  .compare-panel.active, .compare-panel.active .compare-row, .compare-panel.active .compare-icon.yes,
  .grid .panel.cabinet-panel-active, .panel.active, .faq-item.active .faq-answer,
  html.motion-ready .step.mo-reveal.mo-in .num {
    animation: none !important;
  }
  html.motion-ready .step.mo-reveal .num { scale: none; opacity: 1; }
}
