@font-face {
    font-family: 'Latin Modern';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('./fonts/LM-regular.woff2') format('woff2');
}

@font-face {
    font-family: 'Latin Modern';
    font-style: italic;
    font-weight: 400;
    font-display: swap;
    src: url('./fonts/LM-italic.woff2') format('woff2');
}

@font-face {
    font-family: 'Latin Modern';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('./fonts/LM-bold.woff2') format('woff2');
}

@font-face {
    font-family: 'Latin Modern';
    font-style: italic;
    font-weight: 700;
    font-display: swap;
    src: url('./fonts/LM-bold-italic.woff2') format('woff2');
}

:root {
    --font-serif: "Latin Modern", Georgia, "Times New Roman", serif;
    --font-mono: "Latin Modern Mono", Consolas, "Liberation Mono", "Courier New", monospace;
    --text-color: #111111;
    --bg-color: #f9f9f9;
    --rule-color: #111111;
    --line-width: 85ch;
}

/* 2. Reset & Grundlegende Typografie */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    font-size: 11pt; /* Klassische LaTeX-Standardgröße (10pt, 11pt oder 12pt) */
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0 auto;
    padding: 4rem 2rem;
    max-width: var(--line-width);
    font-family: var(--font-serif);
    font-size: 1.15rem;
    line-height: 1.55;
    color: var(--text-color);
    background-color: var(--bg-color);

    /* Feintypografie & Ligaturen */
    text-rendering: optimizeLegibility;
    font-kerning: normal;
    font-variant-ligatures: common-ligatures contextual;
    -webkit-font-smoothing: antialiased;
}

/* 3. Seitenkopf (Running Header / Navigation im Kolumnentitel-Stil) */
body > header {
    border-bottom: 0.4pt solid var(--rule-color);
    padding-bottom: 0.4rem;
    margin-bottom: 3.5rem;
    font-size: 0.9rem;
}

body > header nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: space-between;
    font-variant: small-caps; /* Kapitälchen wie im LaTeX-Kolumnentitel */
    letter-spacing: 0.05em;
}

/* 4. Titelblock (\maketitle Äquivalent) */
article > header {
    text-align: center;
    margin-bottom: 2.5rem;
}

article > header h1 {
    font-size: 1.8rem;
    font-weight: normal; /* LaTeX-Titel im Standard-Article sind nicht fett, sondern groß */
    line-height: 1.25;
    margin: 0 0 1rem 0;
}

article > header p {
    font-size: 1rem;
    margin: 0.25rem 0;
    text-align: center;
    text-indent: 0;
}

/* 5. Automatische Kapitelnummerierung (\section, \subsection, \subsubsection) */
article {
    counter-reset: section;
}

h2 {
    counter-increment: section;
    counter-reset: subsection;
    font-size: 1.35rem;
    font-weight: bold;
    margin: 2rem 0 0.75rem 0;
    line-height: 1.2;
}

h2::before {
    content: counter(section) "\00a0\00a0\00a0"; /* Zähler + geschützte Leerzeichen */
}

h3 {
    counter-increment: subsection;
    counter-reset: subsubsection;
    font-size: 1.15rem;
    font-weight: bold;
    margin: 1.5rem 0 0.5rem 0;
}

h3::before {
    content: counter(section) "." counter(subsection) "\00a0\00a0\00a0";
}

h4 {
    counter-increment: subsubsection;
    font-size: 1rem;
    font-weight: bold;
    font-style: italic;
    margin: 1.25rem 0 0.5rem 0;
}

h4::before {
    content: counter(section) "." counter(subsection) "." counter(subsubsection) "\00a0\00a0\00a0";
}

/* 6. Der klassische LaTeX-Absatzsatz (Blocksatz & Erstzeileneinzug) */
p {
    margin: 0;
    text-align: justify;
    hyphens: auto;
    -webkit-hyphens: auto;
    text-indent: 0; /* Erster Absatz nach einer Überschrift hat KEINEN Einzug */
}

/* Jeder direkt folgende Absatz erhält den klassischen LaTeX-Einzug */
p + p {
    text-indent: 1.5em;
}

/* 7. Abstract / Zusammenfassung (\begin{abstract}) */
.abstract {
    margin: 2rem 2.5rem 2.5rem 2.5rem;
    font-size: 0.9rem;
    line-height: 1.45;
}

.abstract h2,
.abstract-title {
    font-size: 0.95rem;
    font-weight: bold;
    text-align: center;
    margin: 0 0 0.5rem 0;
}

.abstract h2::before {
    content: none; /* Keine Kapitelnummer für das Abstract */
}

/* 8. Listen, Zitate & Code */
ul, ol {
    margin: 0.75rem 0;
    padding-left: 2em;
    text-align: justify;
}

li {
    margin-bottom: 0.25rem;
}

blockquote {
    margin: 1rem 2.5rem;
    font-size: 0.95rem;
    font-style: italic;
}

code, pre {
    font-family: var(--font-mono);
    font-size: 0.9em;
}

pre {
    margin: 1rem 0;
    padding: 0.75rem 1rem;
    overflow-x: auto;
    border-top: 0.4pt solid var(--rule-color);
    border-bottom: 0.4pt solid var(--rule-color);
}

/* 9. Wissenschaftliche Tabellen im LaTeX-"booktabs"-Stil (keine vertikalen Linien) */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.95rem;
    border-top: 1.2pt solid var(--rule-color);    /* \toprule */
    border-bottom: 1.2pt solid var(--rule-color); /* \bottomrule */
}

th {
    font-weight: bold;
    text-align: left;
    padding: 0.4rem 0.6rem;
    border-bottom: 0.6pt solid var(--rule-color); /* \midrule */
}

td {
    padding: 0.35rem 0.6rem;
}

caption {
    caption-side: bottom;
    font-size: 0.9rem;
    margin-top: 0.5rem;
    text-align: left;
}

/* 10. Links (dezent wie im PDF-Druck, ohne grelles Standard-Blau) */
a {
    color: var(--text-color);
    text-decoration: none;
    border-bottom: 0.5pt dotted #555;
}

a:hover, a:focus {
    border-bottom: 0.5pt solid var(--text-color);
}

/* 11. Fußbereich (Wie eine Fußnote / Kolumnenfuß gesetzt) */
body > footer {
    margin-top: 4rem;
    padding-top: 0.75rem;
    border-top: 0.4pt solid var(--rule-color);
    font-size: 0.85rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

body > footer p {
    text-indent: 0;
}

body > footer nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 1.5rem;
}

/* 12. Druck-Optimierung (falls die Seite als PDF gedruckt wird) */
@media print {
    body {
        background-color: #ffffff;
        padding: 0;
        max-width: 100%;
    }
    body > header, body > footer nav {
        display: none;
    }
    a {
        border-bottom: none;
    }
}


/* 13. Abbildungen bündig im Satzspiegel halten */
figure {
    margin: 2rem 0; /* Überschreibt den 40px-Standardeinzug des Browsers */
    width: 100%;
}

figure img {
    display: block;
    width: 100%;     /* Skaliert das Bild exakt auf die Breite der oberen/unteren Linie */
    max-width: 100%; /* Verhindert das Ausbrechen nach rechts */
    height: auto;    /* Behält das korrekte Seitenverhältnis bei */
}

figcaption {
    margin-top: 0.6rem;
    font-size: 0.9rem;
    line-height: 1.4;
    color: #333333;
}