/* Flipbook - HTML/CSS/JS replacement for the old Flash books (book.swf) */

.flipbook {
	width: 100%;
	max-width: 600px;
	margin: 10px 0 6px 0;
	-webkit-user-select: none;
	user-select: none;
	outline: none;
}

.fb-book {
	position: relative;
	width: 100%;
	padding-top: 45.6667%; /* 600 x 274 - two pages of 300 x 274 */
	-webkit-perspective: 1800px;
	perspective: 1800px;
	cursor: pointer;
}

.fb-page,
.fb-leaf {
	position: absolute;
	top: 0;
	width: 50%;
	height: 100%;
}

.fb-left  { left: 0; }
.fb-right { left: 50%; }

.fb-page img,
.fb-face img {
	display: block;
	width: 100%;
	height: 100%;
}

.fb-page.fb-empty img { visibility: hidden; }

/* shadow along the spine */
.fb-left:not(.fb-empty)::after,
.fb-right:not(.fb-empty)::after,
.fb-front::after,
.fb-back::after {
	content: "";
	position: absolute;
	top: 0;
	bottom: 0;
	width: 12%;
	pointer-events: none;
}
.fb-left::after,
.fb-back::after {
	right: 0;
	background: linear-gradient(to left, rgba(0,0,0,0.25), rgba(0,0,0,0));
}
.fb-right::after,
.fb-front::after {
	left: 0;
	background: linear-gradient(to right, rgba(0,0,0,0.25), rgba(0,0,0,0));
}

/* the turning page */
.fb-leaf {
	display: none;
	z-index: 2;
	-webkit-transform-style: preserve-3d;
	transform-style: preserve-3d;
	transition: transform 0.7s ease-in-out;
}
.fb-leaf.fb-forward  { display: block; left: 50%; transform-origin: 0 50%; }
.fb-leaf.fb-backward { display: block; left: 0;   transform-origin: 100% 50%; }
.fb-leaf.fb-backward .fb-front::after {
	left: auto;
	right: 0;
	background: linear-gradient(to left, rgba(0,0,0,0.25), rgba(0,0,0,0));
}
.fb-leaf.fb-backward .fb-back::after {
	right: auto;
	left: 0;
	background: linear-gradient(to right, rgba(0,0,0,0.25), rgba(0,0,0,0));
}

.fb-face {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	-webkit-backface-visibility: hidden;
	backface-visibility: hidden;
	box-shadow: 0 0 8px rgba(0,0,0,0.3);
}
.fb-back { transform: rotateY(180deg); }

/* navigation */
.fb-nav {
	margin-top: 8px;
	text-align: center;
	font-family: Verdana, Geneva, sans-serif;
	font-size: 11px;
}
.fb-nav button {
	min-width: 34px;
	margin: 0 8px;
	padding: 2px 8px;
	font-size: 16px;
	line-height: 18px;
	cursor: pointer;
}
.fb-nav button:disabled { cursor: default; opacity: 0.35; }

@media (prefers-reduced-motion: reduce) {
	.fb-leaf { transition: none; }
}
