/* =====================================================================
   perf.css — fewer expensive effects, mostly while a video plays and on phones / mid devices
   (html.vid-playing is set by the player; perf-mid / perf-lite by boost in graphics.js)
   ===================================================================== */

/* 1) While a video is playing, the page behind it is not looked at: turn off blur everywhere and hide the
      full-screen background canvases (their animation loops are also slowed down by perf-boost.js). */
/* (explicit list: the old "body *:not(video)" made every play/pause restyle the whole page; smooth.css already left blur on only these surfaces) */
html.vid-playing :is(.glass-sidebar, .glass-header, .glass-main-panel, .glass-modal, #ntf-panel, #va-card, #va-status, #vp-panel, #video-theater .vc-bar, #edit-student-modal, #liked-users-modal, #material-upload-modal, #new-chat-modal, #notes-modal, #redeem-video-modal, #request-account-modal, #student-modal, #student-stats-modal, #tutoring-modal, #video-modal, #toast-container > .toast-item) { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
html.vid-playing #fluid-canvas, html.vid-playing #cursor-particles, html.vid-playing canvas.bg-canvas { display: none !important; }
html.vid-playing :is(.fx-orb, .bg-blob-indigo, .bg-blob-cyan, .bg-blob-purple, .bg-blob-rose, .bg-blob-teal, .lq-blob, .text-shimmer, .border-shimmer) { animation-play-state: paused !important; }

/* 2) Phones and mid-range devices: glass blur is the single most expensive thing the GPU does.
      Keep it only on pop-ups (modals, notifications, menus); everything else gets its normal translucent background. */
/* (no ":not(x *)" ancestor checks here: they made every class change on any panel restyle its whole subtree on phones) */
html:is(.perf-mid, .perf-lite) body *:not(.modal-root):not(#ntf-panel):not(.glass-modal) {
    -webkit-backdrop-filter: none !important; backdrop-filter: none !important;
}

/* 3) Let the browser skip drawing big sections that are off-screen */
.feed-post, .sv-card, .session-card, .lecture-card { content-visibility: auto; contain-intrinsic-size: auto 260px; }

/* 4) The video box paints on its own */
#video-theater { contain: layout style; isolation: isolate; }

/* 5) Respect people who asked for less motion */
@media (prefers-reduced-motion: reduce) { html body *, html body *::before, html body *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; } }

/* 6) Ambient background (mesh, ribbons, bubbles, orbs, stars) stands still when nobody is looking at it:
      on phones / mid / lite devices, while a video plays, and after 10 s without input. It resumes on the next touch or mouse move. */
html:is(.perf-mid, .perf-lite, .vid-playing, .is-idle) :is(#flow-mesh, #lq-bg, .fx-orb, .fx-star, .fx-shoot, .fx-spot, .bg-blob-rose, .bg-blob-teal) ,
html:is(.perf-mid, .perf-lite, .vid-playing, .is-idle) :is(#flow-mesh .fx-mi, .fx-orb .fx-oi, #lq-bg :is(.lq-rib, .lq-bub, .lq-spark, .lq-wave)) { animation-play-state: paused !important; }
html.is-idle #fluid-canvas, html.is-idle #cursor-particles { visibility: hidden; }