/* ---------------------------------------------------------------------------
   marktextml — post/article typography on the uidops slate theme.
   Loaded by every page (via {{head_extra}}) but only affects .article content.
   Fonts are self-hosted: assets/fonts/source-serif4-*.woff2 (latin and
   latin-ext faces pulled from Google Fonts). Source Serif 4 replaces the old
   Crimson Text: a screen-designed serif with a larger x-height and sturdier
   strokes, which holds up far better in light-on-dark long-form reading.
--------------------------------------------------------------------------- */

@font-face {
    font-family: "Source Serif 4";
    src: url(../fonts/source-serif4-400italic-latin-ext.woff2) format("woff2");
    font-style: italic;
    font-weight: 400;
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
    font-display: swap;
}
@font-face {
    font-family: "Source Serif 4";
    src: url(../fonts/source-serif4-400italic-latin.woff2) format("woff2");
    font-style: italic;
    font-weight: 400;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
    font-display: swap;
}
@font-face {
    font-family: "Source Serif 4";
    src: url(../fonts/source-serif4-600italic-latin-ext.woff2) format("woff2");
    font-style: italic;
    font-weight: 600;
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
    font-display: swap;
}
@font-face {
    font-family: "Source Serif 4";
    src: url(../fonts/source-serif4-600italic-latin.woff2) format("woff2");
    font-style: italic;
    font-weight: 600;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
    font-display: swap;
}
@font-face {
    font-family: "Source Serif 4";
    src: url(../fonts/source-serif4-700italic-latin-ext.woff2) format("woff2");
    font-style: italic;
    font-weight: 700;
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
    font-display: swap;
}
@font-face {
    font-family: "Source Serif 4";
    src: url(../fonts/source-serif4-700italic-latin.woff2) format("woff2");
    font-style: italic;
    font-weight: 700;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
    font-display: swap;
}
@font-face {
    font-family: "Source Serif 4";
    src: url(../fonts/source-serif4-400-latin-ext.woff2) format("woff2");
    font-style: normal;
    font-weight: 400;
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
    font-display: swap;
}
@font-face {
    font-family: "Source Serif 4";
    src: url(../fonts/source-serif4-400-latin.woff2) format("woff2");
    font-style: normal;
    font-weight: 400;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
    font-display: swap;
}
@font-face {
    font-family: "Source Serif 4";
    src: url(../fonts/source-serif4-600-latin-ext.woff2) format("woff2");
    font-style: normal;
    font-weight: 600;
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
    font-display: swap;
}
@font-face {
    font-family: "Source Serif 4";
    src: url(../fonts/source-serif4-600-latin.woff2) format("woff2");
    font-style: normal;
    font-weight: 600;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
    font-display: swap;
}
@font-face {
    font-family: "Source Serif 4";
    src: url(../fonts/source-serif4-700-latin-ext.woff2) format("woff2");
    font-style: normal;
    font-weight: 700;
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
    font-display: swap;
}
@font-face {
    font-family: "Source Serif 4";
    src: url(../fonts/source-serif4-700-latin.woff2) format("woff2");
    font-style: normal;
    font-weight: 700;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
    font-display: swap;
}

/* greek subset — the math needs π, σ, φ, θ … in the same face as the prose */
@font-face {
    font-family: "Source Serif 4";
    src: url(../fonts/source-serif4-400italic-greek.woff2) format("woff2");
    font-style: italic;
    font-weight: 400;
    unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
    font-display: swap;
}
@font-face {
    font-family: "Source Serif 4";
    src: url(../fonts/source-serif4-600italic-greek.woff2) format("woff2");
    font-style: italic;
    font-weight: 600;
    unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
    font-display: swap;
}
@font-face {
    font-family: "Source Serif 4";
    src: url(../fonts/source-serif4-700italic-greek.woff2) format("woff2");
    font-style: italic;
    font-weight: 700;
    unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
    font-display: swap;
}
@font-face {
    font-family: "Source Serif 4";
    src: url(../fonts/source-serif4-400-greek.woff2) format("woff2");
    font-style: normal;
    font-weight: 400;
    unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
    font-display: swap;
}
@font-face {
    font-family: "Source Serif 4";
    src: url(../fonts/source-serif4-600-greek.woff2) format("woff2");
    font-style: normal;
    font-weight: 600;
    unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
    font-display: swap;
}
@font-face {
    font-family: "Source Serif 4";
    src: url(../fonts/source-serif4-700-greek.woff2) format("woff2");
    font-style: normal;
    font-weight: 700;
    unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
    font-display: swap;
}

/* ---------------------------------------------------------------------------
   Math typography.
   Formulas are baked at build time by KaTeX, whose default faces are its own
   Computer Modern cut (KaTeX_Main upright, KaTeX_Math italic). Lead every
   stack with Source Serif 4 so the math sits in the same voice as the prose;
   glyphs only KaTeX carries — blackboard bold, script/caligraphic letters,
   the sized delimiters and big operators — fall through to the KaTeX faces
   per glyph, so nothing loses its shape. font-style / font-weight stay as
   the KaTeX rules set them (italic variables, \mathbf = 700, …), because
   these rules only change font-family. post.css loads after katex.min.css,
   so equal specificity wins the cascade.
--------------------------------------------------------------------------- */
.katex,
.katex .mainrm,
.katex .textrm,
.katex .mathit,
.katex .mathbf {
    font-family: "Source Serif 4", KaTeX_Main, "Times New Roman", serif;
}
.katex .mathnormal,
.katex .boldsymbol {
    font-family: "Source Serif 4", KaTeX_Math, KaTeX_Main, serif;
}

/* ---------- article frame ------------------------------------------------ */

/* the article runs the full length of the page: it stretches from the
   topbar down to the footer instead of stopping at its own content box.
   (:has() keeps these scoped to post pages — the index loads this
   stylesheet too and its <main> holds .sec sections, not .article) */
main:has(> .article) {
    display: flex;
    flex-direction: column;
}

.article {
    flex: 1 0 auto;
    max-width: 66rem;
    width: 100%;
    margin: 0 auto;
    padding: 68px 44px 56px;
    /* dark surface for the prose: the page gradient alone reads too light
       behind long-form text and formulas */
    background: rgba(11, 16, 20, 0.74);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
    font-family: "Source Serif 4", Georgia, serif;
    font-size: 1.18rem;
    line-height: 1.72;
    color: var(--ink2);
}

/* no light band between the article and the footer on post pages */
main:has(> .article) + footer {
    margin-top: 0;
}

.article > * + * {
    margin-top: 0;
}

/* ---------- post header (Rust-generated) --------------------------------- */

.post-head {
    text-align: center;
    margin-bottom: 2.4rem;
    padding-bottom: 1.4rem;
    border-bottom: 1px solid var(--line);
}

/* hero banner (frontmatter `banner:`) — spans the header, above the title */
.post-banner {
    display: block;
    width: 100%;
    height: auto;
    margin: 0 0 1.6rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--panel);
}

.post-head h1 {
    margin: 0 0 0.6rem;
    font-family: var(--sans);
    font-size: clamp(1.7rem, 5vw, 2.15rem);
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.01em;
    color: var(--ink);
}

.post-meta {
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--ink3);
}

.post-meta a {
    color: var(--accent);
}

.post-tags {
    margin-top: 0.8rem;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.post-tags a,
.post-tags span {
    font-family: var(--mono);
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink2);
    text-decoration: none;
    padding: 4px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel);
    transition: border-color 0.25s, color 0.25s;
}

.post-tags a:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.post-foot {
    margin: 2.6rem 0 0;
    padding-top: 1.2rem;
    border-top: 1px solid var(--line);
    font-family: var(--mono);
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.article .post-foot a {
    color: var(--ink3);
    border-bottom: 0;
}

.article .post-foot a:hover {
    color: var(--accent);
}

/* ---------- prose -------------------------------------------------------- */

.article h1,
.article h2,
.article h3,
.article h4 {
    font-family: var(--sans);
    color: var(--ink);
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: -0.01em;
}

/* `.article h1` (further down, same specificity) is what actually styles the
   post title, so this value is the one to keep in sync with it. */
.article h1 {
    font-size: 2.15rem;
    margin: 2.4rem 0 1rem;
}

.article h2 {
    font-size: 1.5rem;
    margin: 2.6rem 0 0.9rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--line);
}

.article h3 {
    font-size: 1.2rem;
    margin: 2rem 0 0.7rem;
}

.article h4 {
    font-size: 1.02rem;
    margin: 1.6rem 0 0.6rem;
    color: var(--ink2);
}

.article p {
    margin: 0 0 1.1rem;
}

.article a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid rgba(90, 209, 224, 0.35);
    transition: border-color 0.2s;
}

.article a:hover {
    border-bottom-color: var(--accent);
}

.article strong {
    color: var(--ink);
    font-weight: 700;
}

.article em {
    font-style: italic;
}

.article ul,
.article ol {
    margin: 0 0 1.1rem;
    padding-left: 1.4rem;
}

.article ul {
    list-style: circle;
}

.article ol {
    list-style: decimal;
}

.article li {
    margin-bottom: 0.35rem;
}

.article li > input[type="checkbox"] {
    margin-right: 0.5rem;
    accent-color: var(--accent);
}

.article li:has(> input[type="checkbox"]) {
    list-style: none;
    margin-left: -1.2rem;
}

.article hr {
    border: 0;
    height: 1px;
    background: var(--line);
    margin: 2.2rem 0;
}

.article blockquote {
    margin: 1.4rem 0;
    padding: 0.9rem 1.2rem;
    border-left: 3px solid var(--accent);
    border-radius: 0 10px 10px 0;
    background: var(--panel);
    color: var(--ink2);
    font-style: italic;
}

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

.article img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 1.6rem auto;
    border-radius: 10px;
}

.article figure {
    margin: 1.6rem 0;
}

.article figcaption {
    margin-top: 0.5rem;
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-align: center;
    color: var(--ink3);
}

/* ---------- code --------------------------------------------------------- */

.article code {
    font-family: var(--mono);
    font-size: 0.85em;
    padding: 0.15em 0.4em;
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid var(--line);
    color: #d7e3e8;
}

.article pre {
    margin: 1.4rem 0;
    padding: 1rem 1.1rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.38);
    overflow-x: auto;
    font-size: 0.86rem;
    line-height: 1.6;
}

.article pre code {
    padding: 0;
    border: 0;
    background: none;
    font-size: 1em;
    color: #d7e3e8;
}

/* ---------- tables ------------------------------------------------------- */

.article table {
    display: block;
    width: 100%;
    margin: 1.4rem 0;
    border-collapse: collapse;
    overflow-x: auto;
    font-size: 1rem;
}

.article th,
.article td {
    padding: 0.55rem 0.8rem;
    border: 1px solid var(--line);
    text-align: left;
}

.article th {
    background: var(--panel2);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.article td {
    color: var(--ink2);
}

.article tr:nth-child(even) td {
    background: rgba(255, 255, 255, 0.02);
}

/* ---------- math (build-time katex) -------------------------------------- */

.article .katex {
    font-size: 1.06em;
}

.article .katex-display {
    margin: 1.4rem 0;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 4px 0;
}

.article .katex-error {
    color: #ff9d9d;
}

@media (max-width: 800px) {
    .article .katex-display {
        overflow: auto hidden;
    }
}

/* ---------- mermaid (rendered client-side) -------------------------------- */

.mermaid {
    margin: 1.6rem 0;
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.28);
    text-align: center;
    font-family: var(--mono);
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--ink3);
    white-space: pre-wrap;
}

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

/* ---------- footnotes ---------------------------------------------------- */

.article section.footnotes {
    margin-top: 2.4rem;
    padding-top: 1rem;
    border-top: 1px solid var(--line);
    font-size: 0.95rem;
    color: var(--ink3);
}

.article section.footnotes ol {
    padding-left: 1.2rem;
}

.article a.footnote-definition,
.article a[id^="footnote-ref"] {
    font-family: var(--mono);
    font-size: 0.8em;
}

/* ---------- post list (index page) --------------------------------------- */

.post-list {
    display: grid;
    gap: 18px;
}

.post-item {
    position: relative;
    display: block;
    padding: 24px 26px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.05),
        rgba(255, 255, 255, 0.015)
    );
    color: var(--ink);
    text-decoration: none;
    transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1),
        border-color 0.35s, box-shadow 0.35s;
}

.post-item:hover {
    transform: translateY(-3px);
    border-color: rgba(90, 209, 224, 0.5);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}

.post-item h2 {
    margin: 0 0 0.4rem;
    font-family: var(--sans);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--ink);
}

.post-item:hover h2 {
    color: var(--accent);
}

.post-item .post-meta {
    display: block;
    margin-bottom: 0.7rem;
}

.post-item .excerpt {
    margin: 0;
    font-family: "Source Serif 4", Georgia, serif;
    font-size: 1.05rem;
    line-height: 1.6;
    color: var(--ink2);
}

.post-empty {
    padding: 28px;
    border: 1px dashed var(--line);
    border-radius: 14px;
    text-align: center;
    color: var(--ink3);
    font-family: var(--mono);
    font-size: 0.85rem;
}
