/* Blätterkatalog-Viewer – Farben über CSS-Variablen anpassbar */
:root {
  --vbk-bg: #e6e7ea;          /* Hintergrund der Bühne */
  --vbk-bar-bg: #ffffff;      /* Werkzeugleiste */
  --vbk-fg: #1f2329;          /* Schrift/Icons */
  --vbk-muted: #6b7280;
  --vbk-accent: #c8102e;      /* Akzentfarbe (z. B. Markenfarbe) */
  --vbk-line: rgba(0, 0, 0, .1);
  --vbk-bar-h: 52px;
}
html, body { margin: 0; padding: 0; height: 100%; overflow: hidden; background: var(--vbk-bg); }
body { font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: var(--vbk-fg); -webkit-text-size-adjust: 100%; }

.vbk { position: fixed; inset: 0; display: flex; flex-direction: column; background: var(--vbk-bg); overflow: hidden;
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
.vbk-loading, .vbk-error { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--vbk-muted); padding: 24px; text-align: center; }
.vbk-spinner { width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--vbk-line); border-top-color: var(--vbk-accent); animation: vbk-spin .8s linear infinite; }
@keyframes vbk-spin { to { transform: rotate(360deg); } }

/* Bühne */
.vbk-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; touch-action: none; cursor: default; }
.vbk-zoom { position: absolute; inset: 0; transform-origin: 0 0; }
/* will-change nur während einer Zoom-/Schiebebewegung (viewer.js), sonst rendert Chrome die Schrift-Ebene unscharf */
.vbk-book { position: absolute; }
.vbk-pf { position: relative; }
.vbk-page { background: transparent; }
.vbk-sheet { position: absolute; left: 0; top: 0; width: 100%; height: 100%; background: #fff; overflow: hidden; }
.vbk-page img { display: block; width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity .2s; pointer-events: none; }
.vbk-page.vbk-loaded img { opacity: 1; transition: none; }
.vbk-page img.vbk-txt { position: absolute; left: 0; top: 0; }
.vbk-page:not(.vbk-loaded) .vbk-sheet::before { content: ""; position: absolute; left: 50%; top: 50%; width: 28px; height: 28px; margin: -14px; border-radius: 50%;
  border: 3px solid var(--vbk-line); border-top-color: var(--vbk-accent); animation: vbk-spin .8s linear infinite; }
/* Schatten unter dem Buch und Falz in der Mitte */
.vbk-pf { filter: drop-shadow(0 3px 10px rgba(0, 0, 0, .2)); }
.vbk-side-l .vbk-sheet::after, .vbk-side-r .vbk-sheet::after { content: ""; position: absolute; top: 0; bottom: 0; width: 7%; pointer-events: none; }
.vbk-side-l .vbk-sheet::after { right: 0; background: linear-gradient(to left, rgba(0,0,0,.16) 0, rgba(0,0,0,.07) 25%, rgba(0,0,0,.02) 60%, transparent 100%); }
.vbk-side-r .vbk-sheet::after { left: 0; background: linear-gradient(to right, rgba(0,0,0,.13) 0, rgba(0,0,0,.05) 25%, rgba(0,0,0,.015) 60%, transparent 100%); }
.vbk-stage, .vbk-stage * { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }

/* Links im PDF */
.vbk-links { position: absolute; inset: 0; }
.vbk-link { position: absolute; display: block; border-radius: 2px; cursor: pointer; }
@media (hover: hover) { .vbk-link:hover { background: rgba(255, 214, 0, .28); box-shadow: 0 0 0 1px rgba(200, 150, 0, .5); } }
.vbk-link:focus-visible { outline: 2px solid var(--vbk-accent); outline-offset: 1px; }

.vbk-at-edge .vbk-stage { cursor: pointer; }
.vbk-at-page .vbk-stage { cursor: zoom-in; }
.vbk-zoomed .vbk-stage { cursor: grab; }
.vbk-zoomed .vbk-stage:active { cursor: grabbing; }

/* Pfeile an der Seite */
.vbk-nav { position: absolute; top: 50%; width: 44px; height: 64px; margin-top: -32px; z-index: 10; border-radius: 8px;
  background: rgba(255, 255, 255, .78); box-shadow: 0 1px 6px rgba(0,0,0,.15); opacity: .85; }
.vbk-nav:hover { opacity: 1; background: #fff; }
.vbk-nav-prev { left: 6px; }
.vbk-nav-next { right: 6px; }
.vbk .vbk-nav[hidden], .vbk-zoomed .vbk-nav { display: none; }
@media (max-width: 599px), (pointer: coarse) and (max-width: 900px) { .vbk .vbk-nav { display: none; } }

/* Werkzeugleiste */
.vbk-bar { flex: none; height: var(--vbk-bar-h); display: flex; align-items: center; gap: 8px; padding: 0 8px;
  padding-bottom: env(safe-area-inset-bottom); background: var(--vbk-bar-bg); border-top: 1px solid var(--vbk-line); position: relative; z-index: 20; }
.vbk-bar-l, .vbk-bar-r { flex: 1 1 0; display: flex; align-items: center; min-width: 0; }
.vbk-bar-r { justify-content: flex-end; gap: 2px; }
.vbk-bar-m { flex: none; display: flex; align-items: center; gap: 2px; }
.vbk-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: 6px; }
.vbk-btn { appearance: none; -webkit-appearance: none; border: 0; background: transparent; color: var(--vbk-fg); width: 40px; height: 40px;
  padding: 0; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; text-decoration: none; flex: none; }
.vbk-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.vbk-btn:hover:not(:disabled) { background: rgba(0, 0, 0, .06); }
.vbk-btn:disabled { opacity: .3; cursor: default; }
.vbk-btn:focus-visible, .vbk-ind:focus-visible { outline: 2px solid var(--vbk-accent); outline-offset: 1px; }
.vbk-ind { appearance: none; border: 0; background: rgba(0,0,0,.05); color: var(--vbk-fg); font: inherit; height: 36px; min-width: 86px; padding: 0 12px;
  border-radius: 18px; cursor: pointer; font-variant-numeric: tabular-nums; white-space: nowrap; }
.vbk-ind span { color: var(--vbk-muted); }
.vbk-ind:hover { background: rgba(0,0,0,.09); }
@media (max-width: 599px) {
  .vbk-bar-l, .vbk-first, .vbk-last, .vbk-zin, .vbk-zout, .vbk-grid { display: none; }
  .vbk-bar { gap: 4px; }
  .vbk-bar-m { flex: 1; justify-content: flex-start; }
  .vbk-bar-r { flex: none; }
}
@media (max-width: 899px) { .vbk-bar-l { display: none; } .vbk-bar-r { flex: none; } .vbk-bar-m { flex: 1; justify-content: center; } }
@media (max-width: 599px) { .vbk-bar-m { justify-content: flex-start; } }

/* Hinweis */
.vbk-toast { position: absolute; left: 50%; bottom: calc(var(--vbk-bar-h) + 16px); transform: translate(-50%, 10px); background: rgba(20, 22, 26, .92); color: #fff;
  padding: 8px 14px; border-radius: 8px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 40; max-width: 90%; word-break: break-all; }
.vbk-toast.vbk-show { opacity: 1; transform: translate(-50%, 0); }

/* Seitenübersicht */
.vbk-thumbs { position: absolute; inset: 0; z-index: 30; background: #f5f6f8; display: flex; flex-direction: column; -webkit-user-select: none; user-select: none; }
.vbk-thumbs[hidden] { display: none; }
.vbk-th-head { flex: none; display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 16px; border-bottom: 1px solid var(--vbk-line); background: var(--vbk-bar-bg); }
.vbk-th-title { flex: 1; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vbk-th-goto { display: flex; align-items: center; gap: 6px; }
.vbk-th-goto label { display: flex; align-items: center; gap: 6px; color: var(--vbk-muted); }
.vbk-th-goto input { width: 64px; height: 32px; font: inherit; padding: 0 8px; border: 1px solid var(--vbk-line); border-radius: 6px; background: #fff; color: var(--vbk-fg); -webkit-user-select: text; user-select: text; }
.vbk-btn-txt { height: 32px; padding: 0 12px; border: 0; border-radius: 6px; background: var(--vbk-accent); color: #fff; font: inherit; cursor: pointer; }
.vbk-th-body { flex: 1; min-height: 0; overflow: auto; -webkit-overflow-scrolling: touch; display: flex; align-items: flex-start; }
.vbk-th-grid { flex: 1; display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 18px 14px; padding: 16px; }
@media (max-width: 599px) { .vbk-th-grid { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 14px 10px; padding: 12px; } .vbk-th-title { display: none; } }
.vbk-th { appearance: none; border: 0; background: transparent; padding: 0; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--vbk-muted); font: inherit; font-size: 13px; }
.vbk-th img { width: 100%; height: auto; display: block; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.2); border-radius: 2px; outline: 3px solid transparent; outline-offset: 2px; transition: outline-color .15s; }
.vbk-th:hover img { outline-color: rgba(0,0,0,.15); }
.vbk-th.vbk-cur img { outline-color: var(--vbk-accent); }
.vbk-th.vbk-cur span { color: var(--vbk-fg); font-weight: 600; }
.vbk-toc { flex: none; width: 280px; position: sticky; top: 0; max-height: 100%; overflow: auto; padding: 16px; box-sizing: border-box; border-right: 1px solid var(--vbk-line); }
.vbk-toc h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--vbk-muted); margin: 0 0 8px; }
.vbk-toc ul { list-style: none; margin: 0; padding: 0; }
.vbk-toc ul ul { padding-left: 14px; }
.vbk-toc a { display: flex; gap: 8px; padding: 6px 8px; border-radius: 6px; color: var(--vbk-fg); text-decoration: none; }
.vbk-toc a:hover { background: rgba(0,0,0,.05); }
.vbk-toc a span { flex: 1; }
.vbk-toc a em { font-style: normal; color: var(--vbk-muted); font-variant-numeric: tabular-nums; }
@media (max-width: 799px) { .vbk-th-body.vbk-has-toc { flex-direction: column; align-items: stretch; } .vbk-toc { width: auto; position: static; border-right: 0; border-bottom: 1px solid var(--vbk-line); max-height: none; } }

@media (prefers-reduced-motion: reduce) { .vbk-page img, .vbk-toast { transition: none; } }
