/* Franklins Guides: full screen flipbook. */

html,
body.fg-viewer-body {
	height: 100%;
	overflow: hidden;
}

.fgv {
	--fgv-navy: var(--awb-color4, #0f1935);
	--fgv-orange: var(--awb-color5, #ff6418);
	--fgv-bar: 84px;
	--fgv-foot: 72px;
	--fgv-btn-bg: rgba(255, 255, 255, 0.1);
	--fgv-btn-bg-hover: rgba(255, 255, 255, 0.2);
	--fgv-muted: rgba(255, 255, 255, 0.62);
	position: fixed;
	inset: 0;
	/* Above the site, below the Complianz cookie banner so consent can still be given here. */
	z-index: 99990;
	display: grid;
	grid-template-rows: var(--fgv-bar) minmax(0, 1fr) var(--fgv-foot);
	/* Fixed column, so a zoomed book scrolls inside the stage instead of widening it. */
	grid-template-columns: minmax(0, 1fr);
	overflow: hidden;
	background: var(--fgv-navy);
	color: #fff;
	font-family: var(--body_typography-font-family, "Lato"), sans-serif;
	-webkit-font-smoothing: antialiased;
}

/* The Franklins chevron, faint, behind the book. */
.fgv::before,
.fgv::after {
	content: "";
	position: absolute;
	z-index: 0;
	pointer-events: none;
	transform: rotate(45deg);
}

.fgv::before {
	top: -38vmax;
	left: -30vmax;
	width: 70vmax;
	height: 70vmax;
	background: linear-gradient(135deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02));
}

.fgv::after {
	bottom: -46vmax;
	left: -40vmax;
	width: 62vmax;
	height: 62vmax;
	background: rgba(0, 0, 0, 0.16);
}

.fgv > * {
	position: relative;
	z-index: 1;
}

/* Logged-in editors keep the WordPress admin bar above the reader. */
body.admin-bar .fgv {
	top: 32px;
}

@media (max-width: 782px) {
	body.admin-bar .fgv {
		top: 46px;
	}
}

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

.fgv svg {
	width: 20px;
	height: 20px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.fgv button {
	font-family: inherit;
}

/* ---------- Top bar ---------- */

.fgv-bar {
	display: flex;
	align-items: center;
	gap: 22px;
	padding: 0 40px;
	z-index: 3;
}

.fgv-brand {
	display: flex;
	flex: none;
	align-items: center;
	color: #fff !important;
	text-decoration: none !important;
}

.fgv-brand img {
	display: block;
	width: auto;
	height: 34px;
}

.fgv-wordmark {
	font-size: 22px;
	font-weight: 700;
	line-height: 1;
	letter-spacing: 0.06em;
}

.fgv-wordmark span {
	color: var(--fgv-orange);
}

.fgv-heading {
	flex: 1;
	min-width: 0;
	padding-left: 22px;
	border-left: 1px solid rgba(255, 255, 255, 0.28);
}

.fgv-title,
.fgv-subtitle,
.fgv-thumbs__head h2 {
	text-transform: none !important;
}

.fgv-title {
	margin: 0 !important;
	overflow: hidden;
	color: #fff !important;
	font-size: 17px !important;
	line-height: 1.3 !important;
	font-weight: 700 !important;
	letter-spacing: -0.005em !important;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.fgv-subtitle {
	margin: 2px 0 0;
	overflow: hidden;
	color: var(--fgv-muted);
	font-size: 13px;
	line-height: 1.3;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.fgv-tools {
	display: flex;
	flex: none;
	align-items: center;
	gap: 10px;
}

.fgv-round {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 46px;
	height: 46px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--fgv-btn-bg);
	color: #fff !important;
	text-decoration: none !important;
	cursor: pointer;
	transition: background-color 0.2s ease, opacity 0.2s ease;
}

.fgv-round:hover:not(:disabled),
.fgv-round[aria-expanded="true"],
.fgv-round[aria-pressed="true"] {
	background: var(--fgv-btn-bg-hover);
}

.fgv-round:disabled {
	opacity: 0.4;
	cursor: default;
}

.fgv-round--sm {
	width: 40px;
	height: 40px;
}

.fgv-round--sm svg {
	width: 18px;
	height: 18px;
}

.fgv-zoom[aria-pressed="true"] .fgv-zoom__plus {
	display: none;
}

.fgv-download {
	display: inline-flex;
	align-items: center;
	gap: 9px;
	height: 46px;
	padding: 0 24px;
	border-radius: 999px;
	background: var(--fgv-orange);
	color: #fff !important;
	font-size: 15px;
	font-weight: 700;
	line-height: 1;
	text-decoration: none !important;
	box-shadow: 0 8px 20px -8px rgba(255, 100, 24, 0.8);
	transition: background-color 0.2s ease;
}

.fgv-download svg {
	width: 18px;
	height: 18px;
}

.fgv-download:hover {
	background: #e9560f;
}

.fgv-round:focus-visible,
.fgv-download:focus-visible,
.fgv-nav:focus-visible,
.fgv-thumb:focus-visible,
.fgv-share-menu > *:focus-visible {
	outline: 3px solid var(--fgv-orange);
	outline-offset: 3px;
}

/* Share menu */
.fgv-share {
	position: relative;
}

.fgv-share-menu {
	position: absolute;
	top: calc(100% + 10px);
	right: 0;
	z-index: 5;
	display: grid;
	min-width: 190px;
	padding: 8px;
	background: #fff;
	border-radius: 14px;
	box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

.fgv-share-menu[hidden] {
	display: none;
}

.fgv-share-menu > * {
	display: block;
	width: 100%;
	padding: 11px 14px;
	border: 0;
	border-radius: 8px;
	background: none;
	color: var(--fgv-navy) !important;
	font: inherit;
	font-size: 15px;
	text-align: left;
	text-decoration: none !important;
	cursor: pointer;
}

.fgv-share-menu > *:hover {
	background: #f4f4f4;
}

/* ---------- Stage ---------- */

.fgv-stage {
	position: relative;
	min-width: 0;
	min-height: 0;
	overflow: hidden;
}

.fgv-scroller {
	width: 100%;
	height: 100%;
	padding: 18px 140px 26px;
	overflow: hidden;
}

.fgv.is-zoomed .fgv-scroller {
	padding: 0;
	overflow: auto;
	cursor: grab;
	touch-action: none;
	scrollbar-width: thin;
	scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.fgv.is-panning .fgv-scroller {
	cursor: grabbing;
}

.fgv-book-wrap {
	width: 100%;
	height: 100%;
	margin: 0 auto;
	/* Slides a lone cover to the centre and back as it opens; same pace as a page turn. */
	transition: transform 0.7s cubic-bezier(0.45, 0, 0.25, 1);
}

.fgv.is-zoomed .fgv-book-wrap,
.fgv.is-panning .fgv-book-wrap {
	transition: none;
}

.fgv-book {
	width: 100%;
	height: 100%;
	opacity: 0;
	transition: opacity 0.4s ease;
}

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

.fgv-book .stf__block {
	filter: drop-shadow(0 24px 40px rgba(0, 0, 0, 0.45));
}

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

.fgv-page canvas {
	display: block;
	width: 100%;
	height: 100%;
}

/* Centre fold between two facing pages. */
.fgv-gutter {
	position: absolute;
	width: 56px;
	margin-left: -28px;
	pointer-events: none;
	background: linear-gradient(90deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.07) 38%, rgba(0, 0, 0, 0.2) 50%, rgba(0, 0, 0, 0.07) 62%, rgba(0, 0, 0, 0) 100%);
	mix-blend-mode: multiply;
	z-index: 2;
}

.fgv-gutter[hidden] {
	display: none;
}

.fgv-nav {
	position: absolute;
	top: 50%;
	left: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	margin-top: -24px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--fgv-orange);
	color: #fff;
	cursor: pointer;
	box-shadow: 0 10px 24px -6px rgba(0, 0, 0, 0.45);
	transition: opacity 0.2s ease, transform 0.2s ease, background-color 0.2s ease;
	z-index: 3;
}

.fgv-nav svg {
	width: 22px;
	height: 22px;
	stroke-width: 2.6;
}

.fgv-nav:hover:not(:disabled) {
	transform: scale(1.07);
}

.fgv-nav:disabled {
	opacity: 0;
	pointer-events: none;
}

.fgv:not(.is-ready) .fgv-nav {
	visibility: hidden;
}

/* Loading and error */
.fgv-status {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 18px;
	color: var(--fgv-muted);
	font-size: 16px;
	text-align: center;
	pointer-events: none;
}

.fgv.is-ready .fgv-status {
	display: none;
}

.fgv.is-error .fgv-status {
	pointer-events: auto;
}

.fgv-spinner {
	width: 42px;
	height: 42px;
	border: 3px solid rgba(255, 255, 255, 0.18);
	border-top-color: var(--fgv-orange);
	border-radius: 50%;
	animation: fgv-spin 0.9s linear infinite;
}

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

/* ---------- Page list ---------- */

.fgv-thumbs {
	position: absolute;
	inset: 0;
	z-index: 4;
	display: flex;
	flex-direction: column;
	padding: 10px 40px 24px;
	background: rgba(11, 18, 40, 0.96);
	backdrop-filter: blur(6px);
}

.fgv-thumbs[hidden] {
	display: none;
}

.fgv-thumbs__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 18px;
}

.fgv-thumbs__head h2 {
	margin: 0 !important;
	color: #fff !important;
	font-size: 18px !important;
	font-weight: 700 !important;
	line-height: 1.3 !important;
}

.fgv-thumbs__grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
	align-content: start;
	gap: 26px 20px;
	overflow-y: auto;
	padding: 4px 4px 20px;
}

.fgv-thumb {
	position: relative;
	display: block;
	width: 100%;
	padding: 0;
	border: 0;
	border-radius: 4px;
	background: rgba(255, 255, 255, 0.08);
	cursor: pointer;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.fgv-thumb canvas {
	display: block;
	width: 100%;
	height: 100%;
	border-radius: 4px;
}

.fgv-thumb:hover {
	transform: translateY(-3px);
}

.fgv-thumb.is-current {
	box-shadow: 0 0 0 3px var(--fgv-orange);
}

.fgv-thumb__num {
	position: absolute;
	bottom: -20px;
	left: 0;
	right: 0;
	color: var(--fgv-muted);
	font-size: 12px;
	text-align: center;
}

/* ---------- Footer ---------- */

.fgv-foot {
	display: grid;
	grid-template-columns: 1fr minmax(160px, 380px) 1fr;
	align-items: center;
	gap: 24px;
	padding: 0 40px;
}

.fgv-foot__left {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
}

.fgv-count {
	margin: 0 0 0 6px;
	color: var(--fgv-muted);
	font-size: 13px;
	white-space: nowrap;
}

.fgv-hint {
	margin: 0;
	color: var(--fgv-muted);
	font-size: 13px;
	text-align: right;
	white-space: nowrap;
}

.fgv-slider {
	--fgv-progress: 0%;
	display: block;
	width: 100%;
	height: 4px;
	margin: 0;
	appearance: none;
	-webkit-appearance: none;
	border-radius: 4px;
	background: linear-gradient(90deg, var(--fgv-orange) var(--fgv-progress), rgba(255, 255, 255, 0.18) var(--fgv-progress));
	cursor: pointer;
}

.fgv-slider::-webkit-slider-thumb {
	-webkit-appearance: none;
	width: 14px;
	height: 14px;
	border: 0;
	border-radius: 50%;
	background: var(--fgv-orange);
	opacity: 0;
	transition: opacity 0.2s ease;
}

.fgv-slider::-moz-range-thumb {
	width: 14px;
	height: 14px;
	border: 0;
	border-radius: 50%;
	background: var(--fgv-orange);
	opacity: 0;
}

.fgv-slider:hover::-webkit-slider-thumb,
.fgv-slider:focus-visible::-webkit-slider-thumb {
	opacity: 1;
}

.fgv-slider:hover::-moz-range-thumb,
.fgv-slider:focus-visible::-moz-range-thumb {
	opacity: 1;
}

.fgv-slider:disabled {
	opacity: 0.4;
}

.fgv-slider:focus-visible {
	outline: 3px solid var(--fgv-orange);
	outline-offset: 6px;
}

/* Make room for the UserWay accessibility button, which sits bottom left. */
body:has(#userwayAccessibilityIcon) .fgv-foot {
	padding-left: 100px;
}

/* The Moneypenny chat opens itself over the book; leave it out of the reading view. */
body.fg-viewer-body #designstudio,
body.fg-viewer-body #designstudio-button {
	display: none !important;
}

/* ---------- Smaller screens ---------- */

@media (max-width: 1100px) {
	.fgv-scroller {
		padding-left: 96px;
		padding-right: 96px;
	}
}

@media (hover: none) {
	.fgv-hint {
		visibility: hidden;
	}
}

@media (max-width: 760px) {
	.fgv {
		--fgv-bar: 64px;
		--fgv-foot: 62px;
		height: 100dvh;
	}

	.fgv-bar {
		gap: 10px;
		padding: 0 12px 0 16px;
	}

	.fgv-brand,
	.fgv-subtitle,
	.fgv-hint,
	.fgv-hide-sm {
		display: none !important;
	}

	.fgv-heading {
		padding-left: 0;
		border-left: 0;
	}

	.fgv-title {
		font-size: 15px !important;
	}

	.fgv-tools {
		gap: 6px;
	}

	.fgv-round {
		width: 40px;
		height: 40px;
	}

	.fgv-download {
		width: 40px;
		height: 40px;
		padding: 0;
		justify-content: center;
	}

	.fgv-scroller {
		padding: 10px 14px 14px;
	}

	/* Arrows sit over the page edges on phones; swiping also turns pages. */
	.fgv-nav {
		width: 40px;
		height: 40px;
		margin-top: -20px;
		opacity: 0.92;
	}

	.fgv-foot {
		grid-template-columns: auto 1fr;
		gap: 16px;
		padding: 0 16px;
	}

	body:has(#userwayAccessibilityIcon) .fgv-foot {
		padding-left: 76px;
	}

	.fgv-count {
		margin-left: 2px;
		font-size: 12px;
	}

	.fgv-thumbs {
		padding: 6px 16px 16px;
	}

	.fgv-thumbs__grid {
		grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
		gap: 24px 14px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.fgv-book,
	.fgv-nav,
	.fgv-round,
	.fgv-thumb {
		transition: none;
	}
}
