.paper {
    /* This is a reset for Mobile Safari; without it, many pieces of text
     * are rendered too small to read cleanly */
    -webkit-text-size-adjust: 100%;
}

.paper {
    white-space: pre-line; /* Preserve linebreaks. */
    margin: 1em; padding: 1em;
    background-color: #ffc;
    max-width: 50em;
    background-image: url(seamless_paper_texture-yellow.png);
    border: 1px solid #dda;
    line-height: 1.6;
}
.sqrt > * { border-top: 1px solid black; padding-top: -1px }
.sqrt::before { content: "√" }
/* h3 is for class headers; h4 is for subroutine/function/method headers */
/* Trick for double-underline */
.paper h3 { border-bottom: 1.5px solid black }
.paper h3, .paper h4 {
    /* prevent extra linebreaks and 100% width, but without suppressing bottom margin */
    display: inline-block;
    /* suppress the usual h3/h4 rendering */
    font-size: 1em;
    font-style: inherit;
    font-weight: inherit;
    text-decoration: underline;
    margin: 0 0 0.5em;

    /* Some resets to override stuff from
    http://canonical.org/~kragen/style.css: */
    letter-spacing: 0px;
    padding-bottom: 0px;
    color: inherit;
    font-variant: normal;
    text-align: inherit;
}
.paper h4 { border-bottom: 0 }
/* Ensure a minimum width for these headers using non-break spaces.
   Party like it’s 1999! */
.paper h3::before, .paper h4::before, .paper h3::after, .paper h4::after {
    content: "  ";
}



/* I’m formatting loops and conditionals with tables because
ⓐ they ARE tables and 
ⓑ the markup is a LOT nicer than when I was doing this with nested divs, and
ⓒ I had to force those nested divs to use table layout anyway!
*/
.paper table {
    border-spacing: 0;
    display: inline-block;
    vertical-align: top;
    margin: 0 0 0.5em;
}
.paper td { border-width: 1px 0 0 1px; border-style: solid; padding: 0.5em; vertical-align: top }
.paper tr:first-child > td { border-top: 0; padding-top: 0 }
.paper tr:last-child > td { padding-bottom: 0 }
.paper td:first-child { border-left: 0; padding-left: 0 }
/* This is used for pattern-matching. */
.paper td[colspan="2"] { text-align: center }

.paper aside {
    font-size: smaller;
    font-style: italic;
    float: right;
    clear: right;
    width: 60%;
    white-space: normal;
}
.paper abbr {
    /* For some reason Chromium doesn’t have a default stylesheet for abbr? */
    border-bottom: 1px dotted black;
}

/* Underset, for argmax and things like that.  I’m using table display in order
   to get the arg and sequence centered vertically under the operator name, */
.paper .underset {
    display: inline-block;
    vertical-align: top;
    padding-top: 0.25em;  /* 1.6 normal line-height, minus 1.1 below, ÷ 2 */
    padding-bottom: 0.25em;
}
.paper .underset > * { display: table; border-spacing: 0 }
.paper .underset .top, .paper .underset sub { 
    display: table-row;
    text-align: center;
    line-height: 1.1;
}

/* When you want something similar without the underset: */
.paper .box { display: inline-block; vertical-align: top }

/* Crudely parenthesizing things that may be more than one line tall.
 * This doesn’t work in the old Mobile Safari on my phone, which uses
 * the top and bottom border radius for the rounded corners.
 */
.parenthesized {
    border-width: 0 1px;
    border-style: solid;
    border-radius: 0.5em;
    padding: 0 0.2em;
}