/* ============================================================
   Анимации главной – те же, что на страницах Butler / Concierge / Glass
   (style.css + js/main.js): первый экран поднимается по очереди,
   заголовки разделов проявляются по словам, блоки въезжают при прокрутке.
   Работают только с js/motion.js (класс .motion на <html>):
   без скрипта страница видна целиком.

   Ради плавной прокрутки на iPhone анимируются только opacity и transform
   (без filter: blur – он перерисовывает большие снимки каждый кадр),
   will-change – только пока блок въезжает (.in без .m-done).
   ============================================================ */
:root {
  --ease-lux: cubic-bezier(0.22, 1, 0.36, 1);
  /* мягкий ease-out для въезда при прокрутке: без резкого старта */
  --ease-reveal: cubic-bezier(0.25, 0.8, 0.3, 1);
}

/* первый экран: по очереди, как .rise на старых страницах */
.motion .m-rise {
  opacity: 0;
  transform: translate3d(0, 18px, 0);
  animation: m-rise 0.9s var(--ease-lux) forwards;
  animation-delay: calc(var(--d, 0) * 120ms + 100ms);
}
@keyframes m-rise { to { opacity: 1; transform: none; } }

/* заголовки разделов – по словам */
.motion .title-word {
  display: inline-block;
  opacity: 0;
  transform: translate3d(0, 0.4em, 0);
  transition: opacity 0.7s var(--ease-reveal), transform 0.7s var(--ease-reveal);
  transition-delay: calc(var(--w, 0) * 60ms);
}
.motion .words-in .title-word { opacity: 1; transform: none; }

/* блоки при прокрутке – как .reveal, но короче и без размытия */
.motion .m-reveal {
  opacity: 0;
  transform: translate3d(0, 24px, 0);
  transition: opacity 0.8s var(--ease-reveal), transform 0.8s var(--ease-reveal);
}
.motion .m-reveal.in { opacity: 1; transform: none; }
.motion .m-reveal.in:not(.m-done) { will-change: opacity, transform; }
.motion .m-reveal.m-done { transition: none; }

@media (prefers-reduced-motion: reduce) {
  .motion .m-rise, .motion .title-word, .motion .m-reveal {
    opacity: 1; transform: none; animation: none; transition: none;
  }
}

/* ---------- кино-оболочка, как на Butler / Concierge / Glass ---------- */
/* шторки кадра открываются после загрузки (только десктоп) */
.m-letterbox {
  position: fixed; left: 0; right: 0; height: 11vh; z-index: 140; pointer-events: none;
  background: #05071a;
  transition: transform 1.5s var(--ease-lux) 0.25s;
}
.m-letterbox.top { top: 0; transform-origin: top; }
.m-letterbox.bottom { bottom: 0; transform-origin: bottom; }
.film-open .m-letterbox { transform: scaleY(0); visibility: hidden; transition: transform 1.5s var(--ease-lux) 0.25s, visibility 0s 1.8s; }

/* полоса прогресса прокрутки: transform пишет скрипт, а где есть scroll-timeline – сам браузер */
.m-progress { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 145; pointer-events: none; background: rgba(242, 243, 250, 0.05); }
.m-progress span {
  display: block; height: 100%; transform-origin: left; transform: scaleX(0);
  will-change: transform;
  background: linear-gradient(90deg, #8fa0e0, #e8e1d4);
}
@keyframes m-progress { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@supports (animation-timeline: scroll()) {
  .m-timeline .m-progress span {
    animation: m-progress linear both;
    animation-timeline: scroll(root block);
  }
}

/* пыль в свете первого экрана и параллакс – только десктоп с мышью (.m-rich) */
.motion .hero { position: relative; overflow: hidden; }
.motion .hero > .wrap { position: relative; z-index: 2; }
.m-dust { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.m-rich .hero-copy, .m-rich .hero-shot { will-change: transform; }
.m-rich .hero.m-off .hero-copy, .m-rich .hero.m-off .hero-shot { will-change: auto; }

/* телефон чуть парит, как карточки в кадре старых страниц; стоит, когда первый экран не виден */
.motion .hero-shot .shot { animation: m-float 6s ease-in-out 1.6s infinite; will-change: transform; }
.motion .hero.m-off .hero-shot .shot { animation-play-state: paused; will-change: auto; }
@keyframes m-float { 0%, 100% { transform: translate3d(0, 0, 0); } 50% { transform: translate3d(0, -10px, 0); } }

/* шарик Astor: пока его не видно, все его бесконечные анимации на паузе */
.motion .orb.m-off, .motion .orb.m-off * { animation-play-state: paused !important; }

/* подсказка «листайте» внизу первого экрана */
.m-hint {
  position: absolute; left: 50%; bottom: 18px; z-index: 3; transform: translateX(-50%);
  display: inline-flex; flex-direction: column; align-items: center; gap: 0.6em;
  background: none; border: 0; cursor: pointer; color: var(--paper-dim);
  font: inherit; font-size: 0.74rem; letter-spacing: 0.18em; text-transform: uppercase;
  opacity: 0; animation: m-hint-in 0.95s var(--ease-lux) 1.1s forwards;
}
.m-hint svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; animation: m-hint-float 2.4s ease-in-out infinite; }
.hero.m-off .m-hint svg { animation-play-state: paused; }
@keyframes m-hint-in { to { opacity: 1; } }
@keyframes m-hint-float { 0%, 100% { transform: translate3d(0, 0, 0); } 50% { transform: translate3d(0, 5px, 0); } }
@media (max-width: 959px) { .m-hint, .m-letterbox { display: none; } }
@media (max-width: 600px) { .m-letterbox { height: 7vh; } }
