/**
 * Dev Blog custom Prism.js theme.
 *
 * Token colors are defined here as CSS custom properties with a light default
 * and a [data-theme="dark"] override, so code blocks follow the active theme.
 * Structural colors (background, border) come from style.css. Works with the
 * WordPress core Code block (pre > code.language-xxx) and the Prism autoloader,
 * plus the toolbar + copy-to-clipboard plugins.
 */

:root {
	--prism-comment: #6a737d;
	--prism-punctuation: #5b6570;
	--prism-number: #005cc5;
	--prism-string: #22863a;
	--prism-operator: #b31d28;
	--prism-keyword: #d73a49;
	--prism-function: #6f42c1;
	--prism-variable: #e36209;
	--prism-selection: rgba(13, 148, 136, 0.15);
}

[data-theme="dark"] {
	--prism-comment: #6b7280;
	--prism-punctuation: #9ca3af;
	--prism-number: #f87171;
	--prism-string: #4ade80;
	--prism-operator: #fbbf24;
	--prism-keyword: var(--color-accent);
	--prism-function: #a78bfa;
	--prism-variable: #fb923c;
	--prism-selection: rgba(45, 212, 191, 0.2);
}

code[class*="language-"],
pre[class*="language-"] {
	color: var(--color-text);
	background: none;
	font-family: var(--font-mono);
	font-size: 0.875rem;
	text-align: left;
	white-space: pre;
	word-spacing: normal;
	word-break: normal;
	word-wrap: normal;
	line-height: 1.6;
	tab-size: 4;
	hyphens: none;
}

pre[class*="language-"] {
	padding: 20px;
	margin: 0 0 1.25rem;
	overflow: auto;
	border-radius: var(--radius-md);
	background: var(--color-code-bg);
	border: 1px solid var(--color-code-border);
}

:not(pre) > code[class*="language-"] {
	padding: 0.15em 0.45em;
	border-radius: 4px;
	background: var(--color-code-bg);
	border: 1px solid var(--color-code-border);
	white-space: normal;
}

code[class*="language-"]::selection,
code[class*="language-"] ::selection,
pre[class*="language-"]::selection,
pre[class*="language-"] ::selection {
	background: var(--prism-selection);
}

.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
	color: var(--prism-comment);
	font-style: italic;
}

.token.punctuation {
	color: var(--prism-punctuation);
}

.token.namespace {
	opacity: 0.7;
}

.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol,
.token.deleted {
	color: var(--prism-number);
}

.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted {
	color: var(--prism-string);
}

.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string {
	color: var(--prism-operator);
}

.token.atrule,
.token.attr-value,
.token.keyword {
	color: var(--prism-keyword);
}

.token.function,
.token.class-name {
	color: var(--prism-function);
}

.token.regex,
.token.important,
.token.variable {
	color: var(--prism-variable);
}

.token.important,
.token.bold {
	font-weight: bold;
}

.token.italic {
	font-style: italic;
}

.token.entity {
	cursor: help;
}

/* =========================================================
   Prism Toolbar + copy-to-clipboard button
   ========================================================= */
div.code-toolbar {
	position: relative;
}

div.code-toolbar > .toolbar {
	position: absolute;
	top: 0;
	right: 0;
	opacity: 1;
	transition: opacity 0.2s ease;
}

div.code-toolbar > .toolbar > .toolbar-item > button {
	background: var(--color-surface-raised);
	color: var(--color-text-muted);
	border: 1px solid var(--color-code-border);
	border-radius: 4px;
	padding: 6px;
	box-shadow: none;
	font-size: 0;
	line-height: 0;
	margin-top: 8px;
	margin-right: 8px;
	cursor: pointer;
}

div.code-toolbar > .toolbar > .toolbar-item > button::before {
	content: '';
	display: block;
	width: 16px;
	height: 16px;
	background-repeat: no-repeat;
	background-position: center;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238b939e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='9' width='13' height='13' rx='2' ry='2'%3E%3C/rect%3E%3Cpath d='M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1'%3E%3C/path%3E%3C/svg%3E");
}

div.code-toolbar > .toolbar > .toolbar-item > button:hover,
div.code-toolbar > .toolbar > .toolbar-item > button:focus {
	background: var(--color-border);
	color: var(--color-text);
}

div.code-toolbar > .toolbar > .toolbar-item > button.copied::before {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%232dd4bf' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
}
