/*
 * Site overrides for LaTeXML-generated documents.
 *
 * LaTeXML.css and ltx-article.css are unmodified copies from the LaTeXML
 * distribution so they can be replaced wholesale on upgrades; everything
 * matching this site's visual style belongs here. Loaded last, after the
 * two stock sheets. Palette values mirror assets/css/main.css; documents
 * have no theme-toggle script, so dark mode follows the system preference
 * only.
 */

@font-face {
    font-family: "Source Serif 4";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("/fonts/SourceSerif4-Latin-VariableFont_opsz,wght.woff2") format("woff2");
}

@font-face {
    font-family: "Source Serif 4";
    font-style: italic;
    font-weight: 100 900;
    font-display: swap;
    src: url("/fonts/SourceSerif4-Italic-Latin-VariableFont_opsz,wght.woff2") format("woff2");
}

/* Typography mirrors the site's base styles exactly (main.css): body
   weight 300 with 1.5 line height, bold at 600, site heading scale. */
body {
    font-family: "Source Serif 4", Georgia, serif;
    font-weight: 300;
    background-color: #faf7f2;
    color: #1a1a1a;
    line-height: 1.5;
    text-rendering: optimizeLegibility;
}

b,
strong,
.ltx_font_bold {
    font-weight: 600;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 600;
}

h1.ltx_title_document {
    font-size: 2.5rem;
}

/*
 * The CV's letterhead already leads with the name, so its document
 * title (kept for the <title> tag, crawlers, and assistive tech) would
 * print the name twice. Visually hide it, mirroring the site's
 * .sr-only utility. Keyed to the letterhead's oversized bold name
 * span, which only the CV template produces (inline style converted
 * to a class by latexml_postprocess.py).
 */
.ltx_document:has(#p1 .ltxs-font-size-173) > .ltx_title_document {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

h2.ltx_title_section {
    font-size: 1.5rem;
}

/* Stock LaTeXML lets text span the whole window; render the document
   as a card on the page background, like the site's article pages. */
.ltx_page_main {
    max-width: 46rem;
    margin: 2rem auto;
    padding: 2.5rem 2rem;
    background-color: #f2efe9;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
}

a {
    color: #0069d9;
}

/* LaTeXML emits \hrule as a span with inline "background: black";
   currentColor keeps rules matching the text in every theme. */
.ltx_rule {
    background-color: currentColor !important;
}

/*
 * Document lists. The CV template builds its layout from lists nested
 * three deep; browser-default list padding compounds to ~120px of dead
 * margin, crippling narrow screens. One modest step per level instead.
 */
.ltx_itemize,
.ltx_enumerate {
    padding-left: 1.5rem;
    margin-top: 0;
    margin-bottom: 0;
}

/*
 * Contact separators: the CV's \bull macro emits 400%-size math dots
 * pulled below the baseline, which render as giant misaligned bullets.
 * The contact block is the document's first paragraph (#p1); the
 * .ltxs-* classes are inline styles converted by latexml_postprocess.py.
 */
#p1 math mo {
    font-size: 1.2em;
}

#p1 span[class*="ltxs-position-relative"] {
    position: static !important;
}

@media (max-width: 768px) {
    .ltx_itemize,
    .ltx_enumerate {
        padding-left: 0.9rem;
    }

    .ltx_page_main {
        margin: 0.75rem;
        padding: 1.5rem 1rem;
    }
}

/*
 * Print: ink-friendly page on white, no artificial column cap, and keep
 * headings attached to the content they introduce. Placed last so it
 * also wins over the dark-mode block when both media apply.
 */
@media print {
    body {
        background-color: #fff;
        color: #000;
    }

    a {
        color: inherit;
    }

    .ltx_page_main {
        max-width: none;
        margin: 0;
        padding: 0;
        background-color: #fff;
        border: none;
        border-radius: 0;
    }

    h1,
    h2 {
        break-after: avoid;
    }

    li.ltx_item {
        break-inside: avoid;
    }
}

@media (prefers-color-scheme: dark) {
    body {
        background-color: #121212;
        color: #e0e0e0;
    }

    .ltx_page_main {
        background-color: #222;
        border-color: #444;
    }

    a {
        color: #e0d890;
    }
}
