:root {
    --color-text: black;
    --color-tag1: gray;
    --color-tag2: darkolivegreen;
    --color-bg: white;
    --color-link: #0000ee;
    --color-notice: #fb4f4f;
}

@media (prefers-color-scheme: dark) {
    :root {
        --color-text: white;
        --color-bg: black;
    }
}

html {
    scrollbar-gutter: stable;
    scroll-behavior: smooth;
    font-size: 14pt;
}

body {
    font-family:
        "Lato",
        -apple-system,
        BlinkMacSystemFont,
        "PingFang SC",
        "Microsoft YaHei",
        sans-serif;
    font-optical-sizing: auto;
    font-weight: 400;
    font-style: normal;
    font-size: 1rem;
    line-height: 140%;
    color: var(--color-text);
    background-color: var(--color-bg);
    text-rendering: optimizeLegibility;
    text-autospace: no-autospace; /*using pangu.hs*/
}

body a {
    text-decoration: none;
}

body a:hover {
    text-decoration: underline;
}
details {
    padding-left: 1em;
    border: 2px solid var(--color-text);
}
summary:hover {
    cursor: pointer;
}

/*mathML*/
.htmlmathparagraph,
mtext,
math {
    font-family: Lete Sans Math;
}
.math-container,
#math-container {
    display: block;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0.5em;
}

.math-container.math-container-tagged {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    column-gap: 1rem;
    overflow: visible;
    padding: 0.5em 0;
}

.math-container.math-container-tagged .math-tag-spacer {
    min-width: 0;
}

.math-container.math-container-tagged .math-equation {
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0.5em 0;
}

.math-container.math-container-tagged .math-tag {
    justify-self: end;
    white-space: nowrap;
    font-family: "IosevkaC", sans-serif;
}

.math-container.math-container-tagged .math-tag math {
    display: inline;
}

.text-space .langtag {
    color: var(--color-tag1);
}

.sc {
    font-variant-caps: small-caps;
}

a.url {
    word-break: break-all;
}

html body div.text-space main ul.post-list {
    list-style-type: none;
    padding-left: 1em;
}

/* top bar */
header {
    font-weight: 400;
    font-family: "IosevkaC", sans-serif;
}
nav a {
    display: inline-block;
    text-decoration: none;
}

.uri {
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-all;
    white-space: normal;
}

footer {
    color: var(--color-text);
    font-size: 0.8rem;
    margin-top: 2em;
    text-align: right;
    padding-right: 1em;
}

.pagetitle {
    font-size: 2rem;
    font-weight: normal;
    font-style: normal;
    text-align: left;
    line-height: 100%;
}

h1 {
    margin-top: 1em;
    font-size: 1.44rem;
    font-weight: bold;
    font-style: normal;
}

h2 {
    margin-top: 1em;
    font-size: 1.2rem;
    font-weight: bold;
    font-style: normal;
}

h3 {
    margin-top: 1em;
    font-size: 1rem;
    font-weight: bold;
    font-style: normal;
}

article .header {
    font-size: 1rem;
    font-style: normal;
    color: var(--color-tag1);
    text-align: left;
}

.info,
.info a {
    color: var(--color-tag2);
    font-size: 1rem;
    font-style: normal;
    text-align: left;
}

.info a:visited {
    color: var(--color-tag2);
}

section.body {
    margin-top: 2rem;
}

.ascii-art {
    font-family: monospace;
    line-height: normal;
}

/* table. copied from https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/table */
table {
    border-collapse: collapse;
    border: 2px solid rgb(140 140 140);
    font-size: 0.8rem;
    letter-spacing: 1px;
}

caption {
    caption-side: bottom;
    padding: 10px;
    font-weight: bold;
}

thead,
tfoot {
    background-color: rgb(228 240 245);
}

th,
td {
    border: 1px solid rgb(160 160 160);
    padding: 8px 10px;
}

td:last-of-type {
    text-align: center;
}

tbody > tr:nth-of-type(even) {
    background-color: rgb(237 238 242);
}

tfoot th {
    text-align: right;
}

tfoot td {
    font-weight: bold;
}

figure {
    display: flex;
    flex-flow: column;
    padding: 5px;
    margin: auto;
    max-width: 80%;
}

.centerimg img {
    margin: 0 auto 0 auto;
    display: block;
}

div.highlight,
pre code {
    margin: auto;
    padding: 10px;
    overflow: auto;
    display: block;
}

code {
    font-family: "IosevkaC", monospace;
    margin: 0 auto;
    display: inline-block;
    padding: 0px 2px;
    border-radius: 2px;
    font-variant-ligatures: none;
    font-kerning: none;
    text-rendering: optimizeSpeed;
}

.draft-notice {
    color: var(--color-notice);
    margin: 1em auto;
    text-align: center;
}

.subtitle {
    text-align: left;
    font-size: 1.2rem;
    margin-top: 0;
}
.gallery {
    margin-top: 2em;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 12px;
}

.gallery img {
    width: 100%;
    max-width: 320px;
    display: block;
}

/* phones -- no sidebar no sidenotes*/
@media (max-width: 768px) {
    body {
        /* width: 90%; */
        margin: auto;
        padding: 0 5%;
        text-align: left;
        max-width: 876px;
    }
    mjx-container[display="true"]
    /*, .katex-display */ {
        overflow-x: auto;
        overflow-y: hidden;
    }

    /* .katex-display>.katex>.katex-html>.tag {
        display: inline-block;
        position: relative;
        padding-left: 10pt;
    } */
}

.toc {
    display: none;
}

/* sidebar. no sidenotes */
@media (min-width: 769px) {
    body {
        max-width: 1350px;
        display: -webkit-flex;
        -webkit-flex-flow: row wrap;
        display: -ms-flexbox;
        -ms-flex-flow: row wrap;
        flex-flow: row wrap;
        width: 95%;
        padding-right: 5%;
        margin: auto;
    }

    .toc {
        margin-top: 5rem;
        margin-left: 0;
        margin-right: 0;
        width: 33%;
        display: inline-block;
    }

    div#contents ul,
    div#contents-big ul {
        margin-top: 0.5em;
        margin-bottom: 0.5em;
        padding-left: 1em;
        line-height: 1.2;
        list-style-type: decimal;
        margin-left: 0;
    }

    div#contents ul.notes-list,
    div#contents-big ul.notes-list {
        list-style: none;
        padding-left: 0;
    }

    div#contents-big ul ul {
        list-style-type: none;
    }

    div#contents-big li + li {
        margin-top: 0.5em;
    }

    div#contents-big {
        font-size: 80%;
        padding-top: 0;
        padding-left: 1rem;
        text-align: left;
        max-width: 60%;
        clear: both;
        margin-right: 4em;
        position: sticky;
        top: 5rem;
        left: 100%;
    }

    div#contents-big .mini-header {
        font-weight: bold;
        margin: 0;
        font-variant: small-caps;
    }

    .text-space {
        display: inline-block;
        width: 66%;
        max-width: 875px;
    }
}
/* sidebar+sidenotes */
@media (min-width: 1200px) {
    body {
        width: 75%;
        padding-right: 25%;
    }
}

@media print {
    .no-print,
    .no-print * {
        display: none !important;
    }

    body {
        margin: auto;
    }
}
