/*
    viewer.doclokr.com — layout only.

    No web fonts, no images, no external anything: the Content-Security-Policy in
    staticwebapp.config.json is default-src 'self', and this file must never need it widened.
*/

:root {
	color-scheme: light dark;
	--viewerBackground: #1f232b;
	--viewerSurface: #2b3038;
	--viewerText: #e7eaef;
	--viewerBorder: #3a404a;
}

* {
	box-sizing: border-box;
}

html,
body {
	height: 100%;
	margin: 0;
}

body {
	background: var(--viewerBackground);
	color: var(--viewerText);
	font-family: system-ui, "Segoe UI", sans-serif;
	font-size: 14px;
}

.viewer {
	display: flex;
	flex-direction: column;
	height: 100%;
}

.surface {
	position: relative;
	flex: 1 1 auto;
	min-height: 0;
	overflow: auto;
	background: var(--viewerSurface);
	display: flex;
	align-items: center;
	justify-content: center;
}

.status {
	margin: 0;
	padding: 16px;
	text-align: center;
	opacity: 0.75;
}

.rendered {
	width: 100%;
	height: 100%;
	border: 0;
	display: block;
	background: #ffffff;
}

#documentImage {
	object-fit: contain;
	background: transparent;
}

/*
    A .txt used to be handed to an inner iframe as a blob and drawn by the browser's own plain-text
    viewer. That viewer takes its colours from the reader's preferred colour scheme, so on a dark
    system it painted WHITE text, while the page underneath it was white — an unreadable document
    that still reported itself as rendered. The text is drawn here now, with the colours stated
    outright, so no browser preference can decide them.
*/
.textDocument {
	margin: 0;
	padding: 16px;
	overflow: auto;
	color: #1b1e24;
	font-family: ui-monospace, "Cascadia Mono", Consolas, "Courier New", monospace;
	font-size: 13px;
	line-height: 1.5;
	tab-size: 4;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}

.canvasHost {
	display: block;
	margin: auto;
	padding: 12px;
}

.canvasHost canvas {
	display: block;
	max-width: 100%;
	height: auto;
	background: #ffffff;
	box-shadow: 0 2px 10px rgb(0 0 0 / 45%);
}

.pager {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	padding: 8px;
	border-top: 1px solid var(--viewerBorder);
	background: var(--viewerBackground);
}

.pager button {
	font: inherit;
	color: var(--viewerText);
	background: var(--viewerSurface);
	border: 1px solid var(--viewerBorder);
	border-radius: 6px;
	padding: 6px 14px;
	cursor: pointer;
}

.pager button:disabled {
	opacity: 0.4;
	cursor: default;
}

.pageLabel {
	min-width: 8em;
	text-align: center;
}

/*
    More specific than the element rules above, so hiding actually hides. Phase 01b lost a matrix
    cell to exactly this: `.surface img { display: block }` beat a bare `.hidden { display: none }`
    and an image that had decoded perfectly well was recorded as "does not render".
*/
.surface .rendered.hidden,
.surface .canvasHost.hidden,
.viewer .pager.hidden,
.surface .status.hidden {
	display: none;
}
