/* Use lining digits in prose without changing letters or MathJax fonts. */
@font-face {
    font-family: "Blog Numerals";
    src: url("assets/fonts/roboto-400.woff2") format("woff2");
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    unicode-range: U+0030-0039;
}

@font-face {
    font-family: "Blog Numerals";
    src: url("assets/fonts/roboto-700.woff2") format("woff2");
    font-style: normal;
    font-weight: 600 700;
    font-display: swap;
    unicode-range: U+0030-0039;
}

@font-face {
    font-family: "STIX Two Math Web";
    src: url("assets/fonts/stix-two-math.woff2") format("woff2");
    font-style: normal;
    font-weight: 400;
    font-display: swap;
}

.article-page {
    --blog-text: "Blog Numerals", Georgia, "Noto Serif CJK SC", "Source Han Serif SC", "Songti SC", SimSun, "AR PL SungtiL GB", serif;
    --latex-math: "STIX Two Math Web", "STIX Two Math", "Cambria Math", serif;
    background: var(--background);
}

.article-shell {
    width: min(1400px, calc(100% - 64px));
    padding: 52px 0 80px;
}

.blog-article { width: 100%; }

.article-header {
    max-width: 850px;
    margin: 0 auto 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--line);
}

.article-kicker {
    margin-bottom: 12px;
    color: var(--muted);
    font-size: 14px;
    letter-spacing: .08em;
}

.article-header h1 {
    max-width: 1000px;
    margin-bottom: 14px;
    font-family: var(--blog-text);
    font-size: 30px;
    line-height: 1.4;
    font-weight: 600;
}

.article-meta {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.article-layout {
    display: block;
}

.article-outline .toc > ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.article-outline .toc ul ul {
    margin: 5px 0 0;
    padding-left: 15px;
}

.article-outline {
    max-width: 850px;
    margin: 0 auto 42px;
    padding: 13px 18px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: #f7f7f7;
    font-size: 14px;
}

.article-outline summary {
    cursor: pointer;
    font-weight: 600;
}

.article-outline .toc { margin-top: 14px; }
.article-outline li { margin: 0 0 7px; }
.article-outline a { color: var(--muted); }
.article-outline a:hover { color: var(--accent); }

.article-content {
    max-width: 850px;
    margin-inline: auto;
    min-width: 0;
    font-family: var(--blog-text);
    font-size: 18px;
    font-weight: 400;
    line-height: 1.9;
    color: #111;
}

.article-content > p:first-child {
    color: #404040;
    font-size: 1em;
}

.article-subtitle {
    margin: -4px 0 8px;
    color: #66717e;
    font-size: 1.18em;
}

.article-byline {
    color: var(--muted);
    font-size: .9em;
}

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

.article-content h2,
.article-content h3,
.article-content h4,
.article-content h5 {
    scroll-margin-top: 100px;
    font-family: var(--blog-text);
    font-weight: 600;
}

.article-content h2 {
    margin: 42px 0 16px;
    font-size: 23px;
}

.article-content h3 {
    margin: 32px 0 14px;
    font-size: 19px;
}

.article-content h4 {
    margin: 34px 0 16px;
    font-size: 16px;
}

.article-content h5 {
    margin: 28px 0 14px;
    font-size: 15px;
}

.article-content p,
.article-content li { max-width: none; }

.article-content p { margin-bottom: 18px; }

.article-content ul,
.article-content ol { padding-left: 1.5em; }
.article-content li + li { margin-top: 7px; }

.article-content img {
    display: block;
    width: 100%;
    height: auto;
    margin: 30px auto 12px;
    border: 1px solid var(--line);
    background: #fff;
}

.article-content figure {
    margin: 30px 0;
}

.article-content figure img {
    margin: 0 auto 10px;
}

.article-content figure.figure-compact img {
    width: min(100%, 820px);
}

.article-content figcaption,
.article-content .table-caption {
    color: #404040;
    font-size: .86em;
    font-weight: 400;
    text-align: center;
}

.article-content .table-caption {
    margin: 24px 0 -17px;
}

.article-content pre {
    max-width: 100%;
    margin: 24px 0;
    padding: 20px 22px;
    overflow-x: auto;
    border: 1px solid var(--line);
    background: #f4f4f4;
    font-size: .72rem;
    line-height: 1.58;
}

.article-content code {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: .84em;
}

.article-content :not(pre) > code {
    padding: .1em .3em;
    background: #f1f1f1;
}

.article-content table {
    display: block;
    width: 100%;
    margin: 24px 0 30px;
    overflow-x: auto;
    border-collapse: collapse;
    font-family: var(--blog-text);
    font-size: .76rem;
    white-space: nowrap;
}

.article-content th,
.article-content td {
    padding: 9px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
}

.article-content thead th {
    border-bottom-color: rgba(0, 0, 0, .32);
    font-weight: 600;
}

.article-content math[display="block"] {
    display: block;
    width: fit-content;
    max-width: 100%;
    margin: 1em auto;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 3px 0;
    text-align: center;
}

.article-header math,
.article-content math {
    font-family: var(--latex-math);
    font-size: 1em;
}

.article-header mjx-container,
.article-content mjx-container {
    font-size: 1em;
}

.article-content mjx-container[display="true"] {
    max-width: 100%;
    margin: 1em auto !important;
    overflow-x: auto;
    overflow-y: hidden;
    text-align: center;
}

.article-content .equation-number {
    margin: -1.15em 0 1em;
    color: var(--muted);
    font-size: .82em;
    text-align: right;
    scroll-margin-top: 100px;
}

.article-content blockquote {
    margin: 22px 0;
    padding: 11px 16px;
    border-left: 3px solid var(--accent);
    background: #f7f7f7;
    color: #404040;
}

.article-content blockquote p:last-child { margin-bottom: 0; }

/* Keep long display equations scrollable within the article, including quotes. */
.article-content div.arithmatex {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
}

.article-content hr {
    margin: 50px 0;
    border: 0;
    border-top: 1px solid var(--line);
}

.article-footer {
    display: flex;
    justify-content: space-between;
    max-width: 850px;
    margin: 64px auto 0;
    padding-top: 24px;
    border-top: 1px solid var(--line);
    font-size: .82rem;
}

@media (max-width: 620px) {
    .article-shell {
        width: min(100% - 28px, 900px);
        padding-top: 34px;
    }

    .article-header { margin-bottom: 24px; }
    .article-header h1 { font-size: 28px; }

    .article-outline {
        margin-bottom: 30px;
        padding: 12px 14px;
    }

    .article-content {
        font-size: 17px;
        line-height: 1.9;
    }

    .article-content h2 {
        margin-top: 36px;
        font-size: 20px;
    }

    .article-content pre {
        margin-inline: -4px;
        padding: 16px;
        font-size: .72rem;
    }

    .article-footer {
        flex-direction: column;
        gap: 10px;
    }
}
