/*
 * HHG PDF Document tab (product page).
 * Added 2026-09-20. Paired with /inc/hhg-pdf-document-tab.php and /assets/js/hhg-pdf.js
 * Neutral rgba colours only, so the module reads correctly on light and dark headers.
 */

.hhg-pdf {
	--hp-line: rgba(120, 120, 120, 0.28);
	--hp-soft: rgba(120, 120, 120, 0.10);
	--hp-muted: rgba(120, 120, 120, 0.85);
	--hp-text: rgba(70, 70, 70, 0.95);
	color-scheme: light dark;
	margin: 0 0 1.5em;
}

.hhg-pdf__bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 0.6em 1em;
	padding: 0.7em 0.9em;
	border: 1px solid var(--hp-line);
	border-bottom: 0;
	border-radius: 0.4em 0.4em 0 0;
	background: var(--hp-soft);
	font-size: 0.86rem;
	line-height: 1.4;
}

.hhg-pdf__file {
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 0.15em;
}

.hhg-pdf__name {
	font-weight: 600;
	color: var(--hp-text);
	overflow-wrap: anywhere;
}

.hhg-pdf__meta {
	color: var(--hp-muted);
	font-size: 0.8rem;
	font-variant-numeric: tabular-nums;
}

.hhg-pdf__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5em;
	margin-left: auto;
}

.hhg-pdf__btn {
	display: inline-flex;
	align-items: center;
	gap: 0.35em;
	padding: 0.42em 0.85em;
	border: 1px solid var(--hp-line);
	border-radius: 0.32em;
	background: transparent;
	color: inherit;
	font-size: 0.82rem;
	font-weight: 500;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}

.hhg-pdf__btn:hover,
.hhg-pdf__btn:focus-visible {
	background: var(--hp-soft);
	border-color: var(--hp-muted);
	text-decoration: none;
}

.hhg-pdf__viewer {
	position: relative;
	height: clamp(420px, 72vh, 900px);
	min-height: 320px;
	overflow: auto;
	resize: vertical;
	border: 1px solid var(--hp-line);
	border-radius: 0 0 0.4em 0.4em;
	background: #f2f2f2;
}

.hhg-pdf__holder,
.hhg-pdf__frame {
	width: 100%;
	height: 100%;
}

.hhg-pdf__frame {
	display: block;
	border: 0;
	background: #fff;
}

.hhg-pdf__loading {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.7em;
	padding: 1em;
	text-align: center;
	color: var(--hp-muted);
	font-size: 0.85rem;
}

.hhg-pdf__spinner {
	width: 26px;
	height: 26px;
	border: 2px solid var(--hp-line);
	border-top-color: var(--hp-muted);
	border-radius: 50%;
	animation: hhg-pdf-spin 0.9s linear infinite;
}

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

.hhg-pdf--ready .hhg-pdf__loading {
	display: none;
}

.hhg-pdf--failed .hhg-pdf__loading {
	color: #a4341f;
}

.hhg-pdf__note {
	margin: 0.6em 0 0;
	color: var(--hp-muted);
	font-size: 0.78rem;
}

@media (max-width: 781px) {
	.hhg-pdf__bar {
		flex-direction: column;
		align-items: flex-start;
	}

	.hhg-pdf__actions {
		margin-left: 0;
		width: 100%;
	}

	.hhg-pdf__btn {
		flex: 1 1 auto;
		justify-content: center;
	}

	.hhg-pdf__viewer {
		height: clamp(360px, 78vh, 640px);
	}
}

@media (prefers-reduced-motion: reduce) {
	.hhg-pdf__spinner {
		animation-duration: 2.4s;
	}

	.hhg-pdf__btn {
		transition: none;
	}
}
