/* User Provided Stylesheet */

/* Phones: let the long book title in the top bar wrap instead of pushing
   the search and theme buttons off-screen. */
@media (max-width: 767px) {
  .myst-top-nav-bar > div:has(> .myst-home-link) {
    flex-shrink: 1;
    min-width: 0;
  }
  .myst-home-link {
    min-width: 0;
  }
  .myst-home-link span {
    font-size: 0.95rem;
    line-height: 1.25;
    white-space: normal;
  }
  /* The hidden "¶" anchor after a heading that wraps near the right edge
     would otherwise make the whole page scroll sideways. */
  main.article-grid {
    overflow-x: clip;
  }
}

/* Keep a heading close to the table it introduces (the theme stacks the
   heading's bottom margin and the table's top margin, about 52px), and
   leave more room above the next section's heading instead. The theme
   sets heading margin-top to 0 !important, so that space is padding. */
article :is(h2, h3):has(+ .overflow-auto > table) {
  margin-bottom: 0.75rem;
}
article :is(h2, h3) + .overflow-auto > table {
  margin-top: 0;
}
article .overflow-auto:has(> table) + :is(h2, h3) {
  padding-top: 1rem;
}
