/* Cool Flipbox page loader. Placeholder, iframe and lightbox. */

.cfb-flipbook {
	display: block;
	width: 100%;
	max-width: 100%;
	margin: 1.5em auto;
	box-sizing: border-box;
}

/*
 * A width set in the flipbook, per screen (--cfb-w, --cfb-w-tablet, --cfb-w-mobile from the shortcode).
 * !important stands in for the inline max-width used before: themes limit what sits in the content
 * (Astra: ".entry-content[data-ast-blocks-layout] > *") with rules a plain class cannot beat.
 * cfb-size-desktop: the desktop width is set. cfb-size: some screen has a width.
 * Screen widths are the same as CFB_Flipbook_Schema::DEVICES.
 */
.cfb-flipbook.cfb-size-desktop {
	max-width: var(--cfb-w) !important;
}

@media (max-width: 1024px) {
	.cfb-flipbook.cfb-size {
		max-width: var(--cfb-w-tablet) !important;
	}
}

@media (max-width: 767px) {
	.cfb-flipbook.cfb-size {
		max-width: var(--cfb-w-mobile) !important;
	}
}

.cfb-flipbook.cfb-align-left {
	margin-left: 0;
	margin-right: auto;
	text-align: left;
}

.cfb-flipbook.cfb-align-center {
	text-align: center;
}

.cfb-flipbook.cfb-align-right {
	margin-left: auto;
	margin-right: 0;
	text-align: right;
}

.cfb-frame {
	display: block;
	width: 100%;
	border: 0;
	background: transparent;
}

/*
 * Picture of the first page, shown with the page itself until the viewer has opened. It covers the
 * placeholder (and the frame while it loads) and sits where the viewer's own loading picture will be,
 * so the swap is not visible. The selectors are specific because themes style every img.
 */
.cfb-flipbook {
	position: relative;
}

.cfb-flipbook .cfb-flipbook__poster {
	position: absolute;
	inset: 0;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	pointer-events: none;
}

.cfb-flipbook.cfb-align-left .cfb-flipbook__poster {
	justify-content: flex-start;
}

.cfb-flipbook.cfb-align-right .cfb-flipbook__poster {
	justify-content: flex-end;
}

.cfb-flipbook .cfb-flipbook__poster img {
	display: block;
	width: auto;
	height: 100%;
	max-width: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	object-fit: contain;
	background: #ffffff;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.cfb-open {
	display: inline-block;
	padding: 0.6em 1.2em;
	border: 0;
	border-radius: 4px;
	background: #2563eb;
	color: #ffffff;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

.cfb-open:hover {
	background: #1d4ed8;
}

/* The words only, like a link. A button element, so the keyboard and screen readers treat it as one. */
.cfb-open.cfb-open--text {
	padding: 0;
	border-radius: 0;
	background: none;
	color: #2563eb;
	font-weight: inherit;
	text-decoration: underline;
}

.cfb-open.cfb-open--text:hover {
	background: none;
	color: #1d4ed8;
}

/* The cover picture is the thing to click. */
.cfb-cover {
	position: relative;
	display: inline-block;
	width: min(100%, 320px);
	max-width: 100%;
	margin: 0;
	padding: 0;
	overflow: hidden;
	border: 0;
	border-radius: 6px;
	background: #e5e7eb;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
	line-height: 0;
	cursor: pointer;
	transition: transform 0.15s, box-shadow 0.15s;
}

.cfb-cover:hover {
	transform: translateY(-2px);
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
}

.cfb-cover img {
	display: block;
	width: 100%;
	height: auto;
}

.cfb-cover__label {
	position: absolute;
	right: 0;
	bottom: 0;
	left: 0;
	padding: 28px 12px 10px;
	background: linear-gradient(to top, rgba(0, 0, 0, 0.75), transparent);
	color: #ffffff;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.3;
	text-align: left;
}

.cfb-cover:focus-visible {
	outline: 2px solid #2563eb;
	outline-offset: 2px;
}

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

	.cfb-cover:hover {
		transform: none;
	}
}

.cfb-open:focus-visible,
.cfb-lightbox-close:focus-visible {
	outline: 2px solid #2563eb;
	outline-offset: 2px;
}

.cfb-lightbox {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: stretch;
	padding: 52px 10vw 3vh;
	background: rgba(0, 0, 0, 0.8);
	box-sizing: border-box;
	overscroll-behavior: contain;
}

.cfb-lightbox .cfb-frame {
	height: 100%;
	border-radius: 6px;
	background: #ffffff;
}

.cfb-lightbox .cfb-frame.cfb-frame--clear {
	background: transparent;
}

.cfb-lightbox .cfb-lightbox-close {
	position: absolute;
	top: 6px;
	right: calc(3vw - 4px);
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.16);
	box-shadow: none;
	color: #ffffff;
	font: 400 28px/1 Arial, sans-serif;
	text-shadow: none;
	text-transform: none;
	cursor: pointer;
}

.cfb-lightbox .cfb-lightbox-close:hover {
	background: rgba(255, 255, 255, 0.32);
	color: #ffffff;
}

.cfb-flipbook-notice {
	padding: 0.75em 1em;
	border-left: 4px solid #d97706;
	background: #fffbeb;
	color: #78350f;
}
