/* =============================================================
   Songbook (/songbook.php)

   Wird zusätzlich zu profil.css und album.css geladen und baut
   darauf auf. Hier steht nur, was das Buch ausmacht.

   Die Buchoptik hängt an der Klasse .sb-buch--blaetterbar, die
   erst songbook.js setzt. Ohne JavaScript bleiben die Seiten
   schlicht untereinander stehen und sind vollständig lesbar.
   ============================================================= */

/* ---------- Bühne: der Tisch, auf dem das Buch liegt ---------- */

.sb-buehne {
  padding: 2.5rem 0 3.5rem;
  color: var(--al-nacht-text);
  background-color: #120d0b;
  /* Die Deckschicht ist nur so dicht, dass der Tisch noch zu
     sehen ist. Lesetext liegt hier nirgends direkt auf dem Foto:
     Er steht auf dem Papier oder auf einer eigenen Fläche. */
  background-image:
    linear-gradient(rgba(10, 7, 6, 0.6), rgba(10, 7, 6, 0.78)),
    url("/images/album/tisch.jpg");
  background-position: center;
  background-size: cover;
}

/* ---------- Kopf der Seite ----------
   Dahinter liegt eine Aufnahme aus der Zeit: Songbook, Mikrofon
   und Neonlicht. Das Bild bleibt gut sichtbar, weil der Text
   nicht darauf, sondern auf einer Tafel darüber steht. */

.sb-kopf {
  padding: 0 0 clamp(2rem, 5vw, 3.5rem);
  color: var(--al-nacht-text);
  background-color: #15100e;
  border-bottom: 6px solid var(--al-rot);
}

/* Das Foto über dem Kopf: volle Breite, volle Helligkeit, nichts
   darüber. Die Höhe ist gedeckelt, damit auf einem flachen
   Fenster nicht nur Bild zu sehen ist. */
.sb-kopf__bild {
  display: block;
  width: 100%;
  height: clamp(11rem, 32vw, 26rem);
  object-fit: cover;
  object-position: center 38%;
  border-bottom: 3px solid var(--al-rot);
}

/* Die Tafel rückt unter dem Bild wieder nach oben. */
.sb-kopf .wrap {
  padding-top: clamp(1.6rem, 4vw, 2.6rem);
}

.sb-kopf__tafel {
  padding: 1.8rem clamp(1.1rem, 4vw, 2.2rem) 1.7rem;
  /* Warmes Schwarz wie die Tafel im Albumkopf, nicht Blau:
     Sonst übertönt die Tafel das Foto, das darunter liegt. */
  background: rgba(12, 8, 7, 0.9);
  border: 3px solid var(--al-rot);
  border-radius: 0 14px 14px 14px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.55);
}

.sb-kopf h1 {
  margin: 0 0 0.2rem;
  font-size: clamp(1.9rem, 6vw, 3.2rem);
  font-weight: 800;
  line-height: 1.1;
  text-transform: uppercase;
  color: #f6ecd9;
  text-shadow: 3px 3px 0 var(--al-rot);
}

.sb-kopf .album-lead,
.sb-kopf p {
  color: #f6ecd9;
}

.album .sb-kopf a,
.sb-kopf a {
  color: #8fd9e0;
}

.sb-kopf__zurueck {
  margin-top: 1.4rem;
}

/* ---------- Bedienleiste ---------- */

.sb-leiste {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem 1rem;
  align-items: center;
  justify-content: space-between;
  max-width: 62rem;
  margin: 0 auto 1.6rem;
}

/* Dieselbe Leiste noch einmal unter dem Buch: Wer einen langen
   Text zu Ende gelesen hat, soll dort weiterblättern können und
   nicht erst zurückscrollen müssen. */
.sb-leiste--unten {
  margin: 1.6rem auto 0;
}

/* Auch hier: ".album a" ist spezifischer als ".sb-knopf" und
   würde die Linkfarbe durchsetzen. */
.album .sb-knopf,
.sb-knopf {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
  /* 48 Pixel hoch: so groß, dass der Knopf auch mit zittriger Hand
     oder am Handy sicher zu treffen ist. */
  min-height: 48px;
  padding: 0.7rem 1.3rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  color: #fff8ec;
  background: var(--al-rot);
  border: 3px solid #fff8ec;
  border-radius: 0 10px 10px 10px;
}

.album .sb-knopf:hover,
.album .sb-knopf:focus {
  color: #17110f;
  background: #fff8ec;
}

/* Abgeschaltet am Anfang und am Ende des Buches. Nicht nur blass:
   Der Zustand steht zusätzlich als aria-disabled im HTML, damit er
   auch angesagt wird. */
.sb-knopf--aus {
  opacity: 0.45;
  cursor: default;
  pointer-events: none;
}

.sb-zaehler {
  /* Eigene Fläche, damit die Seitenzahl nicht auf dem Foto des
     Tisches liegt, sondern auf festem Grund. */
  padding: 0.45rem 0.9rem;
  background: rgba(10, 7, 6, 0.8);
  border-radius: 3px;
  margin: 0;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--al-nacht-leise);
}

/* ---------- Das Buch ---------- */

.sb-buch {
  max-width: 62rem;
  margin: 0 auto;
  /* Die Perspektive braucht es nur, wenn wirklich geblättert wird;
     sie schadet aber auch sonst nicht. */
  perspective: 1800px;
}

.sb-seite {
  margin: 0 0 2rem;
}

/* Sobald geblättert wird, steht immer nur eine Seite da – dann
   braucht es auch keinen Abstand zur nächsten mehr. */
.sb-buch--blaetterbar .sb-seite {
  margin-bottom: 0;
}

/* Das Blatt: warmes Papier, oben ein angedeuteter Falz zur Mitte
   hin, unten ein Schatten, als läge es auf dem Tisch. */
.sb-blatt {
  position: relative;
  padding: 2.8rem 2.6rem 2.2rem;
  color: #241c14;
  background-color: #f7eeda;
  background-image:
    linear-gradient(90deg, rgba(120, 90, 50, 0.18), rgba(120, 90, 50, 0) 7%),
    linear-gradient(-90deg, rgba(120, 90, 50, 0.12), rgba(120, 90, 50, 0) 5%);
  border: 1px solid #c8b492;
  border-radius: 2px 10px 10px 2px;
  box-shadow:
    0 2px 0 #e3d6bb,
    0 4px 0 #d9ccb1,
    0 6px 0 #cfc2a7,
    14px 18px 40px rgba(0, 0, 0, 0.55);
}

.sb-blatt__kopf {
  margin-bottom: 1.8rem;
  padding-bottom: 1.2rem;
  border-bottom: 2px solid rgba(36, 28, 20, 0.25);
}

.sb-blatt__nummer {
  margin: 0;
  font-size: 2.6rem;
  font-weight: 800;
  line-height: 1;
  color: var(--al-rot);
}

.sb-blatt__titel {
  margin: 0.2rem 0 0.6rem;
  font-size: clamp(1.5rem, 4vw, 2.3rem);
  font-weight: 800;
  line-height: 1.15;
  text-transform: uppercase;
  color: #241c14;
}

/* Der Fokusrahmen beim Blättern: Die Überschrift ist kein Knopf,
   bekommt den Fokus aber trotzdem. Ohne sichtbaren Rahmen wüsste
   niemand, wo er gerade steht. */
.sb-blatt__titel:focus-visible {
  outline: 3px solid var(--al-rot);
  outline-offset: 6px;
}

.sb-blatt__ueber {
  max-width: 34rem;
  margin: 0 0 0.8rem;
  font-style: italic;
  color: #4a3b29;
}

.sb-blatt__hoeren {
  margin: 0;
  font-weight: 700;
}

.album .sb-blatt__hoeren a {
  color: #8a2b14;
}

.album .sb-blatt__hoeren a:hover,
.album .sb-blatt__hoeren a:focus {
  color: #241c14;
}

.sb-blatt__trenner {
  margin: 0 0.5rem;
  color: #8a7458;
}

.sb-blatt__text {
  font-size: 1.08rem;
  line-height: 1.8;
}

.sb-blatt__text p {
  margin: 0 0 1.6rem;
  /* Eine Strophe soll nicht zwischen zwei Spalten zerrissen
     werden – im gedruckten Songbook macht das auch niemand. */
  break-inside: avoid;
}

.sb-blatt__text p:last-child {
  margin-bottom: 0;
}

/* Lange Texte zweispaltig, aber erst ab einer Breite, bei der eine
   Spalte noch genug Zeichen trägt. Darunter wäre jede Zeile ein
   Wortfetzen. */
@media (min-width: 56rem) {
  .sb-blatt--zweispaltig .sb-blatt__text {
    column-count: 2;
    column-gap: 3.5rem;
    /* Die Linie in der Mitte ist der Falz des Buches. */
    column-rule: 1px solid rgba(36, 28, 20, 0.22);
  }
}

.sb-blatt__fehlt {
  padding: 1rem 1.2rem;
  border: 2px dashed #8a7458;
  border-radius: 0 10px 10px 10px;
}

.sb-blatt__fuss {
  margin: 2.2rem 0 0;
  padding-top: 1rem;
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: center;
  color: #8a7458;
  border-top: 1px solid rgba(36, 28, 20, 0.2);
}

/* ---------- Die Coverseite ---------- */

.sb-blatt--cover {
  display: grid;
  gap: 2rem;
  align-items: center;
  text-align: center;
}

@media (min-width: 46rem) {
  .sb-blatt--cover {
    grid-template-columns: 1fr 1fr;
    text-align: left;
  }
}

.sb-cover {
  width: 100%;
  max-width: 24rem;
  height: auto;
  margin: 0 auto;
  border: 3px solid #241c14;
  border-radius: 2px;
  box-shadow: 10px 10px 0 rgba(36, 28, 20, 0.25);
}

.sb-cover__titel {
  margin: 0 0 0.3rem;
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  font-weight: 800;
  text-transform: uppercase;
  color: #241c14;
}

.sb-cover__titel:focus-visible {
  outline: 3px solid var(--al-rot);
  outline-offset: 6px;
}

.sb-cover__wer {
  margin: 0 0 1.2rem;
  font-weight: 700;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: #8a2b14;
}

/* ---------- Umblättern ----------
   Keine echte 3D-Drehung des Papiers: Die sähe bei langen Texten
   albern aus und kostet auf schwachen Geräten spürbar Leistung.
   Stattdessen kippt die neue Seite kurz aus der Bindung heraus
   herein – von rechts beim Vorblättern, von links zurück. */

@keyframes sb-weiter {
  from { opacity: 0; transform: rotateY(-14deg) translateX(3%); }
  to   { opacity: 1; transform: none; }
}

@keyframes sb-zurueck {
  from { opacity: 0; transform: rotateY(14deg) translateX(-3%); }
  to   { opacity: 1; transform: none; }
}

.sb-buch--blaetterbar .sb-seite[data-richtung="weiter"] {
  transform-origin: left center;
  animation: sb-weiter 0.35s ease-out;
}

.sb-buch--blaetterbar .sb-seite[data-richtung="zurueck"] {
  transform-origin: right center;
  animation: sb-zurueck 0.35s ease-out;
}

/* ---------- Inhaltsverzeichnis ---------- */

.sb-inhalt {
  margin: 1.5rem 0 2.5rem;
  padding: 0;
  list-style: none;
  counter-reset: none;
}

.sb-inhalt li {
  margin: 0;
}

.sb-inhalt__link {
  display: flex;
  gap: 1rem;
  align-items: baseline;
  min-height: 48px;
  padding: 0.6rem 0.8rem;
  text-decoration: none;
  border-bottom: 1px dotted var(--al-leise);
}

.album .sb-inhalt__link:hover,
.album .sb-inhalt__link:focus {
  background: var(--al-creme-tief);
}

.sb-inhalt__nr {
  flex: none;
  font-weight: 800;
  color: var(--al-akzent);
}

.sb-inhalt__titel {
  flex: 1 1 auto;
  font-weight: 700;
  text-decoration: underline;
}

.sb-inhalt__dauer {
  flex: none;
  color: var(--al-leise);
}

/* ---------- Dunkle Darstellung ----------
   Ein cremefarbenes Blatt in Bildschirmgröße wäre im Dunkelmodus
   eine Lampe. Das Papier wird dann dunkel, die Schrift hell. */

:root[data-theme="dark"] .sb-blatt,
:root[data-theme="dark"] .sb-blatt--cover {
  color: #f6ecd9;
  background-color: #241c19;
  background-image: none;
  border-color: #5d4e3c;
  --rb-rand: #e9d9ba;
  --rb-rille: #6b5d4e;
  --rb-reflex: 0.2;
  box-shadow:
    0 2px 0 #1d1715,
    0 4px 0 #191413,
    0 6px 0 #151110,
    14px 18px 40px rgba(0, 0, 0, 0.6);
}

:root[data-theme="dark"] .sb-blatt__titel,
:root[data-theme="dark"] .sb-cover__titel {
  color: #f6ecd9;
}

:root[data-theme="dark"] .sb-blatt__ueber {
  color: #cbb79a;
}

:root[data-theme="dark"] .album .sb-blatt__hoeren a {
  color: #8fd9e0;
}

:root[data-theme="dark"] .album .sb-blatt__hoeren a:hover,
:root[data-theme="dark"] .album .sb-blatt__hoeren a:focus {
  color: #ff8a90;
}

:root[data-theme="dark"] .sb-blatt__kopf,
:root[data-theme="dark"] .sb-blatt__fuss {
  border-color: rgba(246, 236, 217, 0.25);
}

/* Das gedämpfte Braun der Fußzeile reicht auf dunklem Papier
   nicht: 3,8 statt der nötigen 4,5. Hier also heller. */
:root[data-theme="dark"] .sb-blatt__fuss,
:root[data-theme="dark"] .sb-blatt__trenner {
  color: #cbb79a;
}

:root[data-theme="dark"] .sb-blatt--zweispaltig .sb-blatt__text {
  column-rule-color: rgba(246, 236, 217, 0.22);
}

:root[data-theme="dark"] .sb-cover {
  border-color: #5d4e3c;
  box-shadow: 10px 10px 0 rgba(0, 0, 0, 0.5);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .sb-blatt,
  :root:not([data-theme="light"]) .sb-blatt--cover {
    color: #f6ecd9;
    background-color: #241c19;
    background-image: none;
    border-color: #5d4e3c;
    /* Schwarzes Vinyl auf dunklem Papier braucht einen hellen
       Rand, sonst ist die Platte nur ein Fleck. */
    --rb-rand: #e9d9ba;
    --rb-rille: #6b5d4e;
    --rb-reflex: 0.2;
    box-shadow:
      0 2px 0 #1d1715,
      0 4px 0 #191413,
      0 6px 0 #151110,
      14px 18px 40px rgba(0, 0, 0, 0.6);
  }

  :root:not([data-theme="light"]) .sb-blatt__titel,
  :root:not([data-theme="light"]) .sb-cover__titel {
    color: #f6ecd9;
  }

  :root:not([data-theme="light"]) .sb-blatt__ueber {
    color: #cbb79a;
  }

  :root:not([data-theme="light"]) .album .sb-blatt__hoeren a {
    color: #8fd9e0;
  }

  :root:not([data-theme="light"]) .album .sb-blatt__hoeren a:hover,
  :root:not([data-theme="light"]) .album .sb-blatt__hoeren a:focus {
    color: #ff8a90;
  }

  :root:not([data-theme="light"]) .sb-blatt__kopf,
  :root:not([data-theme="light"]) .sb-blatt__fuss {
    border-color: rgba(246, 236, 217, 0.25);
  }

  :root:not([data-theme="light"]) .sb-blatt__fuss,
  :root:not([data-theme="light"]) .sb-blatt__trenner {
    color: #cbb79a;
  }

  :root:not([data-theme="light"]) .sb-blatt--zweispaltig .sb-blatt__text {
    column-rule-color: rgba(246, 236, 217, 0.22);
  }

  :root:not([data-theme="light"]) .sb-cover {
    border-color: #5d4e3c;
    box-shadow: 10px 10px 0 rgba(0, 0, 0, 0.5);
  }
}

/* ---------- Rücksicht ---------- */

@media (prefers-reduced-motion: reduce) {
  .sb-buch--blaetterbar .sb-seite[data-richtung="weiter"],
  .sb-buch--blaetterbar .sb-seite[data-richtung="zurueck"] {
    animation: none;
  }
}

@media (prefers-contrast: more) {
  .sb-buehne {
    background-image: none;
  }

  .sb-kopf__tafel {
    background: none;
    box-shadow: none;
  }

  .sb-blatt {
    background-image: none;
    box-shadow: none;
  }

  .sb-kopf h1 {
    text-shadow: none;
  }
}

@media (forced-colors: active) {
  .sb-buehne {
    background-image: none;
  }

  .sb-kopf__tafel {
    border-color: CanvasText;
  }

  .sb-blatt {
    box-shadow: none;
  }

  .sb-knopf {
    border: 2px solid ButtonText;
  }
}

/* Gedruckt ist das Songbook wieder ein Heft: alle Seiten
   untereinander, jedes Lied auf einem eigenen Blatt. */
@media print {
  .sb-buehne,
  .sb-kopf,
  .sb-kopf__tafel {
    color: #000;
    background: none;
    border: 0;
    box-shadow: none;
  }

  .sb-leiste,
  .sb-blatt__hoeren {
    display: none;
  }

  /* Auch ausgeblendete Seiten gehören ins gedruckte Heft. */
  .sb-seite[hidden] {
    display: block !important;
  }

  .sb-seite {
    break-after: page;
  }

  .sb-blatt {
    color: #000;
    background: none;
    border: none;
    box-shadow: none;
  }

  .sb-kopf h1,
  .sb-blatt__titel,
  .sb-cover__titel {
    color: #000;
    text-shadow: none;
  }
}

/* ---------- Schmale Bildschirme ---------- */

@media (max-width: 40rem) {
  .sb-blatt {
    padding: 1.6rem 1.3rem 1.4rem;
  }

  .sb-leiste {
    gap: 0.6rem;
  }

  .sb-knopf {
    flex: 1 1 auto;
    justify-content: center;
    padding: 0.7rem 0.9rem;
  }

  .sb-zaehler {
    order: 3;
    flex: 1 0 100%;
    text-align: center;
  }
}

/* ---------- Schmuck auf dem Blatt ----------
   Dieselbe Single wie auf der Albumseite, nur kleiner und auf
   hellem Papier: Dort braucht das schwarze Vinyl keinen Schatten,
   es steht ohnehin für sich. */

.sb-blatt__marke {
  position: relative;
  width: 4.2rem;
  height: 4.2rem;
  margin: 0 0 0.6rem;
}

.sb-blatt__platte {
  display: block;
  width: 100%;
  height: 100%;
  color: #a8111b;
}

.sb-blatt__nummer {
  position: absolute;
  top: 50%;
  left: 50%;
  margin-top: -0.42rem;
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.06em;
  color: #fff4e6;
  transform: translate(-50%, -50%);
}

/* Im Kopf der Seite steht die Zierlinie auf dunkelblauem Grund. */
.sb-kopf .album-zier {
  color: #ff5a62;
}

@media (forced-colors: active) {
  .sb-blatt__platte {
    display: none;
  }

  .sb-blatt__nummer {
    position: static;
    margin: 0;
    color: CanvasText;
    transform: none;
  }

  .sb-blatt__marke {
    width: auto;
    height: auto;
  }
}

@media print {
  .sb-blatt__platte {
    display: none;
  }

  .sb-blatt__nummer {
    position: static;
    margin: 0;
    color: #000;
    transform: none;
  }
}
