/* FRS Webkatalog – Viewer */
.frs-wk {
	--frs-bg: #2b2f36;
	--frs-accent: #e30613;
	--frs-tb: #16181d;
	--frs-h: 80vh;
	--frs-tb-h: 52px;
	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	height: var(--frs-h);
	min-height: 320px;
	background: var(--frs-bg);
	color: #fff;
	overflow: hidden;
	border-radius: 6px;
	font: 14px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	box-sizing: border-box;
	outline: none;
	-webkit-user-select: none;
	user-select: none;
	-webkit-tap-highlight-color: transparent;
}
.frs-wk *, .frs-wk *::before, .frs-wk *::after { box-sizing: border-box; }
.frs-wk:focus-visible { box-shadow: 0 0 0 3px var(--frs-accent); }
.frs-wk-inline { margin: 0 0 1.5em; }

/* Bühne */
.frs-wk-stage {
	position: relative;
	flex: 1 1 auto;
	min-height: 0;
	overflow: hidden;
	background:
		radial-gradient(ellipse at center, rgba(255,255,255,.08) 0%, rgba(0,0,0,0) 70%),
		var(--frs-bg);
}
.frs-wk-viewport {
	position: absolute;
	inset: 24px 64px;
}
.frs-wk-zoom {
	position: absolute;
	inset: 0;
	transform-origin: 50% 50%;
	transition: transform .18s ease-out;
	will-change: transform;
}
.frs-wk-book { width: 100%; height: 100%; transition: transform .45s ease; }
.frs-wk-book .stf__wrapper { height: 100%; }
.frs-wk-book .stf__block { touch-action: pan-y; }

/* Seiten */
.frs-wk-page {
	position: relative;
	background: #fff;
	overflow: hidden;
}
.frs-wk-page .frs-wk-canvas {
	position: absolute;
	left: 0; top: 0;
	width: 100%; height: 100%;
	opacity: 0;
	transition: opacity .25s;
}
.frs-wk-page.is-rendered .frs-wk-canvas { opacity: 1; }
.frs-wk-page.frs-wk-fit .frs-wk-canvas { object-fit: contain; }
.frs-wk-page-ph {
	position: absolute; inset: 0;
	display: flex; align-items: center; justify-content: center;
	color: #c9ccd1; font-size: 28px; font-weight: 300;
	background: #fff;
}
.frs-wk-page.is-rendered .frs-wk-page-ph { display: none; }
/* Falz-Schatten zur Buchmitte */
.frs-wk-page::after {
	content: ""; position: absolute; top: 0; bottom: 0; width: 7%;
	pointer-events: none; z-index: 3;
}
.frs-wk-page.--left::after { right: 0; background: linear-gradient(to left, rgba(0,0,0,.16), rgba(0,0,0,0)); }
.frs-wk-page.--right::after { left: 0; background: linear-gradient(to right, rgba(0,0,0,.16), rgba(0,0,0,0)); }
.frs-wk-page[data-density="hard"]::after,
.frs-wk-book .--portrait .frs-wk-page::after { display: none; }

.frs-wk-hl, .frs-wk-links { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
.frs-wk-hl-mark { position: absolute; background: rgba(255, 214, 0, .45); mix-blend-mode: multiply; border-radius: 2px; }
.frs-wk-links a {
	position: absolute; display: block; pointer-events: auto; cursor: pointer;
	border-radius: 2px; transition: background .15s;
}
.frs-wk-links a:hover { background: rgba(0, 120, 255, .14); outline: 1px solid rgba(0, 120, 255, .35); }

/* Pfeile */
.frs-wk-arrow {
	position: absolute; top: 50%; z-index: 20;
	width: 48px; height: 72px; margin-top: -36px; padding: 0;
	border: 0; border-radius: 6px; cursor: pointer;
	background: rgba(0,0,0,.25); color: #fff;
	display: flex; align-items: center; justify-content: center;
	transition: background .2s, opacity .2s;
}
.frs-wk-arrow svg { width: 34px; height: 34px; fill: currentColor; }
.frs-wk-arrow:hover { background: var(--frs-accent); }
.frs-wk-arrow:disabled { opacity: 0; pointer-events: none; }
.frs-wk-arrow-prev { left: 8px; }
.frs-wk-arrow-next { right: 8px; }

/* Zoom: Verschiebe-Ebene */
.frs-wk-panlayer { position: absolute; inset: 0; z-index: 15; display: none; cursor: grab; touch-action: none; }
.frs-wk.is-zoomed .frs-wk-panlayer { display: block; }
.frs-wk.is-zoomed .frs-wk-arrow { opacity: 0; pointer-events: none; }
.frs-wk-panlayer.is-grabbing { cursor: grabbing; }
.frs-wk-panlayer.is-grabbing ~ * .frs-wk-zoom,
.frs-wk.is-zoomed .frs-wk-zoom { transition: none; }

/* Werkzeugleiste */
.frs-wk-toolbar {
	flex: 0 0 var(--frs-tb-h);
	display: flex; align-items: center; justify-content: space-between; gap: 6px;
	padding: 0 8px;
	background: var(--frs-tb);
	border-top: 1px solid rgba(255,255,255,.06);
	z-index: 30;
}
.frs-wk-tb-group { display: flex; align-items: center; gap: 2px; flex: 1 1 0; }
.frs-wk-tb-center { justify-content: center; flex: 0 0 auto; }
.frs-wk-tb-right { justify-content: flex-end; }
.frs-wk-btn {
	display: inline-flex; align-items: center; justify-content: center;
	width: 38px; height: 38px; padding: 0; margin: 0;
	border: 0; border-radius: 6px; cursor: pointer;
	background: transparent; color: #d7dae0;
	text-decoration: none !important; box-shadow: none !important;
	transition: background .15s, color .15s;
}
.frs-wk-btn svg { width: 22px; height: 22px; fill: currentColor; }
.frs-wk-btn:hover { background: rgba(255,255,255,.1); color: #fff; }
.frs-wk-btn.is-active { background: var(--frs-accent); color: #fff; }
.frs-wk-btn:disabled { opacity: .3; cursor: default; background: transparent; }
.frs-wk-btn:focus-visible, .frs-wk-arrow:focus-visible { outline: 2px solid var(--frs-accent); outline-offset: 1px; }
.frs-wk-pageinfo { display: inline-flex; align-items: center; gap: 4px; margin: 0 6px; color: #aeb3bb; white-space: nowrap; cursor: text; }
.frs-wk-pageinput {
	min-width: 2.6em; height: 30px; padding: 0 6px !important; margin: 0 !important;
	text-align: center; font: inherit; font-weight: 600; color: #fff !important;
	background: rgba(255,255,255,.08) !important; border: 1px solid rgba(255,255,255,.14) !important;
	border-radius: 5px !important; box-shadow: none !important; width: auto;
}
.frs-wk-pageinput:focus { border-color: var(--frs-accent) !important; outline: none; }

/* Seitenleiste */
.frs-wk-panel {
	position: absolute; top: 0; bottom: 0; left: 0; z-index: 25;
	width: 300px; max-width: 88%;
	display: flex; flex-direction: column;
	background: rgba(22,24,29,.97);
	box-shadow: 4px 0 24px rgba(0,0,0,.35);
	transform: translateX(-105%);
	transition: transform .25s ease;
}
.frs-wk-panel.is-open { transform: none; }
.frs-wk-panel header {
	display: flex; align-items: center; justify-content: space-between;
	padding: 10px 8px 10px 16px; border-bottom: 1px solid rgba(255,255,255,.08);
	font-weight: 600; font-size: 15px;
}
.frs-wk-panel-close { background: none; border: 0; color: #aeb3bb; cursor: pointer; padding: 4px; border-radius: 4px; display: flex; }
.frs-wk-panel-close:hover { color: #fff; background: rgba(255,255,255,.1); }
.frs-wk-panel-close svg { width: 20px; height: 20px; fill: currentColor; }
.frs-wk-panel-body { flex: 1 1 auto; overflow-y: auto; padding: 12px; -webkit-overflow-scrolling: touch; }
.frs-wk-panel-body::-webkit-scrollbar { width: 8px; }
.frs-wk-panel-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 4px; }

.frs-wk-thumbs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.frs-wk-thumb { background: none; border: 0; padding: 0; cursor: pointer; color: #aeb3bb; text-align: center; }
.frs-wk-thumb-img { position: relative; display: block; background: #fff; border-radius: 2px; overflow: hidden; outline: 2px solid transparent; outline-offset: 2px; transition: outline-color .15s; }
.frs-wk-thumb-img canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.frs-wk-thumb:hover .frs-wk-thumb-img { outline-color: rgba(255,255,255,.4); }
.frs-wk-thumb.is-current .frs-wk-thumb-img { outline-color: var(--frs-accent); }
.frs-wk-thumb.is-current { color: #fff; }
.frs-wk-thumb-no { display: block; font-size: 12px; margin-top: 4px; }

.frs-wk-toc, .frs-wk-toc ul { list-style: none; margin: 0; padding: 0; }
.frs-wk-toc ul { padding-left: 14px; }
.frs-wk-toc a {
	display: flex; justify-content: space-between; gap: 10px;
	padding: 7px 8px; border-radius: 4px;
	color: #e3e5e8 !important; text-decoration: none !important; box-shadow: none !important;
}
.frs-wk-toc a:hover { background: rgba(255,255,255,.08); }
.frs-wk-toc-pg { color: #8a9099; font-variant-numeric: tabular-nums; }

.frs-wk-search-form { display: flex; gap: 6px; margin-bottom: 12px; }
.frs-wk-search-input {
	flex: 1; height: 36px; padding: 0 10px !important; margin: 0 !important; font: inherit;
	color: #fff !important; background: rgba(255,255,255,.08) !important;
	border: 1px solid rgba(255,255,255,.16) !important; border-radius: 5px !important; box-shadow: none !important;
}
.frs-wk-search-input:focus { border-color: var(--frs-accent) !important; outline: none; }
.frs-wk-search-go { width: 36px; height: 36px; border: 0; border-radius: 5px; background: var(--frs-accent); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; }
.frs-wk-search-go svg { width: 20px; height: 20px; fill: currentColor; }
.frs-wk-search-count { color: #8a9099; margin: 0 0 8px; font-size: 13px; }
.frs-wk-hit {
	display: block; width: 100%; text-align: left; cursor: pointer;
	padding: 9px 10px; margin: 0 0 6px; border: 0; border-radius: 5px;
	background: rgba(255,255,255,.05); color: #cfd3d9; font: inherit; font-size: 13px;
}
.frs-wk-hit:hover { background: rgba(255,255,255,.1); }
.frs-wk-hit-pg { display: block; font-weight: 600; color: #fff; margin-bottom: 3px; }
.frs-wk-hit mark { background: #ffd600; color: #000; padding: 0 1px; border-radius: 2px; }
.frs-wk-empty { color: #8a9099; margin: 8px 0; }

/* Lader */
.frs-wk-loader {
	position: absolute; inset: 0; z-index: 40;
	display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
	background: var(--frs-bg); color: #cfd3d9;
	transition: opacity .35s;
}
.frs-wk-loader.is-done { opacity: 0; pointer-events: none; }
.frs-wk-spinner {
	width: 42px; height: 42px; border-radius: 50%;
	border: 3px solid rgba(255,255,255,.15); border-top-color: var(--frs-accent);
	animation: frs-wk-spin .8s linear infinite;
}
.frs-wk-spinner-sm { width: 24px; height: 24px; margin: 12px auto; }
@keyframes frs-wk-spin { to { transform: rotate(360deg); } }
.frs-wk-progress { width: 180px; height: 3px; background: rgba(255,255,255,.12); border-radius: 2px; overflow: hidden; }
.frs-wk-progress span { display: block; height: 100%; width: 0; background: var(--frs-accent); transition: width .2s; }
.frs-wk-error { text-align: center; padding: 20px; }
.frs-wk-error a { color: var(--frs-accent); }

/* Hinweis-Toast */
.frs-wk-toast {
	position: absolute; left: 50%; bottom: 16px; z-index: 35;
	transform: translate(-50%, 10px); opacity: 0; pointer-events: none;
	background: rgba(0,0,0,.8); color: #fff; padding: 8px 14px; border-radius: 20px; font-size: 13px;
	transition: opacity .2s, transform .2s;
}
.frs-wk-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* Vollbild */
.frs-wk:fullscreen { height: 100vh; border-radius: 0; }
.frs-wk:-webkit-full-screen { height: 100vh; border-radius: 0; }
.frs-wk.is-pseudo-fs { position: fixed !important; inset: 0; z-index: 999999; height: 100% !important; border-radius: 0; }
html.frs-wk-noscroll, html.frs-wk-noscroll body { overflow: hidden !important; }

/* Popup */
.frs-wk-overlay {
	position: fixed; inset: 0; z-index: 999990;
	background: rgba(10,11,14,.85);
	display: flex; align-items: center; justify-content: center;
	padding: 2vh 2vw;
	opacity: 0; transition: opacity .25s;
}
.frs-wk-overlay.is-open { opacity: 1; }
.frs-wk-popup { height: 100%; max-width: 1800px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
@media (max-width: 700px) {
	.frs-wk-overlay { padding: 0; }
	.frs-wk-popup { border-radius: 0; }
}

/* Titelbild-Karte (Popup-Modus & Übersicht) */
.frs-wk-popup-card { max-width: 340px; margin: 0 0 1.5em; }
.frs-wk-cover {
	position: relative; display: block; overflow: hidden;
	border-radius: 4px; background: #f2f3f5;
	box-shadow: 0 6px 20px rgba(0,0,0,.18), 0 1px 3px rgba(0,0,0,.1);
	transition: transform .25s, box-shadow .25s;
	text-decoration: none !important;
}
.frs-wk-cover::before { /* Buchrücken-Effekt */
	content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6%; z-index: 2;
	background: linear-gradient(to right, rgba(0,0,0,.18), rgba(255,255,255,.15) 40%, rgba(0,0,0,0));
}
.frs-wk-cover:hover { transform: translateY(-4px) rotate(-.5deg); box-shadow: 0 14px 34px rgba(0,0,0,.25); }
.frs-wk-cover img, .frs-wk-cover canvas { display: block; width: 100% !important; height: auto !important; margin: 0 !important; }
.frs-wk-cover-canvas { aspect-ratio: 1 / 1.414; background: #fff; }
.frs-wk-cover-canvas.is-rendered { aspect-ratio: auto; }
.frs-wk-cover-btn {
	position: absolute; left: 50%; bottom: 14px; z-index: 3;
	transform: translate(-50%, 8px); opacity: 0;
	background: var(--frs-accent, #e30613); color: #fff; white-space: nowrap;
	padding: 9px 18px; border-radius: 30px; font-size: 14px; font-weight: 600;
	box-shadow: 0 4px 14px rgba(0,0,0,.25);
	transition: opacity .2s, transform .2s;
}
.frs-wk-cover:hover .frs-wk-cover-btn, .frs-wk-cover:focus-visible .frs-wk-cover-btn { opacity: 1; transform: translate(-50%, 0); }
@media (hover: none) { .frs-wk-cover-btn { opacity: 1; transform: translate(-50%, 0); } }

.frs-wk-grid { display: grid; grid-template-columns: repeat(var(--frs-cols, 3), minmax(0, 1fr)); gap: 32px; margin: 0 0 1.5em; }
.frs-wk-grid-item { margin: 0; }
.frs-wk-grid-item figcaption { margin-top: 12px; text-align: center; font-weight: 600; }
@media (max-width: 900px) { .frs-wk-grid { grid-template-columns: repeat(min(var(--frs-cols, 3), 2), minmax(0, 1fr)); gap: 20px; } }
@media (max-width: 480px) { .frs-wk-grid { grid-template-columns: 1fr 1fr; gap: 14px; } }

.frs-wk-hint { padding: 10px 14px; background: #fff3cd; border-left: 4px solid #e0a800; color: #5c4400; }

/* Mobil */
@media (max-width: 640px) {
	.frs-wk { --frs-tb-h: 48px; }
	.frs-wk-viewport { inset: 10px 8px; }
	.frs-wk-arrow { width: 34px; height: 54px; margin-top: -27px; background: rgba(0,0,0,.18); }
	.frs-wk-arrow svg { width: 26px; height: 26px; }
	.frs-wk-arrow-prev { left: 2px; }
	.frs-wk-arrow-next { right: 2px; }
	.frs-wk-btn { width: 34px; height: 34px; }
	.frs-wk-btn svg { width: 20px; height: 20px; }
	.frs-wk-btn-first, .frs-wk-btn-last, .frs-wk-btn-zoomOut, .frs-wk-btn-zoomIn, .frs-wk-btn-sound { display: none; }
	.frs-wk-pageinfo { margin: 0 2px; font-size: 13px; }
	.frs-wk-toolbar { padding: 0 4px; gap: 2px; }
}
@media (max-width: 380px) {
	.frs-wk-btn-share { display: none; }
}

@media (prefers-reduced-motion: reduce) {
	.frs-wk-zoom, .frs-wk-panel, .frs-wk-cover { transition: none; }
}
