.cfb {
	--cfb-accent: #b08d6e;
	--cfb-max: 960px;
	position: relative;
	box-sizing: border-box;
	width: 100%;
	max-width: var(--cfb-max);
	margin: 1.5rem auto;
	padding: 0;
	background: transparent;
	outline: none;
	color: inherit;
}

.cfb *,
.cfb *::before,
.cfb *::after { box-sizing: border-box; }

/* Escenario: sin fondo, solo una sombra suave bajo la revista.
   El ancho y alto exactos los pone el script según el espacio disponible. */
.cfb-stage {
	position: relative;
	margin: 0 auto;
	max-width: 100%;
	min-height: 200px;
	background: transparent;
	transition: transform .95s cubic-bezier(.45, 0, .2, 1);
}

.cfb-stage::after {
	content: "";
	position: absolute;
	left: 6%;
	right: 6%;
	bottom: -10px;
	height: 22px;
	background: radial-gradient(ellipse at center, rgba(0, 0, 0, .20) 0%, rgba(0, 0, 0, 0) 70%);
	filter: blur(5px);
	pointer-events: none;
	z-index: 0;
	transition: left .95s cubic-bezier(.45, 0, .2, 1), right .95s cubic-bezier(.45, 0, .2, 1);
}

/* Portada o contraportada solas: la sombra solo va bajo la página visible */
.cfb-stage.is-cover::after { left: 50%; }
.cfb-stage.is-back::after { right: 50%; }

.cfb-book {
	position: relative;
	z-index: 1;
	opacity: 0;
	transition: opacity .5s ease;
}

.cfb.is-ready .cfb-book { opacity: 1; }

.cfb-page {
	background: #fff;
	overflow: hidden;
}

.cfb-page img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	opacity: 0;
	transition: opacity .4s ease;
	-webkit-user-drag: none;
	user-select: none;
	pointer-events: none;
}

.cfb-page img.is-loaded { opacity: 1; }

/* Estado de carga */
.cfb-status {
	position: absolute;
	inset: 0;
	z-index: 2;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: .75rem;
	font-size: .85rem;
	opacity: .8;
	transition: opacity .3s ease;
}

.cfb.is-ready .cfb-status { opacity: 0; pointer-events: none; }
.cfb.is-error .cfb-status { opacity: 1; }
.cfb.is-error .cfb-spinner { display: none; }

.cfb-spinner {
	width: 26px;
	height: 26px;
	border: 2px solid rgba(0, 0, 0, .12);
	border-top-color: var(--cfb-accent);
	border-radius: 50%;
	animation: cfb-spin .8s linear infinite;
}

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

/* Controles: una sola fila, siempre debajo de la revista */
.cfb-controls {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: .5rem;
	margin: 1.5rem 0 0;
	padding: 0;
	opacity: 0;
	transition: opacity .4s ease;
}

.cfb.is-ready .cfb-controls { opacity: 1; }

.cfb-count {
	min-width: 76px;
	text-align: center;
	font-size: .8rem;
	letter-spacing: .08em;
	font-variant-numeric: tabular-nums;
	opacity: .7;
	white-space: nowrap;
}

.cfb .cfb-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 36px;
	height: 36px;
	margin: 0;
	padding: 0;
	border: 1px solid color-mix(in srgb, var(--cfb-accent) 55%, transparent);
	border-radius: 50%;
	background: transparent;
	color: var(--cfb-accent);
	box-shadow: none;
	text-decoration: none;
	cursor: pointer;
	transition: background .2s ease, color .2s ease, border-color .2s ease;
}

.cfb .cfb-btn svg {
	display: block;
	width: 16px;
	height: 16px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.7;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.cfb .cfb-btn:hover,
.cfb .cfb-btn:focus-visible {
	background: var(--cfb-accent);
	border-color: var(--cfb-accent);
	color: #fff;
}

.cfb .cfb-btn[disabled] {
	opacity: .3;
	cursor: default;
	background: transparent;
	color: var(--cfb-accent);
}

/* Separa un poco los botones de acción (pantalla completa / descarga) */
.cfb .cfb-full { margin-left: .75rem; }
.cfb .cfb-dl { margin-left: 0; }

/* Texto opcional bajo la revista */
.cfb-caption {
	margin: 1.1rem auto 0;
	max-width: 520px;
	text-align: center;
	font-size: .85rem;
	line-height: 1.5;
	opacity: .7;
}

.cfb-caption strong {
	display: block;
	margin-bottom: .15rem;
	font-size: .8rem;
	font-weight: 600;
	letter-spacing: .12em;
	text-transform: uppercase;
	opacity: 1;
}

/* Pantalla completa */
.cfb:fullscreen {
	max-width: none;
	margin: 0;
	padding: 1.25rem;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	background: #f7f5f2;
	overflow: auto;
}

.cfb:fullscreen .cfb-stage { flex: 0 0 auto; }

@media (max-width: 599px) {
	.cfb { margin: 1rem auto; }
	.cfb .cfb-btn { width: 42px; height: 42px; }
}

@media (prefers-reduced-motion: reduce) {
	.cfb-spinner { animation-duration: 2s; }
}
