/* LiquidLens: real refraction at the rim of a glass surface.
   Two layers behind the content, siblings so both read the page behind them
   (an element with its own backdrop-filter becomes the backdrop root of its
   children, which then blur nothing but its tint):
   ::before  the lens: backdrop-filter url(#…) and a thin rim tint. Nothing
             follows the displacement in the chain; a blur after it would
             average the bend away.
   ::after   the frosted core: blur and the core tint, faded in over
             --mw-lens-rim, so the rim shows the bent backdrop and the text in
             the middle sits on dense frost.
   data-mw-lens is "on" only where the engine applies the lens; "idle" (off
   screen) and "off" leave the element's own frosted surface untouched. */

.mw-lens[data-mw-lens="on"] {
  isolation: isolate;
  background-color: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.mw-lens[data-mw-lens="on"]::before,
.mw-lens[data-mw-lens="on"]::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  padding: 0;
  border-radius: inherit;
  pointer-events: none;
}
.mw-lens[data-mw-lens="on"]::before {
  background: var(--mw-lens-rim-bg, rgb(255 255 255 / .22));
  -webkit-backdrop-filter: var(--mw-lens-filter);
  backdrop-filter: var(--mw-lens-filter);
}
.mw-lens[data-mw-lens="on"]::after {
  background: var(--mw-lens-core-bg, rgb(255 255 255 / .42));
  -webkit-backdrop-filter: blur(var(--mw-surface-blur, 18px)) saturate(var(--mw-surface-saturate, 1.8));
  backdrop-filter: blur(var(--mw-surface-blur, 18px)) saturate(var(--mw-surface-saturate, 1.8));
  /* Two crossed ramps: clear at the bevel, frosted from --mw-lens-rim inward. */
  -webkit-mask:
    linear-gradient(to right, transparent 0, #000 var(--mw-lens-rim, 34px), #000 calc(100% - var(--mw-lens-rim, 34px)), transparent 100%),
    linear-gradient(to bottom, transparent 0, #000 var(--mw-lens-rim, 34px), #000 calc(100% - var(--mw-lens-rim, 34px)), transparent 100%);
  -webkit-mask-composite: source-in;
  mask:
    linear-gradient(to right, transparent 0, #000 var(--mw-lens-rim, 34px), #000 calc(100% - var(--mw-lens-rim, 34px)), transparent 100%) intersect,
    linear-gradient(to bottom, transparent 0, #000 var(--mw-lens-rim, 34px), #000 calc(100% - var(--mw-lens-rim, 34px)), transparent 100%);
}
