function setMaxHeightAllPages() {
    let pages = document.querySelectorAll('.overlay .page');

    let maxHeight = Math.min(0.9 * window.innerHeight, 640) + 'px';
    for (let i = 0; i < pages.length; i++) pages[i].style.maxHeight = maxHeight;
  }
Sets the max-height of all pages in all overlays, based on the window
height.