/* MY Slider PRO Flipbook: front-end and editor preview styles. */

.msp-flipbook {
	--msp-fb-paper: #f5f3ed;
	box-sizing: border-box;
	margin-block: 1.5em;
}

.msp-flipbook *,
.msp-flipbook *::before,
.msp-flipbook *::after {
	box-sizing: inherit;
}

/* Page list: shown as it is without JavaScript; replaced by the book once the script runs. */
.msp-flipbook__pages {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: 1rem;
	justify-items: center;
}

.msp-flipbook__page {
	margin: 0;
	padding: 0;
}

.msp-flipbook__page img {
	display: block;
	width: auto;
	max-width: 100%;
	height: auto;
	max-height: var(--msp-fb-max-height, 85vh);
	box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
}

/* While the script loads, keep a cover-sized box so the page does not jump. The other pages stay
   reachable (sideways scroll, accessibility tree) in case the script never runs. */
@media (scripting: enabled) {
	.msp-flipbook:not(.is-ready) .msp-flipbook__pages {
		display: flex;
		align-items: flex-start;
		overflow-x: auto;
		overscroll-behavior-x: contain;
		scroll-snap-type: x mandatory;
	}

	.msp-flipbook:not(.is-ready) .msp-flipbook__page {
		flex: 0 0 100%;
		display: flex;
		justify-content: center;
		scroll-snap-align: center;
	}
}

.msp-flipbook.is-ready .msp-flipbook__pages {
	display: none;
}

/* The book reads left to right whatever the page direction, so its controls do too. */
.msp-flipbook__viewer,
.msp-flipbook__controls {
	direction: ltr;
}

.msp-flipbook__viewer {
	position: relative;
	border-radius: 2px;
}

.msp-flipbook__viewer:focus {
	outline: none;
}

.msp-flipbook__viewer:focus-visible {
	outline: 3px solid currentColor;
	outline-offset: 6px;
}

.msp-flipbook__stage {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow-x: clip;
	overflow-y: visible;
}

.msp-flipbook__book {
	position: relative;
	flex: none;
	cursor: pointer;
	-webkit-user-select: none;
	user-select: none;
	-webkit-tap-highlight-color: transparent;
}

/* The book slides to recentre only during a turn, not on load or resize. */
.msp-flipbook__book.is-turning {
	transition: transform .6s cubic-bezier(.4, .1, .2, 1);
}

.msp-flipbook__half {
	position: absolute;
	top: 0;
	width: var(--msp-fb-pw);
	height: 100%;
}

.msp-flipbook__half.is-left {
	left: 0;
}

.msp-flipbook__half.is-right {
	left: var(--msp-fb-pw);
}

.msp-flipbook.is-single .msp-flipbook__half.is-left {
	display: none;
}

.msp-flipbook.is-single .msp-flipbook__half.is-right {
	left: 0;
}

/* Every page box has the cover's shape; a page of another shape is shown whole on paper. */
.msp-flipbook .msp-flipbook__half img,
.msp-flipbook .msp-flipbook__face img {
	display: block;
	width: 100%;
	max-width: none;
	height: 100%;
	margin: 0;
	object-fit: contain;
	background: var(--msp-fb-paper);
	border-radius: 0;
}

.msp-flipbook__half img {
	box-shadow: 0 18px 40px rgba(0, 0, 0, .35);
}

/* Shading along the spine. */
.msp-flipbook__half::after {
	content: "";
	position: absolute;
	top: 0;
	bottom: 0;
	width: 12%;
	pointer-events: none;
}

.msp-flipbook__half.is-left::after {
	right: 0;
	background: linear-gradient(90deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, .16) 100%);
}

.msp-flipbook__half.is-right::after {
	left: 0;
	background: linear-gradient(90deg, rgba(0, 0, 0, .16) 0%, rgba(0, 0, 0, 0) 100%);
}

.msp-flipbook.is-single .msp-flipbook__half.is-right::after,
.msp-flipbook__half.is-empty::after,
.msp-flipbook__half.is-empty img {
	visibility: hidden;
}

/* The turning page: two faces back to back. */
.msp-flipbook__leaf {
	position: absolute;
	top: 0;
	z-index: 2;
	width: var(--msp-fb-pw);
	height: 100%;
	transform-style: preserve-3d;
	will-change: transform;
}

.msp-flipbook__leaf[hidden] {
	display: none;
}

.msp-flipbook__face {
	position: absolute;
	inset: 0;
	overflow: hidden;
	background: var(--msp-fb-paper);
	-webkit-backface-visibility: hidden;
	backface-visibility: hidden;
}

.msp-flipbook__face.is-back {
	transform: rotateY(180deg);
}

.msp-flipbook__face::after {
	content: "";
	position: absolute;
	inset: 0;
	pointer-events: none;
	background: linear-gradient(90deg, rgba(0, 0, 0, .12), rgba(0, 0, 0, 0) 30%, rgba(255, 255, 255, .06) 60%, rgba(0, 0, 0, .1));
}

.msp-flipbook__face.is-blank img,
.msp-flipbook__face.is-empty img {
	visibility: hidden;
}

/* Controls */
.msp-flipbook__controls {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 1rem;
	margin-top: 1.25rem;
}

.msp-flipbook__controls[hidden] {
	display: none;
}

.msp-flipbook .msp-flipbook__button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	margin: 0;
	padding: 0;
	border: 1.5px solid currentColor;
	border-radius: 50%;
	background: transparent;
	color: inherit;
	font: inherit;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
}

.msp-flipbook .msp-flipbook__button:hover {
	background: rgba(127, 127, 127, .12);
}

.msp-flipbook .msp-flipbook__button[aria-disabled="true"] {
	opacity: .35;
	cursor: default;
	background: transparent;
}

/* Sound: the speaker shows sound on, the crossed speaker shows it muted. */
.msp-flipbook .msp-flipbook__sound[hidden],
.msp-flipbook .msp-flipbook__sound[aria-pressed="true"] .msp-flipbook__sound-off,
.msp-flipbook .msp-flipbook__sound[aria-pressed="false"] .msp-flipbook__sound-on {
	display: none;
}

/* Play shows while stopped, pause while the pages turn by themselves. */
.msp-flipbook .msp-flipbook__play[aria-pressed="true"] .msp-flipbook__play-on,
.msp-flipbook .msp-flipbook__play[aria-pressed="false"] .msp-flipbook__play-off {
	display: none;
}

/* The download button is a link styled as the round buttons; theme link styles must not show. */
.msp-flipbook a.msp-flipbook__download,
.msp-flipbook a.msp-flipbook__download:hover {
	color: inherit;
	text-decoration: none;
}

.msp-flipbook .msp-flipbook__button:focus-visible {
	outline: 3px solid currentColor;
	outline-offset: 3px;
}

/* A link button's own text colour would vanish on a matching page, so its ring is a dark line
   on a white gap, visible on light and dark pages alike. */
.msp-flipbook .msp-flipbook__link:focus-visible {
	outline: 3px solid #1e1e1e;
	outline-offset: 3px;
	box-shadow: 0 0 0 3px #fff;
}

.msp-flipbook__counter {
	min-width: 10em;
	margin: 0;
	text-align: center;
	font-size: .9em;
	font-variant-numeric: tabular-nums;
}

/* A hidden counter is still read out by screen readers. */
.msp-flipbook__counter[data-hidden],
.msp-flipbook__sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	min-width: 0;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

/* Link buttons: theme button styles win where the theme has them. */
.msp-flipbook__links {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: .75rem;
	margin-top: 1rem;
}

:where(.msp-flipbook__link) {
	display: inline-block;
	padding: .65em 1.4em;
	border-radius: 999px;
	background: #1e1e1e;
	color: #fff;
	text-decoration: none;
	line-height: 1.2;
}

.msp-flipbook .msp-flipbook__link-icon {
	display: inline-block;
	width: 1.15em;
	height: 1.15em;
	margin-inline-end: .45em;
	vertical-align: -.2em;
}

/* Hover effects chosen in the settings; readers who ask for less motion get no movement. */
.msp-flipbook__links[data-hover] .msp-flipbook__link {
	transition: transform .2s ease, box-shadow .2s ease, opacity .2s ease;
}

.msp-flipbook__links[data-hover="lift"] .msp-flipbook__link:hover {
	transform: translateY(-2px);
	box-shadow: 0 6px 16px rgba(0, 0, 0, .2);
}

.msp-flipbook__links[data-hover="grow"] .msp-flipbook__link:hover {
	transform: scale(1.06);
}

.msp-flipbook__links[data-hover="fade"] .msp-flipbook__link:hover {
	opacity: .8;
}

@media (prefers-reduced-motion: reduce) {
	.msp-flipbook__links[data-hover] .msp-flipbook__link {
		transition: none;
	}

	.msp-flipbook__links[data-hover] .msp-flipbook__link:hover {
		transform: none;
	}
}

/* Print every page in order, not the open spread and its buttons. */
@media print {
	.msp-flipbook .msp-flipbook__pages {
		display: grid;
	}

	.msp-flipbook .msp-flipbook__page img {
		max-height: none;
		box-shadow: none;
	}

	.msp-flipbook__viewer,
	.msp-flipbook__controls {
		display: none;
	}
}
