.pmg-fb {
	--pmg-fb-height: 80vh;
	--pmg-fb-bg: #1a1a1a;
	--pmg-fb-bar: #111;
	--pmg-fb-ink: #f4f4f4;
	box-sizing: border-box;
	position: relative;
	width: 100%;
	height: var(--pmg-fb-height);
	height: max(420px, var(--pmg-fb-height));
	background: var(--pmg-fb-bg);
	color: var(--pmg-fb-ink);
	overflow: hidden;
	font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
	-webkit-tap-highlight-color: transparent;
	user-select: none;
	-webkit-user-select: none;
	touch-action: none;
	overscroll-behavior: none;
	overscroll-behavior-x: none;
}

html.pmg-fb-active,
html.pmg-fb-active body,
body.pmg-fb-lock {
	overscroll-behavior-x: none;
}

.pmg-fb *,
.pmg-fb *::before,
.pmg-fb *::after {
	box-sizing: border-box;
}

.pmg-fb__loading {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 100%;
	margin: 0;
	opacity: 0.8;
}

.pmg-fb__stage {
	position: absolute;
	inset: 0 0 52px 0;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	touch-action: none;
	-ms-touch-action: none;
	-webkit-user-select: none;
	overscroll-behavior: none;
	overscroll-behavior-x: none;
}

.pmg-fb.is-thumbs .pmg-fb__stage,
.pmg-fb.is-toc .pmg-fb__stage {
	bottom: 168px;
}

.pmg-fb__stage.is-zoomed {
	overflow: hidden;
	cursor: grab;
	touch-action: none;
}

.pmg-fb__stage.is-zoomed.is-panning {
	cursor: grabbing;
}

.pmg-fb__stage.is-peek {
	justify-content: flex-start;
}

.pmg-fb__book.is-peek {
	flex-shrink: 0;
	will-change: transform;
}

.pmg-fb__book.is-peek .pmg-fb__page {
	flex: 0 0 50%;
}

.pmg-fb__book:has(.pmg-fb__page--right.is-blank) .pmg-fb__page--left {
	box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

.pmg-fb__book {
	position: relative;
	display: flex;
	transform-origin: center center;
	transform-style: preserve-3d;
	box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
	background: #fff;
	gap: 0;
}

.pmg-fb__page {
	position: relative;
	flex: 1 1 50%;
	height: 100%;
	margin: 0;
	min-width: 0;
	background: #fff;
	overflow: hidden;
}

.pmg-fb__page--left {
	margin-right: -1px;
	z-index: 1;
}

.pmg-fb__page--right {
	z-index: 0;
}

.pmg-fb__page.is-unfocused {
	pointer-events: none;
}

.pmg-fb__page.is-empty {
	display: none;
}

.pmg-fb__page.is-blank {
	background: var(--pmg-fb-bg);
	box-shadow: none;
}

.pmg-fb__page.is-blank .pmg-fb__img {
	visibility: hidden;
	background: transparent;
}

.pmg-fb__book:has(.pmg-fb__page.is-blank) {
	background: var(--pmg-fb-bg);
	box-shadow: none;
}

.pmg-fb__book:has(.pmg-fb__page--left.is-blank) .pmg-fb__page--right {
	box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

.pmg-fb__book.is-single .pmg-fb__page {
	flex-basis: 100%;
	margin-right: 0;
}

.pmg-fb__img,
.pmg-fb__sheet-face img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: fill;
	background: #fff;
	pointer-events: none;
	-webkit-user-drag: none;
}

.pmg-fb__hotspots,
.pmg-fb__hotspot {
	position: absolute;
	pointer-events: none;
}

.pmg-fb__hotspots {
	inset: 0;
	z-index: 3;
}

.pmg-fb__hotspot {
	display: block;
	padding: 0;
	border: 0;
	background: rgba(0, 140, 255, 0);
	cursor: pointer;
	z-index: 4;
	touch-action: none;
	-webkit-touch-callout: none;
	user-select: none;
}

@media (hover: hover) and (pointer: fine) {
	.pmg-fb__hotspot {
		pointer-events: auto;
		cursor: pointer;
	}
}

.pmg-fb.is-highlight .pmg-fb__hotspot:hover,
.pmg-fb.is-highlight .pmg-fb__hotspot:focus-visible {
	background: rgba(0, 140, 255, 0.18);
	outline: 2px solid rgba(0, 140, 255, 0.55);
	outline-offset: -2px;
}

.pmg-fb__edge {
	position: absolute;
	top: 0;
	bottom: 0;
	width: 14%;
	border: 0;
	padding: 0;
	background: transparent;
	cursor: pointer;
	z-index: 5;
}

.pmg-fb__edge--left {
	left: 0;
}

.pmg-fb__edge--right {
	right: 0;
}

.pmg-fb__sheet {
	display: block;
	position: absolute;
	top: 0;
	height: 100%;
	width: 50%;
	transform: perspective(1800px) rotateY(0deg);
	transform-style: preserve-3d;
	z-index: 6;
	pointer-events: none;
	visibility: hidden;
	opacity: 0;
	will-change: transform;
}

.pmg-fb__sheet.is-on {
	visibility: visible;
	opacity: 1;
}

.pmg-fb__sheet.is-forward {
	right: 0;
	transform-origin: left center;
}

.pmg-fb__sheet.is-back {
	left: 0;
	transform-origin: right center;
}

/* Cover the gutter by 1px so the turning leaf and the static page never flash a gap. */
.pmg-fb__sheet.is-forward .pmg-fb__sheet-face {
	left: -1px;
	right: auto;
	width: calc(100% + 1px);
}

.pmg-fb__sheet.is-back .pmg-fb__sheet-face {
	right: -1px;
	left: auto;
	width: calc(100% + 1px);
}

.pmg-fb__book.is-single .pmg-fb__sheet {
	width: 100%;
}

.pmg-fb__sheet-face {
	position: absolute;
	inset: 0;
	backface-visibility: hidden;
	-webkit-backface-visibility: hidden;
	background: #fff;
	overflow: hidden;
	transform-style: preserve-3d;
}

.pmg-fb__sheet-front {
	transform: rotateY(0deg) translateZ(1px);
}

.pmg-fb__sheet-back {
	transform: rotateY(180deg) translateZ(1px);
}

.pmg-fb__sheet-shade {
	position: absolute;
	inset: 0;
	z-index: 5;
	pointer-events: none;
	opacity: 0.2;
	transform: translateZ(2px);
	backface-visibility: hidden;
	-webkit-backface-visibility: hidden;
	background: linear-gradient(
		90deg,
		rgba(0, 0, 0, 0.38) 0%,
		rgba(0, 0, 0, 0.08) 18%,
		rgba(0, 0, 0, 0) 48%,
		rgba(0, 0, 0, 0.1) 82%,
		rgba(0, 0, 0, 0.32) 100%
	);
}

.pmg-fb__sheet.is-back .pmg-fb__sheet-shade {
	background: linear-gradient(
		270deg,
		rgba(0, 0, 0, 0.38) 0%,
		rgba(0, 0, 0, 0.08) 18%,
		rgba(0, 0, 0, 0) 48%,
		rgba(0, 0, 0, 0.1) 82%,
		rgba(0, 0, 0, 0.32) 100%
	);
}

.pmg-fb__nav {
	display: none;
	position: absolute;
	top: 50%;
	z-index: 7;
	align-items: center;
	justify-content: center;
	width: 56px;
	height: 56px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(12, 12, 12, 0.62);
	color: #fff;
	cursor: pointer;
	transform: translateY(-50%);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
	touch-action: auto;
}

.pmg-fb.has-side-nav .pmg-fb__nav {
	display: inline-flex;
}

.pmg-fb.is-zoomed .pmg-fb__nav,
.pmg-fb.is-thumbs .pmg-fb__nav,
.pmg-fb.is-toc .pmg-fb__nav {
	display: none;
}

.pmg-fb__nav svg {
	width: 30px;
	height: 30px;
}

.pmg-fb__nav--prev {
	left: 12px;
}

.pmg-fb__nav--next {
	right: 12px;
}

.pmg-fb__nav:hover,
.pmg-fb__nav:focus-visible {
	background: rgba(255, 255, 255, 0.18);
	outline: none;
}

.pmg-fb__nav:disabled {
	opacity: 0.28;
	cursor: default;
}

.pmg-fb__ui {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 8;
	background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.35) 30%, #0d0d0d);
	touch-action: auto;
}

.pmg-fb__bar {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 4px;
	min-height: 52px;
	padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}

.pmg-fb__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: #fff;
	cursor: pointer;
	text-decoration: none;
}

.pmg-fb__icon svg {
	width: 22px;
	height: 22px;
}

.pmg-fb__toc-jump {
	width: auto;
	padding: 0 10px;
	gap: 6px;
	font-size: 12px;
	font-weight: 650;
	letter-spacing: 0.04em;
}

.pmg-fb__toc-jump span {
	line-height: 1;
}

.pmg-fb__icon:hover,
.pmg-fb__icon:focus-visible {
	background: rgba(255, 255, 255, 0.12);
}

.pmg-fb__icon:disabled {
	opacity: 0.35;
	cursor: default;
}

.pmg-fb__page-ctrl {
	display: flex;
	align-items: center;
	gap: 4px;
	min-width: 92px;
	justify-content: center;
	font-size: 13px;
}

.pmg-fb__page-input {
	width: 52px;
	height: 32px;
	border: 1px solid rgba(255, 255, 255, 0.2);
	border-radius: 6px;
	background: rgba(255, 255, 255, 0.08);
	color: #fff;
	text-align: center;
	font-size: 16px;
}

.pmg-fb__thumbs,
.pmg-fb__toc {
	display: none;
	height: 116px;
	overflow: auto;
	-webkit-overflow-scrolling: touch;
	background: #0d0d0d;
	padding: 8px 12px;
}

.pmg-fb.is-thumbs .pmg-fb__thumbs,
.pmg-fb.is-toc .pmg-fb__toc {
	display: block;
}

.pmg-fb__thumbs {
	display: none;
	white-space: nowrap;
}

.pmg-fb.is-thumbs .pmg-fb__thumbs {
	display: flex;
	gap: 14px;
	align-items: stretch;
}

.pmg-fb__thumb-spread {
	display: flex;
	flex: 0 0 auto;
	gap: 0;
	align-items: stretch;
	overflow: hidden;
	font-size: 0;
	background: #111;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.pmg-fb__thumb {
	flex: 0 0 auto;
	width: 72px;
	min-width: 0;
	padding: 0;
	margin: 0;
	border: 0;
	border-radius: 0;
	background: #222;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}

.pmg-fb__thumb-spread .pmg-fb__thumb + .pmg-fb__thumb {
	margin-left: 0;
}

.pmg-fb__thumb.is-active,
.pmg-fb__thumb:hover {
	box-shadow: inset 0 0 0 2px #fff;
}

.pmg-fb__thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.pmg-fb__toc {
	color: #eee;
	font-size: 14px;
}

.pmg-fb__toc ul {
	list-style: none;
	margin: 0;
	padding: 0 0 0 12px;
}

.pmg-fb__toc li button {
	display: block;
	width: 100%;
	padding: 6px 8px;
	border: 0;
	background: transparent;
	color: inherit;
	text-align: left;
	cursor: pointer;
}

.pmg-fb__toc li button:hover {
	background: rgba(255, 255, 255, 0.08);
}

.pmg-fb__toc-logo {
	padding: 4px 8px 10px;
}

.pmg-fb__toc-logo img {
	display: block;
	max-height: 40px;
	margin: 0 auto;
}

.pmg-fb.is-fs {
	position: fixed;
	inset: 0;
	z-index: 999999;
	height: 100vh;
	height: 100dvh;
	width: 100vw;
	--pmg-fb-height: 100dvh;
}

body.pmg-fb-lock {
	overflow: hidden;
	touch-action: none;
	overscroll-behavior-x: none;
}

@media (max-width: 879px) {
	.pmg-fb.has-side-nav .pmg-fb__nav {
		display: none;
	}
}

@media (max-width: 720px) {
	.pmg-fb {
		height: min(92dvh, 820px);
	}

	.pmg-fb__bar {
		gap: 0;
	}

	.pmg-fb__icon {
		width: 36px;
		height: 36px;
	}

	.pmg-fb__toc-jump {
		width: auto;
		padding: 0 8px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.pmg-fb__sheet,
	.pmg-fb__book {
		transition-duration: 0.01ms !important;
	}
}
