/**
 * Inline PDF Viewer for phpBB attachments.
 *
 * Deliberately neutral: it borrows the host style's fonts and sits quietly
 * inside the attachment box rather than introducing its own visual language.
 *
 * @license GNU General Public License, version 2 (GPL-2.0-only)
 */

.pdfv {
	margin: 6px 0 10px;
	border: 1px solid rgba(0, 0, 0, .2);
	border-radius: 4px;
	overflow: hidden;
	background: #f4f4f4;
	max-width: 100%;
}

/* Toolbar ---------------------------------------------------------------- */

.pdfv-bar {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 4px;
	padding: 5px 6px;
	background: #ededed;
	border-bottom: 1px solid rgba(0, 0, 0, .18);
	font-size: 11px;
	line-height: 1.4;
}

.pdfv-name {
	flex: 1 1 auto;
	min-width: 0;
	font-weight: bold;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	color: #333;
}

.pdfv-counter {
	flex: 0 0 auto;
	margin-right: 4px;
	color: #666;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.pdfv-btn {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 24px;
	height: 22px;
	padding: 0 6px;
	border: 1px solid rgba(0, 0, 0, .2);
	border-radius: 3px;
	background: #fbfbfb;
	color: #333;
	font: inherit;
	font-size: 12px;
	line-height: 1;
	text-decoration: none;
	cursor: pointer;
}

.pdfv-btn svg {
	display: block;
	pointer-events: none;
}

.pdfv-btn:hover,
.pdfv-btn:focus {
	background: #fff;
	color: #000;
	text-decoration: none;
}

.pdfv-btn:focus-visible {
	outline: 2px solid #0076b1;
	outline-offset: 1px;
}

a.pdfv-btn.pdfv-dl,
a.pdfv-btn.pdfv-dl:hover {
	text-decoration: none;
}

/* Document area ---------------------------------------------------------- */

.pdfv-viewport {
	position: relative;
	max-height: 78vh;
	overflow: auto;
	padding: 10px 0;
	background: #4b4f52;
	text-align: center;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior: contain;
}

.pdfv-viewport:focus-visible {
	outline: 2px solid #0076b1;
	outline-offset: -2px;
}

.pdfv-page {
	position: relative;
	margin: 0 auto 10px;
	background: #fff;
	box-shadow: 0 1px 4px rgba(0, 0, 0, .45);
	max-width: 100%;
}

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

.pdfv-page canvas {
	display: block;
	width: 100%;
	height: 100%;
}

.pdfv-status {
	padding: 24px 16px;
	color: #e6e6e6;
	font-size: 12px;
}

.pdfv-status-error {
	color: #ffd7d7;
}

.pdfv-failed .pdfv-counter,
.pdfv-failed .pdfv-btn:not(.pdfv-dl):not(.pdfv-toggle) {
	display: none;
}

/* Collapsed state -------------------------------------------------------- */

.pdfv-collapsed .pdfv-viewport {
	display: none;
}

/* Full screen ------------------------------------------------------------ */

.pdfv:fullscreen,
.pdfv:-webkit-full-screen {
	display: flex;
	flex-direction: column;
	border: 0;
	border-radius: 0;
	background: #4b4f52;
}

.pdfv:fullscreen .pdfv-viewport,
.pdfv:-webkit-full-screen .pdfv-viewport {
	flex: 1 1 auto;
	max-height: none;
}

/* Fallback for browsers that will not put an arbitrary element full screen
   (notably iOS Safari): pin the viewer over the page instead. */
.pdfv-maximised {
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 9999;
	display: flex;
	flex-direction: column;
	margin: 0;
	border: 0;
	border-radius: 0;
	background: #4b4f52;
}

.pdfv-maximised .pdfv-viewport {
	flex: 1 1 auto;
	max-height: none;
}

.pdfv-maximised .pdfv-bar {
	flex: 0 0 auto;
}

html.pdfv-lock,
html.pdfv-lock body {
	overflow: hidden;
}

/* Small screens ---------------------------------------------------------- */

@media (max-width: 700px) {
	.pdfv-viewport {
		max-height: 65vh;
		padding: 6px 0;
	}

	.pdfv-name {
		flex-basis: 100%;
		margin-bottom: 2px;
	}
}

/* Printing --------------------------------------------------------------- */

@media print {
	.pdfv {
		display: none;
	}
}
