body {
  max-width: 760px;
  margin: 2rem auto;
  padding: 0 1rem;
  font-size: 1.1rem;
}

body p {
  line-height: 1.3;
}

blockquote {
  position: relative;
}

blockquote::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -1rem;
  border-left: 1px solid black;
  content: "";
}

.comment,
code {
  overflow-wrap: anywhere;
}

pre {
  overflow-x: auto;
}

.comment-error {
  color: red;
}

.comment-success {
  display: none;
  color: green;
}

.comment-success:target {
  display: block;
}

form p {
  display: flex;
  align-items: start;
  gap: 0.5rem;
}

form input,
form textarea {
  box-sizing: border-box;
  flex: 1;
  min-width: 0;
}

form textarea {
  resize: vertical;
  min-height: 64px;
}

.moderation-actions {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1em;
}

/* LaTeXML lecture pages: drop the extra padding so margins match body */
.ltx_page_main {
  padding: 0;
}

/* LaTeXML: keep equations inside center environments centered */
.ltx_eqn_table.ltx_centering {
  display: table;
}

/* LaTeXML framed boxes: no extra paragraph margins inside the frame */
.ltx_framed > .ltx_p:first-child {
  margin-top: 0;
}

.ltx_framed > .ltx_p:last-child {
  margin-bottom: 0;
}

/* LaTeXML: place adjacent pictures (e.g. side-by-side plots) on one line,
   centered, wrapping onto new lines on narrow screens */
.ltx_para:has(> svg.ltx_picture + svg.ltx_picture) {
  text-align: center;
}

.ltx_para:has(> svg.ltx_picture + svg.ltx_picture) > svg.ltx_picture {
  display: inline-block;
  margin: 0 0.5em;
}

/* Notebook pages (nbconvert): same side padding as the other pages;
   the page width comes from the body rule above */
body.jp-Notebook {
  padding: 0 1rem;
}

/* "Back to main course page" link: the browser's usual link style (blue,
   purple when visited, underlined), even on pages whose own styles remove
   it (nbconvert removes all link styling) */
a.back-link {
  color: revert;
  text-decoration: revert;
}

/* Long words and URLs wrap instead of widening the page */
body {
  overflow-wrap: break-word;
}

/* LaTeXML pictures (plots) shrink to fit narrow screens (lectures/fix_svg.pl
   adds the viewBox this needs) */
svg.ltx_picture {
  max-width: 100%;
  height: auto;
}

/* Text in LaTeXML pictures (plot labels, legends): never wrap a label
   mid-word. (Its font size is set on each picture by lectures/fix_svg.pl.) */
svg.ltx_picture foreignObject {
  white-space: nowrap;
}

/* Plot math in the same sans-serif font. Browsers italicize single-letter
   variables using mathematical italic characters, which sans-serif text fonts
   lack (they would fall back to a serif math font), so use plain italics */
svg.ltx_picture math {
  font-family: inherit;
}

svg.ltx_picture mi:not([mathvariant]):not([class]) {
  text-transform: none;
  font-style: italic;
}

/* Narrow screens: wide tables, including LaTeXML display equations, scroll on
   their own instead of widening the whole page. This replaces LaTeXML's
   table-based centering, so equations are left-aligned on narrow screens. The
   LaTeXML selectors are needed to override its own display rules. */
@media (max-width: 600px) {
  table,
  table.ltx_eqn_table,
  table.ltx_tabular.ltx_centering {
    display: block;
    max-width: 100%;
    overflow-x: auto;
  }
}
