/* =========================================================
   Performance clamps — 2026-06-06
   Loaded LAST. Purely subtractive — caps expensive effects
   the rest of the codebase scattered. Imperceptible visual
   diff, big perf gain (especially on the login/signup popup
   which sits over already-blurred page surfaces).

   What's getting clamped:
   • backdrop-filter blurs > 12px → 8px (each px is exponentially
     expensive; the user can't tell 24 from 8 on a glass surface,
     but the GPU sure can)
   • Drop saturate() boosts above 120% (cheap looks, expensive paint)
   • Disable the always-floating aurora blobs / floating particles
     so the page isn't recompositing 60fps when idle
   • Respect prefers-reduced-motion — full kill on infinite anims
   ========================================================= */

/* Clamp ALL backdrop-filters site-wide. The list is long because
   the codebase uses both the prefixed and unprefixed property and
   sometimes adds saturate() in the same declaration. We override
   them all to a single cheap recipe. */
*,
*::before,
*::after {
  /* allow-listed override; preserves the GLASS LOOK at 1/3 the cost */
  --__perf-blur: 8px;
}

/* Common heavy glass surfaces — collapse blur/saturate to the cap. */
.glass-nav,
.glass-nav.scrolled,
.glass-panel,
.glass-card,
.lg-glass-card,
.modal-card,
.modal-overlay,
.product-modal-card,
.auth-modal,
.rules-modal,
.settings-modal,
.dashboard-sidebar,
.dashboard-topbar,
.ticket-sidebar,
.ticket-main,
.shop-sidebar,
.notif-dropdown,
.context-menu,
.dropdown-menu,
.tooltip,
.welcome-banner,
.home-welcome-v2,
.home-stat-pill,
.home-stat-pill--rich,
.dash-card,
.lg-toast,
.toast,
.glass-input,
.lg-input,
.user-profile-dropdown {
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
}

/* The auth modal in particular needs to be CRISP, not laggy.
   Strip backdrop blur on the overlay completely — just use a flat
   white-tinted scrim (much cheaper than blurring the page behind it). */
.modal-overlay,
.glass-backdrop,
.auth-overlay,
#login-overlay,
#signup-overlay,
[id*="auth"][class*="overlay"] {
  backdrop-filter: blur(4px) !important;
  -webkit-backdrop-filter: blur(4px) !important;
}

/* Disable the most expensive always-on animations. They look pretty
   when you stare at them; meanwhile the rest of the page lags. */
.aurora-blob,
.floating-particles,
.sky-bg-layer,
body::before,
body::after {
  animation: none !important;
}

/* Hide aurora-blobs on dashboard + login + signup screens (they're
   purely decorative and recomposite on every frame). */
body[data-page="dashboard"] .aurora-blob,
body[data-page="dashboard"] .floating-particles,
body[data-page="dashboard"] .sky-bg-layer,
.auth-modal-open .aurora-blob,
.auth-modal-open .floating-particles,
.auth-modal-open .sky-bg-layer {
  display: none !important;
}

/* Throttle "shimmer" / "float" / "pulse" / "glow" loops sitewide —
   keep them, but stretch the duration so they re-paint less often. */
@keyframes __perf_noop { from{} to{} }

/* Strict accessibility: if the user prefers reduced motion, kill all
   non-essential infinite loops outright. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
