.doclens-viewer {
	--doclens-bg: #f7f5f0;
	--doclens-surface: #ffffff;
	--doclens-ink: #1a2330;
	--doclens-muted: #667487;
	--doclens-border: rgba(26, 35, 48, 0.1);
	--doclens-accent: #007d53;
	--doclens-accent-soft: rgba(0, 125, 83, 0.12);
	--doclens-hit: #ffe29a;
	--doclens-hit-active: #ffb020;
	--doclens-font-size: 16px;
	--doclens-radius: 10px;
	--doclens-sidebar-w: 220px;
	--doclens-shadow: 0 1px 0 rgba(26, 35, 48, 0.04);

	font-family: Inter, "Aptos", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
	color: var(--doclens-ink);
	background: var(--doclens-bg);
	border: 1px solid var(--doclens-border);
	border-radius: var(--doclens-radius);
	overflow: hidden;
	max-width: 100%;
	box-sizing: border-box;
	isolation: isolate;
}

.doclens-viewer *,
.doclens-viewer *::before,
.doclens-viewer *::after {
	box-sizing: border-box;
}

/*
 * Before JavaScript builds the reader, the element has no children and would
 * otherwise collapse to a 1px hairline — indistinguishable from a broken embed,
 * and especially confusing inside a flex container like an Elementor Flexbox,
 * which then collapses too. Hold open a visible loading state instead.
 */
.doclens-viewer:not(.doclens-ready) {
	min-height: 140px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.doclens-viewer:not(.doclens-ready)::after {
	content: "";
	width: 24px;
	height: 24px;
	border: 2px solid var(--doclens-border);
	border-top-color: var(--doclens-accent);
	border-radius: 50%;
	animation: doclens-spin 0.7s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
	.doclens-viewer:not(.doclens-ready)::after {
		animation: none;
	}
}

.doclens-viewer.doclens-dark {
	--doclens-bg: #121820;
	--doclens-surface: #1a222d;
	--doclens-ink: #e8eef6;
	--doclens-muted: #9aabbf;
	--doclens-border: rgba(232, 238, 246, 0.12);
	--doclens-accent: #28b885;
	--doclens-accent-soft: rgba(40, 184, 133, 0.2);
	--doclens-hit: #6b5410;
	--doclens-hit-active: #c48a0a;
}

/* Color templates are generated from the token map in class-doclens-theme.php */

/* Duller night mode for bright document pages */
.doclens-viewer.doclens-dark .doclens-page canvas,
.doclens-viewer.doclens-dark .doclens-thumb {
	filter: brightness(0.82) contrast(0.9) saturate(0.88);
}

.doclens-viewer.doclens-dark .doclens-docx-content .docx-wrapper,
.doclens-viewer.doclens-dark .doclens-xlsx-content table {
	filter: brightness(0.88) contrast(0.92) saturate(0.9);
}

.doclens-viewer.doclens-is-fullscreen {
	border-radius: 0;
	border: none;
	height: 100vh;
	background: var(--doclens-bg);
	display: flex;
	flex-direction: column;
}

/* Let the reader take the leftover height instead of subtracting a fixed
   toolbar height, which was wrong as soon as the toolbar wrapped. */
.doclens-viewer.doclens-is-fullscreen .doclens-chrome {
	flex: 1;
	min-height: 0;
}

.doclens-viewer.doclens-is-fullscreen .doclens-body {
	flex: 1;
	min-height: 0;
	height: auto !important;
}

.doclens-chrome {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

/* Error */
.doclens-error {
	padding: 16px 18px;
	border: 1px dashed #c97878;
	color: #6e1f1f;
	background: #fdf4f4;
	border-radius: 8px;
	font-family: "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
	font-size: 14px;
	line-height: 1.45;
}

/* Toolbar */
.doclens-toolbar {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 12px;
	background: var(--doclens-surface);
	border-bottom: 1px solid var(--doclens-border);
	flex-wrap: wrap;
}

.doclens-toolbar-left,
.doclens-toolbar-center,
.doclens-toolbar-right {
	display: flex;
	align-items: center;
	gap: 8px;
	min-width: 0;
}

.doclens-toolbar-left {
	flex: 0 1 auto;
	min-width: 0;
}

/* Search takes the slack rather than reserving a fixed basis, so the three
   groups stay on one line down to the compact breakpoint. */
.doclens-toolbar-center {
	flex: 1 1 auto;
	justify-content: flex-end;
}

.doclens-toolbar-right {
	flex: 0 0 auto;
	justify-content: flex-end;
	flex-wrap: nowrap;
	position: relative;
}

.doclens-actions {
	display: flex;
	align-items: center;
	gap: 8px;
}

/* Only appears in compact mode. */
.doclens-more-btn {
	display: none;
}

.doclens-title-wrap {
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 1px;
}

.doclens-title {
	font-weight: 650;
	font-size: 14px;
	letter-spacing: -0.01em;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	line-height: 1.25;
}

.doclens-meta {
	font-size: 12px;
	color: var(--doclens-muted);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.doclens-search {
	display: flex;
	align-items: center;
	gap: 2px;
	width: min(100%, 320px);
	background: var(--doclens-bg);
	border: 1px solid var(--doclens-border);
	border-radius: 8px;
	padding: 3px 4px 3px 10px;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.doclens-search:focus-within {
	border-color: var(--doclens-accent);
	box-shadow: 0 0 0 3px var(--doclens-accent-soft);
}

.doclens-search-input {
	flex: 1;
	border: none;
	background: transparent;
	outline: none;
	font-size: 13px;
	color: var(--doclens-ink);
	padding: 5px 2px;
	min-width: 0;
}

.doclens-search-input::placeholder {
	color: var(--doclens-muted);
}

.doclens-icon-btn,
.doclens-btn {
	appearance: none;
	border: 1px solid transparent;
	background: transparent;
	color: var(--doclens-ink);
	border-radius: 7px;
	padding: 7px;
	font-size: 12.5px;
	cursor: pointer;
	line-height: 1;
	text-decoration: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.doclens-icon-btn:hover,
.doclens-btn:hover {
	background: var(--doclens-accent-soft);
	color: var(--doclens-accent);
}

.doclens-icon-btn:focus-visible,
.doclens-btn:focus-visible,
.doclens-search-input:focus-visible {
	outline: 2px solid var(--doclens-accent);
	outline-offset: 2px;
}

.doclens-download {
	border: 1px solid var(--doclens-border);
	background: var(--doclens-bg);
	padding: 6px 10px;
	font-weight: 600;
}

.doclens-download:hover {
	border-color: var(--doclens-accent);
}

.doclens-search-count {
	font-size: 11.5px;
	color: var(--doclens-muted);
	min-width: 48px;
	text-align: center;
	padding: 0 4px;
	white-space: nowrap;
}

/* Progress */
.doclens-progress {
	height: 2px;
	background: var(--doclens-border);
}

.doclens-progress-fill {
	height: 100%;
	width: 0;
	background: var(--doclens-accent);
	transition: width 0.12s linear;
}

/* Body */
.doclens-body {
	display: flex;
	position: relative;
	min-height: 320px;
	background: var(--doclens-bg);
}

.doclens-sidebar {
	width: var(--doclens-sidebar-w);
	flex-shrink: 0;
	overflow: hidden;
	border-right: 1px solid var(--doclens-border);
	background: var(--doclens-surface);
	transition: width 0.2s ease, opacity 0.2s ease;
}

.doclens-sidebar-inner {
	height: 100%;
	overflow-y: auto;
	padding: 14px 10px;
}

.doclens-viewer.doclens-sidebar-collapsed .doclens-sidebar {
	width: 0;
	border-right: none;
	opacity: 0;
	pointer-events: none;
}

.doclens-sidebar-backdrop {
	display: none;
	appearance: none;
	border: none;
	padding: 0;
	margin: 0;
	background: rgba(10, 16, 24, 0.35);
	position: absolute;
	inset: 0;
	z-index: 4;
	cursor: pointer;
}

.doclens-sidebar-label {
	font-size: 10.5px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--doclens-muted);
	padding: 4px 8px 8px;
}

/* Collapsible sidebar sections */
.doclens-section + .doclens-section {
	margin-top: 6px;
	border-top: 1px solid var(--doclens-border);
	padding-top: 6px;
}

.doclens-section-toggle {
	display: flex;
	align-items: center;
	gap: 6px;
	width: 100%;
	appearance: none;
	border: none;
	background: transparent;
	cursor: pointer;
	padding: 7px 8px;
	border-radius: 6px;
	color: var(--doclens-muted);
	font-size: 10.5px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	text-align: left;
}

.doclens-section-toggle:hover {
	background: var(--doclens-accent-soft);
	color: var(--doclens-accent);
}

.doclens-section-toggle:focus-visible {
	outline: 2px solid var(--doclens-accent);
	outline-offset: -2px;
}

.doclens-section-label {
	flex: 1;
	min-width: 0;
}

.doclens-section-count {
	font-variant-numeric: tabular-nums;
	font-weight: 600;
	opacity: 0.75;
}

.doclens-chevron {
	flex-shrink: 0;
	transform: rotate(90deg);
	transition: transform 0.15s ease;
}

.doclens-section-collapsed .doclens-chevron {
	transform: rotate(0deg);
}

.doclens-section-collapsed > .doclens-section-body {
	display: none;
}

.doclens-content {
	flex: 1;
	min-width: 0;
	overflow: auto;
	padding: 22px;
	font-size: var(--doclens-font-size);
	line-height: 1.72;
	scroll-behavior: smooth;
}

.doclens-status {
	padding: 8px 14px;
	font-size: 12px;
	color: var(--doclens-muted);
	border-top: 1px solid var(--doclens-border);
	background: var(--doclens-surface);
}

.doclens-status[hidden] {
	display: none;
}

.doclens-status-error {
	color: #b3261e;
	background: #fff5f4;
}

.doclens-viewer.doclens-dark .doclens-status-error {
	background: #2a1716;
	color: #ffb4ab;
}

/* TOC */
.doclens-toc-empty {
	font-size: 12px;
	color: var(--doclens-muted);
	padding: 6px 8px;
	margin: 0;
	line-height: 1.4;
}

/* Says why the outline is empty and what to do about it. */
.doclens-toc-hint {
	font-size: 11.5px;
	color: var(--doclens-muted);
	margin: 6px 8px 0;
	padding: 8px 10px;
	line-height: 1.45;
	background: var(--doclens-bg);
	border: 1px dashed var(--doclens-border);
	border-radius: 6px;
}

.doclens-toc-list,
.doclens-toc-list ul {
	list-style: none;
	margin: 0;
	padding-left: 0;
}

/* Nested levels indent from the disclosure column, not the row edge, so the
   tree lines up under its parent's label. */
.doclens-toc-list .doclens-toc-list {
	padding-left: 14px;
}

/* The outline renders inside post content, where themes routinely style bare
   list items. Neutralise that so spacing stays ours. */
.doclens-toc-list li {
	margin: 0;
	padding: 0;
	list-style: none;
}

.doclens-toc-row {
	display: flex;
	align-items: flex-start;
	gap: 2px;
}

.doclens-toc-toggle {
	flex-shrink: 0;
	appearance: none;
	border: none;
	background: transparent;
	color: var(--doclens-muted);
	cursor: pointer;
	padding: 6px 2px;
	margin-top: 1px;
	border-radius: 4px;
	line-height: 0;
}

.doclens-toc-toggle svg {
	transform: rotate(90deg);
	transition: transform 0.15s ease;
}

.doclens-toc-collapsed > .doclens-toc-row .doclens-toc-toggle svg {
	transform: rotate(0deg);
}

.doclens-toc-collapsed > .doclens-toc-list {
	display: none;
}

.doclens-toc-toggle:hover {
	background: var(--doclens-accent-soft);
	color: var(--doclens-accent);
}

/* Reserves the disclosure column for leaf rows so labels stay aligned. */
.doclens-toc-spacer {
	flex-shrink: 0;
	width: 20px;
}

.doclens-toc-link {
	display: block;
	flex: 1;
	min-width: 0;
	text-align: left;
	font-size: 13px;
	color: var(--doclens-ink);
	text-decoration: none;
	padding: 7px 8px;
	border-radius: 6px;
	border: none;
	background: transparent;
	cursor: pointer;
	line-height: 1.35;
	font-family: inherit;
}

.doclens-toc-link:hover {
	background: var(--doclens-accent-soft);
	color: var(--doclens-accent);
}

/* Where the reader currently is. */
.doclens-toc-link.doclens-toc-active {
	background: var(--doclens-accent-soft);
	color: var(--doclens-accent);
	font-weight: 650;
	box-shadow: inset 2px 0 0 var(--doclens-accent);
}

/* Deeper levels read as secondary. */
.doclens-toc-list .doclens-toc-list .doclens-toc-link {
	font-size: 12.5px;
}

.doclens-toc-list .doclens-toc-list .doclens-toc-list .doclens-toc-link {
	font-size: 12px;
	color: var(--doclens-muted);
}

.doclens-sheet-tab.doclens-active {
	background: var(--doclens-accent);
	color: #fff;
}

.doclens-sheet-tab.doclens-active:hover {
	color: #fff;
}

/* PDF pages */
.doclens-page {
	position: relative;
	margin: 0 auto 22px;
	background: #fff;
	border-radius: 2px;
	box-shadow:
		0 1px 2px rgba(16, 24, 40, 0.04),
		0 8px 24px rgba(16, 24, 40, 0.08);
}

.doclens-page-pending {
	background: repeating-linear-gradient(
		-45deg,
		var(--doclens-surface),
		var(--doclens-surface) 8px,
		var(--doclens-bg) 8px,
		var(--doclens-bg) 16px
	);
	border: 1px dashed var(--doclens-border);
	box-shadow: none;
	border-radius: 6px;
}

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

/* The layer itself is fully opaque and its text is transparent: at opacity 0.2
   the whole layer was faded, which took search highlights down with it and left
   them all but invisible over the rendered page. */
.doclens-textlayer {
	position: absolute;
	top: 0;
	left: 0;
	overflow: hidden;
	opacity: 1;
	line-height: 1;
	pointer-events: auto;
}

.doclens-textlayer span {
	position: absolute;
	white-space: pre;
	transform-origin: 0 0;
	color: transparent;
}

.doclens-textlayer span::selection {
	background: var(--doclens-accent-soft);
}

.doclens-thumbs {
	display: flex;
	flex-direction: column;
	gap: 10px;
	align-items: center;
	padding: 4px 0 12px;
}

.doclens-thumb-btn {
	border: 2px solid transparent;
	background: none;
	padding: 3px;
	cursor: pointer;
	border-radius: 6px;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	transition: border-color 0.12s ease;
}

.doclens-thumb-btn:hover {
	border-color: var(--doclens-accent);
}

.doclens-thumb-btn.doclens-thumb-active {
	border-color: var(--doclens-accent);
	background: var(--doclens-accent-soft);
}

.doclens-thumb-btn.doclens-thumb-active .doclens-thumb-label {
	color: var(--doclens-accent);
	font-weight: 700;
}

.doclens-thumb {
	background: #fff;
	border-radius: 2px;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
	max-width: 100%;
}

.doclens-thumb-label {
	font-size: 10px;
	color: var(--doclens-muted);
	font-weight: 600;
}

/* Word */
.doclens-docx-content {
	background: transparent;
}

.doclens-docx-content .docx-wrapper {
	background: transparent !important;
	padding: 0 !important;
}

.doclens-docx-content section.docx {
	background: #fff !important;
	box-shadow:
		0 1px 2px rgba(16, 24, 40, 0.06),
		0 10px 30px rgba(16, 24, 40, 0.09);
	margin: 0 auto 24px !important;
	border-radius: 3px;
	/* Last-resort guard. JS scales the page to fit, but if that has not run yet
	   the page must not overflow and clip its own text. */
	max-width: 100%;
	font-family: "Source Serif 4", "Noto Serif", Georgia, "Times New Roman", serif;
}

/* The wrapper is what JS zooms; keep it centred at any scale. */
.doclens-docx-content .docx-wrapper {
	display: flex;
	flex-direction: column;
	align-items: center;
}

.doclens-viewer.doclens-dark .doclens-docx-content section.docx {
	filter: invert(0.92) hue-rotate(180deg);
}

/* Excel */
.doclens-table-wrap {
	overflow: auto;
	border-radius: 8px;
	border: 1px solid var(--doclens-border);
	background: #fff;
}

.doclens-sheet-table {
	border-collapse: collapse;
	font-size: var(--doclens-font-size);
	width: max-content;
	min-width: 100%;
	background: #fff;
}

.doclens-sheet-table td,
.doclens-sheet-table th {
	border: 1px solid var(--doclens-border);
	padding: 6px 10px;
	white-space: nowrap;
	text-align: left;
	vertical-align: top;
}

.doclens-sheet-table th {
	background: #f0f3f1;
	font-weight: 650;
	position: sticky;
	top: 0;
	z-index: 1;
}

.doclens-viewer.doclens-dark .doclens-table-wrap,
.doclens-viewer.doclens-dark .doclens-sheet-table {
	background: #1c2430;
}

.doclens-viewer.doclens-dark .doclens-sheet-table th {
	background: #243041;
}

/* Search hits */
mark.doclens-hit,
.doclens-hit {
	background: var(--doclens-hit);
	color: inherit;
	border-radius: 2px;
}

.doclens-hit-active {
	background: var(--doclens-hit-active) !important;
	outline: 2px solid var(--doclens-accent);
	outline-offset: 1px;
}

/* PDF hits sit in the invisible text layer over a canvas that is white in both
   themes, so they use a translucent amber that lets the glyphs beneath read
   through rather than the theme-dependent highlight colours. */
.doclens-textlayer span.doclens-hit {
	color: transparent !important;
	background: rgba(255, 213, 79, 0.55);
	border-radius: 2px;
}

.doclens-textlayer span.doclens-hit-active {
	background: rgba(255, 145, 0, 0.72) !important;
	outline: 1px solid #b35c00;
	outline-offset: 0;
}

/* Whole-page hit: a match on a page that has not been rasterised yet. */
.doclens-page.doclens-hit,
.doclens-page.doclens-hit-active {
	background: var(--doclens-surface);
	outline: 2px solid var(--doclens-accent);
	outline-offset: 2px;
}

/* Responsive
   ------------------------------------------------------------------------
   Driven by .doclens-compact, which JavaScript sets from the viewer's own
   measured width. A viewport media query gets this wrong in the common case:
   a 700px embed inside a content column on a wide monitor is narrow in every
   way that matters, but the window is not. Only genuinely viewport-bound rules
   (height clamps) stay as media queries below. */

.doclens-viewer.doclens-compact .doclens-toolbar {
	gap: 8px;
	padding: 8px;
}

/* Row one: title and actions. Row two: search. */
.doclens-viewer.doclens-compact .doclens-toolbar-left {
	flex: 1 1 auto;
	min-width: 0;
	order: 1;
}

.doclens-viewer.doclens-compact .doclens-toolbar-right {
	flex: 0 0 auto;
	order: 2;
}

.doclens-viewer.doclens-compact .doclens-toolbar-center {
	flex: 1 1 100%;
	order: 3;
	justify-content: flex-start;
}

.doclens-viewer.doclens-compact .doclens-search {
	width: 100%;
}

.doclens-viewer.doclens-compact .doclens-download span {
	display: none;
}

/* Secondary actions fold behind the "…" button. */
.doclens-viewer.doclens-compact .doclens-more-btn {
	display: inline-flex;
}

.doclens-viewer.doclens-compact .doclens-actions {
	display: none;
	position: absolute;
	top: calc(100% + 8px);
	right: 0;
	z-index: 20;
	flex-direction: column;
	align-items: stretch;
	gap: 2px;
	min-width: 190px;
	padding: 6px;
	background: var(--doclens-surface);
	border: 1px solid var(--doclens-border);
	border-radius: 10px;
	box-shadow: 0 12px 30px rgba(16, 24, 40, 0.18);
}

.doclens-viewer.doclens-compact .doclens-actions.doclens-actions-open {
	display: flex;
}

.doclens-viewer.doclens-compact .doclens-actions .doclens-icon-btn {
	justify-content: flex-start;
	gap: 10px;
	padding: 9px 10px;
	width: 100%;
}

.doclens-viewer.doclens-compact .doclens-actions .doclens-action-label {
	display: inline;
	font-size: 13px;
	white-space: nowrap;
}

/* Comfortable touch targets. */
.doclens-viewer.doclens-compact .doclens-icon-btn,
.doclens-viewer.doclens-compact .doclens-btn {
	min-width: 40px;
	min-height: 40px;
}

.doclens-viewer.doclens-compact .doclens-search-input {
	/* 16px stops iOS Safari zooming the page on focus. */
	font-size: 16px;
}

.doclens-viewer.doclens-compact .doclens-search-count {
	min-width: 0;
}

/* Sidebar becomes an overlay drawer. */
.doclens-viewer.doclens-compact .doclens-sidebar {
	position: absolute;
	inset: 0 auto 0 0;
	width: min(86%, 320px);
	z-index: 5;
	transform: translateX(-105%);
	transition: transform 0.22s ease;
	box-shadow: 8px 0 24px rgba(0, 0, 0, 0.18);
	opacity: 1;
	border-right: 1px solid var(--doclens-border);
}

.doclens-viewer.doclens-compact.doclens-sidebar-open .doclens-sidebar {
	transform: translateX(0);
}

.doclens-viewer.doclens-compact.doclens-sidebar-open .doclens-sidebar-backdrop {
	display: block;
}

.doclens-viewer.doclens-compact.doclens-sidebar-collapsed .doclens-sidebar {
	width: min(82%, 300px);
	opacity: 1;
	pointer-events: auto;
}

/* Bigger tap targets in the drawer. */
.doclens-viewer.doclens-compact .doclens-toc-link {
	padding: 10px 8px;
	font-size: 14px;
}

.doclens-viewer.doclens-compact .doclens-toc-toggle {
	padding: 9px 4px;
}

.doclens-viewer.doclens-compact .doclens-toc-spacer {
	width: 24px;
}

.doclens-viewer.doclens-compact .doclens-section-toggle {
	padding: 11px 8px;
}

/* One tall column of thumbnails means endless scrolling in a drawer; a grid
   puts far more of the document within reach. */
.doclens-viewer.doclens-compact .doclens-thumbs {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
	gap: 10px;
	align-items: start;
}

.doclens-viewer.doclens-compact .doclens-thumb-btn {
	width: 100%;
}

.doclens-viewer.doclens-compact .doclens-thumb {
	width: 100%;
	height: auto;
}

.doclens-viewer.doclens-compact .doclens-content {
	padding: 12px;
}

.doclens-viewer.doclens-compact .doclens-title {
	font-size: 13px;
}

.doclens-viewer.doclens-compact .doclens-meta {
	font-size: 11px;
}

.doclens-viewer.doclens-compact .doclens-sheet-table {
	font-size: 14px;
}

.doclens-viewer.doclens-compact .doclens-sheet-table td,
.doclens-viewer.doclens-compact .doclens-sheet-table th {
	padding: 6px 8px;
}

/* Height is genuinely viewport-bound, so these stay media queries. The inline
   per-embed pixel height still applies; this only caps it. */
@media (max-width: 720px) {
	.doclens-body {
		max-height: 78vh;
	}
}

@media (max-width: 480px) {
	.doclens-body {
		max-height: 72vh;
	}
}

@media (max-height: 520px) and (orientation: landscape) {
	.doclens-body {
		max-height: 88vh;
	}
}

@media (prefers-reduced-motion: reduce) {
	.doclens-sidebar,
	.doclens-chevron,
	.doclens-toc-toggle svg,
	.doclens-progress-fill {
		transition: none;
	}
}

/* Hidden unless the actions group is a popover. */
.doclens-action-label {
	display: none;
}

@media print {
	.doclens-toolbar,
	.doclens-progress,
	.doclens-sidebar,
	.doclens-status,
	.doclens-sidebar-backdrop {
		display: none !important;
	}

	.doclens-viewer,
	.doclens-body,
	.doclens-content {
		border: none !important;
		height: auto !important;
		max-height: none !important;
		overflow: visible !important;
		background: #fff !important;
	}

	/* The toolbar Print button adds .doclens-printing to <html> and
	   .doclens-print-target to the viewer being printed, so the document prints on
	   its own without the surrounding page — and without the popup window that
	   used to lose every canvas bitmap on the way across. */
	html.doclens-printing body {
		visibility: hidden !important;
	}

	html.doclens-printing .doclens-print-target,
	html.doclens-printing .doclens-print-target * {
		visibility: visible !important;
	}

	html.doclens-printing .doclens-print-target {
		position: absolute !important;
		top: 0 !important;
		left: 0 !important;
		width: 100% !important;
		margin: 0 !important;
		padding: 0 !important;
	}

	.doclens-page {
		box-shadow: none !important;
		margin: 0 auto 8px !important;
		break-inside: avoid;
		page-break-inside: avoid;
	}

	/* Invisible positioned text over the canvas only creates print artefacts. */
	.doclens-textlayer {
		display: none !important;
	}
}

/* Performance mode — tighter margins, smaller thumbs on constrained devices */
.doclens-viewer.doclens-performance-mode .doclens-thumb {
	max-height: 72px;
}

.doclens-viewer.doclens-performance-mode .doclens-page {
	box-shadow: var(--doclens-shadow);
}

.doclens-toc-link:focus-visible,
.doclens-thumb-btn:focus-visible,
.doclens-sheet-tab:focus-visible {
	outline: 2px solid var(--doclens-accent);
	outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
	.doclens-viewer,
	.doclens-viewer * {
		scroll-behavior: auto !important;
		animation: none !important;
		transition: none !important;
	}

	.doclens-progress-fill {
		transition: none !important;
	}
}
