﻿/* ===== book-base.css (BookCore) – changes rarely =====
   Frame of the book reader: base layout, blue bar, arrow row, swiping and sliding, search field, list rows, text.
   Load order in index.html: book-base.css, book-pages.css, book-tools.css, then the app's css. */

/* BookCore: Stil des Buch-Lesers (aus Gebete übernommen). In index.html der App nach commontools.css und fonts.css einbinden. */

/* ===== base layout ===== */
:root {
    --bar: #1e5fbf;
    --on-bar: #ffffff;
    --text: #1f2328;
    --muted: #5b6470;
    --line: #e3e6ea;
    --red: #b3261e;
    --font-ui: 'Source Sans 3', system-ui, -apple-system, 'Segoe UI', sans-serif;
    /* CommonTools-Teile (Info-Menü, Fenster, Fußzeile) in der Schrift der App */
    --ct-font: var(--font-ui);
    --font-text: 'Source Serif 4', Georgia, 'Times New Roman', serif;
    --text-size: 20px;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
}

body {
    background: #e9edf2;
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 16px;
}

/* The app fills the screen above the footer: the bar stays, only the middle area scrolls.
   The footer (version) is outside the page, at the bottom right of the browser window, 24 px high. */
.page {
    position: relative;
    height: calc(100vh - 24px);
    height: calc(100dvh - 24px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #ffffff;
}

/* PC: the app as a page in a frame, centered, 720 px wide, full window height with a small margin. */
@media (min-width: 760px) {
    .page {
        max-width: 720px;
        height: calc(100vh - 40px);
        height: calc(100dvh - 40px);
        margin: 16px auto 0;
        border: 1px solid #cfd5dd;
        border-radius: 18px;
        box-shadow: 0 4px 24px rgba(20, 24, 31, 0.08);
    }
}

.top-bar {
    flex: 0 0 auto;
}

.content-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    /* Thin scrollbar inside the frame. */
    scrollbar-width: thin;
    scrollbar-color: #b9c1cc transparent;
}

    .content-scroll::-webkit-scrollbar {
        width: 8px;
    }

    .content-scroll::-webkit-scrollbar-thumb {
        background: #b9c1cc;
        border-radius: 4px;
    }

    .content-scroll::-webkit-scrollbar-track {
        background: transparent;
    }

.top-bar {
    background: var(--bar);
    color: var(--on-bar);
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2px;
    padding: 0 6px;
}

.top-bar-title {
    font-size: 20px;
    font-weight: 600;
}

/* Titel und "Info ▾" direkt nebeneinander; der Bereich nimmt den freien Platz (wie früher der Titel allein),
   damit links ☰ 🏠 Titel Info und rechts die Schnell-Knöpfe und die Flagge zusammen stehen */
.top-bar-titlebox {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 2px;
    min-width: 0;
}

    .top-bar-titlebox .top-bar-title {
        flex: 0 1 auto;
    }

.top-bar-info {
    color: var(--on-bar);
    font-size: 15px;
}

/* Handy: schmalere Knöpfe, kleinerer Titel, "Info" nur als ⓘ; außerhalb der Startseiten ohne Flagge.
   Am PC (ab 760 px) bleibt alles wie bisher. */
@media (max-width: 759px) {
    .top-bar {
        gap: 0;
        padding: 0 4px;
    }

        .top-bar > .icon-btn {
            width: 28px;
        }

    .top-bar-title {
        font-size: 17px;
    }

    .top-bar-info {
        font-size: 0;
        padding: 6px 4px;
    }

        .top-bar-info::before {
            content: "ⓘ";
            font-size: 20px;
        }

    .top-bar--inner .ct-lang {
        display: none;
    }
}

.content {
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    box-sizing: border-box;
    padding: 16px;
}

.loading-text,
.placeholder-text {
    color: var(--muted);
    font-size: 17px;
}

/* Footer with the version (CommonTools.AppFooter): at the bottom right of the browser window, outside the page frame */
.ct-footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 24px;
    box-sizing: border-box;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    font-size: 12px;
    color: var(--muted);
}

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ===== Icon buttons in the bar (home, back) ===== */
.icon-btn {
    width: 34px;
    height: 44px;
    flex: 0 0 auto;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

    .icon-btn svg {
        fill: none;
        stroke: currentColor;
        stroke-width: 2.2;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    .icon-btn:hover {
        background: rgba(255, 255, 255, 0.15);
    }

    .icon-btn:focus-visible {
        outline: 2px solid #ffffff;
        outline-offset: 2px;
    }

/* The title is a button (reload), drawn like plain text. */
button.top-bar-title {
    border: 0;
    background: transparent;
    color: inherit;
    font-family: var(--font-ui);
    text-align: left;
    padding: 0 0 0 4px;
    cursor: pointer;
    height: 44px;
}

.top-bar-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.page-info {
    margin: 0 0 8px;
    font-size: 14px;
    color: var(--muted);
}

/* Quick button of the open view */
.icon-btn.active {
    background: rgba(255, 255, 255, 0.25);
}

/* ===== Arrow row at the top of every view ===== */
.arrow-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: -4px 0 8px;
    min-height: 48px;
}

/* ===== New page slides in after ‹ › or swiping (the old one was moved out by the finger, wwwroot/js/swipe.js) ===== */
@keyframes slide-in-from-right {
    from {
        transform: translateX(100%);
    }

    to {
        transform: none;
    }
}

@keyframes slide-in-from-left {
    from {
        transform: translateX(-100%);
    }

    to {
        transform: none;
    }
}

.content.slide-next {
    animation: slide-in-from-right 0.22s ease-out;
}

.content.slide-prev {
    animation: slide-in-from-left 0.22s ease-out;
}

@media (prefers-reduced-motion: reduce) {
    .content.slide-next,
    .content.slide-prev {
        animation: none;
    }
}

.content-scroll {
    position: relative;
    overflow-x: hidden;
    /* The browser scrolls up/down and zooms with two fingers here; sideways movements go to swipe.js. */
    touch-action: pan-y pinch-zoom;
}

/* Neighbour pages for swiping: hidden until swipe.js shows them at the visible part, just outside the edge. */
.peek {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 0;
    overflow: hidden;
    visibility: hidden;
    background: #ffffff;
    pointer-events: none;
}

.nav-btn-static {
    box-sizing: border-box;
}

.search-static {
    display: flex;
    align-items: center;
    overflow: hidden;
    white-space: nowrap;
    color: var(--muted);
}

    .search-static.has-text {
        color: var(--text);
    }

.search-clear-static {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== Search field in the arrow row ===== */
.search-box {
    flex: 1 1 140px;
    min-width: 0;
    max-width: 320px;
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 10px;
    fill: none;
    stroke: var(--muted);
    stroke-width: 2;
    stroke-linecap: round;
    pointer-events: none;
}

.search-input {
    width: 100%;
    min-width: 0;
    height: 38px;
    box-sizing: border-box;
    padding: 0 32px 0 32px;
    border: 1px solid #c9ced6;
    border-radius: 19px;
    font-family: var(--font-ui);
    font-size: 16px;
    color: var(--text);
    background: #ffffff;
}

    .search-input:focus {
        outline: none;
        border-color: var(--bar);
        box-shadow: 0 0 0 2px rgba(30, 95, 191, 0.2);
    }

.search-clear {
    position: absolute;
    right: 4px;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 15px;
    background: transparent;
    color: var(--muted);
    font-size: 14px;
    cursor: pointer;
}

    .search-clear:hover {
        background: #f1f4f8;
        color: var(--text);
    }

mark.hit {
    background: #ffe27a;
    color: inherit;
    border-radius: 2px;
    padding: 0 1px;
}

.nav-label {
    padding: 0 4px;
    text-align: center;
    white-space: nowrap;
    font-size: 15px;
    font-weight: 600;
    color: var(--bar);
}

/* "Nr. …" as a button: click opens the field for jumping to a number */
button.nav-label--btn {
    border: 0;
    background: transparent;
    font-family: var(--font-ui);
    border-radius: 6px;
    cursor: pointer;
    height: 32px;
}

    button.nav-label--btn:hover {
        background: rgba(30, 95, 191, 0.08);
        text-decoration: underline dotted;
    }

.nav-jump {
    width: 6.5em;
    height: 30px;
    box-sizing: border-box;
    border: 1.5px solid var(--bar);
    border-radius: 6px;
    padding: 0 6px;
    font: 600 15px var(--font-ui);
    color: var(--bar);
    text-align: center;
}

.nav-hint {
    color: #c0392b;
}

/* ===== Previous / next on the text page ===== */
.prayer-nav {
    display: flex;
    align-items: center;
    gap: 2px;
}

.nav-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid #c9ced6;
    border-radius: 20px;
    background: #ffffff;
    color: var(--bar);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

    .nav-btn svg {
        fill: none;
        stroke: currentColor;
        stroke-width: 2.2;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    .nav-btn:hover:not(:disabled) {
        background: #eef3fb;
        border-color: var(--bar);
    }

    .nav-btn:disabled {
        color: #b9c1cc;
        cursor: default;
    }

    .nav-btn:focus-visible {
        outline: 2px solid var(--bar);
        outline-offset: 2px;
    }

/* ===== Rows in lists ===== */
.text-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.text-row {
    border-top: 1px solid #eef0f3;
    display: flex;
    align-items: flex-start; /* Stern oben, auf Höhe der ersten Zeile */
}

.text-row-link {
    flex: 1;
    min-width: 0;
    min-height: 60px;
    padding: 10px 4px 10px 0;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    color: var(--text);
    text-decoration: none;
}

    .text-row-link:hover .text-row-title {
        color: var(--bar);
    }

.text-row-label {
    flex: 0 0 auto;
    min-width: 52px;
    padding-top: 3px;
    font-size: 15px;
    font-weight: 600;
    color: var(--bar);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

/* Wortanzahl unter der Nr., z. B. "(186 w.)" */
.text-row-words {
    margin-top: 2px;
    font-size: 11px;
    white-space: nowrap;
    font-weight: 400;
    color: var(--muted);
}

.text-row-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* höchstens 2 Zeilen; längerer Text endet mit "…" am Ende der 2. Zeile */
.text-row-title {
    font-family: var(--font-text);
    font-size: 17px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
}

.text-row-initial {
    font-weight: 600;
}

    /* Marked texts (IBookExtension.IsMarked, e.g. Gebete: female): red initial */
    .text-row-initial.marked {
        color: var(--red);
    }

/* 3. Zeile (Kategorie · Autor): immer einzeilig */
.text-row-info {
    font-size: 13px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Handy: Spalte der Nr. schmaler, kleinerer Abstand zum Text (PC bleibt wie bisher) */
@media (max-width: 759px) {
    .text-row-link {
        gap: 4px;
    }

    /* so breit wie "(1407 w.)", die längste Wortanzahl */
    .text-row-label {
        min-width: 0;
        width: 46px;
    }

    .text-row-words {
        font-size: 10.5px;
    }
}

.star-btn {
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

    .star-btn svg {
        fill: none;
        stroke: #8a929c;
        stroke-width: 1.8;
        stroke-linejoin: round;
    }

    .star-btn.on svg {
        fill: #e0a100;
        stroke: #b07d00;
    }

    .star-btn:hover {
        background: #f1f4f8;
    }

    .star-btn:focus-visible {
        outline: 2px solid var(--bar);
        outline-offset: 2px;
    }

/* ===== Prayer text ===== */
.prayer-article {
    padding-top: 4px;
}

.text-body {
    font-family: var(--font-text);
    font-size: var(--text-size);
    line-height: 1.7;
    color: var(--text);
}

    .text-body p {
        margin: 0 0 20px;
    }

/* Large initial: two lines high (top with line 1, bottom on the baseline of line 2).
   An element of its own (TextBody: span.dropcap-letter), not ::first-letter: with ::first-letter the browsers placed
   the marks of the reading mode wrongly (iPhone: one letter too far). The same in every browser: float (initial-letter only works on
   ::first-letter in Chrome). */
.text-body .dropcap-letter {
    float: left;
    font-size: 3.58em;
    line-height: 0.78;
    padding-top: 0.06em;
    margin-left: -0.04em;
    font-weight: 600;
}

.text-body p.dropcap.marked .dropcap-letter {
    color: var(--red);
}

/* Heading inside a text (e.g. Botschaften aus ʿAkká: the name of the tablet, "Die erste frohe Botschaft") */
.text-body p.blk-heading {
    text-align: center;
    font-weight: 600;
    font-size: 1.05em;
    line-height: 1.4;
    margin: 30px 0 14px;
}

    .text-body p.blk-heading:first-child {
        font-size: 1.2em;
        margin-top: 4px;
    }

/* Salutation of a text (BookOptions.Salutation, e.g. Die Verborgenen Worte "O Sohn des Geistes!") */
.text-body p.blk-salutation {
    font-style: italic;
    margin-bottom: 4px;
}

/* Own label of a text shown italic and red (BookOptions.Labels, e.g. Die Verborgenen Worte "AV", "PN") */
.label-marked {
    font-style: italic;
    color: var(--red);
}

.blk-paragraph::after {
    content: "";
    display: table;
    clear: both;
}

/* With "Papier auf allen Seiten" the hint box lets the paper shine through (only lighter, with a thin border) */
.paper-all .text-body p.blk-hint {
    background: rgba(255, 255, 255, 0.35);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.text-body p.blk-hint {
    padding: 10px 14px;
    background: #f1f4f8;
    border-radius: 8px;
    font-family: var(--font-ui);
    font-size: 15px;
    line-height: 1.45;
    color: #3d444d;
}

.text-body p.blk-instruction {
    margin-bottom: 12px;
    font-family: var(--font-ui);
    font-style: italic;
    font-size: 16px;
    line-height: 1.5;
    color: var(--muted);
}

.text-body p.blk-invocation {
    text-align: center;
    font-style: italic;
}

.text-body p.blk-author {
    text-align: right;
    font-style: italic;
    font-size: 18px;
    color: #3d444d;
    margin-bottom: 6px;
}

.text-body p.blk-source {
    text-align: right;
    font-family: var(--font-ui);
    font-size: 13px;
    color: var(--muted);
}

.note-ref {
    font-family: var(--font-ui);
    font-size: 0.6em;
    font-weight: 600;
    color: var(--bar);
    padding: 0 1px;
}

.notes {
    margin-top: 24px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
    font-family: var(--font-ui);
    font-size: 14px;
    line-height: 1.5;
    color: #3d444d;
}

    .notes h2 {
        margin: 0 0 6px;
        font-size: 13px;
        font-weight: 600;
        letter-spacing: 0.06em;
        text-transform: uppercase;
        color: var(--muted);
    }

    .notes ol {
        list-style: none;
        margin: 0;
        padding: 0;
    }

    .notes li {
        margin-bottom: 4px;
    }

.note-num {
    font-weight: 600;
    color: var(--bar);
}

.note-kind {
    color: var(--muted);
}
