/**
 * WACI Resource Library — reader
 *
 * A bound-volume metaphor: two facing pages on a wide screen, one on a narrow
 * one, and a leaf that physically turns between them.
 *
 * Every selector is scoped with two classes. The Elementor kit styles bare
 * `button` and `a` at (0,1,1), which beats a single class, so single-class
 * rules here would lose and the site's chunky orange buttons would leak into
 * the toolbar — which is exactly how this dialog looked before.
 */

.waci-reader {
	--rd-paper: #fdfcfa;
	--rd-accent: #d05418;
	--rd-chrome: #17181a;
	--rd-chrome-soft: #24262a;

	border: 0;
	box-sizing: border-box;
	color: #f4f2f0;
	font-family: Jost, system-ui, -apple-system, "Segoe UI", sans-serif;
	height: 100%;
	max-height: none;
	max-width: none;
	padding: 0;
	width: 100%;
}

.waci-reader *,
.waci-reader *::before,
.waci-reader *::after {
	box-sizing: inherit;
}

.waci-reader:not([open]) {
	display: none;
}

.waci-reader[open] {
	background: var(--rd-chrome);
	display: flex;
	flex-direction: column;
}

.waci-reader::backdrop {
	backdrop-filter: blur(3px);
	background: rgba(10, 10, 11, .82);
}

/* ------------------------------------------------------------------ chrome */

.waci-reader .waci-reader__bar {
	align-items: center;
	background: var(--rd-chrome);
	border-bottom: 1px solid rgba(255, 255, 255, .08);
	display: flex;
	flex: 0 0 auto;
	gap: 20px;
	justify-content: space-between;
	padding: 12px 18px;
}

.waci-reader .waci-reader__id {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.waci-reader .waci-reader__eyebrow {
	color: #8d8a86;
	font-size: 10px;
	font-weight: 600;
	letter-spacing: .16em;
	text-transform: uppercase;
}

.waci-reader .waci-reader__name {
	color: #fff;
	font-size: 15px;
	font-weight: 600;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.waci-reader .waci-reader__tools {
	align-items: center;
	display: flex;
	flex: 0 0 auto;
	gap: 10px;
}

.waci-reader .waci-reader__zoom {
	align-items: center;
	background: var(--rd-chrome-soft);
	border-radius: 999px;
	display: flex;
	gap: 2px;
	padding: 3px;
}

.waci-reader .waci-reader__zoomlabel {
	color: #b9b6b2;
	font-size: 11px;
	font-variant-numeric: tabular-nums;
	min-width: 42px;
	text-align: center;
}

.waci-reader .waci-reader__btn {
	align-items: center;
	background: transparent !important;
	border: 0 !important;
	border-radius: 999px !important;
	box-shadow: none !important;
	color: #d8d5d1 !important;
	cursor: pointer;
	display: inline-flex;
	font-family: inherit;
	font-size: 14px !important;
	font-weight: 500 !important;
	height: 30px;
	justify-content: center;
	letter-spacing: 0 !important;
	line-height: 1 !important;
	margin: 0 !important;
	padding: 0 !important;
	text-transform: none !important;
	transition: background-color .16s ease, color .16s ease, opacity .16s ease;
	width: 30px;
}

.waci-reader .waci-reader__btn:hover:not(:disabled),
.waci-reader .waci-reader__btn:focus-visible:not(:disabled) {
	background: rgba(255, 255, 255, .12) !important;
	color: #fff !important;
}

.waci-reader .waci-reader__btn:disabled {
	cursor: default;
	opacity: .32;
}

.waci-reader .waci-reader__btn svg {
	height: 16px;
	width: 16px;
}

.waci-reader .waci-reader__download {
	align-items: center;
	background: var(--rd-accent) !important;
	border: 0 !important;
	border-radius: 999px !important;
	color: #fff !important;
	display: inline-flex;
	font-size: 12.5px !important;
	font-weight: 600 !important;
	gap: 7px;
	letter-spacing: 0 !important;
	padding: 9px 16px !important;
	text-decoration: none !important;
	text-transform: none !important;
	transition: background-color .16s ease;
}

.waci-reader .waci-reader__download:hover,
.waci-reader .waci-reader__download:focus-visible {
	background: #b34512 !important;
}

.waci-reader .waci-reader__download svg {
	height: 14px;
	width: 14px;
}

.waci-reader .waci-reader__close {
	background: rgba(255, 255, 255, .08) !important;
}

/* ------------------------------------------------------------------- stage */

.waci-reader .waci-reader__stage {
	align-items: center;
	display: flex;
	flex: 1 1 auto;
	gap: 10px;
	justify-content: center;
	min-height: 0;
	overflow: auto;
	padding: 22px;
	/* Depth for the turning leaf. Without it the rotation is a flat squash. */
	perspective: 2400px;
	position: relative;
}

.waci-reader .waci-reader__nav {
	align-items: center;
	background: rgba(255, 255, 255, .07) !important;
	border: 0 !important;
	border-radius: 50% !important;
	color: #e6e3df !important;
	cursor: pointer;
	display: inline-flex;
	flex: 0 0 auto;
	height: 46px;
	justify-content: center;
	padding: 0 !important;
	transition: background-color .16s ease, opacity .16s ease;
	width: 46px;
	z-index: 3;
}

.waci-reader .waci-reader__nav:hover:not(:disabled) {
	background: rgba(255, 255, 255, .16) !important;
}

.waci-reader .waci-reader__nav:disabled {
	cursor: default;
	opacity: .22;
}

.waci-reader .waci-reader__nav svg {
	height: 20px;
	width: 20px;
}

/* -------------------------------------------------------------------- book */

.waci-reader .waci-reader__book {
	display: flex;
	flex: 0 0 auto;
	position: relative;
	transform-style: preserve-3d;
}

.waci-reader .waci-reader__sheet {
	background: var(--rd-paper);
	line-height: 0;
	position: relative;
}

.waci-reader .waci-reader__sheet.is-verso {
	border-radius: 3px 0 0 3px;
	box-shadow: -2px 6px 26px rgba(0, 0, 0, .45);
}

.waci-reader .waci-reader__sheet.is-recto {
	border-radius: 0 3px 3px 0;
	box-shadow: 2px 6px 26px rgba(0, 0, 0, .45);
}

/* The gutter: paper curves into the binding, so it darkens towards the spine. */
.waci-reader .waci-reader__sheet::after {
	content: "";
	inset: 0;
	pointer-events: none;
	position: absolute;
}

.waci-reader .waci-reader__sheet.is-verso::after {
	background: linear-gradient(270deg, rgba(0, 0, 0, .17), rgba(0, 0, 0, 0) 7%);
}

.waci-reader .waci-reader__sheet.is-recto::after {
	background: linear-gradient(90deg, rgba(0, 0, 0, .17), rgba(0, 0, 0, 0) 7%);
}

.waci-reader.is-single .waci-reader__sheet.is-verso {
	display: none;
}

.waci-reader.is-single .waci-reader__sheet.is-recto {
	border-radius: 3px;
}

.waci-reader.is-single .waci-reader__sheet.is-recto::after {
	display: none;
}

.waci-reader .waci-reader__sheet canvas {
	display: block;
	height: auto;
	max-width: 100%;
}

/* The block of unread pages, so the volume has thickness. */
.waci-reader .waci-reader__edge {
	background: repeating-linear-gradient(180deg, #efeae4 0 2px, #d9d2c9 2px 3px);
	border-radius: 2px;
	bottom: 3px;
	pointer-events: none;
	position: absolute;
	top: 3px;
	width: 6px;
	z-index: -1;
}

.waci-reader .waci-reader__edge.is-left {
	left: -6px;
}

.waci-reader .waci-reader__edge.is-right {
	right: -6px;
}

.waci-reader.is-single .waci-reader__edge.is-left {
	display: none;
}

/* -------------------------------------------------------------------- leaf */

/*
 * The turning page. Two faces back to back: the front carries the page being
 * left behind, the back the page arriving. Rotating the whole leaf about the
 * binding edge is what reads as paper rather than as a crossfade.
 */
.waci-reader .waci-reader__leaf {
	position: absolute;
	top: 0;
	transform-style: preserve-3d;
	transition: transform .62s cubic-bezier(.42, .04, .3, 1);
	z-index: 2;
}

.waci-reader .waci-reader__leaf[hidden] {
	display: none;
}

.waci-reader .waci-reader__leaf.is-forward {
	left: 50%;
	transform-origin: left center;
}

.waci-reader .waci-reader__leaf.is-back {
	right: 50%;
	transform-origin: right center;
}

.waci-reader.is-single .waci-reader__leaf.is-forward {
	left: 0;
}

.waci-reader.is-single .waci-reader__leaf.is-back {
	right: 0;
}

.waci-reader .waci-reader__face {
	backface-visibility: hidden;
	background: var(--rd-paper);
	height: 100%;
	left: 0;
	line-height: 0;
	overflow: hidden;
	position: absolute;
	top: 0;
	width: 100%;
}

.waci-reader .waci-reader__face canvas {
	display: block;
	height: 100%;
	width: 100%;
}

.waci-reader .waci-reader__face.is-back {
	transform: rotateY(180deg);
}

/* A sheen that deepens as the leaf swings, so it catches light like paper. */
.waci-reader .waci-reader__face::after {
	content: "";
	inset: 0;
	opacity: 0;
	pointer-events: none;
	position: absolute;
	transition: opacity .62s ease;
}

.waci-reader .waci-reader__face.is-front::after {
	background: linear-gradient(90deg, rgba(0, 0, 0, .34), rgba(0, 0, 0, 0) 26%);
}

.waci-reader .waci-reader__face.is-back::after {
	background: linear-gradient(270deg, rgba(0, 0, 0, .34), rgba(0, 0, 0, 0) 26%);
}

.waci-reader.is-turning .waci-reader__face::after {
	opacity: 1;
}

/* ----------------------------------------------------------------- loading */

.waci-reader .waci-reader__loading {
	align-items: center;
	color: #cfccc8;
	display: flex;
	flex-direction: column;
	font-size: 13px;
	gap: 12px;
	inset: 0;
	justify-content: center;
	pointer-events: none;
	position: absolute;
	z-index: 4;
}

.waci-reader .waci-reader__loading[hidden] {
	display: none;
}

.waci-reader .waci-reader__loading i {
	animation: waci-reader-spin .8s linear infinite;
	border: 2px solid rgba(255, 255, 255, .18);
	border-radius: 50%;
	border-top-color: var(--rd-accent);
	display: block;
	height: 28px;
	width: 28px;
}

@keyframes waci-reader-spin {
	to { transform: rotate(360deg); }
}

/* -------------------------------------------------------------------- foot */

.waci-reader .waci-reader__foot {
	align-items: center;
	background: var(--rd-chrome);
	border-top: 1px solid rgba(255, 255, 255, .08);
	display: flex;
	flex: 0 0 auto;
	gap: 16px;
	justify-content: center;
	padding: 10px 18px;
}

.waci-reader .waci-reader__count {
	color: #b9b6b2;
	font-size: 12.5px;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.waci-reader .waci-reader__count b {
	color: #fff;
	font-weight: 600;
}

/*
 * The kit styles form fields with a selector that also carries an element, so
 * it out-specifies a two-class rule here and repainted this control as a solid
 * white bar. Hence the !important on the paint properties.
 */
.waci-reader .waci-reader__slider {
	-webkit-appearance: none !important;
	appearance: none !important;
	background: transparent !important;
	border: 0 !important;
	border-radius: 0 !important;
	box-shadow: none !important;
	cursor: pointer;
	height: 14px;
	margin: 0 !important;
	max-width: 460px;
	min-height: 0 !important;
	padding: 0 !important;
	width: 100%;
}

.waci-reader .waci-reader__slider:focus {
	outline: 0;
}

.waci-reader .waci-reader__slider:focus-visible::-webkit-slider-thumb {
	box-shadow: 0 0 0 3px rgba(208, 84, 24, .45);
}

.waci-reader .waci-reader__slider::-webkit-slider-runnable-track {
	background: rgba(255, 255, 255, .14);
	border-radius: 999px;
	height: 4px;
}

.waci-reader .waci-reader__slider::-moz-range-track {
	background: rgba(255, 255, 255, .14);
	border-radius: 999px;
	height: 4px;
}

.waci-reader .waci-reader__slider::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	background: var(--rd-accent);
	border-radius: 50%;
	height: 14px;
	margin-top: -5px;
	width: 14px;
}

.waci-reader .waci-reader__slider::-moz-range-thumb {
	background: var(--rd-accent);
	border: 0;
	border-radius: 50%;
	height: 14px;
	width: 14px;
}

/* ----------------------------------------------------------- small screens */

@media (max-width: 780px) {
	.waci-reader .waci-reader__stage {
		padding: 12px;
	}

	.waci-reader .waci-reader__nav {
		height: 38px;
		width: 38px;
	}

	.waci-reader .waci-reader__eyebrow {
		display: none;
	}

	.waci-reader .waci-reader__download span {
		display: none;
	}

	.waci-reader .waci-reader__download {
		padding: 9px 11px !important;
	}
}

@media (prefers-reduced-motion: reduce) {
	.waci-reader .waci-reader__leaf,
	.waci-reader .waci-reader__face::after {
		transition: none;
	}
}
