/* Zentrales Stylesheet fuer die Buecheruebersicht und (spaeter) die Buchansicht. */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 1.5rem 1rem;
    font-family: Georgia, 'Times New Roman', serif;
    background: #f5f1e8;
    color: #3a332a;
}

h1 {
    text-align: center;
    font-weight: normal;
    margin: 0 0 2rem;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* -- Vorstellung / Einleitung (index.php) -- */

.vorstellung {
    display: flex;
    align-items: center;
    gap: 2rem;
    max-width: 900px;
    margin: 0 auto 2.5rem;
}

.vorstellung-bild {
    flex: 0 0 220px;
}

.vorstellung-bild img {
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.vorstellung-text {
    flex: 1;
    min-width: 0;
}

.vorstellung-name {
    font-size: 1.15rem;
    font-weight: bold;
    margin: 0 0 0.6rem;
}

@media (max-width: 600px) {
    .vorstellung {
        flex-direction: column;
        text-align: center;
    }

    .vorstellung-bild {
        flex: 0 0 auto;
        max-width: 220px;
        margin: 0 auto;
    }
}

/* -- Buecheruebersicht (index.php) -- */

.buecher-liste {
    list-style: none;
    margin: 0 auto;
    padding: 0;
    max-width: 1100px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.5rem;
}

.buch-karte {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.buch-karte:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

.buch-link {
    text-decoration: none;
    color: inherit;
}

.buch-cover {
    width: 100%;
    height: 260px;
    object-fit: cover;
    background: #ddd;
}

.buch-cover-leer {
    width: 100%;
    height: 260px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e0dcd0;
    color: #777;
    font-style: italic;
    text-align: center;
    padding: 1rem;
}

.buch-karte h2 {
    margin: 0.75rem 1rem 0.25rem;
    font-size: 1.2rem;
}

.buch-beschreibung {
    margin: 0 1rem 0.5rem;
    font-size: 0.95rem;
    flex-grow: 1;
}

.buch-meta {
    margin: 0 1rem 1rem;
    font-size: 0.85rem;
    color: #777;
}

@media (max-width: 480px) {
    .buecher-liste {
        grid-template-columns: 1fr;
    }

    .buch-cover,
    .buch-cover-leer {
        height: 200px;
    }
}

/* -- Einzelseiten-Ansicht (buch.php) -- */

.buch-kopf {
    max-width: 900px;
    margin: 0 auto 1rem;
    display: flex;
    align-items: baseline;
    gap: 1rem;
    flex-wrap: wrap;
}

.buch-kopf h1 {
    font-size: 1.4rem;
    margin: 0;
    text-align: left;
}

.zurueck-link {
    color: #6b5d45;
    text-decoration: none;
    white-space: nowrap;
}

.zurueck-link:hover {
    text-decoration: underline;
}

.buch-seite {
    max-width: 1400px;
    margin: 0 auto 1rem;
    text-align: center;
}

.doppelseite {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 0.75rem;
}

.seiten-container {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Steht nur eine Seite in der Doppelseite (z.B. Titelseite), nicht auf volle Breite ziehen. */
.seiten-container:only-child {
    flex: 0 1 520px;
}

.seiten-bild {
    max-width: 100%;
    max-height: 78vh;
    margin: 0 auto;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
    background: #fff;
    cursor: zoom-in;
    transition: opacity 0.15s ease;
}

.seiten-bild:hover {
    opacity: 0.92;
}

.seiten-anzeige {
    margin: 0.75rem 0 0;
    color: #6b5d45;
    font-size: 0.9rem;
}

/* Digitalisierter Text zu einer Seite (z.B. Hochzeitsbuch) */

.seiten-text-umschalter {
    margin-top: 0.6rem;
    width: 100%;
    max-width: 420px;
    font-size: 0.9rem;
}

.seiten-text-umschalter summary {
    cursor: pointer;
    color: #6b5d45;
    font-style: italic;
    text-align: center;
}

.seiten-text-umschalter summary:hover {
    color: #4a4030;
}

.seiten-text {
    margin-top: 0.5rem;
    padding: 0.75rem 1rem;
    background: #fffdf7;
    border: 1px solid #ddd6c4;
    border-radius: 6px;
    white-space: pre-wrap;
    max-height: 40vh;
    overflow-y: auto;
    text-align: left;
    font-family: Georgia, 'Times New Roman', serif;
    line-height: 1.5;
}

/* Popup mit Seite in Originalgroesse */

#bild-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    overflow: auto;
    padding: 2.5rem 1rem 1rem;
    z-index: 1000;
    text-align: center;
}

#bild-overlay.sichtbar {
    display: block;
}

#bild-overlay img {
    max-width: none;
    height: auto;
    margin: 0 auto;
    box-shadow: 0 0 24px rgba(0, 0, 0, 0.6);
    cursor: default;
}

#bild-overlay-schliessen {
    position: fixed;
    top: 0.75rem;
    right: 1rem;
    font-size: 2.2rem;
    line-height: 1;
    color: #fff;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1001;
    padding: 0.25rem 0.5rem;
}

body.overlay-offen {
    overflow: hidden;
}

@media (max-width: 700px) {
    .doppelseite {
        flex-direction: column;
        align-items: center;
        gap: 1.25rem;
    }

    .seiten-container:only-child {
        flex: 0 1 auto;
        width: 100%;
    }

    .seiten-bild {
        max-height: 55vh;
    }
}

.blaetter-navigation {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.nav-button {
    display: inline-block;
    padding: 0.5rem 1.1rem;
    background: #6b5d45;
    color: #fff;
    text-decoration: none;
    border-radius: 5px;
    white-space: nowrap;
}

.nav-button:hover {
    background: #574c39;
}

.nav-button-deaktiviert {
    background: #c9c2b3;
    color: #8a8371;
    cursor: default;
}

.sprung-formular {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.sprung-formular input[type="number"] {
    width: 4.5rem;
    padding: 0.3rem;
    font-family: inherit;
}

.sprung-formular button {
    padding: 0.35rem 0.9rem;
    font-family: inherit;
    cursor: pointer;
}

.fehler-seite {
    max-width: 600px;
    margin: 3rem auto;
    text-align: center;
}

@media (max-width: 480px) {
    .blaetter-navigation {
        justify-content: center;
    }
}
