/* ==========================================================================
   PDF Card
   Todas as cores/raio saem de variáveis: pra tematizar, basta sobrescrever
   .pdfcard { --pdfcard-accent: #04df76 } no CSS do Elementor.
   ========================================================================== */

.pdfcard {
	--pdfcard-w: 420px;
	--pdfcard-accent: #111827;
	--pdfcard-accent-text: #ffffff;
	--pdfcard-bg: #ffffff;
	--pdfcard-border: rgba(17, 24, 39, 0.09);
	--pdfcard-ink: #111827;
	--pdfcard-muted: #6b7280;
	--pdfcard-radius: 18px;
	--pdfcard-shadow: 0 1px 2px rgba(17, 24, 39, 0.04), 0 12px 28px -12px rgba(17, 24, 39, 0.14);
	--pdfcard-shadow-hover: 0 2px 4px rgba(17, 24, 39, 0.05), 0 24px 46px -16px rgba(17, 24, 39, 0.22);

	display: flex;
	max-width: 100%;
}

.pdfcard--align-center { justify-content: center; }
.pdfcard--align-right  { justify-content: flex-end; }

.pdfcard__inner {
	width: 100%;
	max-width: var(--pdfcard-w);
	background: var(--pdfcard-bg);
	border: 1px solid var(--pdfcard-border);
	border-radius: var(--pdfcard-radius);
	box-shadow: var(--pdfcard-shadow);
	overflow: hidden;
	transition: transform .45s cubic-bezier(.2, .8, .25, 1), box-shadow .45s cubic-bezier(.2, .8, .25, 1);
}

.pdfcard__inner:hover {
	transform: translateY(-3px);
	box-shadow: var(--pdfcard-shadow-hover);
}

/* --- Pré-visualização ---------------------------------------------------
   Mostra o topo da primeira página (object-position: top) e desvanece na
   base: a página "continua" para dentro do card em vez de cortar seco.     */

.pdfcard__preview {
	position: relative;
	aspect-ratio: 16 / 10;
	background: #f4f5f7;
	overflow: hidden;
	display: flex;
	align-items: flex-start;
	justify-content: center;
}

.pdfcard__canvas {
	display: block;
	width: 100%;
	height: auto;
	opacity: 0;
	transition: opacity .5s ease, transform .6s cubic-bezier(.2, .8, .25, 1);
}

.pdfcard__canvas.is-ready { opacity: 1; }
.pdfcard__inner:hover .pdfcard__canvas.is-ready { transform: scale(1.02); }

.pdfcard__preview::after {
	content: "";
	position: absolute;
	inset: auto 0 0 0;
	height: 46%;
	background: linear-gradient(to bottom, rgba(255, 255, 255, 0), var(--pdfcard-bg) 92%);
	pointer-events: none;
}

/* Skeleton enquanto a primeira página é renderizada */
.pdfcard__skeleton {
	position: absolute;
	inset: 0;
	background: linear-gradient(100deg, #eef0f3 30%, #f7f8fa 50%, #eef0f3 70%);
	background-size: 220% 100%;
	animation: pdfcard-shimmer 1.4s linear infinite;
}

.pdfcard__skeleton.is-hidden { display: none; }

@keyframes pdfcard-shimmer {
	from { background-position: 180% 0; }
	to   { background-position: -80% 0; }
}

/* Fallback quando o PDF.js não consegue renderizar */
.pdfcard__fallback {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 8px;
	color: #9ca3af;
	font: 600 12px/1 system-ui, -apple-system, "Segoe UI", sans-serif;
	letter-spacing: .08em;
}

.pdfcard__fallback[hidden] { display: none; }

/* --- Corpo --------------------------------------------------------------- */

.pdfcard__body {
	position: relative;
	z-index: 1;
	padding: 4px 20px 20px;
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 16px;
}

.pdfcard__text { min-width: 0; }

.pdfcard__title {
	margin: 0 0 6px;
	font-size: clamp(15px, 1.1vw + 12px, 17px);
	font-weight: 600;
	line-height: 1.3;
	letter-spacing: -0.011em;
	color: var(--pdfcard-ink);
	overflow-wrap: anywhere;
}

.pdfcard__meta {
	margin: 0;
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 12.5px;
	line-height: 1;
	color: var(--pdfcard-muted);
}

.pdfcard__tag {
	font-weight: 600;
	font-size: 10.5px;
	letter-spacing: .07em;
	padding: 4px 7px;
	border-radius: 5px;
	background: rgba(17, 24, 39, 0.06);
	color: var(--pdfcard-ink);
}

.pdfcard__dot {
	width: 3px;
	height: 3px;
	border-radius: 50%;
	background: currentColor;
	opacity: .5;
	display: inline-block;
	margin-right: 8px;
}

.pdfcard__pages { display: inline-flex; align-items: center; }
.pdfcard__pages[hidden] { display: none; }

.pdfcard__subtitle {
	margin: 8px 0 0;
	font-size: 13px;
	line-height: 1.45;
	color: var(--pdfcard-muted);
}

/* --- Botão --------------------------------------------------------------- */

.pdfcard__btn {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 11px 17px;
	border: 0;
	border-radius: 999px;
	background: var(--pdfcard-accent);
	color: var(--pdfcard-accent-text);
	font: 600 14px/1 inherit;
	font-family: inherit;
	cursor: pointer;
	white-space: nowrap;
	transition: transform .25s cubic-bezier(.2, .8, .25, 1), opacity .25s ease;
}

.pdfcard__btn:hover  { transform: translateY(-1px); opacity: .92; }
.pdfcard__btn:active { transform: translateY(0); }

.pdfcard__btn:focus-visible,
.pdfcard__modal__close:focus-visible {
	outline: 2px solid var(--pdfcard-accent);
	outline-offset: 3px;
}

.pdfcard__btn svg { transition: transform .3s cubic-bezier(.2, .8, .25, 1); }
.pdfcard__btn:hover svg { transform: translateX(2px); }

/* Empilha o botão abaixo do texto em cards estreitos */
@media (max-width: 420px) {
	.pdfcard__body {
		flex-direction: column;
		align-items: stretch;
	}
	.pdfcard__btn { justify-content: center; }
}

/* --- Modal --------------------------------------------------------------- */

.pdfcard-modal {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	flex-direction: column;
	background: rgba(9, 11, 16, .82);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	opacity: 0;
	transition: opacity .3s ease;
}

.pdfcard-modal.is-open { opacity: 1; }

.pdfcard-modal__bar {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 14px 18px;
	color: #fff;
}

.pdfcard-modal__name {
	font: 600 14px/1.3 system-ui, -apple-system, "Segoe UI", sans-serif;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.pdfcard-modal__actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

.pdfcard-modal__link,
.pdfcard-modal__close {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	height: 34px;
	padding: 0 13px;
	border: 1px solid rgba(255, 255, 255, .22);
	border-radius: 999px;
	background: rgba(255, 255, 255, .07);
	color: #fff;
	font: 600 13px/1 system-ui, -apple-system, "Segoe UI", sans-serif;
	text-decoration: none;
	cursor: pointer;
	transition: background .2s ease, border-color .2s ease;
}

.pdfcard-modal__link:hover,
.pdfcard-modal__close:hover {
	background: rgba(255, 255, 255, .16);
	border-color: rgba(255, 255, 255, .35);
	color: #fff;
}

.pdfcard-modal__frame {
	flex: 1 1 auto;
	width: 100%;
	border: 0;
	background: #23262d;
	transform: translateY(10px);
	opacity: 0;
	transition: transform .35s cubic-bezier(.2, .8, .25, 1), opacity .35s ease;
}

.pdfcard-modal.is-open .pdfcard-modal__frame {
	transform: translateY(0);
	opacity: 1;
}

html.pdfcard-locked { overflow: hidden; }

/* --- Acessibilidade ------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
	.pdfcard__inner,
	.pdfcard__canvas,
	.pdfcard__btn,
	.pdfcard__btn svg,
	.pdfcard-modal,
	.pdfcard-modal__frame {
		transition: none !important;
	}
	.pdfcard__skeleton { animation: none; }
	.pdfcard__inner:hover { transform: none; }
	.pdfcard__inner:hover .pdfcard__canvas.is-ready { transform: none; }
}
