/* ============================================================
   SITE FX — появление по скроллу для блоков без своей режиссуры
   (js/site-fx.js). Первый экран, полароиды УТП, блокнот, «Программы»
   и галерея режиссируются своими модулями и здесь не трогаются.

   Всё прячущее висит на .sfx, который ставит JS, — без JS и при
   prefers-reduced-motion сайт выглядит как раньше.
   Анимации — только отдельными свойствами translate / scale / rotate /
   clip-path / filter: родной transform элементов (translateX(-50%),
   rotate(var(--rot)), мобильные scale) не перетирается.
   ============================================================ */

.sfx:not(.is-in) { opacity: 0; animation: none; }   /* animation: none — у печати своя sealIn с fill both, она бы показала её раньше времени */
.sfx.is-in { animation-delay: var(--d, 0s); animation-fill-mode: backwards; }

/* Заголовки — поднимаются из «прорези» */
.sfx--rise.is-in {
  animation-name: sfxRise;
  animation-duration: 1.15s;
  animation-timing-function: var(--ease-out);
}
@keyframes sfxRise {
  from { opacity: 0; translate: 0 0.9em; clip-path: inset(-12% -4% 100% -4%); }
  to   { opacity: 1; translate: 0 0;     clip-path: inset(-12% -4% -25% -4%); }
}

/* Рукописные строки — «пишутся» пером слева направо */
.sfx--write {
  -webkit-mask-image: linear-gradient(90deg, #000 45%, transparent 55%);
          mask-image: linear-gradient(90deg, #000 45%, transparent 55%);
  -webkit-mask-size: 240% 100%;
          mask-size: 240% 100%;
  -webkit-mask-repeat: no-repeat;
          mask-repeat: no-repeat;
  -webkit-mask-position: 95% 0;
          mask-position: 95% 0;
}
.sfx--write.is-in {
  animation: sfxWrite var(--dur-write) var(--ease-pen) var(--d, 0s) forwards;
}
@keyframes sfxWrite {
  from { opacity: 1; }
  to   { opacity: 1; -webkit-mask-position: 0% 0; mask-position: 0% 0; }
}

/* Обычный текст / блоки — всплывают из лёгкого размытия */
.sfx--up.is-in {
  animation-name: sfxUp;
  animation-duration: 1s;
  animation-timing-function: var(--ease-soft);
}
@keyframes sfxUp {
  from { opacity: 0; translate: 0 34px; filter: blur(6px); }
  to   { opacity: 1; translate: 0 0;    filter: blur(0); }
}

/* Бумажные плашки/доски — «кладут» сверху с лёгким доворотом */
.sfx--drop.is-in {
  animation-name: sfxDrop;
  animation-duration: 1.1s;
  animation-timing-function: var(--ease-bounce);
}
@keyframes sfxDrop {
  from { opacity: 0; translate: 0 -44px; rotate: -3deg; scale: 1.05; }
  55%  { opacity: 1; }
  to   { opacity: 1; translate: 0 0; rotate: 0deg; scale: 1; }
}

/* Полароиды — «бросили на стол»: прилетают с поворотом и пружинят */
.sfx--toss.is-in {
  animation-name: sfxToss;
  animation-duration: 1.2s;
  animation-timing-function: var(--ease-bounce);
}
@keyframes sfxToss {
  from { opacity: 0; translate: var(--tx, 0px) 120px; rotate: var(--tr, -14deg); scale: 0.72; }
  50%  { opacity: 1; }
  to   { opacity: 1; translate: 0 0; rotate: 0deg; scale: 1; }
}

/* Печати, значки, кнопки — «шлёп» с отскоком */
.sfx--stamp.is-in {
  animation-name: sfxStamp;
  animation-duration: 0.85s;
  animation-timing-function: var(--ease-spring);
}
@keyframes sfxStamp {
  from { opacity: 0; scale: 1.9; rotate: -14deg; filter: blur(3px); }
  60%  { opacity: 1; filter: blur(0); }
  to   { opacity: 1; scale: 1; rotate: 0deg; }
}
.sfx--pop.is-in {
  animation-name: sfxPop;
  animation-duration: 0.8s;
  animation-timing-function: var(--ease-spring);
}
@keyframes sfxPop {
  from { opacity: 0; scale: 0.5; translate: 0 16px; }
  to   { opacity: 1; scale: 1;   translate: 0 0; }
}

/* Метки-пины — падают на карту и втыкаются */
.sfx--pin.is-in {
  animation-name: sfxPin;
  animation-duration: 0.9s;
  animation-timing-function: var(--ease-spring);
}
@keyframes sfxPin {
  from { opacity: 0; translate: 0 -70px; scale: 1.4; }
  55%  { opacity: 1; translate: 0 6px;   scale: 0.92; }
  to   { opacity: 1; translate: 0 0;     scale: 1; }
}

/* Большие картинки — раскрываются шторкой снизу вверх + лёгкий зум */
.sfx--unveil.is-in {
  animation-name: sfxUnveil;
  animation-duration: 1.4s;
  animation-timing-function: var(--ease-out);
}
@keyframes sfxUnveil {
  from { opacity: 0; clip-path: inset(100% 0 0 0); scale: 1.08; }
  15%  { opacity: 1; }
  to   { opacity: 1; clip-path: inset(0 0 0 0);    scale: 1; }
}

/* Панель/рамка — раскрывается от центра */
.sfx--open.is-in {
  animation-name: sfxOpen;
  animation-duration: 1.3s;
  animation-timing-function: var(--ease-out);
}
@keyframes sfxOpen {
  from { opacity: 0; clip-path: inset(0 50% 0 50%); }
  20%  { opacity: 1; }
  to   { opacity: 1; clip-path: inset(0 0 0 0); }
}

/* Въезд сбоку (лев с рулеткой, табличка «О руководителе») */
.sfx--from-r.is-in,
.sfx--from-l.is-in {
  animation-duration: 1.3s;
  animation-timing-function: var(--ease-out);
}
.sfx--from-r.is-in { animation-name: sfxFromR; }
.sfx--from-l.is-in { animation-name: sfxFromL; }
@keyframes sfxFromR {
  from { opacity: 0; translate: 140px 20px; rotate: 8deg; }
  to   { opacity: 1; translate: 0 0;       rotate: 0deg; }
}
@keyframes sfxFromL {
  from { opacity: 0; translate: -140px 20px; rotate: -8deg; }
  to   { opacity: 1; translate: 0 0;        rotate: 0deg; }
}

/* Чемодан «ставят» на пол: падает, приседает, выпрямляется */
.sfx--land.is-in {
  animation-name: sfxLand;
  animation-duration: 1.25s;
  animation-timing-function: var(--ease-soft);
  transform-origin: 50% 100%;
}
@keyframes sfxLand {
  0%   { opacity: 0; translate: 0 -90px; scale: 0.94 1.04; }
  45%  { opacity: 1; translate: 0 0;     scale: 1.04 0.94; }
  70%  {             translate: 0 -8px;  scale: 0.99 1.01; }
  100% { opacity: 1; translate: 0 0;     scale: 1; }
}

/* Золотая корона — падает и «звенит» */
.sfx--crown.is-in {
  animation-name: sfxCrown;
  animation-duration: 1.2s;
  animation-timing-function: var(--ease-soft);
}
@keyframes sfxCrown {
  0%   { opacity: 0; translate: 0 -50px; rotate: -30deg; scale: 0.6; }
  50%  { opacity: 1; translate: 0 0;     rotate: 10deg;  scale: 1.1; }
  70%  { rotate: -6deg; }
  85%  { rotate: 3deg; }
  100% { opacity: 1; rotate: 0deg; scale: 1; }
}

/* ---------- Полоса прогресса чтения страницы ---------- */
.sfx-progress {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1002;          /* над шапкой (.site-header: 1001) */
  width: 100%;
  height: 3px;
  pointer-events: none;
  transform-origin: 0 50%;
  transform: scaleX(var(--sfx-p, 0));
  background: linear-gradient(90deg, #C98A2E, var(--color-gold), #FFE3AC);
  box-shadow: 0 0 10px rgba(245, 177, 67, 0.6);
  will-change: transform;
}

/* ---------- Секция вне экрана — все её анимации на паузе (site-fx.js) ---------- */
.sfx-off,
.sfx-off *,
.sfx-off *::before,
.sfx-off *::after {
  animation-play-state: paused !important;
}
