/**
 * Scroll performance — static compositor-friendly rules (no scroll JS class toggling).
 */

/* Isolate fixed decorative layers from document scroll repaints */
body.guest-site .mesh-gradient,
body.guest-site .tone-shift,
body.guest-site .animated-backdrop,
body.guest-site .page-atmosphere,
body.guest-site .grid-lines {
  contain: strict;
  pointer-events: none;
}

body.guest-site .orb {
  contain: strict;
  pointer-events: none;
  will-change: transform;
}

/* Defer off-screen PDP sections until near viewport */
.rm-pdp__left-stack .cg-pdp__bottom,
.rm-pdp__left-stack .cg-pdp__quality-banner,
.page-product .rm-pdp__left-stack .product-overview--fullwidth {
  content-visibility: auto;
  contain-intrinsic-size: auto 220px;
}

/* ── Mobile scroll performance (≤899px) ── */
@media (max-width: 899px) {
  body.guest-site .mesh-gradient,
  body.guest-site .tone-shift,
  body.guest-site .animated-backdrop,
  body.guest-site .page-atmosphere,
  body.guest-site .pdp-ethereal-fx,
  body.guest-site .mist {
    opacity: 0.42;
    pointer-events: none;
  }

  body.guest-site .grid-lines {
    opacity: 0.18;
    pointer-events: none;
  }

  body.guest-site .cg-social-float-stack {
    animation: cg-social-float 3.8s ease-in-out infinite;
    contain: layout style paint;
  }

  body.guest-site .product-hero-img--zoomhost img,
  body.guest-site .hero-tilt {
    will-change: auto !important;
  }

  body.pdp-ethereal .rm-pdp--modern .rm-pdp__hero-zoom img,
  body.pdp-ethereal .product-hero-img img,
  body.pdp-ethereal #productImage {
    filter: none !important;
  }

  body.guest-site .site-top--fx,
  body.guest-site .nav-dock--fx,
  body.guest-site .global-find__popover,
  body.guest-site .glass-panel,
  body.guest-site .rm-nav-tree-wrap,
  body.pdp-ethereal .rm-nav-tree-wrap,
  body.pdp-ethereal .glass-panel,
  body.pdp-ethereal .product-visual--fx,
  body.pdp-ethereal .product-detail--purchase,
  body.pdp-ethereal .pdp-feature-bar {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  body.guest-site .glass-panel {
    background: rgba(255, 255, 255, 0.96);
  }

  body.guest-site .site-top--fx {
    contain: layout style;
  }

  body.guest-site .site-footer {
    content-visibility: auto;
    contain-intrinsic-size: auto 360px;
  }

  body.guest-site .band-shop .product-grid .product-card:nth-child(n+4),
  body.guest-site .featured-cat-grid .featured-cat-card:nth-child(n+4),
  body.guest-site #shop .craft-cat-card:nth-child(n+5),
  body.guest-site .testimonials-grid .testimonial-card:nth-child(n+3) {
    content-visibility: auto;
    contain-intrinsic-size: auto 200px;
  }

  body.guest-site .rm-pdp__left-stack .cg-pdp__service-banner,
  body.guest-site .rm-pdp__left-stack .cg-pdp__quality-banner,
  body.guest-site .connect-strip {
    content-visibility: auto;
    contain-intrinsic-size: auto 180px;
  }

  /* Home hero decorative FX — pause on mobile to keep touch scroll native and fast */
  body.page-home .rm-landing-hero__bubble,
  body.page-home .rm-landing-hero__particle,
  body.page-home .rm-landing-hero__shimmer,
  body.page-home .rm-landing-hero__wave,
  body.page-home .rm-landing-hero__glow,
  body.page-home .rm-landing-hero__gold,
  body.page-home .rm-landing-hero__glass {
    animation-play-state: paused !important;
  }
}

/* During active scroll, pause infinite decorative animations — native scroll stays immediate */
html.cg-scroll-active body.guest-site .animated-backdrop .orb,
html.cg-scroll-active body.guest-site .mesh-gradient,
html.cg-scroll-active body.guest-site .tone-shift,
html.cg-scroll-active body.page-home .rm-landing-hero__fx *,
html.cg-scroll-active body.page-home .home-landing-hero__fx * {
  animation-play-state: paused !important;
}
