/* ETW Trades — admin content editor scroll-jump fix.
   The blog/education content editor ("input-editor-content") is a tall
   contentEditable box (min-h-[60vh]) that also inserts images inline.
   Two built-in browser behaviors were combining to cause a jarring
   "the whole page jumps up" effect while typing or clicking lower in
   the box to keep writing:

     1. CSS scroll anchoring — when the box's content height changes
        (e.g. an inserted image finishing its layout, or new lines
        being added), the browser recalculates and shifts the page's
        scroll position to "compensate," which can pick the wrong
        anchor and produce a visible upward jump.
     2. Global smooth-scroll (html { scroll-behavior: smooth }) turns
        that correction into a slow, obviously visible slide instead
        of an instant, barely-noticeable adjustment.

   Fix: disable scroll anchoring on the editor (and its toolbar) so
   the browser stops "correcting" scroll position on its own, and
   switch off smooth-scroll site-wide whenever the editor markup is
   present on the page, so if any scroll correction still occurs it's
   instant rather than an animated jump. Anchor-link smooth scrolling
   elsewhere on the site (e.g. jumping to "#journal-features") is
   unaffected on pages that don't include the editor.

   See admin-editor-patch.js for a second, independent fix: a plain
   click anywhere in the editor (not just content/height changes) was
   also jumping the page. That's caused by the editor markup sitting
   inside a <label> with no `for` attribute — clicking anywhere in a
   <label> tells the browser to auto-focus the first "labelable"
   descendant (the first toolbar button), and that silent refocus can
   trigger its own scroll-into-view, independent of the scroll
   anchoring this file addresses. */

[data-testid="input-editor-content"],
.etw-editor-canvas,
.etw-editor-toolbar {
  overflow-anchor: none;
}

[data-testid="input-editor-content"] {
  overscroll-behavior: contain;
}

html:has([data-testid="input-editor-content"]) {
  scroll-behavior: auto !important;
}
