/* PERF_GUARD_2026 v2 — تخفيف الحرارة بلا أي تغيير مرئي ولا وظيفي.
   كل ما يُوقَف هو عنصر خارج الشاشة أو صفحة مخفية. مفتاح إيقاف: ?noperf=1 أو localStorage.pg_off=1 */

/* 1) الصفحة مخفية (تبويب/تطبيق بالخلفية): إيقاف كل الحركات وإسقاط الـblur */
html.pg-hidden *,
html.pg-hidden *::before,
html.pg-hidden *::after { animation-play-state: paused !important; }
html.pg-hidden .pg-blur,
html.pg-hidden .vc-content,
html.pg-hidden .vc-header,
html.pg-hidden #vcLiveRoomsDropdown,
html.pg-hidden #vcAudioMutedBanner {
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

/* 2) عناصر الـblur على طبقة خاصة: يمنع إعادة حساب الـblur لكل فريم */
.pg-blur,
.vc-content,
.vc-header,
#vcLiveRoomsDropdown,
#vcAudioMutedBanner {
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* 3) عنصر خارج الشاشة: وقّف حركته وأسقط الـblur (ما حدا شايفه) */
html.pg-off .pg-anim,
.pg-off .pg-anim { animation-play-state: paused !important; }
.pg-off.pg-blur,
.pg-off .pg-blur-off {
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

/* 4) وضع الخمول (30 ثانية بلا تفاعل): الحركات الزخرفية فقط — ترجع بلمسة واحدة */
html.pg-idle [class*="ct_aura"],
html.pg-idle [class*="fn_glow"],
html.pg-idle [class*="af_pulse"],
html.pg-idle [class*="mtScroll"],
html.pg-idle #global_chat.backglob,
html.pg-idle #show_chat.back_chat,
html.pg-idle #chat_head { animation-play-state: paused !important; }

/* 5) احترام إعداد تقليل الحركة بالنظام */
@media (prefers-reduced-motion: reduce) {
  html.pg-rm [class*="ct_aura"], html.pg-rm [class*="fn_glow"],
  html.pg-rm [class*="af_pulse"], html.pg-rm [class*="mtScroll"] {
    animation-duration: .001s !important;
    animation-iteration-count: 1 !important;
  }
}

/* ============================================================
   6) الحركات تبقى — بس فريمات الرسم تنزل (بدون تغيير الشكل)
   ------------------------------------------------------------
   نبضات الظل (text-shadow / box-shadow) هي الأغلى: كل فريم يعيد رسم
   النص/الظل. تحويلها لخطوات يعني نفس النبض لكن 12-24 تحديث بالدورة
   بدل 60 فريم بالثانية. الفرق البصري شبه معدوم على وهج ناعم.
   يمكن ضبط العدد عبر --pg-glow-steps (كل ما زاد = أنعم وأغلى).
   ============================================================ */
:root { --pg-glow-steps: 24; }

[class*="fn_glow"],
[class*="af_pulse"],
[class*="fn_pulse"],
[class*="un_pulse"] {
  animation-timing-function: steps(var(--pg-glow-steps), end) !important;
}

/* الظل الأكبر من 20px هو اللي بيكلّف أكتر — نقصّ نصف القطر بدون ما يبان الفرق
   على الوهج (الوهج نفسه ثابت الشكل، بس منطقة الرسم أصغر). */
[class*="af_pulse"] { will-change: auto; }
