header {
    text-align: center;
    position: relative; /* anchor for absolutely-positioned theme toggle */
}

h1, h2, h3, h4, h5 {
    font-family: 'PT Serif';
}

html[lang="ko"] contents article_title,
html[lang="ko"] contents article_body {
    font-family: 'MaruBuri', serif;
}

html[lang="ko"] contents article_title h1,
html[lang="ko"] contents article_title h2,
html[lang="ko"] contents article_title h3,
html[lang="ko"] contents article_title h4,
html[lang="ko"] contents article_title h5,
html[lang="ko"] contents article_body h1,
html[lang="ko"] contents article_body h2,
html[lang="ko"] contents article_body h3,
html[lang="ko"] contents article_body h4,
html[lang="ko"] contents article_body h5 {
    font-family: 'MaruBuri', serif;
}

panelnavwrapper {
    display: inline-block;
    text-align: center;
    min-width: 300px;
    max-width: 100%;
    height: 64px;
    margin-top: 12pt;
}

.site_header {
    font-family: 'PT Sans Caption';
    font-weight: 700;
    letter-spacing: 0.1em;
    line-height: 100%;
}

footer {
    padding: 2em 1em 0 1em;
    font-size: 0.9rem;
    text-align: center;
}

article_goback {
    font-family: 'PT Sans';
}

sym {
    display: inline;
    font-family: "Noto Sans Symbols 2";
}

inlinecode {
    font-family: "PT Mono";
    background-color: #f6f6f7;
    color: #111113;
    padding: 2px 4px;
    margin: 0 0.15em;
    border: 1px solid #99999b;
    border-radius: 3px;
    font-size: 96%;
}

pre {
    font-family: "PT Mono";
    background-color: #f6f6f7;
    color: #111113;
    padding: 3px 6px;
    border: 1px solid #99999b;
    border-radius: 3px;
    overflow: auto;
    scrollbar-color: #99999b #f6f6f7;
    font-size: 96%;
}

pre::-webkit-scrollbar-thumb {
    background-color: #99999b;
}

pre::-webkit-scrollbar-track {
    background-color: #f6f6f7;
}

imgbox {
    display: block;
    width: 100%;
    overflow: auto;
}

.gallery_autoresize {
    max-width: 100%;
    height: auto;
}

.table_gallery {
    table-layout: fixed;
}

th, td {
    border: 1px solid #e6e6e7;
}

thead td, td.head, td.foot {
    background: #f2f2f3;
    font-weight: 700;
    color: #393943;
}

thead td, td.head {
    border-bottom: 1px solid #555558;
}
td.foot {
    border-top: 1px solid #555558;
}
thead td:not(:last-child), td.head:not(:last-child), td.foot:not(:last-child) {
    border-right: 1px solid #ceced0;
}

table {
    border: 1px solid #99999b;
    overflow-x: auto;
    border-spacing: 0;
    border-radius: 3px;
}

thead {
}

tbody {
    white-space: nowrap;
}

th, td {
    padding: 5px 10px;
    border-top-width: 0;
    border-left-width: 0;
    text-align: left;
}

hr {
    border: 1px solid rgba(84, 72, 49, 0.15);
}

hr.bold {
    border: 4px solid rgba(84, 72, 49, 0.25);
    margin: 2rem 0;
}

/* ARTICLE BOXES */

article_title {
    display: block;
    margin-top: 0em;
    margin-bottom: 0em;
    font-size: 1.8rem;
    text-align: center;
    line-height: 120%;
}

article_body, article_goback {
    display: block;
    margin: 2em 1em 0 1em;
}

article_alts:empty {
    display: none;
}

article_alts {
    grid-column: 1 / -1;
}

article_timestamp, article_share {
    font-family: 'PT Sans';
    display: inline-block;
    font-size: 0.9rem;
    text-align: center;
}

.nothing_here {
    font-style: italic;
    color: #99999b;
}

header a, header a:visited,
article_title a, article_title a:visited,
article_toolbox a, article_toolbox a:visited,
article_share a, article_share a:visited,
panelnavwrapper a, panelnavwrapper a:visited,
article_goback a, article_goback a:visited,
siteheader a, siteheader a:visited {
    color: unset;
    text-decoration: none;
}

.article_date {
    display: block;
    font-family: 'PT Sans';
    font-size: 0.8rem;
    font-weight: normal;
    color: #757579;
}

article_toolbox {
    display: grid;
    gap: 1.5em;
    grid-template-columns: 1fr 1fr;
    margin: 0 auto 2em auto;
    width: fit-content;
    text-align: center;
}

article_list_container {
    display: grid;
    gap: 1.5em;
    text-align: center;
}

article_list {
    display: block;
}

article_list a {
    display: inline;
    font-family: 'PT Sans';
    font-weight: 700;
    font-size: 1.1rem;
    text-decoration: unset;
}

article_list a:hover {
    transition: all 100ms;
    border-bottom: 1px solid #111113;
}

frac {
    display: grid;
    grid-template-rows: auto auto;
    padding: 0.333em 0.666ex;
    width: fit-content;
}

frac > fn, frac > fd {
    text-align: center;
    display: inline-block;
    padding: 0.1em 0.5em;
}

frac > fd {
    border-top: 1px solid #454549;
}

equation {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    margin-left: auto;
    margin-right: auto;
    width: fit-content;
}

equation[index]::after {
    content: "(" attr(index) ")";
    margin-left: 1em;
}

inlineeq {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
}

inlineeq sup {
    position: relative;
    top: -0.5ex;
}

inlineeq sub {
    position: relative;
    top: 0.5ex;
}

sigma {
    display: grid;
    text-align: center;
}

sigma > ssym {
    font-weight: 700;
    font-size: 1.5rem;
    display: inline-block;
    text-align: center;
    line-height: 1.1;
}

sigma > sup, sigma > sdn {
    font-size: 0.9rem;
    text-align: center;
    display: inline-block;
    line-height: 1.1;
}

math {
    font-size: 1.2rem;
    font-weight: 400;
    margin-top: 6pt;
    margin-bottom: 6pt;
}

/* ── Theme toggle button ─────────────────────────────────────────────────── */

#theme-toggle {
    position: absolute;
    top: 0.6em;
    right: 0;
    background: none;
    border: 1px solid #c0c0c2;
    border-radius: 1.2em;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0.3em 0.6em;
    color: inherit;
    transition: background-color 150ms, border-color 150ms;
}
#theme-toggle:hover {
    background-color: rgba(128, 128, 128, 0.12);
}

/* ── Dark mode — blog.css elements ──────────────────────────────────────────
   Mirrors the two activation paths from style.css:
     html.inverted  — manual toggle
     @media + html:not(.light)  — auto from system preference             */

html.inverted inlinecode,
html.inverted pre {
    background-color: #2c2c2e;
    color: #e0e0e0;
    border-color: #48484a;
}
html.inverted pre {
    scrollbar-color: #48484a #2c2c2e;
}
html.inverted pre::-webkit-scrollbar-thumb { background-color: #48484a; }
html.inverted pre::-webkit-scrollbar-track { background-color: #2c2c2e; }

html.inverted th,
html.inverted td { border-color: #3a3a3c; }
html.inverted thead td,
html.inverted td.head,
html.inverted td.foot { background-color: #2c2c2e; color: #c8c8cc; }
html.inverted thead td,
html.inverted td.head { border-bottom-color: #555558; }
html.inverted td.foot { border-top-color: #555558; }
html.inverted thead td:not(:last-child),
html.inverted td.head:not(:last-child),
html.inverted td.foot:not(:last-child) { border-right-color: #48484a; }
html.inverted table { border-color: #48484a; }

html.inverted hr { border-color: rgba(220, 200, 180, 0.15); }
html.inverted hr.bold { border-color: rgba(220, 200, 180, 0.25); }

html.inverted article_list a:hover { border-bottom-color: #d4d4d4; }
html.inverted .article_date { color: #888889; }
html.inverted .nothing_here { color: #606062; }
html.inverted frac > fd { border-top-color: #888889; }
html.inverted #theme-toggle { border-color: #48484a; }

html.inverted header a, html.inverted header a:visited,
html.inverted article_title a, html.inverted article_title a:visited,
html.inverted article_toolbox a, html.inverted article_toolbox a:visited,
html.inverted article_goback a, html.inverted article_goback a:visited,
html.inverted siteheader a, html.inverted siteheader a:visited { color: unset; }

@media (prefers-color-scheme: dark) {
    html:not(.light) inlinecode,
    html:not(.light) pre {
        background-color: #2c2c2e;
        color: #e0e0e0;
        border-color: #48484a;
    }
    html:not(.light) pre {
        scrollbar-color: #48484a #2c2c2e;
    }
    html:not(.light) pre::-webkit-scrollbar-thumb { background-color: #48484a; }
    html:not(.light) pre::-webkit-scrollbar-track { background-color: #2c2c2e; }

    html:not(.light) th,
    html:not(.light) td { border-color: #3a3a3c; }
    html:not(.light) thead td,
    html:not(.light) td.head,
    html:not(.light) td.foot { background-color: #2c2c2e; color: #c8c8cc; }
    html:not(.light) thead td,
    html:not(.light) td.head { border-bottom-color: #555558; }
    html:not(.light) td.foot { border-top-color: #555558; }
    html:not(.light) thead td:not(:last-child),
    html:not(.light) td.head:not(:last-child),
    html:not(.light) td.foot:not(:last-child) { border-right-color: #48484a; }
    html:not(.light) table { border-color: #48484a; }

    html:not(.light) hr { border-color: rgba(220, 200, 180, 0.15); }
    html:not(.light) hr.bold { border-color: rgba(220, 200, 180, 0.25); }

    html:not(.light) article_list a:hover { border-bottom-color: #d4d4d4; }
    html:not(.light) .article_date { color: #888889; }
    html:not(.light) .nothing_here { color: #606062; }
    html:not(.light) frac > fd { border-top-color: #888889; }
    html:not(.light) #theme-toggle { border-color: #48484a; }

    html:not(.light) header a, html:not(.light) header a:visited,
    html:not(.light) article_title a, html:not(.light) article_title a:visited,
    html:not(.light) article_toolbox a, html:not(.light) article_toolbox a:visited,
    html:not(.light) article_goback a, html:not(.light) article_goback a:visited,
    html:not(.light) siteheader a, html:not(.light) siteheader a:visited { color: unset; }
}
