/* v5.31 — smooth pass. Loaded LAST so it wins.
   Rules: animate only transform/opacity, no per-card blur, no layout-shifting
   keyframes, pause decorative loops while the page scrolls. */

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--lm-header-h, 64px) + 8px); }
body { overflow-anchor: auto; }
img { content-visibility: visible; }
.lm-thumb img, .lm-thumb-fallback, .lm-single-thumb img { content-visibility: visible; }

/* ---------- 1. Cheap replacements for heavy keyframes (same names = override) ---------- */
@keyframes lmTextGlow   { 0% { opacity: .9; } 100% { opacity: 1; } }
@keyframes lmPulseGlow  { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }
@keyframes lmPulseGlowGreen { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }
@keyframes lmTelegramBeat { 0%, 100% { transform: translate3d(0,0,0); } 50% { transform: translate3d(0,-2px,0); } }
@keyframes lgBatBeat    { 0%, 100% { opacity: .82; } 50% { opacity: 1; } }
@keyframes lbGoldBeat   { 0%, 100% { opacity: .82; } 50% { opacity: 1; } }
@keyframes lgGlowAqua   { 0%, 100% { opacity: .85; } 50% { opacity: 1; } }
@keyframes lgInkWave    { 0%, 100% { opacity: .88; } 50% { opacity: 1; } }       /* was letter-spacing = layout every frame */
@keyframes lmLogoDarkGlow  { from { opacity: .9; } to { opacity: 1; } }          /* was text-shadow */
@keyframes lmLogoLightGlow { from { opacity: .9; } to { opacity: 1; } }

/* keep the glow look, but static (no repaint per frame) */
html:not(.lm-light) .lm-mark-dark { filter: drop-shadow(0 0 6px rgba(255, 40, 70, .75)); }
html:not(.lm-light) .lm-bm-dark   { filter: drop-shadow(0 0 6px rgba(242, 182, 50, .75)); }
html.lm-light .lm-mark-mint, html.lm-light .lm-bm-mint { filter: drop-shadow(0 3px 7px rgba(25, 211, 197, .6)); }
.lm-rating-badge { backdrop-filter: none; -webkit-backdrop-filter: none; }       /* blur on every card = scroll jank */

/* Only the always-looping decorative bits pause while scrolling (never one-shot UI animations). */
html.lm-scrolling .lm-logo, html.lm-scrolling .lm-logo *, html.lm-scrolling .lm-brand-name, html.lm-scrolling .lm-brand-name *,
html.lm-scrolling .lm-bm-wrap, html.lm-scrolling .lm-bm-wrap *, html.lm-scrolling .lm-mark-wrap, html.lm-scrolling .lm-mark-wrap *,
html.lm-scrolling .lm-em, html.lm-scrolling .lm-em *, html.lm-scrolling .lm-ico, html.lm-scrolling .lm-flag, html.lm-scrolling .lm-tt,
html.lm-scrolling .lm-telegram, html.lm-scrolling .lm-request, html.lm-scrolling .lm-homebtn, html.lm-scrolling .lm-themebtn-ico {
  animation-play-state: paused;
}

/* ---------- 2. Poster slider: true crossfade, no dark flash, text rises in ---------- */
.lm-featured .lm-featured-track .lm-featured-slide {
  opacity: 0; visibility: hidden; z-index: 0; transform: none; will-change: auto;
  transition: opacity .8s cubic-bezier(.4, 0, .2, 1), visibility 0s linear .8s;
}
.lm-featured .lm-featured-track .lm-featured-slide.is-active {
  opacity: 1; visibility: visible; z-index: 2;
  transition: opacity .8s cubic-bezier(.4, 0, .2, 1), visibility 0s;
}
.lm-featured .lm-featured-track .lm-featured-slide.is-leaving {      /* old slide stays solid until the new one covers it */
  opacity: 1; visibility: visible; z-index: 1; transition: none;
}
.lm-featured-track { contain: layout paint; transform: translateZ(0); }
.lm-featured-image { backface-visibility: hidden; }
.lm-featured-cover { display: block; position: absolute; inset: 0; z-index: 2; cursor: pointer; }   /* whole poster is the link */
.lm-featured-content { z-index: 3; }

.lm-featured-content {
  opacity: 0; transform: translate3d(0, 14px, 0);
  transition: opacity .55s ease .25s, transform .7s cubic-bezier(.22, 1, .36, 1) .25s;
}
.lm-featured-slide.is-active .lm-featured-content { opacity: 1; transform: none; }
.lm-featured-slide.is-leaving .lm-featured-content { opacity: 1; transform: none; transition: none; }

.lm-featured-controls button { transition: background-color .2s ease, transform .2s ease; }
.lm-featured-controls .lm-slider-prev:active, .lm-featured-controls .lm-slider-next:active { transform: translateY(-50%) scale(.9); }
.lm-featured-dots button::after { transition: background-color .3s ease, width .3s ease; }
.lm-featured-dots button[aria-pressed="true"]::after { width: 26px; }

/* ---------- 3. Poster cards: smooth hover only (nothing hides/re-shows on scroll) ---------- */
.lm-card { transition: transform .25s cubic-bezier(.22, 1, .36, 1), box-shadow .25s ease; }
.lm-card:hover { transform: translate3d(0, -4px, 0); }
.lm-card-vip .lm-thumb img, .lm-thumb img {
  transition: transform .45s cubic-bezier(.22, 1, .36, 1);
  backface-visibility: hidden;
}
.lm-thumb { background-color: var(--poster-bg, #16161c); }


/* ---------- 4. Drawer / overlay / search: GPU transitions, no animated blur ---------- */
.lm-overlay, .lm-search-backdrop { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
.lm-overlay { transition: opacity .35s ease, visibility 0s linear .35s; }
body.lm-menu-open .lm-overlay { transition: opacity .35s ease, visibility 0s; }
.lm-drawer {
  visibility: hidden; transform: translate3d(-102%, 0, 0);
  transition: transform .4s cubic-bezier(.22, 1, .36, 1), visibility 0s linear .4s;
  overscroll-behavior: contain;
}
body.lm-menu-open .lm-drawer {
  visibility: visible; transform: translate3d(0, 0, 0);
  transition: transform .4s cubic-bezier(.22, 1, .36, 1), visibility 0s;
}
.lm-search-backdrop { transition: opacity .3s ease, visibility 0s linear .3s; }
.lm-search-backdrop.is-on { transition: opacity .3s ease, visibility 0s; }
.lm-search-panel { transition: opacity .3s ease, transform .35s cubic-bezier(.22, 1, .36, 1), visibility 0s linear .3s; }
.lm-search-panel.is-open { transition: opacity .3s ease, transform .35s cubic-bezier(.22, 1, .36, 1), visibility 0s; }
.lm-live { transition: opacity .2s ease, transform .25s cubic-bezier(.22, 1, .36, 1); }

/* ---------- 6. TV / reduced motion: keep it simple and safe ---------- */
html.lm-tv .lm-featured .lm-featured-track .lm-featured-slide,
html.lm-tv .lm-featured .lm-featured-track .lm-featured-slide.is-active { transition: opacity .3s linear; }
html.lm-tv .lm-featured-content, html.lm-tv .lm-featured-slide.is-active .lm-featured-content { opacity: 1; transform: none; transition: none; }
html.lm-tv .lm-featured-track { transform: none; contain: none; }
html.lm-tv html.lm-tv .lm-drawer, html.lm-tv .lm-drawer * { will-change: auto; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .lm-featured .lm-featured-track .lm-featured-slide, .lm-featured-content, .lm-drawer, .lm-overlay,
  .lm-card, .lm-thumb img { transition: none !important; }
  .lm-featured-content { opacity: 1; transform: none; }
    }
