/* Reset Styles
/*---------------------------------------------*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
    margin: 0;
    padding: 0;
    border: 0;
    outline: 0;
    font-weight: inherit;
    font-style: inherit;
    font-size: 100%;
    font-family: inherit;
    vertical-align: baseline;
}

body {
    line-height: 1;
}

table {
    border-collapse: collapse;
    border-spacing: 0;
}

caption, th, td {
    text-align: left;
    font-weight: normal;
}

blockquote:before, blockquote:after,
q:before, q:after {
    content: "";
}

blockquote, q {
    quotes: "" "";
}

/* HTML5 tags */
header, section, footer,
aside, nav, article, figure {
    display: block;
}

/* hand cursor on clickable input elements */
label, input[type=button], input[type=submit], button {
    cursor: pointer;
}

/* make buttons play nice in IE:
   www.viget.com/inspire/styling-the-button-element-in-internet-explorer/ */
button {
    width: auto;
    overflow: visible;
}

/* Sharper Thumbnails */
img {
    -ms-interpolation-mode: bicubic;
}

/* Input Styles
/*---------------------------------------------*/
input,
textarea,
select {
    padding: 5px;
    color: #666;
    background: white;
    border: 1px solid #999;
    margin: 0 0 1em 0;
}

input:focus,
textarea:focus,
select:focus {
    color: black;
    background: white;
    border: 1px solid #666;
}

/* Main Styles
/*---------------------------------------------*/
html { height: 100%; }

body {
    font: 13pt 'Georgia', 'Source Serif Pro', serif;
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
    height: 100%;
}

a, a:visited {
    text-decoration: none;
    transition: all 0.2s linear;
}

a:hover, a:active {
    text-decoration: none;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Work Sans', serif;
    line-height: 1.2em;
    margin-bottom: 0.6em;
}

#wrapper h1:not(:first-child), #wrapper h2:not(:first-child), #wrapper h3:not(:first-child) {
    margin-top: 30px;
}

h1 {
    font-size: 2em;
}

h2 {
    font-size: 1.7em;
}

h3 {
    font-size: 1.4em;
}

p, table, ol, ul, pre, blockquote, dl {
    margin-bottom: 1em;
}

ol, ul {
    padding-left: 2em;
}

b, strong {
    font-weight: bold;
}

i, em {
    font-style: italic;
}

u {
    text-decoration: underline;
}

abbr, acronym {
    cursor: help;
    border-bottom: 0.1em dotted;
}

td, td img {
    vertical-align: top;
}

td, th {
    border: solid 1px;
    padding: 0.25em 0.5em;
}

th {
    font-weight: bold;
    text-align: center;
}

sub {
    vertical-align: sub;
    font-size: smaller;
}

sup {
    vertical-align: super;
    font-size: smaller;
}

code {
    font-family: Courier, "Courier New", Monaco, Tahoma, monospace;
    font-variant-ligatures: none;
}

:not(pre) > code {
    padding: 0 2px;
}

#content-post pre {
    /* margin width = 100vw - 850px but some fudge factor needed? */
    /* also remove 2 * 1.3em inner padding + 0.1em fudge factor */
    width: calc(clamp(100%, 100% + (100vw - 880px), 100% + 160px) - 2.7em);
}

pre {
    padding: 1.3em;
    overflow: auto;
    line-height: 100%;
}

blockquote {
    font-style: italic;
    margin-left: 0.8em;
    padding-left: 0.5em;
    border-left: 5px solid;
}

dd {
    margin-left: 2em;
}

/* Structure Styles
/*---------------------------------------------*/
.inner {
    width: 100%;
    max-width: 1050px;
    margin: 0 auto;
}

/* Keep the paddings below in px instead of em because they need to be precise */
#header {
    font-family: 'Work Sans', sans-serif;
    padding: 30px 0;
}

#header h1 {
    font-weight: bold;
    margin: 0 -40px;
    float: left;
}

#header ul {
    list-style: none;
}

#header li {
    display: inline-block;
    float: left;
}

#pagetitle {
    border-bottom: 1px solid;
    margin-bottom: 15px;
}

#pagetitle h1 {
    display: inline;
    padding-bottom: 0;
    margin-bottom: 0;
}

#titleinfo {
    float: right;
}

#content {
    font-size: 11pt;
    line-height: 170%;
}

#content li { margin-bottom: 5px; }
#content img { max-width: 100%; }

#wrapper {
    display: flex;
    flex-direction: row;
}

#content-sidebar {
    flex: 0 0 200px;
    margin-right: 0;
    padding-right: 30px;
}

#content-post-wrapper {
    width: 100%;
    margin-left: 0;
    overflow: auto;
}

#content-post {
    max-width: 600px;
}

#toc {
    margin-top: 1.5em;
}

#comments-header {
    margin-top: 2em;
}

a.navigation-prev {
    display: block;
}

a.navigation-next {
    display: block;
    text-align: right;
}

.column-container {
    display: flex;
    width: 100%;
    height: 100%;
}

.column {
    padding-right: 1em;
    margin-right: 1em;
    border-right: 1px solid;
    height: 100%;
    flex: 1 1 0;
}

.column:last-child {
    border: none;
}

.footnotes { font-size: 80%; }

#footer {
    padding: 1.5em 0;
    margin-top: 5em;
    font-size: 9pt;
}

/* Misc Styles
/*---------------------------------------------*/
.clearfix:before,
.clearfix:after {
    content: " ";
    display: table;
}

.clearfix:after {
    clear: both;
}

.nobr {
    white-space: nowrap;
}

.center
{
    margin-left: auto;
    margin-right: auto;
}

img.center {
    display: block;
}

hr {
    border: none;
    text-align: center;
    font-size: 130%;
}

hr:after {
    content: "⁂";
}

table.noborder td {
    border: none;
}

/* Media Queries
/*---------------------------------------------*/

@media only screen and (max-width : 1120px) {
    #header h1 {
        margin: 0 0;
    }
}

/* Small Devices, Tablets */
@media only screen and (max-width : 900px) {
    .inner {
        width: 85%;
    }
    .inner img {
        width:100%;
    }
    #header {
        margin-bottom: 2em;
        padding: 1.5em 0;
    }
    #header h1 {
        float: none;
    }
    #footer {
        margin-top: 2em;
        padding: 1.5em 0;
    }
    .column-container {
        display: initial;
    }
    .column {
        border-right: none;
        height: initial;
    }
    #header {
        margin-bottom: 0;
    }
    #content-post {
        float: initial;
        overflow: hidden;
    }
    #wrapper {
        display: initial;
    }
    #content-post pre, #content-post span.MJXc-display, #content-post div.MathJax_MathML {
        overflow: auto;
    }
}

/* Colors
/*---------------------------------------------*/

/* Light theme colors:
   - white general bg
   - #444 normal text color
   - #bc1d1d highlight color
   - #7f1515 lowlight color
   - grays as needed
 */

@media (prefers-color-scheme: light) {
    body {
        color: #444;
        background: white;
    }

    td, th {
        border-color: #999;
    }

    th {
        background: #eee;
    }

    a, a:visited {
        color: #bc1d1d;
    }

    pre.highlight {
        border-left: 2px solid #eee;
    }

    #pagetitle {
        border-bottom-color: #bc1d1d;
    }

    h1, h2, h3, h4, h5, h6, #header, #header a, a:hover, a:active {
        color: black;
    }

    #footer {
        color: #7f1515;
    }

    #titleinfo {
        color: #777;
    }

    .column, blockquote {
        border-left-color: lightgray;
    }
}

/* Dark theme colors:
   - black general bg
   - #bbb normal text color
   - #78aeff highlight color
   - #176bcf lowlight color
   - grays as needed
 */

@media (prefers-color-scheme: dark) {
    body {
        color: #bbb;
        background: #222;
    }

    td, th {
        border-color: #999;
    }

    th {
        background: #333;
    }

    a, a:visited {
        color: #78aeff;
    }

    pre.highlight {
        border-left: 2px solid #aaa;
    }

    #content-post img:not(.darksafe) {
        background-color: white;
    }

    #content-post img.invert {
        filter: invert(1) hue-rotate(180deg) contrast(75%);
    }

    #pagetitle {
        border-bottom-color: #78aeff;
    }

    h1, h2, h3, h4, h5, h6, #header, #header a, a:hover, a:active {
        color: #ededed;
    }

    #footer {
        color: #176bcf;
    }

    #titleinfo {
        color: #777;
    }

    .column, blockquote {
        border-left-color: gray;
    }
}

/** Side notes **/

.sidenote {
    display: none;
}

@media screen and (min-width: 1050px) {
    .sidenote {
        display: block;
        float: right;
        margin-right: -220px;
        width: 190px;
        line-height: 140%;
        font-size: 80%;
        padding-left: 0.4em;
        border-left: 1px solid #bc1d1d;
    }
    @media (prefers-color-scheme: dark) {
        .sidenote {
            border-left-color: #78aeff;
        }
    }
    sup[role=doc-noteref] {
        display: none;
    }
    div.footnotes {
        display: none;
    }
}
