/**
 * WAISG 代码高亮附加组件样式（复制按钮 / 语言标签 / 行号）
 * 作用域全部收敛在 .waisg-hl-* 类名下，不污染其它内容。
 */

/* 外层容器：按钮/标签的定位锚点（pre 自身 overflow 滚动时组件不跟随） */
.waisg-hl-wrap {
	position: relative;
}

/* 接管后的基础观感：统一代码块外观（背景/内边距/圆角），
   内部 code 的着色背景清空，避免主题样式透出 */
.waisg-hl-wrap > pre {
	background: #f6f8fa;
	padding: 1em;
	border-radius: 6px;
	overflow: auto;
}
.waisg-hl-wrap > pre > code {
	background: transparent !important;
	padding: 0 !important;
	box-shadow: none !important;
	border-radius: 0 !important;
}

/* 语言标签（左上角） */
.waisg-hl-lang {
	position: absolute;
	top: 0;
	left: 0;
	z-index: 2;
	background: rgba(0, 0, 0, 0.45);
	color: #fff;
	font-size: 11px;
	line-height: 1;
	padding: 4px 8px;
	border-radius: 0 0 4px 0;
	pointer-events: none;
	font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
	letter-spacing: 0.3px;
}

/* 复制按钮（右上角，悬停出现；触屏设备常显） */
.waisg-hl-copy {
	position: absolute;
	top: 6px;
	right: 6px;
	z-index: 2;
	background: rgba(255, 255, 255, 0.88);
	color: #333;
	border: 1px solid rgba(0, 0, 0, 0.15);
	border-radius: 3px;
	font-size: 12px;
	line-height: 1;
	padding: 5px 9px;
	cursor: pointer;
	opacity: 0;
	transition: opacity 0.15s;
	font-family: inherit;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}
.waisg-hl-wrap:hover .waisg-hl-copy,
.waisg-hl-copy:focus {
	opacity: 1;
}
.waisg-hl-copy:hover {
	background: #fff;
}
.waisg-hl-copy.is-copied {
	color: #0a6b3d;
	border-color: #0a6b3d;
}
@media (hover: none) {
	.waisg-hl-copy {
		opacity: 1;
	}
}

/* 行号：pre 变 flex，gutter 与 code 同为子项、同起点；强制同字号同行高保证逐行对齐。
   开启行号时代码不自动换行（横向滚动），否则换行会让行号错位。 */
.waisg-hl-lines {
	display: flex !important;
	align-items: stretch;
	overflow-x: auto !important;
}
.waisg-hl-lines code,
.waisg-hl-gutter {
	font-size: 14px !important;
	line-height: 1.6 !important;
}
.waisg-hl-lines code {
	flex: 1 1 auto;
	min-width: 0;
	white-space: pre;
	overflow: visible;
}
.waisg-hl-gutter {
	flex: 0 0 auto;
	width: 2.6em;
	/* 横向滚动时行号钉在左侧不跟随滚动（sticky 依赖 pre 的 overflow-x:auto） */
	position: sticky;
	left: 0;
	text-align: right;
	padding-right: 1em;
	white-space: pre;
	user-select: none;
	-webkit-user-select: none;
	opacity: 0.45;
	border-right: 1px solid currentColor;
	margin-right: 1em;
	background: inherit;
}
