/*
 * Startseite als aufgeschlagenes Buch.
 *
 * Aufbau: ein Blatt ist eine Doppelseite - linke Seite, Bund, rechte Seite.
 * Beim Umschlagen dreht sich ein Wendeblatt um den Bund; es traegt vorn die
 * alte rechte und hinten die neue linke Seite, wie Papier es tun wuerde.
 *
 * Grundregel: Werkbilder werden nie beschnitten. Jedes Blatt steht
 * vollstaendig auf der Seite - notfalls mit Luft ringsherum, wie ein
 * Passepartout. Dafuer ist ueberall "contain" gesetzt, nie "cover".
 */

/*
 * Das Buch fuellt genau den Platz unter der Kopfzeile - ohne zu rechnen,
 * wie hoch die Kopfzeile ist. Dafuer reicht die Hoehe als Flex-Kette von
 * body bis zur Buehne durch.
 */
@media (min-height: 400px) {
  body.is-buch { overflow: hidden; }
}

/* Die Fusszeile steht im Buch auf dem letzten Blatt. */
body.is-buch .wp-site-blocks > footer {
  display: none !important;
}

body.is-buch .wp-site-blocks {
  min-height: 100dvh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Angemeldet sieht Tanja die Adminleiste - die nimmt Hoehe weg. */
body.is-buch.admin-bar .wp-site-blocks {
  min-height: calc(100dvh - 32px);
  height: calc(100dvh - 32px);
}

@media screen and (max-width: 782px) {
  body.is-buch.admin-bar .wp-site-blocks {
    min-height: calc(100dvh - 46px);
    height: calc(100dvh - 46px);
  }
}

body.is-buch .wp-site-blocks > header { flex: 0 0 auto; }

body.is-buch .wp-site-blocks > main {
  flex: 1 1 auto;
  min-height: 0;
  max-width: none;
  width: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
}

body.is-buch main > .entry-content {
  flex: 1 1 auto;
  min-height: 0;
  max-width: none;
  margin: 0;
  display: flex;
  flex-direction: column;
}

body.is-buch .buch-wrap {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
  padding: 0 clamp(14px, 3vw, 30px) 8px;
  display: flex;
  flex-direction: column;
}

/* ---------------------------------------------------------------
   Buchkoerper
   --------------------------------------------------------------- */

.buch {
  --papier: #fbf8f1;
  --papier-tief: #f4ecdc;
  --bund: rgba(44, 36, 28, 0.2);
  --schnitt: #e7ddc6;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/*
 * Die Perspektive ist flach gewaehlt: ein aufgestelltes Blatt soll Raum
 * zeigen, aber nicht so gross werden, dass es ueber das Buch hinauswaechst
 * und die Kopfzeile verdeckt.
 */
.buch-buehne {
  position: relative;
  flex: 1 1 auto;
  min-height: 240px;
  perspective: 4600px;
  perspective-origin: 50% 50%;
}

/*
 * Der Buchblock: links und rechts stapeln sich die Seiten am Schnitt.
 * Das gibt dem Buch Dicke, ohne ein einziges Bild zu kosten.
 */
.buch-buehne::before,
.buch-buehne::after {
  content: "";
  position: absolute;
  top: 7px;
  bottom: 7px;
  width: 8px;
  z-index: 0;
  background: repeating-linear-gradient(
    90deg,
    #f3ecdd,
    #f3ecdd 1px,
    #d8cdb4 1px,
    #d8cdb4 2px
  );
  box-shadow: 0 2px 8px rgba(44, 36, 28, 0.18);
}

.buch-buehne::before {
  left: -7px;
  border-radius: 4px 0 0 4px;
}

.buch-buehne::after {
  right: -7px;
  border-radius: 0 4px 4px 0;
}

/* Der untere Schnitt - die Blaetterkante, auf der das Buch aufliegt. */
.buch-ruecken {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: -6px;
  height: 7px;
  z-index: 0;
  border-radius: 0 0 6px 6px;
  background: repeating-linear-gradient(
    0deg,
    #efe7d6,
    #efe7d6 1px,
    #d5c9af 1px,
    #d5c9af 2px
  );
  box-shadow: 0 8px 18px rgba(44, 36, 28, 0.22);
}

.buch-blaetter {
  position: relative;
  height: 100%;
  border-radius: 4px;
  overflow: hidden;
  background: var(--papier);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.6) inset,
    0 18px 46px rgba(44, 36, 28, 0.22),
    0 0 0 1px rgba(44, 36, 28, 0.08);
}

/* ---------------------------------------------------------------
   Eine Doppelseite
   --------------------------------------------------------------- */

.buch-blatt {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 100%;
  background: var(--papier);
  color: var(--ink);
  overflow: hidden;
}

.buch-blatt.is-current { z-index: 3; }

.buch-blatt.is-after,
.buch-blatt.is-before {
  z-index: 1;
  pointer-events: none;
  visibility: hidden;
}

/* Waehrend des Umschlagens liegt das abgehende Blatt oben und halb frei. */
.buch-blatt.is-haelfte-links {
  z-index: 3;
  visibility: visible;
  pointer-events: none;
  clip-path: inset(0 50% 0 0);
}

.buch-blatt.is-haelfte-rechts {
  z-index: 3;
  visibility: visible;
  pointer-events: none;
  clip-path: inset(0 0 0 50%);
}

.buch-blatt.is-darunter {
  z-index: 2;
  visibility: visible;
  pointer-events: none;
}

/*
 * Ein Hauch Schatten zu den Raendern hin - so wirkt die Seite wie Papier
 * und nicht wie eine leuchtende Flaeche. Bewusst nur ein weicher Verlauf:
 * feine Streifenmuster brechen auf dichten Displays zu sichtbaren Linien.
 */
.buch-blatt::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background-image:
    radial-gradient(130% 100% at 50% 50%, transparent 58%, rgba(44, 36, 28, 0.055));
}

/* Eine einzelne Buchseite. */
.buch-seite {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: clamp(16px, 2.4vw, 30px);
}

/* Aussen mehr Rand als am Bund - so ist ein Buch gesetzt. */
.buch-blatt > .buch-seite:first-child {
  padding-left: clamp(20px, 3vw, 40px);
  padding-right: clamp(18px, 2.6vw, 34px);
}

.buch-blatt > .buch-seite:nth-child(2) {
  padding-left: clamp(18px, 2.6vw, 34px);
  padding-right: clamp(20px, 3vw, 40px);
}

/* Der Bund: Schatten nach beiden Seiten, dazu die Falzlinie. */
.buch-falz {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 84px;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 5;
  background-image:
    /* die Falzlinie selbst */
    linear-gradient(
      90deg,
      transparent calc(50% - 0.5px),
      rgba(44, 36, 28, 0.3) calc(50% - 0.5px),
      rgba(44, 36, 28, 0.3) calc(50% + 0.5px),
      transparent calc(50% + 0.5px)
    ),
    /* und der Schatten, den das Papier in den Bund wirft */
    linear-gradient(
      90deg,
      rgba(44, 36, 28, 0) 0%,
      rgba(44, 36, 28, 0.05) 26%,
      rgba(44, 36, 28, 0.15) 44%,
      rgba(44, 36, 28, 0.26) 50%,
      rgba(44, 36, 28, 0.15) 56%,
      rgba(44, 36, 28, 0.05) 74%,
      rgba(44, 36, 28, 0) 100%
    );
}

/* Kolumnentitel und Seitenzahl, wie im gedruckten Buch aussen unten. */
.buch-kolumne {
  position: absolute;
  bottom: 9px;
  margin: 0 !important;
  z-index: 6;
  font-family: "Shantell Sans", cursive;
  font-size: 0.72rem;
  color: rgba(44, 36, 28, 0.44);
  pointer-events: none;
}

.buch-kolumne--links { left: clamp(20px, 3vw, 40px); }
.buch-kolumne--rechts { right: clamp(20px, 3vw, 40px); }

/* ---------------------------------------------------------------
   Das Wendeblatt
   --------------------------------------------------------------- */

.buch-wender {
  position: absolute;
  left: 50%;
  right: 0;
  top: 0;
  bottom: 0;
  z-index: 8;
  transform-origin: left center;
  transform-style: preserve-3d;
  display: none;
  will-change: transform;
}

.buch.is-wendet .buch-wender { display: block; }

.buch-wender-seite {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: var(--papier);
  backface-visibility: hidden;
  box-shadow: 0 0 0 1px rgba(44, 36, 28, 0.06);
}

.buch-wender-seite--hinten { transform: rotateY(180deg); }

/*
 * Im Wendeblatt liegt eine vollstaendige Doppelseite, doppelt so breit wie
 * das Blatt selbst. Verschoben wird sie so, dass vorn die rechte und hinten
 * die linke Haelfte zu sehen ist - der Satz stimmt dadurch aufs Pixel.
 */
.buch-wender-seite > .buch-blatt {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 200%;
  height: 100%;
  visibility: visible;
}

.buch-wender-seite--vorn > .buch-blatt { left: -100%; }
.buch-wender-seite--hinten > .buch-blatt { left: 0; }

/*
 * Licht und Schatten am Papier, damit die Drehung Koerper bekommt. Flach
 * liegend ist nichts davon zu sehen - erst im Aufstellen wird es dunkler.
 */
.buch-wender-seite::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(90deg, rgba(44, 36, 28, 0.26), rgba(44, 36, 28, 0) 46%);
}

.buch-wender-seite--hinten::after {
  background: linear-gradient(-90deg, rgba(44, 36, 28, 0.28), rgba(44, 36, 28, 0) 48%);
}

.buch.is-laeuft .buch-wender-seite--vorn::after {
  animation: buch-licht 0.72s cubic-bezier(0.32, 0.72, 0.24, 1) forwards;
}

.buch.is-laeuft .buch-wender-seite--hinten::after {
  animation: buch-licht 0.72s cubic-bezier(0.32, 0.72, 0.24, 1) reverse forwards;
}

/* Zurueckgeblaettert laeuft das Licht in die andere Richtung. */
.buch.is-wendet-zurueck.is-laeuft .buch-wender-seite--vorn::after {
  animation-direction: reverse;
}

.buch.is-wendet-zurueck.is-laeuft .buch-wender-seite--hinten::after {
  animation-direction: normal;
}

@keyframes buch-licht {
  from { opacity: 0; }
  to { opacity: 1; }
}

.buch.is-wendet-vor .buch-wender { transform: rotateY(0deg); }
.buch.is-wendet-zurueck .buch-wender { transform: rotateY(-180deg); }

.buch.is-wendet-vor.is-laeuft .buch-wender,
.buch.is-wendet-zurueck.is-laeuft .buch-wender {
  transition: transform 0.72s cubic-bezier(0.32, 0.72, 0.24, 1);
}

.buch.is-wendet-vor.is-laeuft .buch-wender { transform: rotateY(-180deg); }
.buch.is-wendet-zurueck.is-laeuft .buch-wender { transform: rotateY(0deg); }

/* ---------------------------------------------------------------
   Blaettern
   --------------------------------------------------------------- */

.buch-hotspot {
  position: absolute;
  top: 0;
  height: 70%;
  width: 9%;
  border: 0;
  padding: 0;
  background: transparent;
  z-index: 6;
  cursor: pointer;
}

.buch-hotspot--prev { left: 0; cursor: w-resize; }
.buch-hotspot--next { right: 0; cursor: e-resize; }

.buch-hotspot--next:hover {
  background: linear-gradient(90deg, transparent, rgba(44, 36, 28, 0.07));
}

.buch-hotspot--prev:hover {
  background: linear-gradient(-90deg, transparent, rgba(44, 36, 28, 0.07));
}

.buch.is-erste .buch-hotspot--prev,
.buch.is-letzte .buch-hotspot--next { display: none; }

/* Kapitelreiter am Buchschnitt. */
.buch-reiter-leiste {
  position: absolute;
  right: -14px;
  top: 18px;
  bottom: 18px;
  width: 15px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  z-index: 9;
}

/*
 * Die Reiter sitzen teils auf farbigen Blaettern. Ein heller Rand haelt
 * sie auch dann sichtbar, wenn Reiter- und Blattfarbe gleich sind.
 */
.buch-reiter {
  flex: 1;
  border: 0;
  padding: 0;
  cursor: pointer;
  border-radius: 0 5px 5px 0;
  position: relative;
  background: var(--reiter, var(--tuerkis));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    0 0 0 1.5px var(--grund),
    2px 2px 5px rgba(44, 36, 28, 0.18);
  transition: transform 0.15s ease;
}

.buch-reiter.is-aktiv {
  transform: translateX(4px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    0 0 0 1.5px var(--grund),
    0 0 0 3.5px var(--ink);
}

.buch-reiter span {
  position: absolute;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  font-family: "Shantell Sans", cursive;
  font-size: 0.78rem;
  background: var(--ink);
  color: var(--papier);
  padding: 3px 8px;
  border-radius: 999px;
  transition: opacity 0.15s ease;
}

.buch-reiter:hover { transform: translateX(3px); }
.buch-reiter:hover span,
.buch-reiter:focus-visible span { opacity: 1; }

.buch-nav {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 2px 0;
}

.buch-zaehler {
  margin: 0;
  font-family: "Shantell Sans", cursive;
  font-size: 0.86rem;
  color: var(--graphite);
  text-align: center;
}

.buch-btn {
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: "Shantell Sans", cursive;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 8px 4px;
  cursor: pointer;
}

.buch-btn--weiter {
  background: var(--gelb);
  border-radius: 999px;
  padding: 9px 20px;
}

.buch-btn--weiter:hover { background: var(--orange); }

.buch.is-erste [data-buch-prev].buch-btn { visibility: hidden; }
.buch.is-letzte [data-buch-next].buch-btn { visibility: hidden; }

/* ---------------------------------------------------------------
   Schrift auf den Blaettern
   --------------------------------------------------------------- */

.buch-blatt h1,
.buch-blatt h2 {
  font-family: "Young Serif", serif;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0.08em 0 0.4em;
  hyphens: auto;
}

.buch-blatt h1 { font-size: clamp(1.7rem, 2.6vw, 2.7rem); }
.buch-blatt h2 { font-size: clamp(1.2rem, 1.8vw, 1.8rem); }

.buch-blatt p { margin: 0 0 0.6em; }
.buch-blatt a { color: inherit; }

.buch-saetze {
  list-style: none;
  margin: 0.3em 0 0;
  padding: 0;
}

.buch-saetze li {
  font-size: clamp(0.9rem, 0.95vw, 1.02rem);
  line-height: 1.5;
  padding: 0.4em 0;
  border-bottom: 1px solid rgba(44, 36, 28, 0.1);
}

.buch-saetze li:last-child { border-bottom: 0; }

/* Bilder: immer vollstaendig, nie beschnitten. */
.buch-blatt figure {
  margin: 0;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.buch-blatt img,
.buch-blatt video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  border-radius: 0 !important;
}

/* ---------------------------------------------------------------
   Seitenarten
   --------------------------------------------------------------- */

/* Grosse Bildseite: das Blatt steht frei auf dem Papier. */
.buch-seite--bild {
  justify-content: center;
  background: var(--papier);
}

.buch-grossbild { width: 100%; }

.buch-grossbild img {
  filter: drop-shadow(0 6px 14px rgba(44, 36, 28, 0.18));
}

/* Textseite: mittig gesetzt, mit ruhigem Satzspiegel. */
.buch-seite--text {
  justify-content: center;
  overflow-y: auto;
}

.buch-seite--titel { justify-content: center; }

.buch-cover-satz {
  max-width: 34ch;
  font-size: clamp(0.92rem, 1.1vw, 1.06rem);
}

.buch-hint {
  align-self: flex-start;
  margin-top: 0.5rem;
  border: 0;
  background: var(--gelb);
  color: var(--ink);
  font-family: "Shantell Sans", cursive;
  font-weight: 600;
  border-radius: 999px;
  padding: 9px 20px;
  cursor: pointer;
}

.buch-hint:hover { background: var(--orange); }

/* Medienseite: Film oder Standbild, mittig, mit Bildnotiz darunter. */
.buch-seite--medien {
  justify-content: center;
  background: var(--papier-tief);
}

/*
 * Film und Standbild bleiben bei ihrer Bildnotiz, statt die Spalte zu
 * dehnen - sonst reisst zwischen Bild und Notiz eine Luecke auf.
 */
.buch-blatt .buch-still,
.buch-blatt .buch-video {
  flex: 0 1 auto;
  min-height: 0;
}

.buch-still img,
.buch-video {
  max-height: 100%;
  width: auto;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}

.buch-filmnote {
  flex: 0 0 auto;
  margin: 0.55rem 0 0 !important;
  text-align: center;
  font-family: "Shantell Sans", cursive;
  font-size: 0.85rem;
  color: var(--graphite);
}

/* Zwei Bilder auf einer Seite, jeweils mit Beschriftung. */
.buch-seite--paar {
  background: var(--papier-tief);
  gap: clamp(10px, 1.4vw, 18px);
}

.buch-paar {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.buch-paar-bild {
  flex: 1;
  min-height: 0;
}

.buch-paar-bild img { border-radius: 6px !important; }

.buch-paar-label {
  flex: 0 0 auto;
  margin: 5px 0 0 !important;
  font-family: "Shantell Sans", cursive;
  font-size: 0.8rem;
  color: var(--graphite);
}

/* Motto-Seite: ein Satz gross gesetzt, wo ein Foto noch fehlt. */
.buch-seite--zitat {
  justify-content: center;
  background: var(--papier-tief);
}

.buch-seite--zitat blockquote {
  margin: 0;
  border: 0;
  padding: 0;
}

.buch-seite--zitat p {
  font-family: "Young Serif", serif;
  font-size: clamp(1.1rem, 1.7vw, 1.7rem);
  line-height: 1.32;
  margin: 0;
  max-width: 24ch;
}

.buch-seite--zitat p::before { content: "„"; }
.buch-seite--zitat p::after { content: "“"; }

/* Platzhalter, solange ein Foto fehlt. */
.buch-platz {
  flex: 1;
  border: 2px dashed rgba(44, 36, 28, 0.25);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.35rem;
  padding: 1rem;
  color: var(--graphite);
  font-family: "Shantell Sans", cursive;
  font-size: 0.88rem;
  background: repeating-linear-gradient(
    -12deg,
    var(--papier),
    var(--papier) 11px,
    var(--papier-tief) 11px,
    var(--papier-tief) 22px
  );
}

.buch-platz span {
  font-family: "Young Serif", serif;
  color: var(--ink);
  font-size: clamp(1.05rem, 1.5vw, 1.4rem);
}

.buch-platz em {
  font-style: normal;
  max-width: 18ch;
}

/* ---------------------------------------------------------------
   Kapiteltrenner: Zwischentitel links, Inhalt rechts
   --------------------------------------------------------------- */

.buch-seite--trenner {
  background: var(--tuerkis);
  justify-content: center;
}

.buch-trenner-satz { font-size: clamp(0.94rem, 1.2vw, 1.1rem); max-width: 30ch; }

.buch-seite--inhalt { background: var(--papier); }

.buch-inhalt-kopf {
  flex: 0 0 auto;
  margin: 0 0 0.5rem !important;
  font-family: "Shantell Sans", cursive;
  font-size: 0.82rem;
  color: var(--graphite);
}

/*
 * Inhaltsverzeichnis des Bilderkapitels: alle Blaetter auf einen Blick,
 * jedes anklickbar. Auch hier vollstaendig, nichts beschnitten.
 */
.buch-inhalt {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(clamp(76px, 6.5vw, 98px), 1fr));
  gap: clamp(8px, 1vw, 12px);
  align-content: center;
}

.buch-mini {
  width: 100%;
  border: 0;
  padding: 5px;
  background: var(--papier-tief);
  border-radius: 7px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  box-shadow: 0 2px 6px rgba(44, 36, 28, 0.16);
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}

.buch-mini:hover,
.buch-mini:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 5px 12px rgba(44, 36, 28, 0.24);
}

.buch-mini img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: contain;
  background: var(--papier);
  border-radius: 4px !important;
  display: block;
}

.buch-mini-titel {
  font-family: "Shantell Sans", cursive;
  font-size: 0.7rem;
  line-height: 1.2;
  color: var(--ink);
}

/* ---------------------------------------------------------------
   Werkseite: Blatt links, Angaben rechts
   --------------------------------------------------------------- */

.buch-blatt--werk .buch-seite--bild { background: var(--papier-tief); }

.buch-seite--werktext { justify-content: center; }

.buch-werk-nummer {
  margin: 0 0 0.9em !important;
  font-family: "Shantell Sans", cursive;
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--graphite);
}

.buch-seite--werktext h2 {
  font-size: clamp(1.35rem, 2vw, 2.1rem);
  margin: 0 0 0.16em;
}

.buch-seite--werktext h2 a { text-decoration: none; }
.buch-seite--werktext h2 a:hover { text-decoration: underline; }

.buch-werk-datum {
  margin: 0 0 1.1em !important;
  font-family: "Shantell Sans", cursive;
  font-size: 0.84rem;
  color: var(--graphite);
}

/* Der Gedanke traegt die Seite - er darf gross stehen. */
.buch-werk-gedanke {
  position: relative;
  font-size: clamp(1rem, 1.25vw, 1.24rem);
  line-height: 1.6;
  max-width: 30ch;
  padding-top: 0.9em;
}

.buch-werk-gedanke::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 46px;
  height: 2px;
  background: var(--orange, #f47a20);
}

.buch-werk-mehr {
  margin: 0.9em 0 0 !important;
  font-family: "Shantell Sans", cursive;
  font-size: 0.84rem;
}

.buch-werk-mehr a { color: var(--graphite); }

/*
 * Querformate laufen ueber beide Seiten, wie das Panorama in einem
 * Bildband. Die Angaben ruecken dann als Leiste unter das Bild.
 */
.buch-blatt--werk.is-quer {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr auto;
}

.buch-blatt--werk.is-quer > .buch-seite--bild {
  padding: clamp(16px, 2.4vw, 28px) clamp(20px, 3vw, 40px) 0;
}

.buch-blatt--werk.is-quer > .buch-seite--werktext {
  padding: clamp(10px, 1.4vw, 16px) clamp(20px, 3vw, 40px) clamp(22px, 2.4vw, 30px);
  background: var(--papier);
  align-items: center;
  text-align: center;
}

/* Ueber einem Bild darf der Bund nur angedeutet sein. */
.buch-blatt--werk.is-quer .buch-falz { opacity: 0.4; }

.buch-blatt--werk.is-quer .buch-werk-datum { margin-bottom: 0.4em !important; }
.buch-blatt--werk.is-quer .buch-werk-gedanke { max-width: 62ch; }
.buch-blatt--werk.is-quer .buch-werk-mehr { margin-top: 0.5em !important; }

/* ---------------------------------------------------------------
   Schlussblatt
   --------------------------------------------------------------- */

.buch-seite--schluss {
  background: var(--gelb);
  justify-content: center;
}

.buch-seite--schluss .buch-saetze li {
  border-bottom-color: rgba(44, 36, 28, 0.18);
}

.buch-seite--weiter {
  background: var(--papier);
  justify-content: center;
}

.buch-schluss-frage {
  font-family: "Shantell Sans", cursive;
  font-size: 0.86rem;
  color: var(--graphite);
  margin: 0 0 0.6em !important;
}

.buch-schluss-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 1.4rem !important;
}

.buch-knopf {
  display: inline-block;
  background: var(--ink);
  color: var(--papier) !important;
  text-decoration: none;
  border-radius: 999px;
  padding: 10px 20px;
  font-family: "Shantell Sans", cursive;
  font-weight: 600;
  font-size: 0.92rem;
}

.buch-knopf:hover { background: #453a2e; }

.buch-knopf--umriss {
  background: transparent;
  color: var(--ink) !important;
  box-shadow: inset 0 0 0 2px var(--ink);
}

.buch-knopf--umriss:hover {
  background: var(--ink);
  color: var(--papier) !important;
}

.buch-schluss-meta {
  font-family: "Shantell Sans", cursive;
  font-size: 0.84rem;
  margin: 0 !important;
}

/* ---------------------------------------------------------------
   Ruecksichtnahme
   --------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .buch.is-wendet-vor.is-laeuft .buch-wender,
  .buch.is-wendet-zurueck.is-laeuft .buch-wender {
    transition: none;
  }

  .buch.is-wendet .buch-wender { display: none; }
}

/* ---------------------------------------------------------------
   Tablet: Doppelseite bleibt, nur enger
   --------------------------------------------------------------- */

@media (max-width: 1000px) {
  .buch-falz { width: 60px; }
  .buch-blatt h1 { font-size: clamp(1.5rem, 3.4vw, 2.1rem); }
  .buch-saetze li { font-size: 0.92rem; padding: 0.34em 0; }
  .buch-werk-gedanke { font-size: 0.96rem; }
}

/*
 * Auf schmalen Schirmen ist am Buchschnitt kein Platz fuer Register. Die
 * Kapitel wandern als Punktreihe unter das Buch - so bleibt der Sprung ins
 * Kapitel auch auf dem Handy moeglich.
 */
@media (max-width: 860px) {
  .buch-reiter-leiste {
    top: auto;
    right: 0;
    left: 0;
    bottom: -17px;
    width: auto;
    height: 9px;
    flex-direction: row;
    justify-content: center;
    gap: 6px;
  }

  .buch-reiter {
    flex: 0 0 auto;
    width: 26px;
    border-radius: 999px;
  }

  .buch-reiter span { display: none; }
  .buch-reiter:hover { transform: none; }
  .buch-reiter.is-aktiv { transform: none; width: 38px; }

  .buch-nav { padding-top: 24px; }
}

/* Wo die Hoehe ohnehin knapp ist, bleiben die Kapitelpunkte weg. */
@media (max-width: 860px) and (max-height: 620px) {
  .buch-reiter-leiste { display: none; }
  .buch-nav { padding-top: 6px; }
}

/* ---------------------------------------------------------------
   Handy: eine Seite statt Doppelseite
   --------------------------------------------------------------- */

@media (max-width: 720px) {
  body.is-buch header .wp-block-group.alignfull {
    padding-top: 8px !important;
    padding-bottom: 8px !important;
  }

  body.is-buch .buch-wrap { padding: 0 10px 8px; }

  /* Ohne Buchblock aussen bleibt mehr Platz fuer die Seite selbst. */
  .buch-buehne::before,
  .buch-buehne::after { display: none; }

  .buch-buehne { overflow: hidden; }
  .buch-ruecken { display: none; }
  .buch-blaetter { border-radius: 12px; }

  /*
   * Eine Seite: die beiden Haelften stehen uebereinander. Der Text nimmt
   * nur die Hoehe, die er braucht (hoechstens 58 Prozent) - was uebrig
   * bleibt, gehoert dem Bild. So steht unter kurzen Absaetzen keine
   * leere Flaeche und die Bilder werden so gross wie moeglich.
   */
  .buch-blatt {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) fit-content(58%);
  }

  .buch-falz { display: none; }

  /*
   * Auf dem Handy ist nur eine Seite zu sehen. Ein Blatt, das sich um den
   * Bildschirmrand dreht, wirkt dort fremd und kostet viel Rechenzeit.
   * Deshalb gleitet die Seite hier zur Seite - das laeuft auch auf
   * aelteren Telefonen ruhig, weil nur verschoben und nicht gedreht wird.
   */
  .buch-wender {
    left: 0;
    transform-origin: center center;
  }

  .buch-wender-seite > .buch-blatt { width: 100%; }
  .buch-wender-seite--vorn > .buch-blatt { left: 0; }

  /* Beim Gleiten ist nur die Vorderseite zu sehen. */
  .buch-wender-seite--hinten { display: none; }
  .buch-wender-seite::after { display: none; }

  /* Die Kante wirft einen Schatten - daran erkennt man das Blatt. */
  .buch-wender-seite--vorn {
    box-shadow: 7px 0 20px rgba(44, 36, 28, 0.28);
  }

  .buch.is-wendet-vor .buch-wender { transform: translate3d(0, 0, 0); }
  .buch.is-wendet-zurueck .buch-wender { transform: translate3d(-100%, 0, 0); }

  .buch.is-wendet-vor.is-laeuft .buch-wender,
  .buch.is-wendet-zurueck.is-laeuft .buch-wender {
    transition: transform 0.44s cubic-bezier(0.22, 0.61, 0.2, 1);
  }

  .buch.is-wendet-vor.is-laeuft .buch-wender { transform: translate3d(-100%, 0, 0); }
  .buch.is-wendet-zurueck.is-laeuft .buch-wender { transform: translate3d(0, 0, 0); }

  /*
   * Vorwaerts deckt das Wendeblatt die alte Seite vollstaendig ab. Sie muss
   * weichen, sonst liegt sie ueber der neuen und man sieht beim Weggleiten
   * nicht die naechste Seite, sondern wieder die alte.
   */
  .buch-blatt.is-haelfte-links {
    clip-path: none;
    visibility: hidden;
  }

  /* Zurueck bleibt die alte Seite stehen, bis das Blatt sie zudeckt. */
  .buch-blatt.is-haelfte-rechts { clip-path: none; }

  .buch-seite,
  .buch-blatt > .buch-seite:first-child,
  .buch-blatt > .buch-seite:nth-child(2) {
    padding: 12px 15px;
  }

  .buch-seite--text,
  .buch-seite--werktext {
    justify-content: flex-start;
    padding-bottom: 20px;
  }

  /* Wo mehr Text steht, bekommt er mehr Zeile - damit nichts wegfaellt. */
  /* Viel Text: er darf bis zu zwei Drittel der Seite fuellen. */
  .buch-blatt--schutzengel,
  .buch-blatt--erzaehlung,
  .buch-blatt--ansatz {
    grid-template-rows: minmax(0, 1fr) fit-content(66%);
  }

  /* Text zuerst lesen, Bilder darunter. */
  .buch-blatt--schutzengel .buch-seite--text,
  .buch-blatt--ansatz .buch-seite--text { grid-row: 2; }

  .buch-blatt--schutzengel .buch-seite--paar,
  .buch-blatt--ansatz .buch-seite--paar { grid-row: 1; }

  .buch-seite--paar { flex-direction: row; }

  /* Deckblatt und Werkseite: Bild gross oben, Angaben darunter. */
  /* Hier steht das Bild im Mittelpunkt, der Text bleibt knapp darunter. */
  .buch-blatt--deckblatt,
  .buch-blatt--werk,
  .buch-blatt--erstes {
    grid-template-rows: minmax(0, 1fr) fit-content(46%);
  }

  .buch-blatt--werk.is-quer {
    grid-template-rows: minmax(0, 1fr) fit-content(46%);
  }

  .buch-blatt--werk.is-quer > .buch-seite--bild { padding: 12px 15px 0; }

  .buch-blatt--werk.is-quer > .buch-seite--werktext {
    padding: 8px 15px 18px;
    align-items: flex-start;
    text-align: left;
  }

  .buch-blatt--kapiteltrenner {
    grid-template-rows: minmax(0, auto) minmax(0, 1fr);
  }

  .buch-blatt--schluss {
    grid-template-rows: minmax(0, 62%) minmax(0, 38%);
  }

  .buch-inhalt {
    grid-template-columns: repeat(auto-fill, minmax(74px, 1fr));
    gap: 8px;
  }

  .buch-mini-titel { font-size: 0.64rem; }
  .buch-kolumne { bottom: 5px; font-size: 0.66rem; }
  .buch-kolumne--links { left: 15px; }
  .buch-kolumne--rechts { right: 15px; }
  .buch-nav { padding-top: 10px; }

  /*
   * Die untere Haelfte reicht bis an den Blattrand - dort stehen Kapitel
   * und Seitenzahl. Der Satz haelt Abstand, damit sich beides nicht
   * ins Gehege kommt.
   */
  .buch-blatt > .buch-seite:nth-child(2) { padding-bottom: 26px; }
}

/*
 * Kleine Handys haben zu wenig Hoehe, um Bild und Text in festen Anteilen
 * unterzubringen. Dort scrollt das Blatt als Ganzes: das Bild steht oben,
 * der Text darunter vollstaendig. Abgeschnitten wird nichts.
 */
@media (max-width: 720px) and (max-height: 700px) {
  .buch-blatt {
    grid-template-rows: auto auto !important;
    overflow-y: auto;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }

  .buch-blatt::after { display: none; }
  .buch-kolumne { display: none; }

  /* Jede Seite darf so hoch werden, wie ihr Inhalt es braucht. */
  .buch-seite { min-height: auto; }

  .buch-seite--bild,
  .buch-seite--medien,
  .buch-seite--paar,
  .buch-seite--zitat {
    min-height: 46vh;
  }

  .buch-seite--text,
  .buch-seite--werktext,
  .buch-seite--weiter,
  .buch-seite--trenner,
  .buch-seite--inhalt {
    overflow: visible;
  }

  .buch-inhalt { overflow: visible; }
}

@media (max-width: 600px) {
  .buch-cover-satz { display: none; }
  .buch-blatt h1 { font-size: 1.55rem; }
  .buch-saetze li { font-size: 0.89rem; padding: 0.28em 0; }
  .buch-seite--zitat p { font-size: 1.15rem; }
}

/* ---------------------------------------------------------------
   Flache Schirme: Handy im Querformat, kleine Notebooks
   --------------------------------------------------------------- */

@media (max-height: 620px) {
  /* Die Kopfzeile darf hier kaum Hoehe nehmen - das Buch braucht sie. */
  body.is-buch header .wp-block-group.alignfull {
    padding-top: 6px !important;
    padding-bottom: 6px !important;
  }

  body.is-buch .buch-wrap { padding-bottom: 4px; }

  .buch-buehne { min-height: 0; }
  .buch-nav { padding-top: 6px; }
  .buch-btn { font-size: 0.86rem; padding: 5px 4px; }
  .buch-btn--weiter { padding: 6px 15px; }
  .buch-zaehler { font-size: 0.76rem; }
  .buch-blatt h1 { font-size: clamp(1.3rem, 3vw, 1.8rem); }
  .buch-blatt h2 { font-size: clamp(1.05rem, 2vw, 1.4rem); }
  .buch-saetze li { font-size: 0.85rem; padding: 0.22em 0; line-height: 1.42; }
  .buch-hint { padding: 7px 16px; font-size: 0.86rem; }
  .buch-kolumne { display: none; }
}

/* Ganz flache Schirme: der Satz wird enger gefuehrt, damit er hineinpasst. */
@media (max-height: 460px) {
  .buch-blatt h1 { font-size: clamp(1.2rem, 2.6vw, 1.55rem); }
  .buch-blatt h2 { font-size: clamp(0.98rem, 1.8vw, 1.2rem); margin-bottom: 0.25em; }
  .buch-blatt h2 + .buch-werk-datum { margin-bottom: 0.5em !important; }

  .buch-saetze li {
    font-size: 0.8rem;
    line-height: 1.34;
    padding: 0.16em 0;
  }

  .handnote { margin-bottom: 0.1em !important; }
  .buch-trenner-satz { font-size: 0.82rem; }
  .buch-werk-gedanke { font-size: 0.86rem; line-height: 1.42; padding-top: 0.6em; }
  .buch-werk-nummer { margin-bottom: 0.5em !important; font-size: 0.68rem; }
  .buch-werk-mehr { margin-top: 0.5em !important; font-size: 0.76rem; }
  .buch-mini img { aspect-ratio: 1 / 1; }
  .buch-mini-titel { font-size: 0.6rem; }
  .buch-inhalt-kopf { font-size: 0.72rem; margin-bottom: 0.3rem !important; }
}

/*
 * Handy im Querformat: breit, aber sehr flach. Hier steht die Doppelseite
 * wieder nebeneinander - quer ist dafuer genau die richtige Form.
 */
@media (max-height: 520px) and (min-width: 560px) {
  .buch-blatt {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 100%;
  }

  .buch-blatt--schutzengel .buch-seite--text,
  .buch-blatt--ansatz .buch-seite--text { grid-row: 1; }

  .buch-blatt--schutzengel .buch-seite--paar,
  .buch-blatt--ansatz .buch-seite--paar { grid-row: 1; }

  .buch-blatt--werk.is-quer {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
  }

  .buch-falz { display: block; width: 46px; }

  /* Hier ist das Buch aufgeschlagen, also dreht das Blatt wieder um den Bund. */
  .buch-wender {
    left: 50%;
    transform-origin: left center;
  }

  .buch-wender-seite > .buch-blatt { width: 200%; }
  .buch-wender-seite--vorn > .buch-blatt { left: -100%; }
  .buch-wender-seite--hinten { display: block; }
  .buch-wender-seite::after { display: block; }
  .buch-wender-seite--vorn { box-shadow: 0 0 0 1px rgba(44, 36, 28, 0.06); }

  .buch.is-wendet-vor .buch-wender { transform: rotateY(0deg); }
  .buch.is-wendet-zurueck .buch-wender { transform: rotateY(-180deg); }
  .buch.is-wendet-vor.is-laeuft .buch-wender { transform: rotateY(-180deg); }
  .buch.is-wendet-zurueck.is-laeuft .buch-wender { transform: rotateY(0deg); }

  .buch-blatt.is-haelfte-links {
    clip-path: inset(0 50% 0 0);
    visibility: visible;
  }

  .buch-blatt.is-haelfte-rechts { clip-path: inset(0 0 0 50%); }
  .buch-seite--paar { flex-direction: column; gap: 8px; }
  .buch-seite--text { justify-content: center; }
  .buch-cover-satz { display: block; font-size: 0.84rem; }
  .buch-inhalt { grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); }
}
