/* ============================================================
   1) Let a slide scroll if its content is taller than the
      slide box, instead of silently clipping with no way to
      reach the rest. Reveal.js does not enable this by default.
   ============================================================ */
.reveal .slides section {
    max-height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Prior attempt centered content with flexbox, which combined
   badly with overflow: content taller than the slide got
   centered around its midpoint, pushing the TOP off-screen with
   no way to scroll back up to it. Plain block layout (the
   default) keeps top-to-bottom reading order intact so overflow
   scroll behaves the way people expect. */

/* ============================================================
   2) Keep images inside the slide's own logical box.
      Reveal.js lays a slide out at a FIXED logical size
      (~960x700) then scales that whole box to the window with a
      CSS transform, so vh/vw inside a slide do not track the
      slide itself -- they must be pinned in logical px instead.
   ============================================================ */
.reveal .slides section img {
    max-height: 380px;
    max-width: 100%;
    width: auto !important;
    height: auto !important;
    object-fit: contain;
    display: block;
    margin: 0.5rem auto;
}

.reveal .slides figure,
.reveal .slides .image-box,
.reveal .slides [class*="image"] {
    max-width: 100% !important;
    width: auto !important;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

/* ============================================================
   3) Give dense math blocks (stacked equations, like Solution 9)
      a bit more room by trimming vertical spacing, so fewer
      slides need to scroll in the first place.
   ============================================================ */
.reveal .slides section .blockquote,
.reveal .slides section blockquote {
    font-size: 0.85em;
}

.reveal .slides section .displaymath,
.reveal .slides section mjx-container[display="true"] {
    margin: 0.3em 0 !important;
}
