:root {
    --color-text: black;
    --color-tag1: gray;
    --color-tag2: darkolivegreen;
    --color-bg: white;
    --color-link: #337ab7;
    --color-linkhbg: #e6f0ff;
    --color-linkh: #002266;
    --color-bq: olivedrab;
    --color-notice: #fb4f4f;
}

html {
    scrollbar-gutter: stable;
}

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: 1.2em;
    line-height: 125%;
    color: var(--color-text);
    background-color: var(--color-bg);
    text-rendering: optimizeLegibility;
    text-align: justify;
}

body a {
    color: var(--color-link);
    text-decoration: none;
}

body a:hover {
    text-decoration: underline;
    text-decoration-style: solid;
}

main a:hover {
    background-color: var(--color-linkhbg);
    color: var(--color-linkh);
    text-decoration: none;
}

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

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

p {
    hyphens: auto;
}

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

header {
    font-weight: 400;
    font-family: "IosevkaC", sans-serif;
}

/* top bar*/
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: start;
}

/* Links inside the navbar */
.navbar a {
    text-decoration: none;
    color: var(--color-text);
}

.navbar a:visited {
    color: var(--color-text);
}
.navright a,
.navright a:visited {
    white-space: nowrap;
    margin: 0 0.5rem 0 0.5rem;
    color: var(--color-linkh);
    text-decoration: underline;
}
.navright a:hover {
    background-color: var(--color-linkhbg);
}
.navright {
    gap: 1rem 1rem;      /* row gap | column gap */
}


nav {
    background-color: whitesmoke;
    text-align: right;
    /* border-bottom: solid 1px var(--color-text); */
}

nav a {
    font-size: 1.2rem;
    margin-left: 12px;
    display: inline-block;
    /* line-height: 24px;
    height: 24px;
    padding: 0 8px; */
    vertical-align: middle;
    text-decoration: none;
}

.uri {
    word-wrap: break-word;
    /* Legacy support */
    overflow-wrap: break-word;
    /* Modern property */
    word-break: break-all;
    /* Break long words if necessary */
    white-space: normal;
    /* Allow wrapping */
}



footer {
    color: var(--color-text);
    font-size: 12px;
    margin-top: 30px;
    text-align: right;
    padding: 3pt 10pt 0 0;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    text-align: left;
}

.pagetitle {
    /* margin-top: 2em; */
    font-size: 2em;
    font-weight: normal;
    font-style: normal;
    text-align: left;
    line-height: 100%;
}

h1 {
    margin-top: 1em;
    font-size: 1.44em;
    font-weight: bold;
    font-style: normal;
    text-align: left;
    line-height: 100%;
}

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

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

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


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

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

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

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

.ascii-art {
    margin: 0;
    border: 2px solid var(--color-text);
    padding: 10px;
    background-color: #f0f0f0;
    display: block;
    font-family: monospace;
    line-height: normal;
}

blockquote {
    margin: 1rem 0;
    padding: 0 0 0 1.5em;
    border-left: 3px solid var(--color-bq);
}

blockquote p {
    margin: 0;
}

ul {
    list-style-type: square;
}
li {
    margin-bottom: 0.15em;
}

table,
th,
td {
    border: 1px solid darkolivegreen;
    border-collapse: collapse;
    text-align: left;
}

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


figcaption {
    text-align: left;
    font-style: italic;
    font-size: small;
}

.caption {
    display: none
}

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

/* .katex .mathnormal, .katex .mathrm, .katex .custom-Regular, .katex .amsrm {
	font-family: 'LibertinusMath';
} */

.katex,
.katex * {
    line-height: normal !important;
    font-size: 1em;
}

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.2em;
    margin-top: 0
}

/* phones -- no sidebar no sidenotes*/
@media (max-width: 768px) {
    a.home{
        font-size: 2rem;
        white-space: wrap;
        padding-top: 1rem;
        text-align: left;
    }
    .navright a{
        display: block;
    }
    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;
    } */
}

.navbar-space {
    display: none;
}

/* sidebar. no sidenotes */
@media (min-width: 900px) {
    a.home{
        font-size: 2rem;
        white-space: nowrap;
        padding-top: 1rem;
    }
    body {
        max-width: 2500px;
        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;
    }

    .navbar-space {
        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-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: 45%;
        clear: both;
        margin-right: 1.7em;
        margin-left: 0.25em;
        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%;
    }

    .gallery {
        padding-top: 60px;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 20px;
        justify-content: center;
    }

    .gallery {
        column-width: 280px;
        /* target column width */
        column-gap: 20px;
    }

    .gallery img {
        width: 100%;
        display: block;
        margin-bottom: 10px;
    }
}
/* sidebar+sidenotes */
@media (min-width: 1200px) {
    body {
        width: 75%;
        padding-right: 25%;
    }
}

@media print {

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

    body {
        margin: auto;
    }
}