/* Romanfarben und Farbschema */

:root {
    color-scheme: light dark;

    /* Hellmodus */
    --wiese-color: #222222;
    --wueste-color: #174A85;
    --page-background: #ffffff;
    --page-text: #222222;
    --footer-background: #ffffff;
    --footer-text: #000000;
    --footer-border: #cccccc;
}

/* Dunkelmodus */
@media (prefers-color-scheme: dark) {
    :root {
        --wiese-color: #e5e5e5;
        --wueste-color: #83b9f0;
        --page-background: #121212;
        --page-text: #e5e5e5;
        --footer-background: #222222;
        --footer-text: #e5e5e5;
        --footer-border: #555555;
    }
}

/* Gesamte Website */
body {
    background: var(--page-background);
    color: var(--page-text);
}

/* Grundlayout */
body {
    white-space: normal;
    font-family: system-ui, sans-serif;
    padding-bottom: 40px;
}

main {
    padding: 20px 24px;
}

main p {
    white-space: pre-line;
}

/* Kapiteltext */
.chapter-text {
    font-family: system-ui, sans-serif;
    font-size: 1rem;
    line-height: 1.6;
}

.chapter-text h3 {
    margin: 1em 0 0 !important;
}

.chapter-text h3 + ul {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding-top: 0 !important;
}

.chapter-text h3 + ul > li:first-child {
    margin-top: 0 !important;
}

.chapter-text ul {
    padding-left: 1.5em;
}

.chapter-text ul + h3 {
    margin-top: 1em !important;
}

/* Action Units */
.chapter-text p {
    margin: 0 0 1em;
    white-space: pre-line;
}

/* Wiese: ausgewogene Erzählung */
.chapter-text .wiese {
    color: var(--wiese-color);
}

/* Wüste: Handlung oder Rede ohne Gegenpol */
.chapter-text .wueste {
    color: var(--wueste-color);
}

/* Abstand zwischen Absatz und Liste entfernen */
.chapter-text p:has(+ ul) {
    margin-bottom: 0 !important;
}

.chapter-text p + ul {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

.chapter-text p + ul > li:first-child {
    margin-top: 0 !important;
}

/* Fester Footer mit vier Elementen */
.site-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;

    display: grid;
    grid-template-columns: 1fr 1fr 2fr 1fr;
    align-items: center;

    padding: 12px 16px;
    background: var(--footer-background);
    border-top: 1px solid var(--footer-border);
}

/* Footer-Links */
.site-footer a {
    color: var(--footer-text);
    text-decoration: none;
    text-align: center;
}

/* Linksbündiger Zurück-Pfeil */
.site-footer a:first-child {
    text-align: left;
}

/* Rechtsbündiger Weiter-Pfeil */
.site-footer a:last-child {
    text-align: right;
}

.roman-toc {
    line-height: 1.8;
}

.toc-entry {
    margin: 0;
}

.toc-level-1 {
    font-size: 1.3em;
    font-weight: bold;
    margin-top: 1.5em;
}

.toc-level-2 {
    padding-left: 1.5em;
    font-weight: bold;
    margin-top: 0.5em;
}

.toc-level-3 {
    padding-left: 3em;
}

.roman-toc a {
    color: #06c;
    text-decoration: underline;
}

.roman-toc a:hover {
    color: #004080;
}

/* Lesefortschritt */

.reading-progress {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 1.5rem 0;
}

#lesefortschritt {
    font-size: 0.9rem;
}

#lesefortschritt-reset {
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
}

/* Kapitel-Checkboxen */

.toc-read {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.toc-read input[type="checkbox"] {
    flex: 0 0 auto;
    width: 1rem;
    height: 1rem;
    cursor: pointer;
}

.toc-read a {
    flex: 0 1 auto;
}

.faksimile-link {
    display: inline;
    margin-left: 0.4em;
    text-decoration: none;
    font-size: 1.1em;
    opacity: 0.7;
}

.faksimile-link:hover {
    opacity: 1;
}