/* =========================================================
   Audhighasu — PDF flipbook modal (Research Folio)
   Author  : Edi Suherlan | audhighasu.com
   ========================================================= */
body.ah-pdf-open {
	overflow: hidden !important;
}

.ah-pdf-modal[hidden] {
	display: none !important;
}

.ah-pdf-modal {
	position: fixed !important;
	inset: 0 !important;
	z-index: 10000 !important;
	display: flex !important;
	align-items: center;
	justify-content: center;
	padding: 0.35rem;
	box-sizing: border-box;
}

.ah-pdf-modal__backdrop {
	position: absolute;
	inset: 0;
	background:
		radial-gradient(circle at 14% 18%, rgba(232, 93, 4, 0.35), transparent 42%),
		radial-gradient(circle at 88% 78%, rgba(244, 140, 6, 0.28), transparent 46%),
		rgba(28, 25, 23, 0.78);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
}

.ah-pdf-modal__dialog {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	width: min(96vw, 1480px);
	height: min(96vh, 100%);
	border-radius: 10px;
	overflow: hidden;
	background:
		radial-gradient(420px 220px at 100% 0%, rgba(255, 237, 213, 0.22), transparent 55%),
		radial-gradient(360px 200px at 0% 100%, rgba(232, 93, 4, 0.18), transparent 50%),
		linear-gradient(165deg, #1C1917 0%, #292524 42%, #431407 100%);
	border: 1px solid rgba(232, 93, 4, 0.35);
	box-shadow:
		0 28px 70px rgba(28, 25, 23, 0.5),
		0 0 0 1px rgba(255, 255, 255, 0.06),
		inset 0 1px 0 rgba(255, 255, 255, 0.08);
	animation: ahPdfPop 0.34s cubic-bezier(0.2, 0.9, 0.25, 1);
}

.ah-pdf-modal__header,
.ah-pdf-modal__toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	padding: 0.85rem 1.05rem;
	background: rgba(28, 25, 23, 0.55);
	border-bottom: 1px solid rgba(232, 93, 4, 0.22);
}

.ah-pdf-modal__toolbar {
	border-bottom: 0;
	border-top: 1px solid rgba(232, 93, 4, 0.22);
	justify-content: center;
}

.ah-pdf-modal__heading {
	display: flex;
	align-items: center;
	gap: 0.65rem;
	min-width: 0;
}

.ah-pdf-modal__badge {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.3rem;
	min-width: 2.5rem;
	padding: 0.28rem 0.7rem;
	border-radius: 3px;
	background: linear-gradient(135deg, #E85D04, #F48C06);
	color: #fff;
	font-size: 0.72rem;
	font-weight: 800;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	box-shadow: 0 6px 16px rgba(232, 93, 4, 0.4);
}

.ah-pdf-modal__badge-mark {
	display: inline-block;
	width: 8px;
	height: 8px;
	border-radius: 1px;
	background: rgba(255, 255, 255, 0.9);
	box-shadow: 2px 2px 0 rgba(28, 25, 23, 0.25);
}

.ah-pdf-modal__title {
	margin: 0;
	color: #FFF7ED;
	font-family: var(--ah-display, "Libre Baskerville", Georgia, serif);
	font-size: clamp(0.95rem, 2.4vw, 1.15rem);
	font-weight: 700;
	line-height: 1.25;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.ah-pdf-modal__actions {
	display: flex;
	align-items: center;
	gap: 0.45rem;
	flex: 0 0 auto;
}

.ah-pdf-modal__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 40px;
	padding: 0.4rem 0.95rem;
	border: 1px solid rgba(255, 237, 213, 0.22);
	border-radius: 3px;
	background: rgba(255, 255, 255, 0.1);
	color: rgba(255, 247, 237, 0.96);
	font-family: var(--ah-font, "Source Sans 3", system-ui, sans-serif);
	font-size: 0.88rem;
	font-weight: 800;
	text-decoration: none !important;
	cursor: pointer;
	transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.ah-pdf-modal__btn:hover,
.ah-pdf-modal__btn:focus {
	background: rgba(232, 93, 4, 0.35);
	border-color: rgba(244, 140, 6, 0.7);
	color: #FFEDD5;
	outline: none;
	transform: translateY(-1px);
}

.ah-pdf-modal__btn--ghost {
	background: transparent;
}

.ah-pdf-modal__btn--solid {
	background: linear-gradient(135deg, #E85D04, #F48C06);
	border-color: transparent;
	color: #fff;
	box-shadow: 0 8px 18px rgba(232, 93, 4, 0.35);
}

.ah-pdf-modal__btn--solid:hover,
.ah-pdf-modal__btn--solid:focus {
	background: #C2410C;
	color: #fff;
}

.ah-pdf-modal__btn--icon {
	width: 42px;
	padding: 0;
	font-size: 1.45rem;
	line-height: 1;
}

.ah-pdf-modal__stage {
	position: relative;
	flex: 1 1 auto;
	min-height: 0;
	display: block;
	padding: 0;
	overflow: auto;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior: contain;
	background:
		radial-gradient(ellipse at center, rgba(255, 247, 237, 0.08), transparent 58%),
		linear-gradient(180deg, rgba(255, 237, 213, 0.06), rgba(28, 25, 23, 0.35));
}

.ah-pdf-modal__stage::before,
.ah-pdf-modal__stage::after {
	content: "";
	position: absolute;
	pointer-events: none;
	opacity: 0.4;
}

.ah-pdf-modal__stage::before {
	top: 10%;
	right: 7%;
	width: 36px;
	height: 36px;
	border: 2px solid rgba(232, 93, 4, 0.55);
	border-right: 0;
	border-bottom: 0;
}

.ah-pdf-modal__stage::after {
	bottom: 12%;
	left: 6%;
	width: 28px;
	height: 28px;
	border: 2px solid rgba(244, 140, 6, 0.5);
	border-left: 0;
	border-top: 0;
}

.ah-pdf-modal__book-wrap {
	position: relative;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	min-width: 100%;
	min-height: 100%;
	width: max-content;
	height: max-content;
	margin: 0 auto;
	padding: 0.75rem;
	perspective: 1800px;
}

.ah-pdf-modal__book {
	margin: 0 auto;
	box-shadow: 0 18px 50px rgba(28, 25, 23, 0.4);
	min-height: 200px;
	border-radius: 3px;
}

.ah-pdf-modal__book .stf__parent,
.ah-pdf-modal__book .stf__wrapper,
.ah-pdf-modal__book .stf__block {
	margin: 0 auto;
}

.ah-pdf-modal__book .stf__block {
	box-shadow: 0 12px 40px rgba(28, 25, 23, 0.32);
}

.ah-pdf-modal__book .stf__item {
	overflow: hidden !important;
	background: #ffffff;
	background-size: contain !important;
	background-repeat: no-repeat !important;
	background-position: center center !important;
}

.ah-pdf-modal__book .stf__item img,
.ah-pdf-modal__book img {
	display: block;
	width: 100% !important;
	height: 100% !important;
	max-height: 100%;
	object-fit: contain !important;
	object-position: center center !important;
	background: #fff;
}

.ah-pdf-modal__loading,
.ah-pdf-modal__error {
	position: absolute;
	inset: 0;
	z-index: 2;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.85rem;
	padding: 1.5rem;
	text-align: center;
	color: rgba(255, 247, 237, 0.95);
	background: rgba(28, 25, 23, 0.82);
}

.ah-pdf-modal__loading[hidden],
.ah-pdf-modal__error[hidden] {
	display: none !important;
}

.ah-pdf-modal__loading p,
.ah-pdf-modal__error p {
	margin: 0;
	font-size: 0.98rem;
	font-weight: 700;
}

.ah-pdf-modal__spinner {
	width: 46px;
	height: 46px;
	border-radius: 50%;
	border: 3px solid rgba(255, 247, 237, 0.18);
	border-top-color: #E85D04;
	border-right-color: #F48C06;
	animation: ahPdfSpin 0.85s linear infinite;
}

.ah-pdf-modal__pager {
	margin: 0 1rem;
	min-width: 5.5rem;
	padding: 0.35rem 0.85rem;
	border-radius: 3px;
	background: rgba(232, 93, 4, 0.18);
	border: 1px solid rgba(232, 93, 4, 0.28);
	text-align: center;
	color: rgba(255, 247, 237, 0.95);
	font-weight: 800;
	font-variant-numeric: tabular-nums;
}

@keyframes ahPdfPop {
	from { opacity: 0; transform: translateY(16px) scale(0.97); }
	to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes ahPdfSpin {
	to { transform: rotate(360deg); }
}

@media (max-width: 767px) {
	.ah-pdf-modal {
		padding: 0;
	}

	.ah-pdf-modal__dialog {
		width: 100%;
		height: 100%;
		border-radius: 0;
	}

	.ah-pdf-modal__title {
		max-width: 42vw;
	}

	.ah-pdf-modal__stage {
		padding: 0.4rem;
	}

	.ah-pdf-modal__stage::before,
	.ah-pdf-modal__stage::after {
		display: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ah-pdf-modal__dialog,
	.ah-pdf-modal__spinner {
		animation: none !important;
	}
}
