/* ky-perf — what each rung of the governor actually costs the picture.
   ky/ky-perf.js is the only writer of these classes. Every rule here is a
   DOWNGRADE: the page without any of these classes is the full-quality page,
   so a failure to load this sheet can only ever leave things prettier and
   slower, never broken. */

/* ---- rung 1: filter animation frozen ------------------------------------
   The freeze itself is done in JS (pauseAnimations on the <svg> root, which
   holds the filter at its current value). This class is only the belt: on a
   browser where pauseAnimations is missing, drop the displacement filter
   from the wordmark entirely rather than keep paying for turbulence every
   frame. The goo stays — it is the cheaper of the two and it is what makes
   the letterforms read as ink.

   :not(.ky-wallmode) is load-bearing. The goo IS Honey & Ink's wordmark
   treatment, and honey-ink is exactly the no-wallpaper state. Unscoped, this
   rule fired on the WORLD pages too, where the wordmark's baseline filter is
   none — so the governor's first rung ADDED honey-ink's gooey blob to type
   that never had it (measured on Tuesday: the hard 7-step extrusion
   "letters cut from card" inflating into marshmallow the moment the class
   stamped). A downgrade must degrade a world toward LESS of itself, never
   toward another world's identity. */
html.ky-perf-nofilteranim:not(.ky-wallmode) .ky-heroname {
  filter: url(#goo-tight) !important;
}

/* ---- rung 3: 1x canvas ---------------------------------------------------
   ky-wallfx sizes its canvas from devicePixelRatio; this class is what it
   reads to stop doing that. Declared here so the contract is visible in the
   stylesheet rather than only in JS. */
html.ky-perf-flat .ky-heroname {
  will-change: auto;
}

/* ---- rung 4: no lens -----------------------------------------------------
   Every glass surface falls back to a cheap blur, then to a flat tint. The
   surfaces keep their scrim (ky-plates.css paints that on ::before, which
   costs nothing), so contrast is unaffected by the downgrade — this is why
   the scrim was built as a paint layer and not as backdrop opacity. */
html.ky-perf-noglass :is(#ky-cal, #ky-cal-panel, #ky-music, .ky-c3-card, .lg-surface, .ky-glass) {
  -webkit-backdrop-filter: blur(8px) !important;
  backdrop-filter: blur(8px) !important;
}
html.ky-perf-noglass.ky-perf-flat :is(#ky-cal, #ky-cal-panel, #ky-music, .ky-c3-card, .lg-surface, .ky-glass) {
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

/* ---- rung 4+: stop holding compositor layers we are no longer animating -- */
html.ky-perf-noglass :is(#ky-cal, #ky-music, .ky-c3-card, .ky-heroname) {
  will-change: auto !important;
}

/* ---- rung 5: poster only -------------------------------------------------
   The video element is torn down in JS; this hides it in the frame between
   the class landing and the teardown completing, so there is no flash of a
   frozen last frame over the poster. */
html.ky-perf-noVideo .ky-wall-vid,
html.ky-perf-noVideo .ky-wave-rv-vid {
  display: none !important;
}
