Acquire a ref-counted scroll lock on a document root and get back the
matching release function.
The first active lock saves the current overflow / scrollbar-gutter
inline styles and sets overflow: hidden + scrollbar-gutter: stable
(no layout shift when the scrollbar disappears). Releasing the last active
lock restores the saved values. The returned release function is
idempotent - calling it twice cannot over-decrement the count.
Shared engine behind CngxScrollLock and CngxDialog's modal scroll lock;
consumers composing their own overlay primitives can use it directly.
const release = createScrollLock(document.documentElement);// ... overlay open ...release();