/* rlab.css (heavily borrowed from unbook) */

:root {
    --base-font-size: 15px;
    --base-font-family: serif;
    --monospace-font-family: monospace;
    --min-font-size: 13px;
    --min-line-height: 1.5;
    --inside-margin-when-wide: 32px;
    --inside-margin-when-narrow: 16px;
    --outside-bgcolor: #888;
    --inside-bgcolor: #3f3533;
}

html {
    background-color: var(--outside-bgcolor);
	color:#ccc
}

body {
    background-color: var(--inside-bgcolor);
    max-width: 125mm;
    margin: 0 auto;
    padding: var(--inside-margin-when-narrow);

    line-height: var(--min-line-height);

    font-size: var(--base-font-size);
    /* Don't let iOS Safari enlarge the font size when the phone is in landscape mode.
     * https://kilianvalkhof.com/2022/css-html/your-css-reset-needs-text-size-adjust-probably/
     */
    -webkit-text-size-adjust: none;
    text-size-adjust: none;

    font-family: var(--base-font-family);

    /* Without word-break: break-word, iOS Safari 16.1 lets
     * very long words e.g. URLs widen the page */
    word-break: break-word;
}

@media only screen and (min-width: calc(16px + 125mm + 16px)) {
    body {
        padding: var(--inside-margin-when-wide);
    }
}

sup, sub {
    /* <sup> defaults to `vertical-align: super` styling, which causes the containing
     * line to be heightened in an ugly way. https://stackoverflow.com/a/6594576 says
     * to reduce the <sup>'s line-height, but setting 1.0 is not enough to fix it; 0
     * works but seems risky in case anyone has a multi-line <sup>; 0.9 may be enough
     * for most books, but is somewhat arbitrary and might similarly cause readability
     * problems. We use the fix from
     * https://css-tricks.com/snippets/css/prevent-superscripts-and-subscripts-from-affecting-line-height/
     * instead.
     */
    /* !important because books often put a vertical-align: 0.55em or similar on <sup> elements */
    vertical-align: baseline !important;
    position: relative;
    top: -0.4em;
}
sub {
    top: 0.4em;
}
h1 {font-size: 144% }
h2 {font-size: 112% }
h3 {font-size: 100% }
img {
    /* We don't want to let images widen the page, especially on mobile.
     *
     * TODO: allow images to exceed the width of the container, but
     * not the viewport width, and without widening the viewport.
     * 
     * https://stackoverflow.com/a/41059954 does not work because it
     * widens the page when there is a wide image. */
    max-width: 100%;

    /* Some books have an explicit `width: ...px` and `height: ...px` on each image,
     * but we don't want the `height` to apply when we're max-width constrained because
     * that will incorrectly stretch the image.
     * 
     * TODO: only `auto` when we think the image isn't intentionally being made larger
     * or smaller. */
    height: auto !important;
    width: auto !important;

    /* Some books have images for e.g. mathematical formulas in the middle of a paragraph,
     * and we can make these look a little less terrible by vertical-aligning them to the
     * middle instead of the bottom. */
    vertical-align: middle;
}

/* Center the cover when the image is smaller than the max-width */
img.unbook-cover {
    display: block;
    margin: 1em auto;
}
a:link { color: #99c; text-decoration: none }
a:visited {color: #99c; text-decoration: none }
a:hover { color: #9cc }

/* calibre */


@page {
    margin-bottom: 0;
    margin-top: 0
}

.pageheader {
    background-image: url('header_bg_rl230.png');
    background-repeat: no-repeat;
    background-position: center bottom;
    background-color: #b19f9a;
    height: 100px;
    padding-top: 6pt;
    border-bottom: 1px solid #ccc;
    clear: both
}

.rlab-text {
    display: block;
    font-size: max(1em, var(--min-font-size)); /* unbook */
    margin-bottom: 0;
    margin-left: 0;
    margin-right: 0;
    margin-top: 0;
    padding-left: 0;
    padding-right: 0;
}
.rlab-left {
    display: block;
    line-height: max(1.3em, var(--min-line-height)); /* unbook */
    margin-bottom: 0;
    margin-left: 0;
    margin-right: 0;
    margin-top: 0;
    float: left
}
.rlab-right {
    display: block;
	font-size: 0.7em;
    line-height: 1em; 
    margin-bottom: 0;
    margin-left: 0;
    margin-right: 0;
    margin-top: 10px;
	padding: 0 16px 0;
	border: 1px solid #999;
    float: right;
}
.rlab-panel {
    background-color: var(--outside-bgcolor);
}

.calibre1 {
    display: block;
    font-size: max(2em, var(--min-font-size)); /* unbook */
    font-weight: bold;
    margin-bottom: 0.67em;
    margin-left: 0;
    margin-right: 0;
    margin-top: 0.67em;
    text-align: left
}
.calibre2 {
    display: block;
    line-height: max(1.3em, var(--min-line-height)); /* unbook */
    margin-bottom: 0.5em;
    margin-left: 0;
    margin-right: 0;
    margin-top: 0
}
.calibre4 {
    font-style: italic
}
.calibre5 {
    display: block
}
.calibre6 {
    display: block;
    line-height: max(1.3em, var(--min-line-height)); /* unbook */
    margin-bottom: 0.5em;
    margin-left: 0;
    margin-right: 0;
    margin-top: 0;
    text-align: center
}
.ve {color: #da8 ; }
.az {color: #8ad }

