/**
 * WalkWise — Flipbook viewer styles.
 * Brand tokens from tokens.css (--ww-*). Flat, accessible, responsive.
 */

.ww-flipbook {
	margin: 24px 0;
	background: var(--ww-lavender, #F5F6FF);
	border: 1px solid var(--ww-border, #E2E5E9);
	border-radius: 18px;
	padding: 14px;
	font-family: var(--ww-font-body, 'Montserrat', sans-serif);
}

.ww-flipbook__toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	flex-wrap: wrap;
	margin-bottom: 12px;
}

.ww-flipbook__editions {
	display: inline-flex;
	background: var(--ww-white, #fff);
	border: 1px solid var(--ww-border, #E2E5E9);
	border-radius: 999px;
	padding: 3px;
	gap: 2px;
}

.ww-flipbook__edition {
	border: 0;
	background: transparent;
	cursor: pointer;
	font-family: var(--ww-font-heading, 'Poppins', sans-serif);
	font-weight: 600;
	font-size: 0.8125rem;
	color: var(--ww-navy, #203065);
	padding: 7px 16px;
	border-radius: 999px;
	line-height: 1;
	transition: background-color .15s ease, color .15s ease;
}

.ww-flipbook__edition.is-active {
	background: var(--ww-navy, #203065);
	color: #fff;
}

.ww-flipbook__nav {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin-left: auto;
}

.ww-flipbook__btn {
	width: 38px;
	height: 38px;
	border-radius: 10px;
	border: 1px solid var(--ww-border, #E2E5E9);
	background: var(--ww-white, #fff);
	color: var(--ww-navy, #203065);
	font-size: 1.25rem;
	line-height: 1;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: background-color .15s ease, border-color .15s ease, opacity .15s ease;
}

.ww-flipbook__btn:hover:not(:disabled) {
	border-color: var(--ww-primary, #F67E3A);
	color: var(--ww-primary, #F67E3A);
}

.ww-flipbook__btn:disabled {
	opacity: 0.4;
	cursor: default;
}

.ww-flipbook__pageinfo {
	font-family: var(--ww-font-label, 'Archivo', sans-serif);
	font-size: 0.8125rem;
	font-weight: 600;
	color: var(--ww-gray-alt, #494949);
	min-width: 64px;
	text-align: center;
	font-variant-numeric: tabular-nums;
}

.ww-flipbook__stage {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
}

.ww-flipbook__book {
	margin: 0 auto;
	max-width: 100%;
}

.ww-flipbook__page {
	background: var(--ww-white, #fff);
	overflow: hidden;
}

.ww-flipbook__page-ph {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #C4C7CC;
	font-family: var(--ww-font-label, 'Archivo', sans-serif);
	font-size: 0.875rem;
	background: repeating-linear-gradient(45deg, #fafafa, #fafafa 12px, #f3f3f3 12px, #f3f3f3 24px);
}

.ww-flipbook__canvas {
	display: block;
	width: 100%;
	height: 100%;
}

.ww-flipbook__loading {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	color: var(--ww-navy, #203065);
	font-family: var(--ww-font-heading, 'Poppins', sans-serif);
	font-weight: 600;
	font-size: 0.9375rem;
}

.ww-flipbook__spinner {
	width: 34px;
	height: 34px;
	border-radius: 50%;
	border: 3px solid rgba(32, 48, 101, 0.15);
	border-top-color: var(--ww-primary, #F67E3A);
	animation: ww-flipbook-spin 0.8s linear infinite;
}

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

.ww-flipbook__error {
	color: var(--ww-navy, #203065);
	font-weight: 600;
	text-align: center;
	padding: 24px;
}

.ww-flipbook__error a {
	color: var(--ww-primary, #F67E3A);
}

/* Fullscreen */
.ww-flipbook:fullscreen {
	background: var(--ww-navy, #203065);
	display: flex;
	flex-direction: column;
	justify-content: center;
	padding: 16px 24px;
	width: 100vw;
	height: 100vh;
	box-sizing: border-box;
}

.ww-flipbook:fullscreen .ww-flipbook__pageinfo {
	color: #fff;
}

/* Stage fills remaining viewport height so the book can be height-fitted (JS
   reads clientHeight); overrides the inline min-height set for normal view. */
.ww-flipbook:fullscreen .ww-flipbook__stage {
	flex: 1 1 auto;
	min-height: 0 !important;
	height: auto;
	overflow: hidden;
}

.ww-flipbook:fullscreen .ww-flipbook__book {
	max-height: 100%;
}

/* Toolbar controls stay visible on the dark fullscreen backdrop. */
.ww-flipbook:fullscreen .ww-flipbook__toolbar {
	flex: 0 0 auto;
}
.ww-flipbook:fullscreen .ww-flipbook__btn {
	background: rgba(255, 255, 255, 0.12);
	border-color: rgba(255, 255, 255, 0.35);
	color: #fff;
}
.ww-flipbook:fullscreen .ww-flipbook__btn:hover:not(:disabled) {
	background: rgba(255, 255, 255, 0.22);
	border-color: #fff;
	color: #fff;
}
.ww-flipbook:fullscreen .ww-flipbook__editions {
	background: rgba(255, 255, 255, 0.12);
	border-color: rgba(255, 255, 255, 0.35);
}
.ww-flipbook:fullscreen .ww-flipbook__edition {
	color: #fff;
}
.ww-flipbook:fullscreen .ww-flipbook__edition.is-active {
	background: var(--ww-primary, #F67E3A);
	color: #fff;
}

/* Reduced motion — spinner only, page turns are instant (set in JS). */
@media (prefers-reduced-motion: reduce) {
	.ww-flipbook__spinner {
		animation-duration: 1.6s;
	}
}

@media (max-width: 780px) {
	.ww-flipbook {
		padding: 10px;
	}
	.ww-flipbook__nav {
		margin-left: 0;
	}
	.ww-flipbook__toolbar {
		justify-content: center;
	}
}
