/* ==========================================================================
   Amigura — Scroll & compositor performance (safe — no scroll lock)
   Loaded after mobile.css / desktop.css
   ========================================================================== */

/* Instant scroll by default; smooth only on fine-pointer desktops */
html {
  scroll-behavior: auto;
  overflow-y: auto;
}

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  overflow-y: auto;
  overscroll-behavior-y: auto;
}

/* Product grid: no per-card backdrop blur (28× blur is very costly while scrolling) */
.product-card.glass-surface {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.product-card.glass-surface::before {
  display: none;
}

/* Pause decorative motion while the user is actively scrolling */
html.is-scrolling .hero__orb,
html.is-scrolling .trust-bar__track,
html.is-scrolling .reviews-carousel__track {
  animation-play-state: paused !important;
}

html.is-scrolling .hero__orb {
  transition: none;
}

/* Hero orbs off-screen: stop painting & animating */
html:not(.is-hero-visible) .hero__ambient {
  visibility: hidden;
}

html:not(.is-hero-visible) .hero__orb {
  animation-play-state: paused !important;
}

/* --- Touch / coarse pointer: strip expensive effects --- */
@media (hover: none), (pointer: coarse) {
  body {
    text-rendering: auto;
  }

  .sticky-convert__inner.glass-surface,
  .cookie-banner.glass-surface,
  .pdp-sticky__inner {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: var(--color-bg-elevated);
  }

  .sticky-convert__inner.glass-surface::before,
  .cookie-banner.glass-surface::before {
    display: none;
  }

  [data-theme="dark"] .pdp-sticky__inner {
    background: var(--pdp-sticky-bg);
  }

  .hero__orb {
    filter: blur(40px);
    opacity: 0.6;
    animation: none !important;
  }

  .product-card {
    opacity: 1;
    transform: none;
  }

  .product-card.fade-in-up {
    animation: none !important;
  }

  .products__item:has(.product-card.fade-in-up):hover {
    transform: none;
  }

  html.is-scrolling .product-card,
  html.is-scrolling .products__item {
    transition: none !important;
  }

  .sticky-convert {
    transition:
      transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
      opacity 0.2s ease;
  }
}

/* Desktop: reduce sticky bar blur cost during active scroll */
@media (hover: hover) and (pointer: fine) {
  html.is-scrolling .sticky-convert__inner.glass-surface,
  html.is-scrolling .pdp-sticky__inner {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
