/*
 * Lab report viewer: one native <dialog> shared by Home and Science & Quality.
 * Native dialog = modal focus trap, Escape and ::backdrop for free. Loaded only on those two pages.
 */
html.pt-lab-lock {
	overflow: hidden;
}

.pt-lab-viewer {
	box-sizing: border-box;
	width: min(96vw, 1100px);
	max-width: none;
	height: min(94vh, 94dvh);
	max-height: none;
	margin: auto;
	padding: 0;
	border: 0;
	border-radius: 16px;
	background: #fff;
	color: var(--color-text-body);
	overflow: hidden;
	box-shadow: 0 20px 80px rgba(20, 30, 70, 0.35);
}

.pt-lab-viewer:not([open]) {
	display: none;
}

.pt-lab-viewer::backdrop {
	background: rgba(14, 22, 48, 0.72);
}

.pt-lab-viewer__panel {
	display: flex;
	flex-direction: column;
	height: 100%;
}

.pt-lab-viewer__bar {
	display: flex;
	flex: none;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 12px 16px;
	border-bottom: 1px solid var(--color-border-soft);
	background: #fff;
}

.pt-lab-viewer__title {
	min-width: 0;
	margin: 0;
	overflow: hidden;
	color: var(--color-text-heading);
	font-size: 16px;
	font-weight: var(--fw-medium);
	line-height: 1.3;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.pt-lab-viewer__tools {
	display: flex;
	flex: none;
	align-items: center;
	gap: 8px;
}

.pt-lab-viewer__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	min-height: 40px;
	padding: 0 16px;
	border: 1px solid var(--color-border-strong);
	border-radius: var(--radius-pill);
	background: #fff;
	color: var(--color-text-brand);
	font: inherit;
	font-size: 14px;
	line-height: 1;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.2s;
}

.pt-lab-viewer__btn:hover {
	background: var(--color-surface-3);
}

.pt-lab-viewer__btn:focus-visible,
.pt-lab-viewer__stage:focus-visible {
	outline: 2px solid var(--color-action);
	outline-offset: 2px;
}

.pt-lab-viewer__close {
	width: 40px;
	padding: 0;
}

.pt-lab-viewer__close svg {
	display: block;
	width: 14px;
	height: 14px;
}

.pt-lab-viewer__stage {
	flex: 1 1 auto;
	min-height: 0;
	padding: 12px;
	overflow: auto;
	background: #f1f6ff;
	overscroll-behavior: contain;
}

.pt-lab-viewer__img {
	display: block;
	width: auto;
	max-width: 100%;
	height: auto;
	max-height: 100%;
	margin: 0 auto;
	object-fit: contain;
	background: #fff;
}

/* Zoomed: natural-ish width, the stage scrolls in both directions. */
.pt-lab-viewer.is-zoomed .pt-lab-viewer__img {
	width: 200%;
	max-width: none;
	max-height: none;
	margin: 0;
}

@media (max-width: 599px) {
	.pt-lab-viewer {
		width: 100vw;
		height: 100dvh;
		max-height: none;
		border-radius: 0;
	}

	.pt-lab-viewer__bar {
		flex-wrap: wrap;
		padding: 8px 12px;
	}

	.pt-lab-viewer__title {
		flex: 1 1 100%;
	}

	.pt-lab-viewer__tools {
		flex: 1 1 100%;
		justify-content: flex-end;
	}

	.pt-lab-viewer.is-zoomed .pt-lab-viewer__img {
		width: 250%;
	}
}
