/*
 * Samajamukhi Flipbook — every rule is scoped to .smk-flipbook, so nothing else in the theme is affected.
 * Colours come from the theme's own variables (header navy + top-bar beige), with fallbacks.
 */
.smk-flipbook {
	--smk-ink: var(--header_bg_color, #2b335a);
	--smk-paper: var(--header_top_bg_color, #f6eee8);
	--smk-ratio: 0.731; /* page width / height; updated from the PDF by the script */
	--smk-chrome: 250px; /* vertical room kept for site header, toolbar and padding */
	position: relative;
	width: 100%; /* Avada columns are flex containers; without this the book shrinks to a single page. */
	max-width: 1180px;
	margin: 0 auto;
	outline: none;
}

.smk-flipbook__title {
	margin: 0 0 24px;
	text-align: center;
}

.smk-flipbook__panel {
	padding: 36px 72px 22px;
	border-radius: 16px;
	background: var(--smk-paper);
}

/* ---------- Book ---------- */
.smk-flipbook__stage {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 320px;
}
.smk-flipbook__book {
	width: 100%;
	/* Fit a full two-page spread in the viewport height. !important overrides the inline max-width StPageFlip sets. */
	max-width: min(100%, max(520px, calc((100vh - var(--smk-chrome)) * 2 * var(--smk-ratio)))) !important;
	margin: 0 auto;
	filter: drop-shadow(0 14px 22px rgba(20, 22, 40, 0.22));
	transition: transform 0.6s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.smk-flipbook.is-front-cover .smk-flipbook__book {
	transform: translateX(-25%);
}
.smk-flipbook.is-back-cover .smk-flipbook__book {
	transform: translateX(25%);
}
.smk-flipbook__page {
	background: #fff;
	overflow: hidden;
}
.smk-flipbook__page canvas {
	display: block;
	width: 100%;
	height: 100%;
}

/* ---------- Loading ---------- */
.smk-flipbook__status {
	width: min(320px, 80%);
	padding: 120px 0;
	text-align: center;
}
.smk-flipbook__status[hidden] {
	display: none;
}
.smk-flipbook__bar {
	height: 4px;
	margin-bottom: 14px;
	border-radius: 4px;
	background: rgba(43, 51, 90, 0.15);
	overflow: hidden;
}
.smk-flipbook__bar-fill {
	display: block;
	width: 0;
	height: 100%;
	border-radius: 4px;
	background: var(--smk-ink);
	transition: width 0.3s ease;
}
.smk-flipbook__status-text {
	font-size: 14px;
	opacity: 0.75;
}

/* ---------- Side arrows (desktop) ---------- */
.smk-flipbook__side {
	position: absolute;
	top: 50%;
	z-index: 5;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	margin-top: -24px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #fff;
	color: var(--smk-ink);
	box-shadow: 0 4px 14px rgba(20, 22, 40, 0.16);
	cursor: pointer;
	transition: background 0.2s, color 0.2s, opacity 0.2s, transform 0.2s;
}
.smk-flipbook__side[hidden] {
	display: none;
}
.smk-flipbook__side--prev {
	left: -60px;
}
.smk-flipbook__side--next {
	right: -60px;
}
.smk-flipbook__side:hover:not(:disabled) {
	background: var(--smk-ink);
	color: #fff;
	transform: scale(1.06);
}
.smk-flipbook__side:disabled {
	opacity: 0;
	pointer-events: none;
}

/* ---------- Toolbar ---------- */
.smk-flipbook__toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 12px 16px;
	margin-top: 26px;
}
.smk-flipbook__toolbar[hidden] {
	display: none;
}
.smk-flipbook__nav,
.smk-flipbook__actions {
	display: flex;
	align-items: center;
	gap: 6px;
}
.smk-flipbook__nav {
	padding: 4px;
	border-radius: 999px;
	background: #fff;
	box-shadow: 0 2px 8px rgba(20, 22, 40, 0.08);
}
.smk-flipbook__icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--smk-ink);
	cursor: pointer;
	transition: background 0.2s, color 0.2s;
}
.smk-flipbook__icon:hover:not(:disabled) {
	background: var(--smk-ink);
	color: #fff;
}
.smk-flipbook__icon:disabled {
	opacity: 0.3;
	cursor: default;
}
.smk-flipbook__pageinfo {
	min-width: 64px;
	color: var(--smk-ink);
	font-size: 15px;
	font-weight: 500;
	text-align: center;
	font-variant-numeric: tabular-nums;
}
.smk-flipbook__action {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	height: 46px;
	padding: 0 18px;
	border: 1px solid var(--smk-ink);
	border-radius: 999px;
	background: transparent;
	color: var(--smk-ink);
	font: inherit;
	font-size: 14px;
	font-weight: 500;
	line-height: 1;
	text-decoration: none;
	cursor: pointer;
	transition: background 0.2s, color 0.2s;
}
.smk-flipbook__action:last-child {
	background: var(--smk-ink);
	color: #fff;
}
.smk-flipbook__action:hover,
.smk-flipbook__action:focus-visible {
	background: var(--smk-ink);
	color: #fff;
}
.smk-flipbook__action:last-child:hover {
	opacity: 0.88;
}
.smk-flipbook svg {
	width: 20px;
	height: 20px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}
.smk-flipbook__side svg {
	width: 24px;
	height: 24px;
}
.smk-flipbook__action svg {
	width: 18px;
	height: 18px;
}
.smk-flipbook button:focus-visible,
.smk-flipbook a:focus-visible {
	outline: 2px solid var(--smk-ink);
	outline-offset: 2px;
}

.smk-flipbook__hint {
	margin: 14px 0 0;
	font-size: 13px;
	text-align: center;
	opacity: 0.6;
}
.smk-flipbook__hint[hidden] {
	display: none;
}

/* ---------- Full screen ---------- */
.smk-flipbook.is-fullscreen {
	--smk-chrome: 140px;
	display: flex;
	flex-direction: column;
	justify-content: center;
	max-width: none;
	width: 100%;
	height: 100%;
	background: var(--smk-paper);
	overflow: auto;
}
.smk-flipbook.is-fullscreen .smk-flipbook__title {
	display: none;
}
.smk-flipbook.is-fullscreen .smk-flipbook__panel {
	border-radius: 0;
}

/* ---------- Tablet & phone ---------- */
@media (max-width: 900px) {
	.smk-flipbook__panel {
		padding: 24px 16px 18px;
	}
	.smk-flipbook__side {
		display: none;
	}
}
@media (max-width: 600px) {
	.smk-flipbook__panel {
		padding: 16px 10px 14px;
		border-radius: 12px;
	}
	.smk-flipbook__title {
		margin-bottom: 16px;
		font-size: 26px !important; /* theme h2 size is too large for the long heading on phones */
		line-height: 1.35 !important;
	}
	.smk-flipbook__action {
		height: 40px;
		padding: 0 14px;
	}
	.smk-flipbook__hint {
		display: none;
	}
}
