.chapter-opener {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4em;
  margin: 0 0 1em;
  padding: 0.6em 0.9em;
  border-left: 4px solid var(--md-primary-fg-color);
  background: var(--md-code-bg-color);
  border-radius: 4px;
}
.chapter-minutes { font-size: 0.8rem; opacity: 0.85; }

/* Light-background PNG diagrams stay framed in the dark scheme. */
[data-md-color-scheme="slate"] .md-typeset img { background: #F7F9FC; border-radius: 6px; padding: 4px; }

/* Wide tables and code scroll in their own box on phones. */
.md-typeset__scrollwrap { overflow-x: auto; }

/* Long math scrolls inside its own box instead of widening the page (screen only). */
@media screen {
  .md-typeset span.arithmatex { display: inline-block; max-width: 100%; overflow-x: auto; overflow-y: hidden; vertical-align: middle; }
  .md-typeset div.arithmatex { overflow-x: auto; overflow-y: hidden; }
}

/* Print: content only, full width, tables kept whole, URLs shown for external links. */
@media print {
  .md-header, .md-tabs, .md-sidebar, .md-footer, .md-top, .md-search,
  .md-source, .md-content__button, .md-dialog, .headerlink,
  .md-typeset .admonition.print-hint { display: none !important; }
  .md-main__inner, .md-content, .md-grid { max-width: none !important; margin: 0 !important; }
  .md-content__inner { margin: 0 !important; padding: 0 !important; }
  .md-typeset { font-size: 8.5pt; }
  .md-typeset table:not([class]) { font-size: 7.5pt; }
  .md-typeset__scrollwrap, .md-typeset__table { overflow: visible !important; }
  .md-typeset table, .md-typeset pre, .md-typeset .admonition { break-inside: avoid; page-break-inside: avoid; }
  .md-typeset tr { break-inside: avoid; page-break-inside: avoid; }
  .md-typeset h1, .md-typeset h2, .md-typeset h3 { break-after: avoid; page-break-after: avoid; }
  .md-typeset a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.85em; word-break: break-all; }
}
