/*
 * PDF Scroll Embedder - estilos del visor.
 */

.pse-embed {
	--pse-bg: #eef1f5;
	--pse-surface: #ffffff;
	--pse-text: #1d2327;
	--pse-muted: #646970;
	--pse-border: #dcdcde;
	--pse-accent: #2271b1;
	--pse-hover: rgba(0, 0, 0, 0.06);
	--pse-page-shadow: 0 1px 3px rgba(16, 24, 40, 0.12), 0 10px 28px rgba(16, 24, 40, 0.14);
	--pse-scroll-thumb: rgba(29, 35, 39, 0.28);
	--pse-skeleton-a: #f7f8f9;
	--pse-skeleton-b: #eceff2;
	position: relative;
	box-sizing: border-box;
	margin: 1.5rem 0;
	border: 1px solid var(--pse-border);
	border-radius: 10px;
	background: var(--pse-bg);
	color: var(--pse-text);
	overflow: hidden;
	font-size: 14px;
	line-height: 1.4;
}

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

.pse-embed [hidden] {
	display: none !important;
}

.pse-theme-dark {
	--pse-bg: #12171d;
	--pse-surface: #1c232b;
	--pse-text: #f0f2f4;
	--pse-muted: #a7b0ba;
	--pse-border: #333c46;
	--pse-accent: #72aee6;
	--pse-hover: rgba(255, 255, 255, 0.08);
	--pse-page-shadow: 0 2px 6px rgba(0, 0, 0, 0.4), 0 18px 44px rgba(0, 0, 0, 0.5);
	--pse-scroll-thumb: rgba(240, 242, 244, 0.3);
}

@media (prefers-color-scheme: dark) {
	.pse-theme-auto {
		--pse-bg: #12171d;
		--pse-surface: #1c232b;
		--pse-text: #f0f2f4;
		--pse-muted: #a7b0ba;
		--pse-border: #333c46;
		--pse-accent: #72aee6;
		--pse-hover: rgba(255, 255, 255, 0.08);
		--pse-page-shadow: 0 2px 6px rgba(0, 0, 0, 0.4), 0 18px 44px rgba(0, 0, 0, 0.5);
		--pse-scroll-thumb: rgba(240, 242, 244, 0.3);
	}
}

/* Barra de herramientas */

.pse-toolbar {
	position: relative;
	z-index: 2;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 7px 10px;
	border-bottom: 1px solid var(--pse-border);
	background: var(--pse-surface);
	color: var(--pse-text);
}

.pse-toolbar-group {
	display: flex;
	align-items: center;
	gap: 2px;
}

.pse-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	padding: 0;
	border: 0;
	border-radius: 6px;
	background: transparent;
	color: inherit;
	font: inherit;
	line-height: 1;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}

.pse-btn:hover {
	background: var(--pse-hover);
}

.pse-btn:focus-visible {
	outline: 2px solid var(--pse-accent);
	outline-offset: 1px;
}

.pse-btn[disabled],
.pse-btn[disabled]:hover {
	background: transparent;
	opacity: 0.35;
	cursor: default;
}

.pse-btn svg {
	display: block;
	width: 19px;
	height: 19px;
	pointer-events: none;
}

.pse-page-indicator {
	display: inline-flex;
	align-items: baseline;
	gap: 4px;
	min-width: 52px;
	padding: 0 6px;
	font-size: 13px;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
	user-select: none;
}

.pse-page-sep {
	color: var(--pse-muted);
}

.pse-zoom-level {
	min-width: 44px;
	padding: 0 2px;
	color: var(--pse-muted);
	font-size: 12px;
	font-variant-numeric: tabular-nums;
	text-align: center;
	user-select: none;
}

/* Área de páginas */

.pse-viewport {
	position: relative;
	height: var(--pse-height, 800px);
	overflow: auto;
	background: var(--pse-bg);
	scrollbar-width: thin;
	scrollbar-color: var(--pse-scroll-thumb) transparent;
}

.pse-viewport:focus-visible {
	outline: 2px solid var(--pse-accent);
	outline-offset: -3px;
}

.pse-viewport::-webkit-scrollbar {
	width: 12px;
	height: 12px;
}

.pse-viewport::-webkit-scrollbar-track {
	background: transparent;
}

.pse-viewport::-webkit-scrollbar-thumb {
	background: var(--pse-scroll-thumb);
	border: 3px solid transparent;
	border-radius: 999px;
	background-clip: padding-box;
}

.pse-pages {
	position: relative;
	display: block;
	width: max-content;
	min-width: 100%;
	padding: 16px;
}

.pse-page {
	position: relative;
	width: 100%;
	min-height: 120px;
	margin: 0 auto 16px;
	overflow: hidden;
	background: #ffffff;
	box-shadow: var(--pse-page-shadow);
	aspect-ratio: var(--pse-aspect, 0.7071);
}

.pse-page:last-child {
	margin-bottom: 0;
}

.pse-page::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 0;
	background-color: var(--pse-skeleton-a);
	background-image: linear-gradient(100deg, var(--pse-skeleton-a) 30%, var(--pse-skeleton-b) 50%, var(--pse-skeleton-a) 70%);
	background-size: 200% 100%;
	animation: pse-shimmer 1.4s linear infinite;
}

.pse-page.is-rendered::after {
	content: none;
}

.pse-canvas {
	position: absolute;
	inset: 0;
	z-index: 1;
	display: block;
	width: 100%;
	height: 100%;
	opacity: 0;
	transition: opacity 0.2s ease;
}

.pse-page.is-rendered .pse-canvas {
	opacity: 1;
}

/* Carga */

.pse-loading {
	position: absolute;
	inset: 0;
	z-index: 3;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	background: var(--pse-bg);
	color: var(--pse-muted);
	font-size: 13px;
}

.pse-spinner {
	width: 30px;
	height: 30px;
	border: 3px solid var(--pse-border);
	border-top-color: var(--pse-accent);
	border-radius: 50%;
	animation: pse-spin 0.8s linear infinite;
}

/* Error y fallback nativo */

.pse-error {
	padding: 9px 14px;
	border-bottom: 1px solid #f0c8c8;
	background: #fcf0f1;
	color: #8a1f11;
	font-size: 13px;
}

.pse-error a,
.pse-fallback-link {
	color: inherit;
	font-weight: 600;
	text-decoration: underline;
}

.pse-viewport.is-fallback {
	overflow: hidden;
}

.pse-pages.pse-fallback {
	width: 100%;
	min-width: 0;
	height: 100%;
	padding: 0;
}

.pse-native-frame {
	display: block;
	width: 100%;
	height: 100%;
	border: 0;
	background: #ffffff;
}

.pse-embed noscript {
	display: block;
	height: 100%;
}

.pse-is-fallback .pse-toolbar {
	display: none;
}

/* Pantalla completa */

.pse-embed:fullscreen,
.pse-embed:-webkit-full-screen {
	display: flex;
	flex-direction: column;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	border: 0;
	border-radius: 0;
}

.pse-embed:fullscreen .pse-viewport,
.pse-embed:-webkit-full-screen .pse-viewport {
	flex: 1 1 auto;
	height: auto;
	min-height: 0;
}

/* Utilidades */

.pse-sr-only {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Móvil */

@media (max-width: 600px) {
	.pse-viewport {
		height: min(var(--pse-height, 800px), 72vh);
	}

	.pse-toolbar {
		gap: 4px;
		padding: 6px 8px;
	}

	.pse-zoom-level {
		display: none;
	}

	.pse-pages {
		padding: 10px;
	}

	.pse-page {
		margin-bottom: 10px;
	}
}

/* Animaciones */

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

@keyframes pse-shimmer {
	from {
		background-position: 200% 0;
	}

	to {
		background-position: -200% 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.pse-page::after,
	.pse-spinner {
		animation: none;
	}

	.pse-canvas {
		transition: none;
	}
}
