/* The right sidebar's hide/reveal is driven from magma-parameter.css's
   --magma-secondary-sidebar-w grid track (issue #409); collapsible-right-toc.js
   tweens that length to 0 and sets the collapsed sidebar `inert` so its
   links leave the tab order. The width animation and the overflow clip on
   the track do the rest. */

@media (min-width: 1200px) {
  .bd-sidebar-secondary {
    padding-top: 0.75rem;
  }
}

/* On-this-page entries are list items inside a flex-column <ul> (theme's
   own .section-nav.flex-column). Column-direction flex items only stretch
   to the container's cross-axis width when both min-width and width are
   pinned down -- left at the flex defaults (min-width: auto, width: auto)
   they instead take their content's unwrapped max-content width, pushing
   long Magma signatures (e.g. "PermutationDecode(C, I, S, s, Q):
   CodeLinRng, ...") past the sidebar edge and forcing horizontal scroll
   (issue #101). */
.bd-sidebar-secondary .toc-entry {
  min-width: 0;
  width: 100%;
}

/* Sphinx's own basic.css puts white-space: nowrap on every span.pre (each
   space-separated token of a `code` role) so words don't break internally.
   That's fine in the article body, but a single long identifier (e.g.
   "ClassGroupAbelianInvariants(C):") can still be wider than the whole
   sidebar on its own, with no space to wrap at -- override it inside the
   sidebar TOC only, so those tokens break instead of overflowing. */
.bd-sidebar-secondary .toc-entry .pre {
  white-space: normal;
  overflow-wrap: anywhere;
}

/* A code box that wraps in this narrow column splits into pieces with an
   edge missing, so a signature entry is plain text whose later lines hang
   in (#2949). magma_domain.py marks where a long name may break, so the
   overflow-wrap above is a last resort. */
.bd-sidebar-secondary .toc-entry code.literal {
  display: inline-block;
  padding: 0 0 0 1em;
  border: 0;
  border-radius: 0;
  background: none;
  text-indent: -1em;
}
