From e5e103a89b1b55d766e04811dfde71381a8fc9d0 Mon Sep 17 00:00:00 2001
From: Hannu Hartikainen <hannu@hrtk.in>
Date: Thu, 5 Aug 2021 13:37:55 +0300
Subject: [PATCH] Rewrite CSS to support scaling

This changes the layout to use the default font size with a reasonable
max width and margins around the body. Elements that would overflow on
narrow displays are changed to wrap (.author) or present a scroll bar as
necessary (figure, .verbatim, .fancyvrb). The properties on html and
body are set such that there is no full-document vertical scrolling.
Inline math is displayed in the same size as the surrounding text.
---
 html.cfg | 32 ++++++++++++++++++++++++--------
 1 file changed, 24 insertions(+), 8 deletions(-)

diff --git a/html.cfg b/html.cfg
index 8657127..9211d4c 100644
--- a/html.cfg
+++ b/html.cfg
@@ -2,15 +2,31 @@
 
 \Configure{tableofcontents*}{chapter,section,subsection}
 
-\Css{* :not(img) {
-    max-width: 100\%;
-    width: 50vw; 
-    height: auto;
-    margin: 0 auto;
+\Css{html {
+    width: 100vw;
+    overflow-x: hidden;
 }}
 
-\Css{* {
-    font-size: 1vw;
+\Css{body {
+    max-width: 50rem;
+    box-sizing: border-box;
+    padding: 1rem;
+    margin: 0 auto;
+    overflow-x: hidden;
+}}
+
+\Css{div.author {
+    white-space: normal;
+}}
+
+\Css{img.math {
+    height: 1rem;
+    vertical-align: top;
+}}
+
+\Css{figure, .fancyvrb, .verbatim {
+    margin-inline: 0;
+    overflow-x: auto;
 }}
 
 \Css{.ecrm-0500 { 
@@ -33,4 +49,4 @@
 }}
 
 \begin{document}
-\EndPreamble
\ No newline at end of file
+\EndPreamble