/* Spring smooth scroll (smooth-scroll-mount.mjs). Every rule is keyed on html[data-smooth-scroll], which the
   render-blocking mount sets, so a page whose script fails or never runs keeps native scrolling. */

/* Scroll anchoring moves scrollY when content above the viewport resizes; with the layer fixed,
   that fights the spring and the page jumps. Tradeoff: content growing above the viewport now
   pushes the reader down, as it does in browsers without scroll anchoring. */
html[data-smooth-scroll],
html[data-smooth-scroll] [data-scroll-layer],
html[data-smooth-scroll] [data-scroll-spacer] {overflow-anchor: none;}

/* Native smooth scrolling on top of the spring makes reload and back/forward glide in from the
   top. Links and focus still glide: the mount passes behavior 'smooth' itself. */
html[data-smooth-scroll] {scroll-behavior: auto;}

[data-scroll-layer] {padding: 0; margin: 0; border: 0;}

/* Print: a fixed layer does not paginate (one screen of it repeats on every page), so print puts the content back in
   the flow, drops the spacer and the inset the mount copied from the body (the body keeps its own). !important beats
   the inline styles. */
@media print {
  html[data-smooth-scroll] [data-scroll-layer] {position: static !important; transform: none !important;}
  html[data-smooth-scroll] [data-scroll-content] {padding: 0 !important;}
  html[data-smooth-scroll] [data-scroll-spacer] {display: none !important;}
}
