/* Doc Display — inline PDF viewer */

.docdisplay {
	position: relative;
	margin: 1.75em 0;
	border: 1px solid #dfe3e8;
	border-radius: 10px;
	background: #fff;
	box-shadow: 0 1px 3px rgba( 16, 24, 40, 0.06 );
	overflow: hidden;
	max-width: 100%;
}

.docdisplay__fallback {
	margin: 0;
	padding: 14px 16px;
}

/* ----- header ----- */

.docdisplay__head {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 14px;
	background: #f8f9fb;
	border-bottom: 1px solid #e6e9ee;
	min-width: 0;
}

.docdisplay__icon {
	display: inline-flex;
	flex: 0 0 auto;
	color: #c2410c;
}

.docdisplay__title {
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-size: 0.92em;
	font-weight: 600;
	color: #1f2937;
}

.docdisplay__head-actions {
	display: inline-flex;
	flex: 0 0 auto;
	gap: 6px;
}

/* ----- buttons ----- */

.docdisplay__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-width: 32px;
	height: 32px;
	padding: 0 8px;
	border: 1px solid #d6dae1;
	border-radius: 7px;
	background: #fff;
	color: #374151;
	font: inherit;
	font-size: 0.82em;
	font-weight: 500;
	line-height: 1;
	cursor: pointer;
	text-decoration: none;
	transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
	-webkit-appearance: none;
	appearance: none;
}

a.docdisplay__btn,
a.docdisplay__btn:hover,
a.docdisplay__btn:focus {
	text-decoration: none;
}

.docdisplay__btn:hover:not( :disabled ) {
	background: #f1f3f6;
	border-color: #b9bfc9;
	color: #111827;
}

.docdisplay__btn:focus-visible {
	outline: 2px solid #2563eb;
	outline-offset: 1px;
}

.docdisplay__btn:disabled {
	opacity: 0.4;
	cursor: default;
}

.docdisplay__btn--label span {
	display: none;
}

@media ( min-width: 480px ) {
	.docdisplay__btn--label span {
		display: inline;
	}
}

/* ----- stage ----- */

.docdisplay__stage {
	position: relative;
	background: #4b5158;
}

.docdisplay__stage:focus-visible {
	outline: 2px solid #2563eb;
	outline-offset: -2px;
}

.docdisplay__scroller {
	overflow: auto;
	text-align: center;
	-webkit-overflow-scrolling: touch;
}

.docdisplay__pagewrap {
	position: relative;
	display: inline-block;
	vertical-align: top;
	text-align: initial;
}

.docdisplay__canvas {
	display: block;
	background: #fff;
	opacity: 0;
	box-shadow: 0 2px 12px rgba( 0, 0, 0, 0.35 );
}

.docdisplay__canvas--drawn {
	opacity: 1;
	transition: opacity 0.18s ease;
}

/* PDF.js text layer: selectable, searchable, screen-readable text */

.docdisplay__textlayer {
	position: absolute;
	inset: 0;
	overflow: hidden;
	line-height: 1;
	text-size-adjust: none;
	-webkit-text-size-adjust: none;
	forced-color-adjust: none;
	transform-origin: 0 0;
	caret-color: CanvasText;
	z-index: 1;
}

.docdisplay__textlayer span,
.docdisplay__textlayer br {
	position: absolute;
	color: transparent;
	white-space: pre;
	cursor: text;
	transform-origin: 0% 0%;
}

.docdisplay__textlayer span::selection {
	background: rgba( 37, 99, 235, 0.3 );
	color: transparent;
}

.docdisplay__status {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	text-align: center;
	color: #e5e7eb;
	font-size: 0.9em;
	pointer-events: none;
}

.docdisplay--error .docdisplay__status {
	color: #fecaca;
}

.docdisplay__status[hidden] {
	display: none;
}

/* page-flip side zones */

.docdisplay__navzone {
	position: absolute;
	top: 50%;
	transform: translateY( -50% );
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 56px;
	border: 0;
	border-radius: 8px;
	background: rgba( 17, 24, 39, 0.55 );
	color: #fff;
	cursor: pointer;
	opacity: 0;
	transition: opacity 0.18s ease;
}

.docdisplay__navzone--prev {
	left: 10px;
}

.docdisplay__navzone--next {
	right: 10px;
}

.docdisplay__stage:hover .docdisplay__navzone:not( :disabled ),
.docdisplay__navzone:focus-visible {
	opacity: 1;
}

/* No hover on touch devices — keep the zones visible so they are
   discoverable and never invisible-but-tappable. */
@media ( hover: none ) {
	.docdisplay__navzone:not( :disabled ) {
		opacity: 0.6;
	}
}

.docdisplay__navzone:disabled {
	opacity: 0 !important;
	cursor: default;
}

.docdisplay--single .docdisplay__navzone,
.docdisplay--error .docdisplay__navzone {
	display: none;
}

/* ----- controls ----- */

.docdisplay__controls {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 8px 12px;
	background: #f8f9fb;
	border-top: 1px solid #e6e9ee;
	flex-wrap: wrap;
}

.docdisplay__controls--hidden {
	display: none;
}

.docdisplay__pageinfo {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 0.85em;
	color: #374151;
	font-variant-numeric: tabular-nums;
}

.docdisplay__pageinput {
	width: 52px;
	height: 30px;
	padding: 0 6px;
	border: 1px solid #d6dae1;
	border-radius: 6px;
	background: #fff;
	color: #111827;
	font: inherit;
	font-size: 0.9em;
	text-align: center;
	-moz-appearance: textfield;
}

.docdisplay__pageinput::-webkit-outer-spin-button,
.docdisplay__pageinput::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.docdisplay__spacer {
	flex: 1 1 auto;
}

.docdisplay__zoomlabel {
	min-width: 44px;
	text-align: center;
	font-size: 0.85em;
	color: #374151;
	font-variant-numeric: tabular-nums;
}

/* ----- iframe fallback ----- */

.docdisplay__iframe {
	display: block;
	width: 100%;
	height: 100%;
	min-height: 640px;
	border: 0;
	background: #fff;
}

.docdisplay__note {
	margin: 0;
	padding: 8px 14px;
	background: #fffbeb;
	border-bottom: 1px solid #fde68a;
	color: #92400e;
	font-size: 0.82em;
}

/* visually hidden live region */

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

/* ----- fullscreen ----- */

.docdisplay--fs,
.docdisplay:fullscreen {
	display: flex;
	flex-direction: column;
	width: 100%;
	height: 100%;
	margin: 0;
	border: 0;
	border-radius: 0;
	background: #1f2429;
}

.docdisplay--fs .docdisplay__stage,
.docdisplay:fullscreen .docdisplay__stage {
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	min-height: 0;
}

.docdisplay--fs .docdisplay__scroller,
.docdisplay:fullscreen .docdisplay__scroller {
	flex: 1 1 auto;
	display: flex;
	align-items: safe center;
	justify-content: safe center;
	min-height: 0;
}

/* CSS-only "fullscreen" fallback (e.g. iOS Safari) */

.docdisplay--max {
	position: fixed;
	inset: 0;
	z-index: 100001; /* above the WP admin bar (99999) */
	display: flex;
	flex-direction: column;
	margin: 0;
	border-radius: 0;
	background: #1f2429;
}

body.dd-noscroll {
	overflow: hidden;
}

.docdisplay--max .docdisplay__stage {
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	min-height: 0;
}

.docdisplay--max .docdisplay__scroller {
	flex: 1 1 auto;
	min-height: 0;
}

/* ----- print ----- */

@media print {
	.docdisplay__controls,
	.docdisplay__navzone {
		display: none !important;
	}
}
