/* PANGRAPHY Flipbook – gemeinsames Layout für alle Broschüren (/workflow/, später /stile-genres/ …).
   Schriften lokal: Poppins (assets/flipbook/fonts) und Inter (assets/fonts). */
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 500; font-display: swap; src: url('fonts/poppins-500.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 600; font-display: swap; src: url('fonts/poppins-600.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 700; font-display: swap; src: url('fonts/poppins-700.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/inter-400.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 500; font-display: swap; src: url('../fonts/inter-500.woff2') format('woff2'); }

:root {
  --fb-bg: #0E1B2E;
  --fb-bar: rgba(14, 27, 46, 0.85);
  --fb-line: #1F2E45;
  --fb-text: #F4F6F8;
  --fb-dim: #B8BFCB;
  --fb-focus: #9FC3F0;
  --fb-top: 64px;
  --fb-bottom: 84px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--fb-bg); color: var(--fb-text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif; font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; overflow: hidden;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--fb-focus); outline-offset: 3px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Leisten ---------- */
.fb-top, .fb-bottom {
  position: fixed; left: 0; right: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px; padding: 0 20px;
  background: var(--fb-bar); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.fb-top { top: 0; height: var(--fb-top); justify-content: space-between; border-bottom: 1px solid var(--fb-line); }
.fb-bottom { bottom: 0; height: var(--fb-bottom); justify-content: center; border-top: 1px solid var(--fb-line); }
.fb-brand { font-family: 'Poppins', sans-serif; font-weight: 600; font-size: 19px; letter-spacing: 0.01em; text-decoration: none; }
.fb-actions { display: flex; gap: 10px; }

.fb-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--fb-line);
  background: rgba(255, 255, 255, 0.03); color: var(--fb-text); cursor: pointer; text-decoration: none;
  font-family: 'Poppins', sans-serif; font-weight: 500; font-size: 14px; white-space: nowrap;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.fb-btn:hover { background: rgba(255, 255, 255, 0.08); border-color: #33476A; }
.fb-btn svg { width: 18px; height: 18px; flex: none; }
.fb-btn--icon { width: 42px; padding: 0; }
.fb-arrow { width: 56px; height: 56px; border-radius: 50%; padding: 0; }
.fb-arrow svg { width: 22px; height: 22px; }
.fb-arrow:disabled { opacity: 0.35; cursor: default; background: transparent; }

.fb-count { min-width: 92px; text-align: center; font-family: 'Poppins', sans-serif; font-weight: 500; font-size: 15px; color: var(--fb-dim); }
.fb-count strong { color: var(--fb-text); font-weight: 600; }

.fb-toc { display: flex; gap: 6px; margin: 0 8px; }
.fb-toc button {
  height: 34px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--fb-line); background: transparent;
  color: var(--fb-dim); font-size: 13px; cursor: pointer; white-space: nowrap; transition: color 0.2s ease, border-color 0.2s ease;
}
.fb-toc button:hover { color: var(--fb-text); border-color: #33476A; }
.fb-toc button[aria-current="true"] { color: var(--fb-text); border-color: #5B7299; background: rgba(255, 255, 255, 0.05); }

/* Aufklappmenüs: Kapitelgruppen (unten, öffnen nach oben) und „Weitere Broschüren“ (oben, öffnen nach unten) */
.fb-group, .fb-more { position: relative; }
.fb-group-btn { display: inline-flex; align-items: center; gap: 6px; }
.fb-group-btn svg { width: 13px; height: 13px; transition: transform 0.2s ease; }
.fb-group-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
.fb-menu {
  position: absolute; left: 0; bottom: calc(100% + 10px); z-index: 30; min-width: 180px;
  display: flex; flex-direction: column; gap: 4px; padding: 6px;
  background: #13233A; border: 1px solid var(--fb-line); border-radius: 12px; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}
.fb-menu[hidden] { display: none; }
.fb-toc .fb-menu button { width: 100%; text-align: left; border-color: transparent; }
.fb-toc .fb-menu button:hover, .fb-toc .fb-menu button[aria-current="true"] { border-color: var(--fb-line); }
.fb-menu--down { left: auto; right: 0; bottom: auto; top: calc(100% + 10px); min-width: 250px; }
.fb-more-item {
  display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 10px; text-decoration: none;
  color: var(--fb-text); font-family: 'Poppins', sans-serif; font-weight: 500; font-size: 14px;
}
.fb-more-item:hover, .fb-more-item:focus-visible { background: rgba(255, 255, 255, 0.06); }
.fb-more-item img { width: 40px; height: 57px; object-fit: cover; border-radius: 4px; flex: none; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4); }
.fb-more-item small { display: block; margin-top: 2px; font-family: 'Inter', sans-serif; font-weight: 400; font-size: 12px; color: var(--fb-dim); line-height: 1.35; }
.fb-select {
  display: none; height: 42px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--fb-line);
  background: var(--fb-bg); color: var(--fb-text); font: inherit; font-size: 14px; max-width: 160px;
}

/* ---------- Bühne und Heft ---------- */
.fb-stage {
  position: fixed; left: 0; right: 0; top: var(--fb-top); bottom: var(--fb-bottom);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
/* Platz fürs Heft schon vor dem Skript reservieren (kein Layout-Sprung): Doppelseite quer, Einzelseite hoch */
.fb-wrap {
  flex: none; filter: drop-shadow(0 24px 48px rgba(0, 0, 0, 0.45));
  width: var(--fb-book-w, min(calc(100vw - 32px), calc((100vh - var(--fb-top) - var(--fb-bottom) - 32px) * 1588 / 1123)));
}
@media (orientation: portrait), (max-width: 639.98px) {
  .fb-wrap { width: var(--fb-book-w, min(calc(100vw - 20px), calc((100vh - var(--fb-top) - var(--fb-bottom) - 20px) * 794 / 1123))); }
}
/* bis StPageFlip startet: Seiten verborgen, Fläche im Seitenformat freigehalten */
.fb-book:not(.stf__parent) { aspect-ratio: 1588 / 1123; overflow: hidden; }
.fb-book:not(.stf__parent) .fb-page { display: none; }
@media (orientation: portrait), (max-width: 639.98px) { .fb-book:not(.stf__parent) { aspect-ratio: 794 / 1123; } }
.fb-page { background: #fff center / cover no-repeat; overflow: hidden; }
.fb-page img { display: block; width: 100%; height: 100%; object-fit: cover; user-select: none; -webkit-user-drag: none; }
.fb-hint { position: fixed; left: 50%; bottom: calc(var(--fb-bottom) + 14px); transform: translateX(-50%); z-index: 15;
  padding: 6px 14px; border-radius: 12px; background: var(--fb-bar); border: 1px solid var(--fb-line); color: var(--fb-dim);
  font-size: 13px; pointer-events: none; transition: opacity 0.6s ease; }
.fb-hint.is-hidden { opacity: 0; }
.fb-hint { white-space: nowrap; } .fb-hint-klein { display: none; }

/* ---------- Zoom (Doppelklick / Doppeltippen) ---------- */
.fb-zoom { position: fixed; inset: 0; z-index: 40; background: rgba(8, 14, 24, 0.94); overflow: auto; cursor: zoom-out; }
.fb-zoom[hidden] { display: none; }
.fb-zoom img { display: block; width: min(100vw, 1100px); height: auto; margin: 0 auto; }
.fb-zoom-close { position: fixed; top: 14px; right: 14px; z-index: 41; }

/* ---------- Fallback ohne JavaScript ---------- */
.fb-noscript { position: relative; z-index: 30; max-width: 820px; margin: calc(var(--fb-top) + 24px) auto 40px; padding: 0 16px; overflow: auto; }
.fb-noscript img { width: 100%; height: auto; margin-bottom: 16px; }

/* ---------- Tablet / Handy ---------- */
@media (max-width: 1180px) { .fb-toc { display: none; } .fb-select { display: inline-block; } }
@media (max-width: 640px) {
  :root { --fb-top: 56px; --fb-bottom: 76px; }
  .fb-top, .fb-bottom { padding: 0 10px; gap: 8px; }
  .fb-btn-label { display: none; }
  .fb-btn { width: 42px; padding: 0; }
  .fb-arrow { width: 48px; height: 48px; }
  .fb-count { min-width: 64px; font-size: 14px; }
  .fb-select { max-width: 112px; }
  .fb-stage { padding: 10px; }
  .fb-hint-gross { display: none; } .fb-hint-klein { display: inline; }
}
@media (prefers-reduced-motion: reduce) { .fb-hint, .fb-btn, .fb-toc button { transition: none; } }
