/* Injected before each figure's own stylesheet, so the figure's rules still win
   wherever they conflict. Only safe, generic adjustments live here. */

/* Inside the site's frame: let the frame's paper colour show through and never
   show a vertical scrollbar (the frame is sized to the content). */
html.embedded { overflow-y: hidden; overflow-x: auto; color-scheme: light; }
html.embedded body { background: transparent !important; }

/* Keep media inside narrow screens. */
img, video { max-width: 100%; height: auto; }
svg, canvas { max-width: 100%; }
svg[width][viewBox] { height: auto; }

/* Long monospaced lines scroll inside their own box instead of widening the page. */
pre, .code { overflow-x: auto; max-width: 100%; }

/* Grid columns may shrink below their widest child (for example a block of
   pseudocode), so the child scrolls instead of widening the whole figure. */
.grid > *, .wrap > * { min-width: 0; }
