/* Betrachter für die blätterbaren Ausgaben des "Bürger im bunten Rock".
   Farben in Anlehnung an die Website (#18415d). */

:root {
    --bar: #18415d;
    --bar-text: #ffffff;
    --stage: #2b2b2b;
    --accent: #c8a45c;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    height: 100%;
    background: var(--stage);
    color: #e9e9e9;
    font-family: "Helvetica Neue", Arial, sans-serif;
}

body {
    display: grid;
    grid-template-rows: auto 1fr auto;
    overflow: hidden;
}

.bar {
    position: relative;
    z-index: 20;
    display: flex;
    flex-wrap: wrap;
    gap: .75rem 1rem;
    align-items: center;
    justify-content: space-between;
    padding: .6rem 1rem;
    background: var(--bar);
    color: var(--bar-text);
}

.bar-title { display: flex; align-items: baseline; gap: .75rem; min-width: 0; }
.bar-title strong { font-size: 1.05rem; }
.bar-pages { font-size: .85rem; opacity: .8; white-space: nowrap; }

.bar-actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }

.bar button,
.bar a {
    font: inherit;
    font-size: .9rem;
    color: var(--bar-text);
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .25);
    border-radius: 3px;
    padding: .35rem .7rem;
    text-decoration: none;
    cursor: pointer;
}

.bar button:hover,
.bar a:hover { background: rgba(255, 255, 255, .22); }
.bar button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #22303a; }

.bar :focus-visible,
.thumbs :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.search { position: relative; }
.search input {
    font: inherit;
    font-size: .9rem;
    padding: .35rem .7rem;
    border-radius: 3px;
    border: 1px solid rgba(255, 255, 255, .25);
    background: rgba(255, 255, 255, .12);
    color: var(--bar-text);
    width: 15rem;
    max-width: 40vw;
}
.search input::placeholder { color: rgba(255, 255, 255, .65); }

.search-results {
    position: absolute;
    top: calc(100% + .3rem);
    left: 0;
    right: 0;
    max-height: 50vh;
    overflow-y: auto;
    background: #fff;
    color: #222;
    border-radius: 3px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .35);
    z-index: 20;
}
.search-results button {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: 0;
    border-bottom: 1px solid #eee;
    color: inherit;
    padding: .5rem .7rem;
    font-size: .85rem;
    cursor: pointer;
}
.search-results button:hover { background: #f3f6f8; }
.search-results mark { background: var(--accent); }
.search-results .empty { padding: .6rem .7rem; font-size: .85rem; color: #666; }

/* Sicherheitsnetz: kein waagerechtes Scrollen, falls die Buchbreite doch
   einmal die Bühne übersteigt. */
.stage {
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    padding: 1rem;
}

.book-holder {
    max-width: 100%;
    transition: width .2s ease;
}

.book {
    max-width: 100%;
    transition: transform .3s ease;
}

/* Titel- und Rückseite stehen als Einzelseite in einer Doppelseiten-Fläche.
   Das Titelblatt liegt rechts, die Rückseite links – beide werden in die Mitte
   gerückt, aber in entgegengesetzte Richtungen. */
.stage.is-single.is-first .book { transform: translateX(-25%); }
.stage.is-single.is-last .book { transform: translateX(25%); }
.stage.is-portrait .book { transform: none; }
.book img { display: block; width: 100%; height: 100%; }

.nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    font-size: 2rem;
    line-height: 1;
    width: 2.4rem;
    height: 3.6rem;
    color: #fff;
    background: rgba(0, 0, 0, .35);
    border: 0;
    border-radius: 3px;
    cursor: pointer;
}
.nav:hover { background: rgba(0, 0, 0, .55); }
.nav-prev { left: .5rem; }
.nav-next { right: .5rem; }

.loading { position: absolute; font-size: .95rem; opacity: .8; }

/* Ohne diese Regel gewinnt display:grid gegen das [hidden]-Attribut */
.thumbs[hidden] { display: none; }

/* Innerhalb der Bühne statt über dem ganzen Fenster: so beginnt die Liste
   unter der Kopfleiste und endet über dem Seitenregler, statt darunter zu
   verschwinden. */
.thumbs {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 220px;
    padding: 1rem .75rem;
    overflow-y: auto;
    background: rgba(0, 0, 0, .55);
    backdrop-filter: blur(4px);
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: .5rem;
    align-content: start;
    z-index: 15;
}
.thumbs button { padding: 0; border: 2px solid transparent; background: none; cursor: pointer; }
.thumbs button[aria-current="true"] { border-color: var(--accent); }
.thumbs img { width: 100%; display: block; }
.thumbs span { display: block; text-align: center; font-size: .7rem; color: #ddd; }

.bar-footer { gap: 1rem; }
#pageSlider { flex: 1; min-width: 8rem; accent-color: var(--accent); }
.hint { font-size: .8rem; opacity: .7; }

@media (max-width: 900px) {
    /* Gewischt wird direkt auf der Seite; die Pfeiltasten würden sie nur verdecken */
    .nav { display: none; }
    .stage { padding: .5rem; }
}

@media (max-width: 700px) {
    .bar { padding: .45rem .6rem; gap: .4rem .5rem; }
    .bar-title { width: 100%; }
    .bar-title strong { font-size: .95rem; }
    .bar-actions { width: 100%; flex-wrap: nowrap; }
    .bar button, .bar a { font-size: .8rem; padding: .3rem .5rem; white-space: nowrap; }
    .hint { display: none; }
    .thumbs { width: 150px; grid-template-columns: 1fr; }
    .search { flex: 1; min-width: 0; }
    .search input { width: 100%; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
    .stf__item { transition: none !important; }
}
