/* Štefova Klet – PDF Flipbook */

.sfb-wrap {
	--sfb-bg: #e8e2dd;
	--sfb-accent: #b5762f;
	--sfb-page-bg: #ffffff;
	--sfb-max: 1100px;
	--sfb-ink: #3a332e;

	position: relative;
	width: 100%;
	max-width: var(--sfb-max);
	margin: 0 auto;
	padding: clamp(16px, 3vw, 40px) clamp(12px, 4vw, 56px);
	box-sizing: border-box;
	background: var(--sfb-bg);
	outline: none;
}

.sfb-wrap:focus-visible {
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--sfb-accent) 55%, transparent);
}

.sfb-title {
	margin: 0 0 clamp(12px, 2vw, 24px);
	text-align: center;
	font-size: clamp(1rem, 1.6vw, 1.35rem);
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--sfb-ink);
	opacity: 0.75;
}

/* --- pozornica --- */

.sfb-stage {
	position: relative;
	min-height: 220px;
}

.sfb-book {
	margin: 0 auto;
	touch-action: pan-y;
}

.sfb-wrap:not(.is-loaded) .sfb-book {
	opacity: 0;
}

.sfb-book {
	opacity: 1;
	transition: opacity 0.4s ease;
}

.sfb-page {
	background: var(--sfb-page-bg);
	overflow: hidden;
	box-sizing: border-box;
}

.sfb-page-inner {
	position: absolute;
	inset: 0;
	background: var(--sfb-page-bg);
	background-image: linear-gradient(
		100deg,
		transparent 20%,
		rgba(0, 0, 0, 0.035) 40%,
		transparent 60%
	);
	background-size: 220% 100%;
	animation: sfb-shimmer 1.6s linear infinite;
}

.sfb-page.is-drawn .sfb-page-inner {
	animation: none;
	background-image: none;
}

@keyframes sfb-shimmer {
	from { background-position: 140% 0; }
	to { background-position: -40% 0; }
}

.sfb-canvas {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
}

/* --- strelice --- */

.sfb-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 5;
	display: grid;
	place-items: center;
	width: clamp(34px, 4vw, 46px);
	height: clamp(34px, 4vw, 46px);
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #fff;
	color: var(--sfb-ink);
	box-shadow: 0 2px 14px rgba(0, 0, 0, 0.16);
	cursor: pointer;
	opacity: 0;
	transition: opacity 0.25s ease, transform 0.25s ease, background 0.2s ease;
}

.sfb-wrap.is-loaded .sfb-nav { opacity: 0.85; }
.sfb-wrap.is-loaded .sfb-nav-bar { opacity: 1; }
.sfb-nav:hover { background: var(--sfb-accent); color: #fff; opacity: 1; }
.sfb-nav:focus-visible { outline: 2px solid var(--sfb-accent); outline-offset: 3px; opacity: 1; }
.sfb-nav-prev { left: clamp(-6px, 0.5vw, 8px); }
.sfb-nav-next { right: clamp(-6px, 0.5vw, 8px); }

.sfb-nav svg {
	fill: none;
	stroke: currentColor;
	stroke-width: 2.2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.sfb-nav-side svg {
	width: 42%;
	height: 42%;
}

/* --- traka sa strelicama ispod albuma --- */

.sfb-navbar {
	display: none;
	align-items: center;
	justify-content: center;
	gap: 10px;
	margin-top: clamp(12px, 2vw, 20px);
}

.sfb-nav-bar {
	position: static;
	transform: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: auto;
	height: auto;
	min-width: 116px;
	min-height: 44px;
	padding: 10px 20px;
	border-radius: 999px;
	background: var(--sfb-accent);
	color: #fff;
	font-size: 0.86rem;
	font-weight: 500;
	letter-spacing: 0.04em;
	box-shadow: none;
	opacity: 1;
}

.sfb-navbar .sfb-nav-bar:hover,
.sfb-navbar .sfb-nav-bar:focus-visible {
	background: color-mix(in srgb, var(--sfb-accent) 82%, #000);
	color: #fff;
	opacity: 1;
}

.sfb-nav-bar:disabled {
	background: color-mix(in srgb, var(--sfb-accent) 25%, transparent);
	cursor: default;
}

.sfb-nav-bar svg {
	width: 16px;
	height: 16px;
	flex: none;
}

.sfb-counter-bar {
	min-width: 6.5em;
	text-align: center;
}

/* --- gdje se strelice prikazuju --- */

/* Sa strane, a na mobitelu ispod albuma (zadano). */
@media (max-width: 782px) {
	.sfb-navpos-sides .sfb-nav-side { display: none; }
	.sfb-navpos-sides .sfb-navbar { display: flex; }
	.sfb-navpos-sides .sfb-toolbar .sfb-counter { display: none; }
}

/* Uvijek ispod albuma. */
.sfb-navpos-below .sfb-nav-side { display: none; }
.sfb-navpos-below .sfb-navbar { display: flex; }
.sfb-navpos-below .sfb-toolbar .sfb-counter { display: none; }

/* Samo sa strane, na mobitelu bez strelica. */
.sfb-navpos-sides-only .sfb-navbar { display: none; }

/* --- učitavanje --- */

.sfb-loader {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 14px;
	min-height: 220px;
	text-align: center;
	color: var(--sfb-ink);
	font-size: 0.9rem;
	transition: opacity 0.3s ease;
}

.sfb-wrap.is-loaded .sfb-loader {
	opacity: 0;
	pointer-events: none;
	visibility: hidden;
}

.sfb-spinner {
	width: 30px;
	height: 30px;
	border: 2px solid color-mix(in srgb, var(--sfb-accent) 25%, transparent);
	border-top-color: var(--sfb-accent);
	border-radius: 50%;
	animation: sfb-spin 0.9s linear infinite;
}

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

.sfb-progress {
	display: block;
	width: min(220px, 60%);
	height: 2px;
	background: rgba(0, 0, 0, 0.12);
	overflow: hidden;
}

.sfb-progress i {
	display: block;
	width: 0;
	height: 100%;
	background: var(--sfb-accent);
	transition: width 0.25s ease;
}

.sfb-wrap.is-error .sfb-loader { color: #8a3b2f; }
.sfb-wrap.is-error .sfb-progress { display: none; }

/* --- traka s alatima --- */

.sfb-toolbar {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-wrap: wrap;
	gap: 10px 22px;
	margin-top: clamp(14px, 2vw, 24px);
}

.sfb-counter {
	font-size: 0.82rem;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--sfb-ink);
	opacity: 0.7;
	font-variant-numeric: tabular-nums;
}

.sfb-tools {
	display: inline-flex;
	gap: 8px;
}

.sfb-btn {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 7px 14px;
	border: 1px solid color-mix(in srgb, var(--sfb-accent) 35%, transparent);
	border-radius: 999px;
	background: transparent;
	color: var(--sfb-ink);
	font-size: 0.78rem;
	letter-spacing: 0.06em;
	text-decoration: none;
	cursor: pointer;
	transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.sfb-btn:hover,
.sfb-btn:focus-visible {
	background: var(--sfb-accent);
	border-color: var(--sfb-accent);
	color: #fff;
}

.sfb-btn svg {
	width: 15px;
	height: 15px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/* --- cijeli zaslon --- */

.sfb-wrap.is-fullscreen {
	max-width: none;
	height: 100%;
	display: flex;
	flex-direction: column;
	justify-content: center;
	padding: 24px clamp(12px, 5vw, 70px);
}

.sfb-wrap.is-fullscreen .sfb-stage {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
}

/* --- mobitel --- */

@media (max-width: 600px) {
	.sfb-wrap { padding: 14px 10px; }
	.sfb-btn span { display: none; }
	.sfb-btn { padding: 8px 10px; }
	.sfb-navpos-sides-only .sfb-nav-side { display: none; }
	.sfb-nav-bar { min-width: 96px; padding: 10px 16px; }
	.sfb-navbar { gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
	.sfb-page-inner { animation: none; }
	.sfb-spinner { animation-duration: 2s; }
}
