/* Shout Flip — viewer styles */

.sflip-wrap { width: 100%; margin: 0 auto 1.5em; }
.sflip-wrap--inline { max-width: 100%; }

.sflip {
	--sflip-bg: #5c5c5c;
	--sflip-radius: 8px;
	--sflip-pad: 20px;
	--sflip-gap: 16px;
	--sflip-tb-bg: #ffffff;
	--sflip-tb-fg: #2b2b2b;
	--sflip-tb-hover: #eef0f3;
	--sflip-tb-border: rgba(0, 0, 0, .08);
	--sflip-accent: #1a73e8;
	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	background: var(--sflip-bg);
	border-radius: var(--sflip-radius);
	overflow: hidden;
	outline: none;
	font-size: 14px;
	line-height: 1.3;
	-webkit-tap-highlight-color: transparent;
	box-sizing: border-box;
}
.sflip *, .sflip *::before, .sflip *::after { box-sizing: border-box; }
.sflip:focus-visible { box-shadow: 0 0 0 3px rgba(26, 115, 232, .45); }
.sflip:not(.sflip--ready) { min-height: 320px; }

.sflip--theme-dark {
	--sflip-tb-bg: #1f2125;
	--sflip-tb-fg: #f1f3f4;
	--sflip-tb-hover: #33363b;
	--sflip-tb-border: rgba(255, 255, 255, .08);
	--sflip-accent: #8ab4f8;
}

/* ---------- body & stage ---------- */

.sflip-body { position: relative; display: flex; min-height: 0; }
.sflip-stage {
	position: relative;
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	overflow: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	transition: height .25s ease;
}
.sflip-inner {
	margin: auto;               /* centres, but still scrolls correctly when bigger than the stage */
	padding: var(--sflip-pad);
	flex: 0 0 auto;
	transform-origin: center center;
}
.sflip-inner--scroll { display: flex; flex-direction: column; align-items: center; gap: var(--sflip-gap); margin: 0 auto; }

/* ---------- pages ---------- */

.sflip-page {
	position: relative;
	background: #fff;
	flex: 0 0 auto;
}
.sflip-page canvas { display: block; width: 100%; height: 100%; }
.sflip-page::before {       /* loading shimmer until drawn */
	content: "";
	position: absolute; inset: 0;
	background: linear-gradient(100deg, #fff 30%, #f1f1f1 50%, #fff 70%) 0 0 / 300% 100%;
	animation: sflip-shimmer 1.4s linear infinite;
	pointer-events: none;
}
.sflip-page.is-drawn::before { display: none; }
.sflip:not(.sflip--flat) .sflip-inner--slider .sflip-page,
.sflip:not(.sflip--flat) .sflip-inner--scroll .sflip-page { box-shadow: 0 2px 6px rgba(0, 0, 0, .18), 0 10px 30px rgba(0, 0, 0, .22); }
.sflip-inner--slider .sflip-page,
.sflip-inner--scroll .sflip-page { border-radius: 2px; overflow: hidden; }
.sflip-page.sflip-in { animation: sflip-fade .28s ease; }

/* ---------- flipbook ---------- */

.sflip-book {
	position: relative;
	perspective: 2600px;
	transform-style: preserve-3d;
}
.sflip-book.is-shifting { transition: transform var(--sflip-ms, 600ms) cubic-bezier(.45, .05, .25, 1); }
.sflip:not(.sflip--flat) .sflip-book::after {  /* drop shadow for the whole book */
	content: "";
	position: absolute; inset: 0;
	box-shadow: 0 4px 10px rgba(0, 0, 0, .18), 0 18px 40px rgba(0, 0, 0, .28);
	pointer-events: none;
	z-index: -1;
}
.sflip-book.is-single::after { display: none; }
.sflip-book .sflip-page { position: absolute; top: 0; left: 0; cursor: pointer; }
.sflip:not(.sflip--flat) .sflip-book.is-single .sflip-page { box-shadow: 0 4px 10px rgba(0, 0, 0, .18), 0 18px 40px rgba(0, 0, 0, .28); }
.sflip--zoomed .sflip-book .sflip-page { cursor: default; }

/* spine shading */
.sflip-page--left::after,
.sflip-page--right::after {
	content: "";
	position: absolute; top: 0; bottom: 0; width: 9%;
	pointer-events: none;
}
.sflip-page--left::after { right: 0; background: linear-gradient(to left, rgba(0, 0, 0, .16), rgba(0, 0, 0, 0)); }
.sflip-page--right::after { left: 0; background: linear-gradient(to right, rgba(0, 0, 0, .16), rgba(0, 0, 0, 0)); }
.sflip-book.is-single .sflip-page::after { display: none; }

/* turning leaf */
.sflip-leaf {
	position: absolute; top: 0;
	transform-style: preserve-3d;
	transition-property: transform;
	transition-timing-function: cubic-bezier(.45, .05, .25, 1);
	z-index: 5;
	will-change: transform;
}
.sflip-leaf--l { transform-origin: left center; }
.sflip-leaf--r { transform-origin: right center; }
.sflip-leaf--l.is-turned { transform: rotateY(-180deg); }
.sflip-leaf--r.is-turned { transform: rotateY(180deg); }
.sflip-leaf-face {
	position: absolute; inset: 0;
	background: #fff;
	-webkit-backface-visibility: hidden;
	backface-visibility: hidden;
	overflow: hidden;
}
.sflip-leaf-face.is-blank { background: transparent; }
.sflip-leaf-face canvas { display: block; width: 100%; height: 100%; }
.sflip-leaf-back { transform: rotateY(180deg); }
.sflip-leaf-shade {
	position: absolute; inset: 0;
	pointer-events: none;
	opacity: 0;
	animation: sflip-shade var(--sflip-ms, 700ms) ease-in-out forwards;
}
.sflip-leaf--l .sflip-leaf-front .sflip-leaf-shade,
.sflip-leaf--r .sflip-leaf-back .sflip-leaf-shade { background: linear-gradient(to right, rgba(0, 0, 0, .25), rgba(0, 0, 0, 0) 40%, rgba(255, 255, 255, .15)); }
.sflip-leaf--l .sflip-leaf-back .sflip-leaf-shade,
.sflip-leaf--r .sflip-leaf-front .sflip-leaf-shade { background: linear-gradient(to left, rgba(0, 0, 0, .25), rgba(0, 0, 0, 0) 40%, rgba(255, 255, 255, .15)); }

/* ---------- side arrows ---------- */

.sflip-arrow {
	position: absolute; top: 50%;
	transform: translateY(-50%);
	width: 44px; height: 64px;
	display: flex; align-items: center; justify-content: center;
	border: 0; border-radius: 6px;
	background: rgba(0, 0, 0, .18);
	color: #fff;
	cursor: pointer;
	opacity: .75;
	transition: opacity .2s, background .2s;
	z-index: 6;
	padding: 0;
}
.sflip-arrow svg { width: 32px; height: 32px; }
.sflip-arrow:hover { opacity: 1; background: rgba(0, 0, 0, .35); }
.sflip-arrow:disabled { opacity: 0; pointer-events: none; }
.sflip-arrow--prev { left: 8px; }
.sflip-arrow--next { right: 8px; }
.sflip--scroll .sflip-arrow, .sflip:not(.sflip--loaded) .sflip-arrow { display: none; }
.sflip--thumbs .sflip-arrow--prev { left: 158px; }

/* ---------- toolbar ---------- */

.sflip-toolbar {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 6px;
	padding: 6px 10px;
	background: var(--sflip-tb-bg);
	color: var(--sflip-tb-fg);
	z-index: 7;
	flex-wrap: wrap;
}
.sflip--tb-bottom .sflip-toolbar { border-top: 1px solid var(--sflip-tb-border); }
.sflip--tb-top .sflip-toolbar { border-bottom: 1px solid var(--sflip-tb-border); }
.sflip--tb-hidden .sflip-toolbar { display: none; }
.sflip-tb-group { display: flex; align-items: center; gap: 2px; }
.sflip-tb-title {
	flex: 1 1 100%;
	order: -1;
	font-weight: 600;
	white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
	padding: 2px 4px;
	display: none;
}
.sflip-btn {
	display: inline-flex; align-items: center; justify-content: center;
	min-width: 36px; height: 36px;
	padding: 0 6px;
	margin: 0;
	border: 0; border-radius: 6px;
	background: transparent;
	color: inherit;
	font: inherit;
	cursor: pointer;
	text-decoration: none !important;
	box-shadow: none;
	transition: background .15s;
}
.sflip-btn:hover, .sflip-btn.is-active { background: var(--sflip-tb-hover); color: inherit; }
.sflip-btn.is-active { color: var(--sflip-accent); }
.sflip-btn:disabled { opacity: .35; cursor: default; background: transparent; }
.sflip-btn:focus-visible { outline: 2px solid var(--sflip-accent); outline-offset: -2px; }
.sflip-zoom-label { min-width: 54px; font-size: 13px; font-variant-numeric: tabular-nums; }

.sflip-pagebox { display: inline-flex; align-items: center; gap: 4px; padding: 0 4px; background: none; }
.sflip-page-input {
	width: 3ch; min-width: 3ch; height: 30px !important; min-height: 0 !important;
	padding: 0 4px !important; margin: 0;
	line-height: 28px !important;
	border: 1px solid var(--sflip-tb-border);
	border-radius: 5px;
	background: transparent;
	color: inherit;
	font: inherit;
	text-align: center;
	box-shadow: none;
}
.sflip-page-input:focus { outline: 2px solid var(--sflip-accent); outline-offset: 0; }
.sflip-page-total { opacity: .7; white-space: nowrap; }

/* ---------- thumbnails ---------- */

.sflip-thumbs {
	display: none;
	flex: 0 0 150px;
	width: 150px;
	contain: size;              /* never makes the viewer taller than the stage */
	overflow-y: auto;
	padding: 10px;
	background: rgba(0, 0, 0, .22);
	flex-direction: column;
	gap: 10px;
}
.sflip--thumbs .sflip-thumbs { display: flex; }
.sflip-thumb {
	position: relative;
	display: block;
	width: 100%;
	padding: 0; margin: 0;
	border: 2px solid transparent;
	border-radius: 4px;
	background: #fff;
	cursor: pointer;
	flex: 0 0 auto;
}
.sflip-thumb canvas { display: block; width: 100%; height: auto; min-height: 20px; }
.sflip-thumb.is-current { border-color: var(--sflip-accent); box-shadow: 0 0 0 2px rgba(26, 115, 232, .35); }
.sflip-thumb-num {
	position: absolute; right: 4px; bottom: 4px;
	background: rgba(0, 0, 0, .6); color: #fff;
	font-size: 11px; line-height: 1;
	padding: 3px 5px; border-radius: 3px;
}

/* ---------- messages ---------- */

.sflip-msg {
	position: absolute; inset: 0;
	display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
	color: #fff; text-align: center; padding: 20px;
}
.sflip-msg--error { background: rgba(0, 0, 0, .25); }
.sflip-msg-link { color: #fff !important; text-decoration: underline; font-weight: 600; }
.sflip-spinner {
	width: 34px; height: 34px;
	border: 3px solid rgba(255, 255, 255, .3);
	border-top-color: #fff;
	border-radius: 50%;
	animation: sflip-spin .8s linear infinite;
}
.sflip-toast {
	position: absolute; left: 50%; bottom: 14px;
	transform: translate(-50%, 10px);
	background: rgba(20, 20, 20, .88); color: #fff;
	padding: 8px 14px; border-radius: 6px;
	font-size: 13px;
	opacity: 0; pointer-events: none;
	transition: opacity .2s, transform .2s;
	z-index: 8;
}
.sflip-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- full screen & lightbox ---------- */

.sflip--fs, .sflip--fill { border-radius: 0; height: 100%; }
.sflip--fs { width: 100vw; height: 100vh; }
.sflip--fs .sflip-body, .sflip--fill .sflip-body { flex: 1 1 auto; }
.sflip--fs .sflip-stage, .sflip--fill .sflip-stage { height: auto !important; }
.sflip--pseudo-fs { position: fixed !important; inset: 0; z-index: 999999; height: 100dvh; }
.sflip--fill .sflip-tb-title { display: block; }
html.sflip-noscroll, html.sflip-noscroll body { overflow: hidden !important; }

.sflip-lightbox {
	position: fixed; inset: 0;
	z-index: 999998;
	background: rgba(10, 10, 12, .82);
	display: flex; align-items: center; justify-content: center;
	padding: 2.5vh 2.5vw;
	opacity: 0;
	transition: opacity .2s ease;
}
.sflip-lightbox.is-open { opacity: 1; }
.sflip-lightbox-box { width: 100%; height: 100%; max-width: 1600px; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); border-radius: 10px; overflow: hidden; }
.sflip-lightbox-box > .sflip { height: 100%; }
@media (max-width: 700px) {
	.sflip-lightbox { padding: 0; }
	.sflip-lightbox-box { border-radius: 0; }
}

/* ---------- launchers ---------- */

.sflip-launch {
	font: inherit;
	cursor: pointer;
}
.sflip-launch--button {
	display: inline-flex; align-items: center; gap: 8px;
	padding: 12px 20px;
	border: 0; border-radius: 8px;
	background: #1a73e8; color: #fff;
	font-weight: 600;
	transition: filter .15s, transform .15s;
}
.sflip-launch--button:hover { filter: brightness(1.08); transform: translateY(-1px); }
.sflip-launch--thumb {
	display: block; width: 100%;
	padding: 0; border: 0; background: none; text-align: left; color: inherit;
}
.sflip-launch__cover {
	position: relative; display: block;
	background: #fff;
	border-radius: 4px; overflow: hidden;
	box-shadow: 0 2px 6px rgba(0, 0, 0, .15), 0 10px 26px rgba(0, 0, 0, .18);
	transition: transform .2s, box-shadow .2s;
	aspect-ratio: 1 / 1.414;
}
.sflip-launch__cover img, .sflip-launch__cover canvas { display: block; width: 100%; height: 100%; object-fit: cover; }
.sflip-launch__auto { display: block; width: 100%; height: 100%; }
.sflip-launch__open {
	position: absolute; inset: 0;
	display: flex; align-items: center; justify-content: center;
	background: rgba(0, 0, 0, .35); color: #fff;
	opacity: 0; transition: opacity .2s;
}
.sflip-launch--thumb:hover .sflip-launch__cover, .sflip-launch--thumb:focus-visible .sflip-launch__cover { transform: translateY(-3px); box-shadow: 0 4px 10px rgba(0, 0, 0, .18), 0 16px 36px rgba(0, 0, 0, .22); }
.sflip-launch--thumb:hover .sflip-launch__open, .sflip-launch--thumb:focus-visible .sflip-launch__open { opacity: 1; }
.sflip-launch__title { display: block; margin-top: 10px; font-weight: 600; }

/* ---------- small screens ---------- */

@media (max-width: 600px) {
	.sflip-toolbar { padding: 4px; justify-content: center; }
	.sflip-btn { min-width: 34px; height: 34px; padding: 0 4px; }
	.sflip-zoom-label { min-width: 46px; }
	.sflip-arrow { width: 34px; height: 52px; }
	.sflip-thumbs { position: absolute; top: 0; bottom: 0; left: 0; z-index: 6; box-shadow: 4px 0 16px rgba(0, 0, 0, .3); background: rgba(40, 40, 40, .96); }
	.sflip--thumbs .sflip-arrow--prev { left: 8px; }
}

@keyframes sflip-spin { to { transform: rotate(360deg); } }
@keyframes sflip-shimmer { to { background-position: -300% 0; } }
@keyframes sflip-fade { from { opacity: .3; } to { opacity: 1; } }
@keyframes sflip-shade { 0% { opacity: 0; } 50% { opacity: 1; } 100% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
	.sflip-stage, .sflip-book.is-shifting { transition: none; }
}
