/* A native dialog makes the page inert, but does not lock viewport scrolling.
   Follow the open state so Escape, backdrop dismissal and stacked dialogs all
   preserve the document's scroll position without a separate JS lock counter. */
html:has(dialog[open]),
body:has(dialog[open]) {
  overflow: hidden;
  overscroll-behavior: none;
}

/* Keep wheel/touch gestures at a popup's edge inside its scrolling context. */
dialog[open] {
  overscroll-behavior: contain;
}
