/* ---------- Grid ----------
 * Selectors are scoped under .jtpdf so theme rules for lists and buttons
 * (e.g. BeTheme's ".button-default button", ".column_attr ul") don't win.
 */
.jtpdf ul.jtpdf-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 28px;
	list-style: none;
	margin: 0;
	padding: 0;
}
.jtpdf .jtpdf-grid > li {
	list-style: none;
	margin: 0;
	padding: 0;
	background: none;
}
.jtpdf .jtpdf-grid > li::before { content: none; display: none; }
.jtpdf .jtpdf-grid > li::marker { content: ""; }

@media (max-width: 900px) {
	.jtpdf ul.jtpdf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
}
@media (max-width: 560px) {
	.jtpdf ul.jtpdf-grid { grid-template-columns: 1fr; gap: 20px; }
}

.jtpdf .jtpdf-grid button.jtpdf-card,
.jtpdf .jtpdf-grid button.jtpdf-card:hover,
.jtpdf .jtpdf-grid button.jtpdf-card:focus,
.jtpdf .jtpdf-grid button.jtpdf-card:active {
	box-sizing: border-box;
	display: block;
	width: 100%;
	height: auto;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 12px;
	background: none;
	box-shadow: none;
	color: inherit;
	font: inherit;
	line-height: normal;
	text-transform: none;
	letter-spacing: normal;
	cursor: pointer;
}
.jtpdf .jtpdf-grid button.jtpdf-card { transition: transform .3s ease; }
.jtpdf .jtpdf-grid button.jtpdf-card:hover { transform: translateY(-4px); }
.jtpdf .jtpdf-grid button.jtpdf-card:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; }

/* Portrait, the shape of a letter-size magazine cover (8.5 × 11). */
.jtpdf .jtpdf-card__media {
	display: block;
	aspect-ratio: 17 / 22;
	overflow: hidden;
	border-radius: 12px;
	background: rgba(0, 0, 0, .05);
	box-shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 8px 24px rgba(0, 0, 0, .06);
}
.jtpdf .jtpdf-card__media img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	object-fit: cover;
	border-radius: 12px;
	transition: transform .4s ease;
}
.jtpdf .jtpdf-grid button.jtpdf-card:hover .jtpdf-card__media img { transform: scale(1.04); }

/* Layout only; :where() keeps the look at zero specificity so the theme's
   own button style wins when it has one. */
.jtpdf .jtpdf-more {
	display: block;
	margin: 32px auto 0;
}
:where(.jtpdf-more) {
	padding: 12px 28px;
	border: 1px solid currentColor;
	border-radius: 999px;
	background: transparent;
	color: inherit;
	font: inherit;
	cursor: pointer;
}
.jtpdf .jtpdf-more[disabled] { opacity: .5; cursor: progress; }

@media (prefers-reduced-motion: reduce) {
	.jtpdf .jtpdf-grid button.jtpdf-card,
	.jtpdf .jtpdf-card__media img { transition: none; }
	.jtpdf .jtpdf-grid button.jtpdf-card:hover,
	.jtpdf .jtpdf-grid button.jtpdf-card:hover .jtpdf-card__media img { transform: none; }
}

/* ---------- Modal ---------- */
html.jtpdf-lock,
html.jtpdf-lock body { overflow: hidden; }

.jtpdf-modal {
	position: fixed;
	inset: 0;
	z-index: 99999;
}
.jtpdf-modal[hidden] { display: none; }

.jtpdf-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, .6);
	opacity: 0;
	transition: opacity .22s ease;
}
.jtpdf-modal.is-open .jtpdf-modal__backdrop {
	opacity: 1;
	transition-duration: .35s;
}

.jtpdf-modal__panel {
	position: absolute;
	left: 50%;
	bottom: 0;
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	width: min(1200px, 100%);
	height: 94vh;
	height: 94dvh;
	overflow: hidden;
	border-radius: 16px 16px 0 0;
	background: #fff;
	color: #1a1a1a;
	box-shadow: 0 -8px 40px rgba(0, 0, 0, .25);
	transform: translate(-50%, 100%);
	transition: transform .22s cubic-bezier(.4, 0, 1, 1);
}
.jtpdf-modal.is-open .jtpdf-modal__panel {
	transform: translate(-50%, 0);
	transition: transform .35s cubic-bezier(.22, 1, .36, 1);
}

.jtpdf-modal__header {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 16px 14px 24px;
	border-bottom: 1px solid #ececec;
	flex: none;
}
.jtpdf-modal .jtpdf-modal__title {
	flex: 1;
	min-width: 0;
	margin: 0;
	padding: 0;
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.3;
	letter-spacing: normal; /* themes often tighten h2s (BeTheme: -2px) */
	text-transform: none;
	color: inherit;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.jtpdf-modal .jtpdf-modal__download {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 9px 16px;
	border-radius: 999px;
	background: #f2f2f3;
	color: #1a1a1a;
	font-size: .875rem;
	font-weight: 600;
	line-height: 1;
	text-decoration: none;
	transition: background .2s ease;
}
.jtpdf-modal .jtpdf-modal__download:hover { background: #e6e6e8; color: #1a1a1a; }
.jtpdf-modal button.jtpdf-modal__close,
.jtpdf-modal button.jtpdf-modal__close:focus,
.jtpdf-modal button.jtpdf-modal__close:active {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: none;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	box-shadow: none;
	min-height: 0;
	color: #1a1a1a;
	cursor: pointer;
	transition: background .2s ease;
}
.jtpdf-modal button.jtpdf-modal__close:hover { background: #f2f2f3; }
.jtpdf-modal__download:focus-visible,
.jtpdf-modal__close:focus-visible { outline: 2px solid #1a1a1a; outline-offset: 2px; }

.jtpdf-modal__body {
	flex: 1;
	overflow: auto;
	overscroll-behavior: contain;
	background: #f4f4f5;
	padding: 24px;
}

@media (max-width: 560px) {
	.jtpdf-modal__panel { border-radius: 12px 12px 0 0; }
	.jtpdf-modal__header { padding: 10px 8px 10px 16px; }
	.jtpdf-modal .jtpdf-modal__download span { display: none; }
	.jtpdf-modal .jtpdf-modal__download { padding: 11px; }
	.jtpdf-modal__body { padding: 12px; }
}

@media (prefers-reduced-motion: reduce) {
	.jtpdf-modal__panel,
	.jtpdf-modal.is-open .jtpdf-modal__panel {
		transform: translate(-50%, 0);
		opacity: 0;
		transition: opacity .2s ease;
	}
	.jtpdf-modal.is-open .jtpdf-modal__panel { opacity: 1; }
}

/* ---------- Viewer ---------- */
.jtpdf-viewer { max-width: 960px; margin: 0 auto; }
.jtpdf-viewer__page {
	width: 100%;
	max-width: 100%;
	margin: 0 auto 16px;
	background: #fff;
	box-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 4px 16px rgba(0, 0, 0, .04);
}
.jtpdf-viewer__page canvas { display: block; width: 100%; height: auto; }

.jtpdf-viewer__loading {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 100%;
	min-height: 200px;
}
.jtpdf-viewer__spinner {
	width: 32px;
	height: 32px;
	border: 3px solid rgba(0, 0, 0, .12);
	border-top-color: #1a1a1a;
	border-radius: 50%;
	animation: jtpdf-spin .8s linear infinite;
}
@keyframes jtpdf-spin { to { transform: rotate(360deg); } }

.jtpdf-viewer__sr {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

.jtpdf-viewer__error {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 16px;
	height: 100%;
	min-height: 200px;
	text-align: center;
}
.jtpdf-viewer__error p { margin: 0; }
.jtpdf-viewer__error a {
	padding: 10px 20px;
	border-radius: 999px;
	background: #1a1a1a;
	color: #fff;
	font-weight: 600;
	text-decoration: none;
}

@media (prefers-reduced-motion: reduce) {
	.jtpdf-viewer__spinner { animation-duration: 2s; }
}

.jtpdf-modal__body:focus { outline: none; }
.jtpdf-modal__body:focus-visible { outline: 2px solid #1a1a1a; outline-offset: -2px; }
