/* PDF embed — desktop PDF.js viewer; mobile cover + folder label */

.pdf-embed {
	box-sizing: border-box;
	width: 100%;
	max-width: 1400px;
	margin: 0 auto;
	padding: 96px var(--site-gutter-x) 24px;
	font-family: var(--body-font);
	font-weight: var(--body-weight);
	font-size: var(--body-size);
	line-height: var(--body-line-height);
	color: #000;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

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

.pdf-embed__desktop {
	display: block;
	opacity: 0;
	transition: opacity 0.28s ease;
}

.pdf-embed--booted .pdf-embed__desktop {
	opacity: 1;
}

.pdf-embed--booting .pdf-embed__desktop {
	display: none;
}

.pdf-embed__boot {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: calc(100dvh - 120px);
	font-family: var(--body-font);
	font-size: var(--body-size);
	font-style: italic;
	color: #666;
}

.pdf-embed--booted .pdf-embed__boot {
	display: none;
}

.pdf-embed__mobile {
	display: none;
	text-align: center;
}

.pdf-embed__viewer {
	/* Header clearance only — footer is hidden on pdf-embed-page */
	--pdf-viewer-h: calc(100dvh - 120px);
	display: flex;
	flex-direction: column;
	gap: 10px;
	outline: none;
	height: var(--pdf-viewer-h);
	min-height: 420px;
}

.pdf-embed__toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 0.4rem 0.85rem;
	font-family: var(--body-font);
	font-size: 12px;
	font-weight: var(--body-weight);
	color: #000;
}

.pdf-embed__toolbar-group {
	display: inline-flex;
	align-items: center;
	gap: 4px;
}

.pdf-embed__btn {
	appearance: none;
	box-sizing: border-box;
	padding: 0;
	border: 1px solid #ccc;
	background: transparent;
	color: #000;
	font-family: var(--body-font);
	font-size: 12px;
	font-weight: var(--body-weight);
	line-height: 1;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	min-width: 32px;
	flex-shrink: 0;
	transition: color 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}

.pdf-embed__icon {
	width: 18px;
	height: 18px;
	display: block;
}

.pdf-embed__btn:hover:not(:disabled) {
	color: #ff0000;
	border-color: #ff0000;
}

.pdf-embed__btn[aria-pressed='true'],
.pdf-embed__btn.is-active {
	color: #fff;
	background: #ff0000;
	border-color: #ff0000;
}

.pdf-embed__btn[aria-pressed='true']:hover:not(:disabled),
.pdf-embed__btn.is-active:hover:not(:disabled) {
	color: #fff;
	background: #ff0000;
	border-color: #ff0000;
}

.pdf-embed__btn:disabled {
	opacity: 0.35;
	cursor: default;
}

.pdf-embed__page {
	min-width: 5.5em;
	text-align: center;
	font-variant-numeric: tabular-nums;
	font-size: 12px;
}

.pdf-embed__body {
	display: flex;
	flex: 1 1 auto;
	min-height: 0;
	gap: 0;
	border: 1px solid #e5e5e5;
	background: #fafafa;
	overflow: hidden;
}

.pdf-embed__thumbs {
	flex: 0 0 112px;
	width: 112px;
	border-right: 1px solid #e5e5e5;
	background: #fff;
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

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

.pdf-embed__thumbs-list {
	flex: 1 1 auto;
	overflow-x: hidden;
	overflow-y: auto;
	padding: 8px 8px 12px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior: contain;
}

.pdf-embed__thumb {
	appearance: none;
	display: block;
	width: 100%;
	padding: 0;
	margin: 0;
	border: 1px solid #ccc;
	background: #fff;
	cursor: pointer;
	text-align: center;
	color: #000;
	font-family: var(--body-font);
	font-size: 11px;
	font-weight: var(--body-weight);
	line-height: 1.2;
	transition: border-color 0.12s ease, color 0.12s ease;
}

.pdf-embed__thumb:hover {
	border-color: #ff0000;
	color: #ff0000;
}

.pdf-embed__thumb.is-active {
	border-color: #ff0000;
}

.pdf-embed__thumb-canvas {
	display: block;
	width: 100%;
	height: auto;
	background: #f5f5f5;
}

.pdf-embed__thumb-label {
	display: block;
	padding: 4px 2px 5px;
}

.pdf-embed__stage-wrap {
	position: relative;
	flex: 1 1 auto;
	min-width: 0;
	min-height: 0;
	overflow: auto;
	scrollbar-gutter: stable;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior: none;
	touch-action: pan-y;
}

.pdf-embed__loading {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	font-family: var(--body-font);
	font-size: var(--body-size);
	font-style: italic;
	color: #666;
	pointer-events: none;
	z-index: 1;
	background: #fafafa;
}

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

.pdf-embed__stage {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 16px;
	width: 100%;
	padding: 12px 12px 48px;
	min-height: 100%;
	box-sizing: border-box;
}

.pdf-embed__viewer.is-zoom-preview .pdf-embed__stage {
	will-change: transform;
}

.pdf-embed__viewer.is-zoom-preview .pdf-embed__stage-wrap {
	overflow: hidden;
}

.pdf-embed__slot {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	max-width: none;
	flex: 0 0 auto;
	box-sizing: border-box;
}

.pdf-embed__slot--spread {
	gap: 12px;
	flex-wrap: nowrap;
}

.pdf-embed__page-shell {
	position: relative;
	flex: 0 0 auto;
	background: #fff;
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
	overflow: hidden;
}

.pdf-embed__page-placeholder {
	position: absolute;
	inset: 0;
	background:
		linear-gradient(90deg, #f3f3f3 0%, #fafafa 45%, #f3f3f3 100%);
	background-size: 200% 100%;
	animation: pdf-embed-shimmer 1.4s ease-in-out infinite;
}

.pdf-embed__page-shell.is-ready .pdf-embed__page-placeholder {
	display: none;
}

.pdf-embed__canvas {
	position: relative;
	display: block;
	width: auto;
	height: auto;
	max-width: none;
	max-height: none;
	background: transparent;
	z-index: 1;
	image-rendering: auto;
}

@keyframes pdf-embed-shimmer {
	0% {
		background-position: 100% 0;
	}
	100% {
		background-position: -100% 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.pdf-embed__page-placeholder {
		animation: none;
		background: #f3f3f3;
	}
}

.pdf-embed__cover-link {
	display: inline-block;
	max-width: min(420px, 100%);
	text-decoration: none;
	color: inherit;
}

.pdf-embed__cover {
	display: block;
	width: 100%;
	height: auto;
	margin: 0 auto;
}

.pdf-embed__label {
	margin: 1.25rem 0 0;
	text-align: center;
}

.pdf-embed__link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.35em;
	font-family: var(--body-font);
	font-size: 14px;
	font-weight: var(--body-weight);
	color: #000;
	text-decoration: none;
}

.pdf-embed__link:hover {
	color: #ff0000;
}

.pdf-embed__link::before {
	content: '';
	display: inline-block;
	flex-shrink: 0;
	width: 14px;
	height: 11px;
	background: center / contain no-repeat
		url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 11'%3E%3Cpath d='M1 2.5V9.5C1 10.05 1.45 10.5 2 10.5H12C12.55 10.5 13 10.05 13 9.5V3.5C13 2.95 12.55 2.5 12 2.5H7.5L6 1H2C1.45 1 1 1.45 1 2V2.5Z' fill='none' stroke='%23000' stroke-width='0.9' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.pdf-embed__link:hover::before {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 11'%3E%3Cpath d='M1 2.5V9.5C1 10.05 1.45 10.5 2 10.5H12C12.55 10.5 13 10.05 13 9.5V3.5C13 2.95 12.55 2.5 12 2.5H7.5L6 1H2C1.45 1 1 1.45 1 2V2.5Z' fill='none' stroke='%23ff0000' stroke-width='0.9' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.pdf-embed__text {
	font-style: italic;
}

@media (max-width: 980px) {
	.pdf-embed {
		padding: 24px var(--site-gutter-x) 40px;
	}

	.pdf-embed__desktop {
		display: none;
	}

	.pdf-embed__mobile {
		display: block;
		padding: 12px 0 24px;
	}
}
