/*
 * DT Flipbook Viewer v2 — CSS 3D page-turn engine.
 * Loaded only inside the embed iframe.
 */

html, body {
	margin: 0;
	padding: 0;
	width: 100%;
	height: 100%;
	overflow: hidden;
	background: #efece6;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	-webkit-user-select: none;
	user-select: none;
}

/* ---- Stage ---- */
#dtfb-stage {
	position: relative;
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	background: radial-gradient(ellipse at center, #f7f5f0 0%, #e5e0d6 100%);
}
#dtfb-stage:fullscreen { background: radial-gradient(ellipse at center, #f7f5f0 0%, #e5e0d6 100%); }

#dtfb-loading {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1.05rem;
	color: #6b6455;
	background: inherit;
	z-index: 50;
	padding: 0 2em;
	text-align: center;
}
#dtfb-loading.is-error { color: #a04444; }
#dtfb-loading[hidden] { display: none; }

/* ---- Book ---- */
#dtfb-book {
	position: relative;
	perspective: 2400px;
	transform-style: preserve-3d;
	filter: drop-shadow(0 18px 30px rgba(60, 50, 30, 0.28));
	cursor: pointer;
}

.dtfb-sheet {
	position: absolute;
	top: 0;
	left: 50%;
	width: 50%;
	height: 100%;
	transform-origin: left center;
	transform-style: preserve-3d;
	transition: transform 0.8s cubic-bezier(0.25, 0.1, 0.25, 1);
	transform: rotateY(0deg);
}
.dtfb-sheet.is-turned { transform: rotateY(-180deg); }

/* Single-page mode: the page fills the book and pivots on the book's left edge. */
#dtfb-book.is-single .dtfb-sheet {
	left: 0;
	width: 100%;
}

.dtfb-face {
	position: absolute;
	inset: 0;
	background: #fff;
	overflow: hidden;
	backface-visibility: hidden;
	-webkit-backface-visibility: hidden;
}
.dtfb-back { transform: rotateY(180deg); }

.dtfb-face canvas {
	width: 100%;
	height: 100%;
	display: block;
	pointer-events: none;
}

/* Spine shading gives the spread a gentle curve. */
.dtfb-front::after,
.dtfb-back::after {
	content: "";
	position: absolute;
	inset: 0;
	pointer-events: none;
}
.dtfb-front::after {
	background: linear-gradient(to right, rgba(0,0,0,0.12) 0%, rgba(0,0,0,0) 7%);
}
.dtfb-back::after {
	background: linear-gradient(to left, rgba(0,0,0,0.12) 0%, rgba(0,0,0,0) 7%);
}
#dtfb-book.is-single .dtfb-front::after { background: none; }

/* ---- Controls ---- */
.dtfb-navbtn {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 40;
	width: 44px;
	height: 44px;
	border: none;
	border-radius: 50%;
	background: rgba(40, 34, 22, 0.55);
	color: #fff;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	transition: background 0.2s, opacity 0.2s;
	display: flex;
	align-items: center;
	justify-content: center;
}
.dtfb-navbtn:hover { background: rgba(40, 34, 22, 0.85); }
.dtfb-navbtn:disabled { opacity: 0.25; cursor: default; }
#dtfb-prev { left: 12px; }
#dtfb-next { right: 12px; }

.dtfb-toolbar {
	position: absolute;
	bottom: 10px;
	left: 50%;
	transform: translateX(-50%);
	z-index: 40;
	display: flex;
	align-items: center;
	gap: 12px;
	background: rgba(40, 34, 22, 0.55);
	color: #fff;
	border-radius: 20px;
	padding: 6px 14px;
	font-size: 0.85rem;
	opacity: 0;
	transition: opacity 0.25s;
}
#dtfb-stage.is-ready .dtfb-toolbar,
#dtfb-stage.is-ready .dtfb-navbtn { opacity: 1; }
#dtfb-stage:not(.is-ready) .dtfb-navbtn { opacity: 0; }

/* Prominent, always-visible full-screen button (top right). */
.dtfb-fs-btn {
	position: absolute;
	top: 12px;
	right: 12px;
	z-index: 45;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	background: #7d3c98;
	color: #fff;
	border: none;
	border-radius: 24px;
	padding: 10px 18px;
	font-size: 0.95rem;
	font-weight: 700;
	font-family: inherit;
	cursor: pointer;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
	transition: background 0.2s, transform 0.15s;
}
.dtfb-fs-btn:hover { background: #6a2f84; transform: translateY(-1px); }
.dtfb-fs-btn svg { flex-shrink: 0; }

/* ---- Optional audio bar ---- */
#dtfb-audio {
	position: absolute;
	top: 10px;
	left: 50%;
	transform: translateX(-50%);
	z-index: 40;
	width: min(420px, 86%);
}
#dtfb-audio audio { width: 100%; height: 34px; }
#dtfb-audio[hidden] { display: none; }
