/* Flickthrough viewer */
.flickthrough {
	--flickthrough-bg: #2b2b2f;
	--flickthrough-accent: #ffffff;
	--flickthrough-bar: rgba(0, 0, 0, 0.28);
	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	margin: 0 auto 1.5em;
	background: var(--flickthrough-bg);
	border-radius: 6px;
	overflow: hidden;
	color: var(--flickthrough-accent);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 14px;
	line-height: 1.2;
	box-sizing: border-box;
	-webkit-tap-highlight-color: transparent;
}
.flickthrough *, .flickthrough *::before, .flickthrough *::after { box-sizing: border-box; }

.flickthrough-stage {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 320px;
	width: 100%;
	overflow: hidden;
}
.flickthrough--fixed .flickthrough-stage { height: var(--flickthrough-height, 600px); flex: none; }

.flickthrough-shell {
	position: relative;
	flex: none;
	transition: transform 0.45s ease;
	filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.35));
}
.flickthrough-book { min-width: 0 !important; min-height: 0 !important; max-width: none !important; margin: 0; }
.flickthrough-book .stf__wrapper { height: 100%; padding-bottom: 0 !important; }

.flickthrough-page {
	background: #fff;
	overflow: hidden;
	user-select: none;
	-webkit-user-select: none;
}
.flickthrough-page:not(.is-rendered) {
	background: #fff linear-gradient(90deg, #f1f1f1 0, #fafafa 50%, #f1f1f1 100%);
	background-size: 200% 100%;
	animation: flickthrough-shimmer 1.4s linear infinite;
}
.flickthrough-img {
	position: absolute;
	inset: 0;
	display: block;
	width: 100% !important;
	height: 100% !important;
	max-width: none !important;
	margin: 0 !important;
	object-fit: contain;
	pointer-events: none;
	-webkit-user-drag: none;
	border: 0 !important;
	border-radius: 0 !important;
	box-shadow: none !important;
}
.flickthrough-img:not([src]) { visibility: hidden; }
.flickthrough-links { position: absolute; inset: 0; pointer-events: none; }
.flickthrough-link {
	position: absolute;
	display: block;
	pointer-events: auto;
	cursor: pointer;
	border-radius: 2px;
	transition: background-color 0.15s ease;
}
.flickthrough-link:hover, .flickthrough-link:focus-visible { background: rgba(255, 214, 0, 0.22); outline: none; }

/* Loading and errors */
.flickthrough-status {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 14px;
	padding: 40px 20px;
	text-align: center;
	opacity: 0.85;
}
.flickthrough-status p { margin: 0; color: inherit; }
.flickthrough-spinner {
	width: 34px;
	height: 34px;
	border: 3px solid currentColor;
	border-right-color: transparent;
	border-radius: 50%;
	animation: flickthrough-spin 0.8s linear infinite;
}
.flickthrough-fallback, .flickthrough-fallback:visited { color: inherit; text-decoration: underline; }

/* Buttons */
.flickthrough-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	margin: 0;
	border: 0;
	border-radius: 6px;
	background: transparent;
	color: var(--flickthrough-accent);
	cursor: pointer;
	text-decoration: none;
	box-shadow: none;
	line-height: 1;
	transition: background-color 0.15s ease, opacity 0.15s ease;
}
.flickthrough-btn:hover, .flickthrough-btn:focus-visible { background: rgba(255, 255, 255, 0.14); color: var(--flickthrough-accent); outline: none; }
.flickthrough-btn:disabled { opacity: 0.3; cursor: default; background: transparent; }
.flickthrough-btn svg { display: block; }

.flickthrough-side {
	position: absolute;
	top: 50%;
	z-index: 5;
	width: 48px;
	height: 64px;
	margin-top: -32px;
	display: none;
}
.flickthrough-side svg { width: 30px; height: 30px; }
.flickthrough-side--prev { left: 8px; }
.flickthrough-side--next { right: 8px; }
.flickthrough--wide .flickthrough-side { display: inline-flex; }

/* Toolbar */
.flickthrough-bar {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	flex-wrap: wrap;
	padding: 6px 10px;
	background: var(--flickthrough-bar);
}
.flickthrough-bar-group { display: flex; align-items: center; gap: 2px; }
.flickthrough-counter {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin: 0 6px;
	font-variant-numeric: tabular-nums;
	cursor: text;
}
.flickthrough .flickthrough-page-input {
	width: auto;
	min-width: 3.2em;
	height: 30px;
	margin: 0;
	padding: 0 6px;
	border: 1px solid rgba(255, 255, 255, 0.25);
	border-radius: 4px;
	background: rgba(0, 0, 0, 0.2);
	color: var(--flickthrough-accent);
	font: inherit;
	text-align: center;
	box-shadow: none;
}
.flickthrough .flickthrough-page-input:focus { border-color: var(--flickthrough-accent); outline: none; }
.flickthrough-total { opacity: 0.75; white-space: nowrap; }
.flickthrough-toast {
	position: absolute;
	left: 50%;
	bottom: calc(100% + 10px);
	transform: translate(-50%, 6px);
	padding: 8px 14px;
	border-radius: 20px;
	background: rgba(0, 0, 0, 0.8);
	color: #fff;
	font-size: 13px;
	white-space: nowrap;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s ease, transform 0.2s ease;
}
.flickthrough-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 520px) {
	.flickthrough-hide-sm { display: none; }
	.flickthrough-bar { padding: 4px 6px; justify-content: center; row-gap: 0; }
	.flickthrough-btn { width: 38px; height: 38px; }
}

/* Full screen */
.flickthrough:fullscreen { width: 100%; height: 100%; margin: 0; border-radius: 0; }
.flickthrough:-webkit-full-screen { width: 100%; height: 100%; margin: 0; border-radius: 0; }
.flickthrough.is-fs {
	position: fixed;
	inset: 0;
	z-index: 2147483000;
	width: 100%;
	max-width: none !important;
	height: 100%;
	height: 100dvh;
	margin: 0;
	border-radius: 0;
}
.flickthrough:fullscreen .flickthrough-stage, .flickthrough.is-fs .flickthrough-stage { flex: 1 1 auto; height: auto !important; min-height: 0; }
.flickthrough:-webkit-full-screen .flickthrough-stage { flex: 1 1 auto; height: auto !important; min-height: 0; }
html.flickthrough-locked, html.flickthrough-locked body { overflow: hidden !important; }

/* Overlays */
.flickthrough-overlay {
	position: fixed;
	inset: 0;
	z-index: 1000000;
	display: flex;
	flex-direction: column;
	background: rgba(18, 18, 20, 0.97);
	color: var(--flickthrough-accent, #fff);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 14px;
}
.flickthrough-overlay * { box-sizing: border-box; }
.flickthrough-overlay .flickthrough-btn { color: var(--flickthrough-accent, #fff); }
.flickthrough-overlay-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 8px 10px 8px 18px;
	flex: none;
}
.flickthrough-overlay-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: 0.9; }
.flickthrough-overlay-body { flex: 1 1 auto; overflow: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.flickthrough-overlay--zoom .flickthrough-overlay-body { display: flex; cursor: grab; }
.flickthrough-overlay--zoom .flickthrough-overlay-body.is-dragging { cursor: grabbing; user-select: none; }
.flickthrough-zoom-inner { display: flex; margin: auto; padding: 16px; box-sizing: content-box; }
.flickthrough-zoom-img { display: block; flex: 1 1 0; min-width: 0; width: 100%; height: auto; max-width: none; background: #fff; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5); }

.flickthrough-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
	gap: 22px 16px;
	max-width: 1280px;
	margin: 0 auto;
	padding: 12px 18px 40px;
}
@media (min-width: 900px) { .flickthrough-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); } }
.flickthrough-thumb {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	cursor: pointer;
}
.flickthrough-thumb-frame {
	display: block;
	width: 100%;
	background: #fff linear-gradient(90deg, #ececec 0, #f8f8f8 50%, #ececec 100%);
	background-size: 200% 100%;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
	outline: 3px solid transparent;
	outline-offset: 3px;
	transition: outline-color 0.15s ease, transform 0.15s ease;
}
.flickthrough-thumb-frame img { display: block; width: 100%; height: 100%; object-fit: contain; }
.flickthrough-thumb-frame img:not([src]) { visibility: hidden; }
.flickthrough-thumb:hover .flickthrough-thumb-frame, .flickthrough-thumb:focus-visible .flickthrough-thumb-frame { transform: translateY(-3px); outline-color: rgba(255, 255, 255, 0.5); }
.flickthrough-thumb:focus-visible { outline: none; }
.flickthrough-thumb.is-current .flickthrough-thumb-frame { outline-color: var(--flickthrough-accent, #fff); }
.flickthrough-thumb-num { font-size: 13px; opacity: 0.8; font-variant-numeric: tabular-nums; }

/* Reader page (share link) */
body.flickthrough-reader {
	margin: 0 !important;
	padding: 0 !important;
	height: 100vh;
	height: 100dvh;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}
.flickthrough-reader-head {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 10px 18px;
	flex: none;
	color: #fff;
	background: rgba(0, 0, 0, 0.3);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.flickthrough-reader-site, .flickthrough-reader-site:visited { color: inherit; text-decoration: none; font-weight: 600; flex: none; }
.flickthrough-reader-logo { display: block; max-height: 34px; width: auto; }
.flickthrough-reader-title { margin: 0; font-size: 15px; font-weight: 500; line-height: 1.3; opacity: 0.85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: inherit; }
.flickthrough-reader-main { flex: 1 1 auto; display: flex; min-height: 0; }
.flickthrough-reader-main .flickthrough { margin: 0; border-radius: 0; flex: 1 1 auto; height: 100%; }
.flickthrough--reader .flickthrough-stage { flex: 1 1 auto; min-height: 0; }
.flickthrough-reader-empty { margin: auto; color: #fff; }
.flickthrough-reader-password { margin: auto; max-width: 440px; padding: 24px; color: #fff; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
.flickthrough-reader-password input[type="password"] { max-width: 100%; }
body.flickthrough-reader.admin-bar { height: calc(100dvh - 32px); }
@media (max-width: 782px) { body.flickthrough-reader.admin-bar { height: calc(100dvh - 46px); } }

@keyframes flickthrough-spin { to { transform: rotate(360deg); } }
@keyframes flickthrough-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) {
	.flickthrough-shell { transition: none; }
	.flickthrough-page:not(.is-rendered), .flickthrough-spinner { animation: none; }
}
