/**
 * YOOAdmin Dark Engine v2 — invert islands (last-resort escape hatch).
 *
 * For genuinely "impossible" light-only widgets (canvas-rendered UIs, third-party
 * iframes we can't reach, baked-in light image maps) where tokens, compat and the
 * adaptive fallback all fall short, this provides an opt-in inversion utility.
 *
 * Add the class `.yp-dark-invert-island` to such a container (or register its
 * selector via the `yooadmin_dark_engine_invert_island_selectors` PHP filter).
 * The container is colour-inverted + hue-rotated to approximate dark, then media
 * inside is counter-inverted so photos, logos and icons render true-to-life.
 *
 * This is intentionally a manual, narrow tool — broad use looks artificial.
 */

html[data-yooadmin-studio-color-mode-effective='dark']
  body.yp-dark-v2
  .yp-dark-invert-island {
  /* !important so inversion always starts from a known light surface even if the
     island element also matches a compat surface selector (e.g. *-card). */
  filter: invert(1) hue-rotate(180deg);
  background-color: #ffffff !important;
}

/* Counter-invert true media so photos/logos/icons are not shown as negatives.
   NOTE: canvas & iframe are intentionally EXCLUDED — those are usually the
   impossible UI we are deliberately darkening, not content to preserve. */
html[data-yooadmin-studio-color-mode-effective='dark']
  body.yp-dark-v2
  .yp-dark-invert-island
  :is(
    img, picture, video, svg,
    [class*='logo'], [class*='avatar'], [class*='thumbnail'], [class*='photo'],
    [style*='background-image'], [style*='url(']
  ) {
  filter: invert(1) hue-rotate(180deg);
}
