:root {
	--opv-bg: #eef2f6;
	--opv-surface: #ffffff;
	--opv-text: #172033;
	--opv-muted: #667085;
	--opv-border: #d7dee8;
	--opv-accent: #155eef;
	--opv-accent-hover: #004eeb;
}

html,
body.opv-viewer-page {
	width: 100%;
	min-height: 100%;
	margin: 0;
}

body.opv-viewer-page {
	overflow-x: hidden;
	background: var( --opv-bg );
	color: var( --opv-text );
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.opv-shell {
	display: flex;
	min-height: 100vh;
	min-height: 100dvh;
	flex-direction: column;
}

.opv-toolbar {
	position: relative;
	z-index: 10;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 24px;
	padding: 14px clamp( 16px, 3vw, 36px );
	border-bottom: 1px solid var( --opv-border );
	background: var( --opv-surface );
	box-shadow: 0 2px 8px rgba( 23, 32, 51, 0.06 );
}

.opv-title-group {
	min-width: 0;
}

.opv-site-name {
	display: block;
	margin-bottom: 3px;
	color: var( --opv-accent );
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-decoration: none;
	text-transform: uppercase;
}

.opv-title-group h1 {
	margin: 0;
	overflow: hidden;
	font-size: clamp( 16px, 2vw, 21px );
	line-height: 1.3;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.opv-actions {
	position: relative;
	display: flex;
	flex: 0 0 auto;
	gap: 9px;
}

.opv-open-button {
	display: none;
}

.opv-button {
	display: inline-flex;
	min-height: 42px;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	padding: 9px 15px;
	border: 1px solid var( --opv-border );
	border-radius: 7px;
	background: var( --opv-surface );
	color: var( --opv-text );
	cursor: pointer;
	font: inherit;
	font-size: 14px;
	font-weight: 650;
	line-height: 1;
	text-decoration: none;
}

.opv-button:hover,
.opv-button:focus-visible {
	border-color: var( --opv-accent );
	outline: none;
}

.opv-button-primary {
	border-color: var( --opv-accent );
	background: var( --opv-accent );
	color: #fff;
}

.opv-button-primary:hover,
.opv-button-primary:focus-visible {
	border-color: var( --opv-accent-hover );
	background: var( --opv-accent-hover );
	color: #fff;
}

.opv-share-menu {
	position: absolute;
	top: calc( 100% + 8px );
	right: 0;
	width: 180px;
	padding: 7px;
	border: 1px solid var( --opv-border );
	border-radius: 9px;
	background: var( --opv-surface );
	box-shadow: 0 12px 30px rgba( 23, 32, 51, 0.16 );
}

.opv-share-menu[hidden] {
	display: none;
}

.opv-share-menu a,
.opv-share-menu button {
	display: block;
	width: 100%;
	box-sizing: border-box;
	padding: 9px 10px;
	border: 0;
	border-radius: 5px;
	background: transparent;
	color: var( --opv-text );
	cursor: pointer;
	font: inherit;
	font-size: 14px;
	text-align: left;
	text-decoration: none;
}

.opv-share-menu a:hover,
.opv-share-menu button:hover,
.opv-share-menu a:focus-visible,
.opv-share-menu button:focus-visible {
	background: #f2f4f7;
	outline: none;
}

.opv-document {
	position: relative;
	display: flex;
	min-height: 420px;
	flex: 1 1 auto;
	padding: clamp( 8px, 1.5vw, 18px );
}

.opv-document iframe {
	display: block;
	width: 100%;
	min-height: 72vh;
	min-height: calc( 100dvh - 160px );
	border: 1px solid var( --opv-border );
	border-radius: 8px;
	background: #fff;
}

.opv-description {
	margin: 0;
	padding: 8px 18px 14px;
	color: var( --opv-muted );
	font-size: 13px;
	text-align: center;
}

.opv-fallback {
	margin: auto;
	padding: 30px;
	text-align: center;
}

.opv-document-mobile {
	display: none;
}

@media ( max-width: 768px ) {
	html,
	body.opv-viewer-page {
		overflow-x: hidden;
	}

	.opv-toolbar {
		position: sticky;
		top: 0;
		align-items: stretch;
		flex-direction: column;
		gap: 8px;
		padding: 8px 10px;
	}

	.admin-bar .opv-toolbar {
		top: 46px;
	}

	.opv-site-name {
		display: none;
	}

	.opv-title-group h1 {
		font-size: 15px;
		line-height: 1.25;
		text-align: center;
		white-space: nowrap;
	}

	.opv-actions {
		width: 100%;
	}

	.opv-button {
		min-width: 0;
		min-height: 38px;
		flex: 1 1 33.333%;
		padding: 8px 6px;
		font-size: 12.5px;
	}

	.opv-open-button {
		display: inline-flex;
	}

	.opv-button-primary {
		white-space: nowrap;
	}

	.opv-share-menu {
		left: 0;
		right: 0;
		width: auto;
	}

	.opv-document-desktop {
		display: none;
	}

	.opv-document-mobile {
		display: block;
		width: 100%;
		box-sizing: border-box;
		padding: 8px 6px 2px;
	}

	.opv-mobile-reader,
	.opv-mobile-pages {
		width: 100%;
		box-sizing: border-box;
	}

	.opv-mobile-reader {
		overflow: visible;
		touch-action: pan-y pinch-zoom;
	}

	.opv-mobile-status {
		margin: 0 0 8px;
		color: var( --opv-muted );
		font-size: 12px;
		text-align: center;
	}

	.opv-mobile-status.has-error {
		color: #b42318;
	}

	.opv-mobile-page {
		position: relative;
		width: 100%;
		min-height: 420px;
		box-sizing: border-box;
		margin: 0 auto 10px;
		overflow: hidden;
		border: 1px solid var( --opv-border );
		border-radius: 4px;
		background: #fff;
		box-shadow: 0 2px 8px rgba( 23, 32, 51, 0.08 );
		color: #b42318;
		font-size: 13px;
		text-align: center;
	}

	.opv-mobile-page.is-loading {
		background: linear-gradient( 110deg, #fff 30%, #f2f4f7 45%, #fff 60% );
		background-size: 220% 100%;
		animation: opv-loading-page 1.4s linear infinite;
	}

	.opv-mobile-page canvas {
		display: block;
		width: 100% !important;
		max-width: 100% !important;
		height: auto !important;
		margin: 0 auto;
		background: #fff;
	}

	.opv-page-number {
		position: absolute;
		right: 6px;
		bottom: 6px;
		padding: 3px 6px;
		border-radius: 10px;
		background: rgba( 23, 32, 51, 0.76 );
		color: #fff;
		font-size: 10px;
		line-height: 1;
	}

	.opv-mobile-error {
		margin: 24px 8px;
		padding: 22px;
		border: 1px solid var( --opv-border );
		border-radius: 8px;
		background: #fff;
		text-align: center;
	}

	.opv-mobile-error .opv-button {
		width: 100%;
	}

	.opv-description {
		padding: 7px 12px 12px;
		font-size: 12px;
		line-height: 1.45;
	}
}

@keyframes opv-loading-page {
	0% { background-position: 100% 0; }
	100% { background-position: -100% 0; }
}

@media ( prefers-reduced-motion: reduce ) {
	*,
	*::before,
	*::after {
		scroll-behavior: auto !important;
	}
}
