/* ==========================================================================
   Flipbook (our-profile.html)
   Markup:  .flipbook-stage[data-flipbook="horizontal"]
            > .fb-loader, .fb-error, .fb-frame > .fb-shift > .fb-rot > .fb-book,
              .fb-controls, .fb-share-menu
            .fb-overlay (all-pages grid / zoom view) is added by the JS.
   Behaviour lives in assets/js/flipbook.js. The book's size is set from JS so
   book + controls always fit on screen below the site header.
   ========================================================================== */

.flipbook-section {
	position: relative;
	padding: 32px 0 40px;
}
.flipbook-inner {
	position: relative;
	z-index: 2;
}
/* Page title above the book: the site's standard heading (.tt-heading-title, 32px);
   only spacing is set here so it stays compact above the book */
.fb-title {
	margin-bottom: 40px;
	padding: 0 15px;
}
.fb-title hr.hr-short {
	margin: 12px auto 0;
	border-top-width: 4px;
}
.flipbook-stage {
	position: relative;
	max-width: 1600px;
	margin: 0 auto;
	padding: 0 4%;
}

/* Pages ------------------------------------------------------------------- */

.fb-book {
	width: 100%;
	margin: 0 auto;
}
.fb-book .fb-page {
	background-color: #fff;
	overflow: hidden;
	/* render pages on the GPU so turning stays smooth */
	backface-visibility: hidden;
	-webkit-backface-visibility: hidden;
}
/* The whole page image is always shown: exact PDF page, never cropped */
.fb-book .fb-page img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
	user-select: none;
	-webkit-user-drag: none;
	transform: translateZ(0);
}
/* Override the site-wide grayscale image filter (helper.css) - pages stay in full colour */
.fb-book .fb-page img,
.fb-book .fb-page img:hover,
.fb-overlay img,
.fb-overlay img:hover {
	filter: none;
}

/* Slides the book so a lone page (the cover) sits in the centre */
.fb-shift {
	position: relative;
	/* same duration as the page turn (set from JS), with a soft ease-in-out */
	transition: transform var(--fb-flip-time, 1000ms) cubic-bezier(0.45, 0, 0.25, 1);
	will-change: transform;
}

/* Loading / error --------------------------------------------------------- */

.fb-loader {
	padding: 80px 15px;
	text-align: center;
	color: #fff;
}
.fb-progress {
	width: 260px;
	max-width: 80%;
	height: 4px;
	margin: 20px auto 0;
	background: rgba(255, 255, 255, 0.15);
	border-radius: 2px;
	overflow: hidden;
}
.fb-progress-bar {
	width: 0;
	height: 100%;
	background: #f58220;
	transition: width 0.2s;
}
.fb-error {
	display: none;
	padding: 60px 15px;
	text-align: center;
	color: #fff;
}

/* Control bar ------------------------------------------------------------- */

.fb-controls {
	display: none;
	align-items: center;
	gap: 2px;
	width: max-content;
	max-width: 100%;
	margin: 20px auto 0;
	padding: 5px;
	border: 1px solid rgba(255, 255, 255, 0.12);
	border-radius: 999px;
	background: rgba(15, 15, 15, 0.72);
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.fb-controls.is-ready {
	display: flex;
}
.fb-controls button,
.fb-controls a {
	display: inline-flex;
	flex-shrink: 0;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: #fff;
	font-size: 15px;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.15s, color 0.15s;
}
.fb-controls button:hover,
.fb-controls a:hover,
.fb-controls [data-action="share"][aria-expanded="true"] {
	background: rgba(255, 255, 255, 0.12);
	color: #f58220;
}
.fb-controls button:focus-visible,
.fb-controls a:focus-visible,
.fb-share-menu a:focus-visible,
.fb-share-menu button:focus-visible,
.fb-overlay button:focus-visible {
	outline: 2px solid #f58220;
	outline-offset: 2px;
}
.fb-controls button:disabled {
	opacity: 0.3;
	cursor: default;
	background: transparent;
	color: #fff;
}
.fb-counter {
	min-width: 72px;
	padding: 0 6px;
	text-align: center;
	color: #fff;
	font-size: 14px;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}
.fb-sep {
	flex-shrink: 0;
	width: 1px;
	height: 22px;
	margin: 0 6px;
	background: rgba(255, 255, 255, 0.18);
}

/* Share links (desktop; phones use the device's share sheet) */
.fb-share-menu {
	display: none;
	justify-content: center;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 12px;
}
.fb-share-menu.is-open {
	display: flex;
}
.fb-share-menu button,
.fb-share-menu a {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	height: 36px;
	padding: 0 14px;
	border: 1px solid rgba(255, 255, 255, 0.18);
	border-radius: 999px;
	background: rgba(15, 15, 15, 0.72);
	color: #fff;
	font-size: 13px;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.15s, border-color 0.15s;
}
.fb-share-menu button:hover,
.fb-share-menu a:hover {
	border-color: #f58220;
	background: #f58220;
	color: #fff;
}

/* Overlay: all-pages grid + zoom view ------------------------------------- */

.fb-overlay {
	position: fixed;
	inset: 0;
	/* above the site header (theme.css: 9999, 99999 on small screens) */
	z-index: 100000;
	display: flex;
	flex-direction: column;
	background: rgba(10, 10, 10, 0.96);
	color: #fff;
}
.fb-overlay[hidden] {
	display: none;
}
.fb-ov-bar {
	display: flex;
	flex-shrink: 0;
	align-items: center;
	gap: 8px;
	padding: 10px 14px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.fb-ov-title {
	flex: 1;
	font-size: 15px;
	font-variant-numeric: tabular-nums;
}
.fb-ov-hint {
	color: rgba(255, 255, 255, 0.55);
	font-size: 12px;
}
.fb-overlay button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.08);
	color: #fff;
	font-size: 16px;
	cursor: pointer;
}
.fb-overlay button:hover {
	background: rgba(255, 255, 255, 0.16);
	color: #f58220;
}
.fb-overlay button:disabled {
	opacity: 0.3;
	cursor: default;
}
.fb-ov-body {
	position: relative;
	flex: 1;
	min-height: 0;
	overflow: auto;
	-webkit-overflow-scrolling: touch;
}

/* All pages */
.fb-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
	gap: 18px;
	max-width: 1400px;
	margin: 0 auto;
	padding: 20px;
}
.fb-grid button {
	display: block;
	width: 100%;
	height: auto;
	padding: 0;
	border-radius: 4px;
	background: none;
	text-align: center;
}
.fb-grid button:hover {
	background: none;
}
.fb-grid img {
	display: block;
	width: 100%;
	aspect-ratio: 16 / 9;
	object-fit: contain;
	background: #fff;
	border: 2px solid transparent;
	border-radius: 4px;
	transition: border-color 0.15s, transform 0.15s;
}
.fb-grid button:hover img {
	border-color: rgba(245, 130, 32, 0.6);
	transform: translateY(-2px);
}
.fb-grid button[aria-current="true"] img {
	border-color: #f58220;
}
.fb-grid span {
	display: block;
	margin-top: 6px;
	color: rgba(255, 255, 255, 0.7);
	font-size: 12px;
}
.fb-grid button[aria-current="true"] span {
	color: #f58220;
}

/* Zoom: page fits the screen; tap / click to see it at full size and pan around */
.fb-zoom {
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 100%;
	min-height: 100%;
	padding: 16px;
}
.fb-zoom img {
	display: block;
	max-width: 100%;
	max-height: calc(100vh - 100px);
	background: #fff;
	cursor: zoom-in;
	user-select: none;
	-webkit-user-drag: none;
}
.fb-zoom.is-zoomed {
	display: block;
	padding: 0;
}
/* zoomed: at least the image's real size (1600px) - on phones that's ~4x; on big screens
   a moderate 1.6x so it doesn't get blurry */
.fb-zoom.is-zoomed img {
	width: max(160%, 1600px);
	max-width: none;
	max-height: none;
	cursor: zoom-out;
}
.fb-ov-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
}
.fb-overlay .fb-ov-nav {
	width: 46px;
	height: 46px;
	background: rgba(0, 0, 0, 0.55);
}
.fb-ov-prev {
	left: 12px;
}
.fb-ov-next {
	right: 12px;
}
.fb-ov-wrap {
	position: relative;
	flex: 1;
	min-height: 0;
	display: flex;
	flex-direction: column;
}

/* Fullscreen -------------------------------------------------------------- */

.flipbook-stage:fullscreen {
	display: flex;
	flex-direction: column;
	justify-content: center;
	max-width: none;
	padding: 20px;
	background: #111;
}
.flipbook-stage:-webkit-full-screen {
	display: flex;
	flex-direction: column;
	justify-content: center;
	max-width: none;
	padding: 20px;
	background: #111;
}

/* Phones ------------------------------------------------------------------ */

@media (max-width: 767px) {
	.flipbook-section {
		padding: 24px 0 32px;
	}
	.fb-title {
		margin-bottom: 28px;
	}
	.flipbook-stage {
		padding: 0 12px;
	}
	/* one page at a time on phones - keep the turning page inside the frame */
	.fb-book {
		overflow: hidden;
	}
	.fb-controls {
		margin-top: 14px;
	}
	.fb-grid {
		grid-template-columns: repeat(2, 1fr);
		gap: 12px;
		padding: 12px;
	}
	.fb-ov-hint {
		display: none;
	}
	.fb-overlay .fb-ov-nav {
		width: 40px;
		height: 40px;
	}
	.fb-ov-prev {
		left: 6px;
	}
	.fb-ov-next {
		right: 6px;
	}
}
/* Small phones: drop first/last page and fullscreen (phones barely support it) so the
   bar stays on one line down to 320px */
@media (max-width: 479px) {
	.fb-controls [data-action="first"],
	.fb-controls [data-action="last"],
	.fb-controls [data-action="fullscreen"] {
		display: none;
	}
	.fb-controls button,
	.fb-controls a {
		width: 34px;
		height: 34px;
		font-size: 14px;
	}
	.fb-counter {
		min-width: 52px;
		padding: 0 2px;
		font-size: 13px;
	}
	.fb-sep {
		margin: 0 3px;
	}
}

/* Short screens (phones held sideways): a smaller title, so book + controls still fit */
@media (max-height: 500px) {
	.flipbook-section {
		padding-top: 12px;
	}
	.fb-title {
		margin-bottom: 8px;
	}
	.fb-title h1 {
		font-size: 20px;
	}
	.fb-title hr.hr-short {
		display: none;
	}
}
