@font-face {
    font-family: 'Cascadia Code';
    src: url('fonts/Cascadia Code.woff2') format('woff2'),
         url('fonts/Cascadia Code.woff') format('woff');
}

@font-face {
    font-family: Lato_Bbb;
    src: url('fonts/LatoBbb.woff2') format('woff2'),
         url('fonts/LatoBbb.woff') format('woff');
}

@font-face {
    font-family: FandolSong;
    src: url('fonts/FandolSong-Regular.woff2') format('woff2'),
         url('fonts/FandolSong-Regular.woff') format('woff');
    unicode-range: U+4E00-9FFF, U+3400-4DBF, U+20000-2A6DF, U+2A700-2B73F, U+2B740-2B81F,
                   U+2B820-2CEAF, U+2CEB0-2EBEF, U+30000-3134F, U+31350-323AF, U+F900-FAFF, U+2F800-2FA1F,
                   U+2F00-2FDF, U+2E80-2EFF, U+3000-303F
}

@font-face {
    font-family: FandolSong;
    src: url('fonts/FandolSong-Bold.woff2') format('woff2'),
         url('fonts/FandolSong-Bold.woff') format('woff');
    font-weight: bold;
    unicode-range: U+4E00-9FFF, U+3400-4DBF, U+20000-2A6DF, U+2A700-2B73F, U+2B740-2B81F,
                   U+2B820-2CEAF, U+2CEB0-2EBEF, U+30000-3134F, U+31350-323AF, U+F900-FAFF, U+2F800-2FA1F,
                   U+2F00-2FDF, U+2E80-2EFF, U+3000-303F
}

@font-face {
    font-family: FandolFang;
    src: url('fonts/FandolFang-Regular.woff2') format('woff2'),
         url('fonts/FandolFang-Regular.woff') format('woff');
    font-style: italic;
    unicode-range: U+4E00-9FFF, U+3400-4DBF, U+20000-2A6DF, U+2A700-2B73F, U+2B740-2B81F,
                   U+2B820-2CEAF, U+2CEB0-2EBEF, U+30000-3134F, U+31350-323AF, U+F900-FAFF, U+2F800-2FA1F,
                   U+2F00-2FDF, U+2E80-2EFF, U+3000-303F
}

i {
    font-family: FandolFang, 'Times New Roman', Georgia, Garamond, -apple-system, BlinkMacSystemFont, serif;
}

body {
    font-family: 'Noto Sans', Roboto, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Oxygen', 'Ubuntu', 'Cantarell', 'Helvetica Neue', 'Microsoft YaHei UI', 'Microsoft YaHei', 'Noto Sans CJK SC', 'Source Han Sans CN', sans-serif;
}

.btex-output {
    /* max-width: 1000px; */
    margin: 0 0;
    /* padding: 0px 30px 30px 30px; */
    font-size: 18px;
    font-family: FandolSong, 'Times New Roman', Georgia, Garamond, -apple-system, BlinkMacSystemFont, serif;
    letter-spacing: .015em
}

.btex-output [lang]:not(:lang(zh)) {
    font-family: 'Times New Roman', Georgia, Garamond, -apple-system, BlinkMacSystemFont, serif;
    /* font-family: 'Noto Sans', Roboto, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Oxygen', 'Ubuntu', 'Cantarell', 'Helvetica Neue', 'Microsoft YaHei UI', 'Microsoft YaHei', 'Noto Sans CJK SC', 'Source Han Sans CN', sans-serif; */
    letter-spacing: normal
}

.tright {
    float: right;
    clear: both
}

.tleft {
    float: right;
    clear: both
}

.invisible {
    display: none !important
}

.btex-output a[href] {
    color: #1088c8;
    text-decoration: none
}

.btex-output a[href]:hover,
.btex-output a[href]:focus {
    color: #1088c8;
    text-decoration: none;
    outline: none
}

.btex-output a[href].external {
    color: #1088c8;
}

.btex-output a[href]:visited,
.btex-output a[href].external:visited {
    color: #1088c8;
}
/* 
.btex-output a[href].external::after {
    background-image: url('external-link.svg');
    background-size: .75em;
    width: .75em;
    height: .75em;
    margin-left: 4px;
    display: inline-block;
    content: '';
    background-repeat: no-repeat
} */

.btex-output a[href]:not(.image) {
    line-height: 1.2;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    border-bottom-color: transparent
}

.btex-output a[href]:not(.image):hover,
.btex-output a[href]:not(.image):focus {
    border-bottom-color: #1088c850;
}

.btex-output h2 {
    border: 0;
    padding: 10px 0;
    margin: 1.2em 0 .5em 0;
    font-size: 1.6em
}

.btex-output h2 span.header-number {
    margin-right: .75em;
    font-weight: bold;
    padding: 4px 6px;
    border-bottom: 4px solid #ffd000;
}

.btex-output h3:not(#p-cactions-label) {
    font-size: 1.4em;
    padding: 0;
    margin-top: 1em;
    margin-bottom: .6em;
    margin-left: 0;
    font-weight: bold
}

.btex-output h3:not(#p-cactions-label) span.header-number {
    margin-right: 1em
}

.btex-output h4 {
    font-size: 1.2em;
    padding: 0;
    margin-top: 1em;
    margin-bottom: .6em;
    margin-left: 0;
}

.btex-output h4 span.header-number {
    margin-right: 1em
}

/* Table Of Contents -> Side ToC */
.toc {
    padding: .7em 1.2em;
    background: white;
    border-radius: 5%;
    text-indent: 0;
    max-width: 80%;
    margin-left: 5%;
}

.toc ul {
    padding-left: 0;
    padding-right: 0;
    margin-left: 0;
    margin-right: 0;
    width: 100%;
    line-height: 1em;
    font-family: FandolSong,'Times New Roman',Georgia,Garamond,-apple-system,BlinkMacSystemFont,serif;
    font-size: 16px;
}

.toc ul li {
    margin: 1em 0; 
}

.toc ul {
    list-style-type: none;
}

.tocnumber {
    margin-right: 0.5em;
}

@media only screen and (min-width: 1220px) {
    .toc {
        top: 0;
        min-width: 10em;
        margin-left: -220px;
        display: flex;
        flex-direction: column;
        float: left;
        overflow-y: scroll;
        position: sticky;
        max-height: calc(100vh - 200px);
        width: 200px;
    }
    .toc:hover {
        scrollbar-color: dark;
        scrollbar-width: thin;
        width: 208px;
    }
    .toc::-webkit-scrollbar {
        display: none;
    }
    .toc:hover::-webkit-scrollbar {
        display: flex;
        width: 8px;
        height: 8px;
    }
    .toc::-webkit-scrollbar-thumb {
        background-color: #dfdfee;
    }
    main:has(.toc) {
        margin-left: 0px;
    }
    .toc>ul>li>a.active {
        color: black;
    }
}

.toc .toctitle {
    text-align: left;
    font-size: 1.6em;
}

.toc ul li.toclevel-2 {
    padding-left: 1.5em;
}

.toc ul li.toclevel-3 {
    padding-left: 3em;
}

.toc ul li.toclevel-4 {
    padding-left: 4.5em;
}

.btex-output h1,
.btex-output h2,
.btex-output h3:not(#p-cactions-label),
.btex-output h4 {
    line-height: 1.4
}

.b-page-body code,
.b-page-body pre {
    font-family: sans-serif;
    border: 1px;
    background-color: #9da5ad;
    line-height: 1.4;
    color: #666;
    font-size: 90%
}

.b-page-body code {
    margin: 0 3px;
    /* white-space: pre-wrap; */
    /* overflow-x: scroll */
}

.b-page-body pre {
    margin: 0;
    padding: .5em 1em;
    /* white-space: pre; */
    overflow-x: auto
}

/* 
.b-page-body code,
.b-page-body pre {
    font-family: var(--vscode-editor-font-family, 'Cascadia Code', 'Consolas', 'Microsoft YaHei UI', 'Microsoft YaHei', 'Noto Sans CJK SC', 'Source Han Sans CN', sans-serif);
    border: none;
    background-color: var(--vscode-textCodeBlock-background, #f4f6f8);
    line-height: 1.4;
    color: var(--vscode-editor-foreground, #666);
    font-size: 90%
}

.b-page-body code {
    margin: 0 3px;
    white-space: pre-wrap
}

.b-page-body pre {
    margin: 0;
    padding: .5em 1em;
    white-space: pre;
    overflow-x: auto
} */

.btex-output .identifier {
    font-family: 'Cascadia Code','Consolas','Microsoft YaHei UI','Microsoft YaHei','Noto Sans CJK SC','Source Han Sans CN',sans-serif;
    font-size: 90%
}

.btex-output .code-btex {
    font-variant-ligatures: none;
    overflow-x: auto;
}

.btex-output .code-btex .btex-function {
    color: #f87000
}

.btex-output .code-btex .btex-argument {
    color: #30a0e0
}

.btex-output .code-btex .btex-string {
    color: #70a000
}

.btex-output .code-btex .btex-comment {
    color: #b0b0b0
}

.btex-output img {
    max-width: 100%;
    height: auto
}

.btex-output a.image {
    display: inline-block;
    max-width: 100%
}

.btex-output table.list span.display-math {
    display: grid;
    grid-template-columns: max-content auto max-content
}

.btex-output table.list span.display-math span.katex-display,
.btex-output table.list span.display-math svg {
    grid-column: 2
}

.btex-output table.list span.display-math span.equation-tag-left {
    grid-column: 1
}

.btex-output table.list span.display-math span.equation-tag-right {
    grid-column: 3
}

.btex-output span.display-math svg {
    margin: 0 auto;
    max-width: 100%
}

.btex-output .warningbox {
    margin: 0 0 16px 0;
    border: 0;
    padding: 1em
}

.btex-output textarea#wpTextbox1:not(.b-unhide) {
    opacity: 0
}

.btex-output .btex-monaco-container {
    height: 600px;
    margin: 0 -30px
}

.btex-output .error {
    font-size: 100%
}

.btex-output .mw-editTools,
.btex-output .templatesUsed,
.btex-output .hiddencats,
.btex-output .limitreport {
    display: none
}

.btex-output td.mw-enhanced-rc {
    font-family: 'Cascadia Code','Consolas','Microsoft YaHei UI','Microsoft YaHei','Noto Sans CJK SC','Source Han Sans CN',sans-serif;
}

.katex {
    font-size: 1.1em !important;
    letter-spacing: normal
}

.katex .cjk_fallback:not(.sizing):not(.fontsize-ensurer) {
    font-size: 90.91%
}

.btex-output .katex {
    font-family: KaTeX_Main, 'Noto Sans', Roboto, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Oxygen', 'Ubuntu', 'Cantarell', 'Helvetica Neue', 'Microsoft YaHei UI', 'Microsoft YaHei', 'Noto Sans CJK SC', 'Source Han Sans CN', sans-serif
}

.btex-output .katex .mathbb,
.btex-output .katex .textbb {
    font-family: Lato_Bbb, KaTeX_AMS
}

.btex-output {
    hyphens: auto;
    -webkit-hyphens: auto;
    -moz-hyphens: auto;
    word-break:normal;
}

.btex-output p,
.btex-output .p,
.btex-output table.list {
    margin: 0 0 1em 0;
    width: initial
}

.btex-output .block,
.btex-output tr.list-item,
.btex-output h2,
.btex-output h3,
.btex-output h4 {
    transition: outline-color 600ms ease;
    outline-color: transparent;
    outline-offset: 5px
}

.btex-output .block {
    padding: .8em 1.2em;
    margin: 0 0 1em 0;
    background-color: #f4f6f8;
    border-color: #c0c4c8;
    border-left: 5px solid
}

.btex-output span.katex-display {
    margin: 0
}

.btex-output span.display-math {
    margin: 1em 0
}

.btex-output p:last-child,
.btex-output .p:last-child,
.btex-output table.list:last-child {
    margin-bottom: 0
}

.btex-output div.floatright {
    float: right;
    margin: 0
}

.btex-output table.list.footnotes {
    font-size: 90%;
    border-style: solid;
    border-width: 1px 1px 1px 4px;
    border-color: #e0e4e8
}

.btex-output p+table.list.list-no-sep-above {
    margin-top: -1em
}

.btex-output table.list {
    width: 100%;
    border-collapse: collapse
}

.btex-output table.list tr.list-item:not(:last-child)>td {
    padding-bottom: 1em
}

.btex-output table.list tr.list-item.list-item-no-sep>td {
    padding-bottom: 0
}

.btex-output table.list td {
    vertical-align: baseline
}

.btex-output table.list td.list-item-label {
    width: 1.5em;
    max-width: 16em;
    overflow-x: clip;
    white-space: nowrap;
    text-align: right;
    padding-right: 0.75em;
    user-select: none;
    -webkit-user-select: none
}

.btex-output table.list.subpage-list tr.list-item:not(:last-child)>td {
    padding-bottom: 0
}

.btex-output table.list.subpage-list td.list-item-label {
    display: none
}

.btex-output table.list.subpage-list tr.list-item-indent-1>td:last-child {
    padding-left: 1.5em
}

.btex-output table.list.subpage-list tr.list-item-indent-2>td:last-child {
    padding-left: 3em
}

.btex-output table.list.subpage-list tr.list-item-indent-3>td:last-child {
    padding-left: 4.5em
}

.btex-output .table-wrapper {
    display: inline-block;
    max-width: 100%;
    overflow-x: auto
}

.btex-output span.display-math {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    justify-content: stretch
}

.btex-output span.display-math.tikz-in-math {
    align-items: center
}

.btex-output span.display-math span.katex-display {
    flex-grow: 1;
    overflow-x: auto;
    overflow-y: hidden
}

.btex-output span.display-math span.equation-tag-left,
.btex-output span.display-math span.equation-tag-right {
    flex-shrink: 0;
    flex-grow: 0
}

.btex-output span.undefined-reference {
    font-weight: bold;
    color: #ff3000
}

/* TODO theorem styles here */

.btex-output .proof-header,
.btex-output .proof-content > p:first-child,
.btex-output .block.style-a > p:first-child,
.btex-output .block.style-b > p:first-child,
.btex-output .block.style-c > p:first-child,
.btex-output .proof-content > .p:first-child,
.btex-output .block.style-a > .p:first-child,
.btex-output .block.style-b > .p:first-child,
.btex-output .block.style-c > .p:first-child {
    text-indent: 0
}

.btex-output .block.style-a {
    background: #f0f6ff;
    border-color: #a0e0ff
}

.btex-output .block.style-a span.item-header {
    color: #1088c8
}

.btex-output .block.style-a a span.item-header {
    color: #1088c8
}

.btex-output .block.style-a a.new span.item-header {
    color: #80b700
}

.btex-output .block.style-b {
    background: #fff0ea;
    border-color: #ffd880
}

.btex-output .block.style-b span.item-header {
    color: #dc6700
}

.btex-output .block.style-b a span.item-header {
    color: #1088c8
}

.btex-output .block.style-b a.new span.item-header {
    color: #80b700
}

.btex-output .block.style-c {
    background: #ebfbeb;
    border-color: #a0e0a0
}

.btex-output .block.style-c span.item-header {
    color: #209020
}

.btex-output .block.style-c a span.item-header {
    color: #1088c8
}

.btex-output .block.style-c a.new span.item-header {
    color: #80b700
}

.btex-output .table-wrapper table {
	border: 1px solid #ddd;
}

.btex-output .table-wrapper td, th {
	border: 1px solid #ddd;
}

.btex-output .block.quotation {
    background: #c0c4c8;
    border-color: #606468;
}

.proof, .proof-collapsible {
    margin: 0 0 1em 0;
    overflow: hidden; /* Fixes qed position */
  }

.proof-collapsible {
.proof-expander {
    position: absolute;
    cursor: pointer;
    margin-left: -20px;
}

.proof-expander.proof-expander-ellipsis {
    position: relative;
    top: -.1em;
    display: inline-flex;
    overflow-y: hidden;
    align-items: center;
    margin: 0 .5em;
    padding: 0 .6em;
    background-color: #f0f2f6;
    color: #a2a9b1;
    border-radius: .6em;
    height: 1em;
    user-select: none;
    -webkit-user-select: none;
}
}

/* ! Note that collapsed/expanded is reversed temporarily */
.btex-output .proof-collapsible.proof-collapsible-collapsed>.proof-content,
.btex-output .proof-collapsible.proof-collapsible-collapsed>.proof-expander-collapsing {
    display: none
}

.btex-output .proof-collapsible.proof-collapsible-expanded>.proof-header,
.btex-output .proof-collapsible.proof-collapsible-expanded>.proof-expander-expanding {
    display: none
}

span.btex-diagram {
    display: inline-block
}

#render-content[invert-only] span.btex-diagram >svg.overlay,
#render-content[invert-only] span.tikz-in-math >svg {
    filter: invert(1);
    mix-blend-mode: difference;
}

#render-content[invert-all] .katex {
    color: #000;
    filter: invert(1);
    mix-blend-mode: difference
}

span.btex-diagram span.cell,
span.btex-diagram span.label {
    display: flex;
    position: relative;
    width: 0;
    height: 0;
    align-items: center;
    justify-content: center
}

span.btex-diagram .katex {
    font-size: 1em !important
}

span.btex-diagram .katex span.rlap {
    user-select: none;
    -webkit-user-select: none
}

.btex-output .marginnotebody {
    font-size: 80%;
    position: relative;
}
/* Wide viewport */
@media (min-width: 1400px) {
    .btex-output .marginnotebody {
        display: block;
        float: right;
        clear: right;
        margin-right: -23vw;
        text-align: left;

        top: -1rem;
        width: 20vw;
        margin-top: 1rem;
    }
}

@media (max-width: 1400px) {
    .btex-output .marginnotebody {
      display: block;
      float: left;
      clear: right;
      text-align: left;
      margin-left: 2rem;
      margin-right: 2rem;
      width: 100%;
  }
}

@media (min-width: 1400px) {
/* Highlight the sidenote when mouse hovers on the sidenote number in body. */
.btex-output .marginnote:hover .marginnotebody {
    background-color: #a0e0ff;
}
} 

/* Update when https://github.com/banana-space/banana-space/issues/7 is resolved */
@media print {
    .b-nav-wrapper,#siteNotice,.content__before-header,.content__namespaces-actions,footer {
        display: none
    }

    .btex-output {
        box-shadow: none;
        padding: 0;
        font-size: 12px;
        width: calc(100% - 120px);
        padding: 100px 60px 60px 60px;
    }

    h1,h2,h3,h4 {
        font-weight: normal
    }

    .nomobile {
        display: none
    }

    /* .btex-output span.display-math span.katex-display {
        overflow-x: visible;
    } */
}