/*
 * Lynbro Blocks — highlighted code. Colours follow the site: the block's
 * background and text come from the theme presets, the token colours have a
 * light and a dark set (dark under prefers-color-scheme and data-theme="dark",
 * the suite's dark-mode switch). All AA on both backgrounds. Low specificity
 * (:where) so a theme or the owner can override anything.
 */
:where(pre.lynbro-code) {
	--lb-code-bg: var(--wp--preset--color--surface-2, #f4f5f7);
	--lb-code-fg: var(--wp--preset--color--contrast, #1d2127);
	--lb-c: #5f6b7a;
	--lb-k: #8a2be2;
	--lb-s: #0b6b3a;
	--lb-n: #a14a00;
	--lb-f: #1f5fbf;
	--lb-v: #b3261e;
	--lb-t: #1f5fbf;
	--lb-a: #8a4b00;
	--lb-p: #5f6b7a;
	position: relative;
	background: var(--lb-code-bg);
	color: var(--lb-code-fg);
	font-family: var(--wp--preset--font-family--mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
	font-size: 0.875em;
	line-height: 1.6;
	padding: 0.9em 1.25em 1.25em;
	font-variant-ligatures: none;
	border-radius: var(--wp--custom--radius--md, 10px);
	border: 1px solid var(--wp--preset--color--border, rgba(0, 0, 0, 0.1));
	overflow-x: auto;
	tab-size: 4;
	white-space: pre;
}
:where(pre.lynbro-code)::before {
	content: attr(data-lang);
	display: block;
	margin-bottom: 0.6em;
	font-size: 0.75em;
	line-height: 1.5;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--lb-c);
}
:where(pre.lynbro-code) code {
	font: inherit;
	background: none;
	padding: 0;
	color: inherit;
}
:where(pre.lynbro-code:focus-visible) {
	outline: var(--wp--custom--focus--width, 2px) solid var(--wp--custom--color--focus, currentColor);
	outline-offset: var(--wp--custom--focus--offset, 2px);
}
:where(.lynbro-code) .lb-c { color: var(--lb-c); font-style: italic; }
:where(.lynbro-code) .lb-k { color: var(--lb-k); font-weight: 600; }
:where(.lynbro-code) .lb-s { color: var(--lb-s); }
:where(.lynbro-code) .lb-n { color: var(--lb-n); }
:where(.lynbro-code) .lb-f { color: var(--lb-f); }
:where(.lynbro-code) .lb-v { color: var(--lb-v); }
:where(.lynbro-code) .lb-t { color: var(--lb-t); }
:where(.lynbro-code) .lb-a { color: var(--lb-a); }
:where(.lynbro-code) .lb-p { color: var(--lb-p); user-select: none; }
:where(.lynbro-code__copy) {
	position: absolute;
	top: 0.4em;
	right: 0.6em;
	font: 600 0.75em/1 var(--wp--preset--font-family--body, system-ui, sans-serif);
	padding: 0.45em 0.7em;
	border-radius: var(--wp--custom--radius--sm, 6px);
	border: 1px solid var(--wp--preset--color--border, rgba(0, 0, 0, 0.15));
	background: var(--wp--preset--color--surface, #fff);
	color: var(--lb-code-fg);
	cursor: pointer;
}
:where(.lynbro-code__copy):focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) :where(pre.lynbro-code) {
		--lb-c: #9aa5b4;
		--lb-k: #d0a6ff;
		--lb-s: #7fd6a4;
		--lb-n: #ffb26b;
		--lb-f: #8ab4ff;
		--lb-v: #ff8f86;
		--lb-t: #8ab4ff;
		--lb-a: #f5c26b;
		--lb-p: #9aa5b4;
	}
}
:root[data-theme="dark"] :where(pre.lynbro-code) {
	--lb-c: #9aa5b4;
	--lb-k: #d0a6ff;
	--lb-s: #7fd6a4;
	--lb-n: #ffb26b;
	--lb-f: #8ab4ff;
	--lb-v: #ff8f86;
	--lb-t: #8ab4ff;
	--lb-a: #f5c26b;
	--lb-p: #9aa5b4;
}
/* Themes and core set pre-wrap on code; a wrapped command line is a wrong
   command line, so scroll instead (deliberately not in :where). */
pre.lynbro-code {
	white-space: pre;
	overflow-wrap: normal;
	word-break: normal;
	overflow-x: auto;
}
@media print {
	:where(.lynbro-code__copy) { display: none; }
}
