/* ============================================================
   agentbit.ru — движение: появление блоков при прокрутке, «живой» Бит, линия апгрейда, наклон карточек.
   Только transform и opacity (кроме мелких переходов кнопок и ссылок). Класс html.fx выставляет assets/theme.js
   и только если браузер умеет IntersectionObserver и человек не просил «уменьшить движение»: без него всё
   стоит на месте и видно сразу. Подключается и на главной, и на странице бесплатных глав.
   ============================================================ */

/* ---------- появление при прокрутке ---------- */
.fx .rv { opacity: 0; transform: translateY(22px); }
.fx .rv.in {
  opacity: 1; transform: none;
  transition: opacity .75s cubic-bezier(.2, .65, .2, 1) var(--d, 0s), transform .75s cubic-bezier(.2, .65, .2, 1) var(--d, 0s);
}
.fx .rv.rv-pop { transform: translateY(14px) scale(.96); }
.fx .rv.rv-pop.in { transform: none; }

/* ---------- обложка: вход при загрузке ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(14px) scale(.9); } to { opacity: 1; transform: none; } }
.fx .hero-tx > * { animation: rise .7s cubic-bezier(.2, .65, .2, 1) both; }
.fx .hero-tx > :nth-child(1) { animation-delay: .05s; }
.fx .hero-tx > :nth-child(2) { animation-delay: .12s; }
.fx .hero-tx > :nth-child(3) { animation-delay: .19s; }
.fx .hero-tx > :nth-child(4) { animation-delay: .26s; }
.fx .hero-tx > :nth-child(5) { animation-delay: .33s; }
.fx .hero-tx > :nth-child(6) { animation-delay: .4s; }
.fx .hero-tx > :nth-child(7) { animation-delay: .47s; }
.fx .hero-art { animation: pop-in .9s cubic-bezier(.2, .7, .2, 1) .1s both; }

/* ---------- Бит на обложке: парит, машет, глаза следят (скрипт fx.js двигает .b-eyes и .b-mouth) ---------- */
@keyframes b-bob { 50% { transform: translateY(-14px); } }
@keyframes b-bob-s { 50% { transform: translateY(-9px); } }
@keyframes b-twinkle { 0%, 100% { opacity: .2; transform: scale(.6); } 50% { opacity: 1; transform: scale(1.1); } }
@keyframes b-wave { 0%, 100% { transform: rotate(0); } 18% { transform: rotate(-13deg); } 36% { transform: rotate(6deg); } 54% { transform: rotate(-10deg); } 72% { transform: rotate(3deg); } }
@keyframes b-blink { 0%, 100% { transform: scaleY(1); } 45% { transform: scaleY(.08); } }
.b-body { animation: b-bob 5.6s ease-in-out infinite; }
@keyframes b-shadow { 50% { transform: scale(.78); opacity: .55; } }
.b-shadow { transform-box: fill-box; transform-origin: center; animation: b-shadow 5.6s ease-in-out infinite; }
.b-float { animation: b-bob-s 6s ease-in-out infinite; }
.b-float.f1 { animation-duration: 5.4s; animation-delay: -.6s; }
.b-float.f2 { animation-duration: 6.4s; animation-delay: -2.2s; }
.b-float.f3 { animation-duration: 5.1s; animation-delay: -1.4s; }
.b-float.f4 { animation-duration: 6.8s; animation-delay: -3.1s; }
.b-float.f5 { animation-duration: 4.8s; animation-delay: -.2s; }
.b-float.f6 { animation-duration: 5.9s; animation-delay: -2.6s; }
.b-spark { transform-box: fill-box; transform-origin: center; animation: b-twinkle 3.4s ease-in-out infinite; }
.b-spark.s2 { animation-delay: -.9s; animation-duration: 3.9s; }
.b-spark.s3 { animation-delay: -1.8s; animation-duration: 3.1s; }
.b-spark.s4 { animation-delay: -2.5s; animation-duration: 4.3s; }
.b-wave { transform-origin: 37px 14px; animation: b-wave 3.6s ease-in-out infinite; }
.b-blink { transform-box: fill-box; transform-origin: 50% 60%; }
.b-blink.is-blink { animation: b-blink .22s ease-in-out; }
.bitlive.is-off *, .bitlive.is-off { animation-play-state: paused !important; }

/* маленькие Биты на других блоках: лёгкое парение */
.fx .final-art .bit, .fx .week-art .bit, .fx .free-art .bit, .fx .buy-art .bit { animation: b-float-img 6s ease-in-out infinite; }
@keyframes b-float-img { 50% { transform: translateY(-6px); } }

/* ---------- уровни: наклон карточки под курсором и линия апгрейда ---------- */
.tiers { perspective: 1200px; }
.tier { transition: transform .5s cubic-bezier(.2, .7, .2, 1); }
.tier.tilt { transition: transform .12s linear; transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(-4px); will-change: transform; }

@keyframes flow-y { to { transform: translateY(16px); } }
@keyframes flow-x { to { transform: translateX(16px); } }
.up-line::before { animation: flow-y .9s linear infinite; }
.up-pill, .up-arrow { transition: opacity .5s ease, transform .5s cubic-bezier(.2, .7, .2, 1); }
.fx .up-link:not(.in) .up-line { transform: scaleY(0); }
.fx .up-link:not(.in) .up-line::before { animation-play-state: paused; }
.fx .up-link:not(.in) .up-pill { opacity: 0; transform: translateX(-10px); }
.fx .up-link.in .up-line { transition: transform .9s cubic-bezier(.65, 0, .35, 1) .1s; }
.fx .up-link.in .up-pill { transition-delay: .7s; }
.fx .up-link:not(.in) .up-arrow { opacity: 0; }
.fx .up-link.in .up-arrow { transition-delay: .95s; }
@media (min-width: 1040px) {
  .up-line::before { animation-name: flow-x; }
  .fx .up-link:not(.in) .up-line { transform: scaleX(0); }
  .fx .up-link:not(.in) .up-pill { transform: translateY(8px); }
  .up-arrow { transition: opacity .4s ease; }
}

/* ---------- лесенка доплаты: полосы вырастают слева направо ---------- */
.fx .ladder .lbar { transform-origin: left; }
.fx .upgrade:not(.in) .lbar { transform: scaleX(.02); opacity: 0; }
.fx .upgrade.in .lbar { transition: transform .9s cubic-bezier(.2, .7, .2, 1), opacity .4s ease; }
.fx .upgrade.in .lrow:nth-child(2) .lbar { transition-delay: .15s; }
.fx .upgrade.in .lrow:nth-child(3) .lbar { transition-delay: .3s; }

/* ---------- словарик: возврат от звёздочки подсвечивается ---------- */
.gl-item:target, .gl-ref:target a { animation: hl-pulse 1.4s ease-out 1; }
@keyframes hl-pulse { from { box-shadow: 0 0 0 6px color-mix(in srgb, var(--mint) 55%, transparent); } to { box-shadow: 0 0 0 0 transparent; } }

/* ---------- кто просил меньше движения, у того всё на месте ---------- */
@media (prefers-reduced-motion: reduce) {
  .fx .rv, .fx .rv.in { opacity: 1 !important; transform: none !important; }
  .tier.tilt { transform: none !important; }
  /* Бит и линия доплаты тоже замирают: бесконечные покачивания и мерцания не нужны тем, кто просил меньше движения */
  .b-body, .b-shadow, .b-float, .b-spark, .b-wave, .b-blink.is-blink, .up-line::before { animation: none !important; }
}
@media print {
  .rv { opacity: 1 !important; transform: none !important; }
}
