/**
 * Tiny Code Highlight — light IDE-style code blocks + copy button.
 *
 * Token colors use .tch-pre prefixes so they always win over theme CSS.
 *
 * @package Tiny_Code_Highlight
 */

.tch-pre {
	position: relative;
	margin: 1.25em 0;
	padding: 20px;
	overflow-x: auto;
	overflow-y: visible;
	border: 1px solid #e5e7eb;
	border-radius: 12px;
	background: #f8fafc !important;
	color: #1f2937;
	font-family: "JetBrains Mono", "Fira Code", Consolas, monospace;
	font-size: 0.9em;
	line-height: 1.6;
	white-space: pre;
	-webkit-overflow-scrolling: touch;
}

.tch-pre.tch-has-toolbar {
	padding-top: 42px;
}

.tch-pre > code,
.tch-pre code.hljs {
	display: block;
	padding: 0;
	overflow-x: visible;
	background: transparent !important;
	font-family: inherit;
	font-size: inherit;
	line-height: inherit;
	white-space: pre;
	border: 0;
	border-radius: 0;
	box-shadow: none;
}

/* ---- Syntax tokens (GitHub Light / IDE-like) ---- */
.tch-pre .hljs {
	background: transparent;
	color: #24292f;
}

.tch-pre .hljs-comment,
.tch-pre .hljs-code,
.tch-pre .hljs-formula {
	color: #6e7781;
	font-style: italic;
}

.tch-pre .hljs-keyword,
.tch-pre .hljs-doctag,
.tch-pre .hljs-meta .hljs-keyword,
.tch-pre .hljs-template-tag,
.tch-pre .hljs-template-variable,
.tch-pre .hljs-type,
.tch-pre .hljs-variable.language_ {
	color: #cf222e;
}

.tch-pre .hljs-title,
.tch-pre .hljs-title.class_,
.tch-pre .hljs-title.class_.inherited__,
.tch-pre .hljs-title.function_ {
	color: #8250df;
}

.tch-pre .hljs-attr,
.tch-pre .hljs-attribute,
.tch-pre .hljs-literal,
.tch-pre .hljs-meta,
.tch-pre .hljs-number,
.tch-pre .hljs-operator,
.tch-pre .hljs-variable,
.tch-pre .hljs-selector-attr,
.tch-pre .hljs-selector-class,
.tch-pre .hljs-selector-id {
	color: #0550ae;
}

.tch-pre .hljs-string,
.tch-pre .hljs-regexp,
.tch-pre .hljs-meta .hljs-string {
	color: #0a3069;
}

.tch-pre .hljs-built_in,
.tch-pre .hljs-symbol {
	color: #953800;
}

.tch-pre .hljs-name,
.tch-pre .hljs-quote,
.tch-pre .hljs-selector-tag,
.tch-pre .hljs-selector-pseudo {
	color: #116329;
}

.tch-pre .hljs-subst {
	color: #24292f;
}

.tch-pre .hljs-section {
	color: #0550ae;
	font-weight: 700;
}

.tch-pre .hljs-bullet {
	color: #953800;
}

.tch-pre .hljs-emphasis {
	font-style: italic;
}

.tch-pre .hljs-strong {
	font-weight: 700;
}

.tch-pre .hljs-deletion {
	color: #82071e;
	background-color: #ffebe9;
}

.tch-pre .hljs-addition {
	color: #116329;
	background-color: #dafbe1;
}

.tch-pre .hljs-punctuation,
.tch-pre .hljs-tag {
	color: #24292f;
}

.tch-pre .hljs-tag .hljs-name {
	color: #116329;
}

.tch-pre .hljs-tag .hljs-attr {
	color: #0550ae;
}

/* Toolbar: language (left) + copy (right), same row */
.tch-lang,
.tch-copy {
	position: absolute;
	top: 10px;
	z-index: 5;
	margin: 0;
	padding: 5px 10px;
	border: 1px solid #d1d5db;
	border-radius: 6px;
	background: #ffffff;
	color: #374151;
	font-family: system-ui, sans-serif;
	font-size: 11px;
	font-weight: 500;
	line-height: 1.2;
	letter-spacing: 0.02em;
}

.tch-lang {
	left: 10px;
	opacity: 0.9;
	user-select: none;
	pointer-events: none;
}

.tch-copy {
	right: 10px;
	cursor: pointer;
	opacity: 0.85;
	transition: opacity 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.tch-copy:hover,
.tch-copy:focus {
	opacity: 1;
	outline: none;
	background: #f3f4f6;
	border-color: #9ca3af;
}

.tch-copy:focus-visible {
	box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.35);
}

.tch-copy.tch-copy--done {
	opacity: 1;
	border-color: #86efac;
	background: #f0fdf4;
	color: #166534;
}

/* TinyMCE Visual editor preview */
.mce-content-body .tch-pre {
	margin: 1em 0;
}
