/*
 * Tabler / --pgw-* skin for diff2html markup.
 * Do not load vendor diff2html CSS; colors come from --pgw-diff-*
 * (defined in main.css, which tracks prefers-color-scheme).
 */

#d2h-output {
	color: var(--pgw-text);

	a {
		color: var(--pgw-diff-moved-label);
		text-decoration: none;

		&:visited {
			color: var(--pgw-diff-moved-label);
		}

		&:hover {
			color: var(--pgw-link-hover);
			text-decoration: underline;
		}
	}

	code,
	pre {
		background: none;
		border: none;
		padding: 0;
		color: inherit;
		font-size: inherit;
		line-height: inherit;
	}

	.hljs {
		background: transparent;
	}
}

.d2h-wrapper {
	text-align: left;
}

.d2h-file-wrapper {
	background-color: var(--pgw-diff-bg);
	border: 1px solid var(--pgw-diff-border);
	border-radius: var(--tblr-border-radius, 0.25rem);
	margin-bottom: 1rem;
	overflow: hidden;
}

.d2h-file-header {
	align-items: center;
	background-color: var(--pgw-diff-header-bg);
	border-bottom: 1px solid var(--pgw-diff-header-border);
	color: var(--pgw-text);
	display: flex;
	font-family: "Fira Sans", var(--tblr-font-sans-serif, system-ui, sans-serif);
	font-size: 0.875rem;
	gap: 0.5rem;
	min-height: 2.25rem;
	padding: 0.375rem 0.75rem;

	&.d2h-sticky-header {
		position: sticky;
		top: 0;
		z-index: 1;
	}
}

.d2h-file-stats {
	display: flex;
	font-size: 0.8125rem;
	margin-left: auto;
}

.d2h-lines-added {
	border: 1px solid var(--pgw-diff-ins-border);
	border-radius: 0.25rem 0 0 0.25rem;
	color: var(--pgw-diff-ins-label);
	padding: 0.125rem 0.375rem;
	text-align: right;
}

.d2h-lines-deleted {
	border: 1px solid var(--pgw-diff-del-border);
	border-radius: 0 0.25rem 0.25rem 0;
	color: var(--pgw-diff-del-label);
	margin-left: 1px;
	padding: 0.125rem 0.375rem;
	text-align: left;
}

.d2h-file-name-wrapper {
	align-items: center;
	display: flex;
	font-size: 0.875rem;
	min-width: 0;
	width: 100%;
}

.d2h-file-name {
	color: var(--pgw-text);
	overflow-x: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.d2h-file-collapse {
	align-items: center;
	border: 1px solid var(--pgw-diff-border);
	border-radius: var(--tblr-border-radius, 0.25rem);
	color: var(--pgw-text-muted);
	cursor: pointer;
	display: none;
	font-size: 0.75rem;
	justify-content: flex-end;
	padding: 0.25rem 0.5rem;

	&.d2h-selected {
		background-color: var(--pgw-diff-selected);
		color: var(--pgw-text);
	}
}

.d2h-file-collapse-input {
	margin: 0 0.25rem 0 0;
}

.d2h-diff-table {
	border-collapse: collapse;
	font-family: ui-monospace, "Fira Code", "Fira Mono", monospace;
	font-size: 0.8125rem;
	line-height: 1.5;
	width: 100%;
}

.d2h-files-diff {
	display: flex;
	width: 100%;
}

.d2h-file-diff {
	overflow-y: hidden;
}

.d2h-file-diff.d2h-d-none,
.d2h-files-diff.d2h-d-none {
	display: none;
}

.d2h-file-side-diff {
	display: inline-block;
	overflow-x: auto;
	overflow-y: hidden;
	width: 50%;
}

.d2h-code-line {
	padding: 0 8em;
	width: calc(100% - 16em);
}

.d2h-code-line,
.d2h-code-side-line {
	display: inline-block;
	user-select: none;
	white-space: nowrap;
}

.d2h-code-side-line {
	padding: 0 4.5em;
	width: calc(100% - 9em);
}

.d2h-code-line-ctn {
	background: none;
	color: var(--pgw-text);
	display: inline-block;
	padding: 0;
	user-select: text;
	vertical-align: middle;
	white-space: pre;
	width: 100%;
	word-wrap: normal;
}

.d2h-code-line del,
.d2h-code-side-line del {
	background-color: var(--pgw-diff-del-highlight);
}

.d2h-code-line del,
.d2h-code-line ins,
.d2h-code-side-line del,
.d2h-code-side-line ins {
	border-radius: 0.2em;
	display: inline-block;
	margin-top: -1px;
	text-decoration: none;
}

.d2h-code-line ins,
.d2h-code-side-line ins {
	background-color: var(--pgw-diff-ins-highlight);
	text-align: left;
}

.d2h-code-line-prefix {
	background: none;
	display: inline;
	padding: 0;
	white-space: pre;
	word-wrap: normal;
}

.line-num1 {
	float: left;
}

.line-num1,
.line-num2 {
	box-sizing: border-box;
	overflow: hidden;
	padding: 0 0.5em;
	text-overflow: ellipsis;
	width: 3.5em;
}

.line-num2 {
	float: right;
}

.d2h-code-linenumber,
.d2h-code-side-linenumber {
	background-color: var(--pgw-diff-bg);
	border: solid var(--pgw-diff-line-border);
	border-width: 0 1px;
	box-sizing: border-box;
	color: var(--pgw-diff-dim);
	cursor: pointer;
	direction: rtl;
	display: inline-block;
	position: absolute;
	text-align: right;
	user-select: none;

	&::after {
		content: "\200b";
	}
}

.d2h-code-linenumber {
	width: 7.5em;
}

.d2h-code-side-linenumber {
	overflow: hidden;
	padding: 0 0.5em;
	text-overflow: ellipsis;
	width: 4em;
}

.d2h-code-side-emptyplaceholder,
.d2h-emptyplaceholder {
	background-color: var(--pgw-diff-empty-bg);
	border-color: var(--pgw-diff-empty-border);
}

.d2h-code-line-prefix,
.d2h-emptyplaceholder {
	user-select: none;
}

.d2h-del {
	background-color: var(--pgw-diff-del-bg);
	border-color: var(--pgw-diff-del-border);
}

.d2h-ins {
	background-color: var(--pgw-diff-ins-bg);
	border-color: var(--pgw-diff-ins-border);
}

.d2h-info {
	background-color: var(--pgw-diff-info-bg);
	border-color: var(--pgw-diff-info-border);
	color: var(--pgw-diff-dim);
}

.d2h-file-diff .d2h-del.d2h-change {
	background-color: var(--pgw-diff-change-del);
}

.d2h-file-diff .d2h-ins.d2h-change {
	background-color: var(--pgw-diff-change-ins);
}

.d2h-file-list-wrapper {
	background-color: var(--pgw-diff-bg);
	border: 1px solid var(--pgw-diff-border);
	border-radius: var(--tblr-border-radius, 0.25rem);
	margin-bottom: 1rem;
	padding: 0.5rem 0.75rem;
}

.d2h-file-list-header {
	text-align: left;
}

.d2h-file-list-title {
	color: var(--pgw-text);
	font-weight: 600;
}

.d2h-file-list-line {
	display: flex;
	text-align: left;
}

.d2h-file-list {
	display: block;
	list-style: none;
	margin: 0;
	padding: 0;

	> li {
		border-bottom: 1px solid var(--pgw-diff-border);
		margin: 0;
		padding: 0.375rem 0.25rem;

		&:last-child {
			border-bottom: none;
		}
	}
}

.d2h-file-switch {
	cursor: pointer;
	display: none;
	font-size: 0.625rem;
}

.d2h-icon {
	fill: currentColor;
	margin-right: 0.625rem;
	vertical-align: middle;
}

.d2h-deleted {
	color: var(--pgw-diff-del-label);
}

.d2h-added {
	color: var(--pgw-diff-ins-label);
}

.d2h-changed {
	color: var(--pgw-diff-change-label);
}

.d2h-moved {
	color: var(--pgw-diff-moved-label);
}

.d2h-tag {
	background-color: var(--pgw-diff-bg);
	display: flex;
	font-size: 0.625rem;
	margin-left: 0.375rem;
	padding: 0 0.125rem;
}

.d2h-deleted-tag {
	border: 1px solid var(--pgw-diff-del-label);
}

.d2h-added-tag {
	border: 1px solid var(--pgw-diff-ins-label);
}

.d2h-changed-tag {
	border: 1px solid var(--pgw-diff-change-label);
}

.d2h-moved-tag {
	border: 1px solid var(--pgw-diff-moved-label);
}

.pgw-callout-row .pgw-callout-line,
td.pgw-callout-line {
	background-color: color-mix(in srgb, var(--pgw-link) 14%, transparent) !important;
}

td.pgw-callout-linenum {
	background-color: color-mix(in srgb, var(--pgw-link) 22%, transparent) !important;
	font-weight: 600;
}

.mr-diff-callout-bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem;
	margin: 0.5rem 0;
}

.mr-diff-file-d2h td.d2h-code-side-linenumber,
.mr-diff-file-d2h td.d2h-code-linenumber,
.mr-diff-file-d2h td.d2h-code-side-line,
.mr-diff-file-d2h td.d2h-code-line {
	cursor: pointer;
}

.mr-diff-comment-wrap {
	position: sticky;
	bottom: 0;
	z-index: 2;
	background: var(--pgw-bg, var(--tblr-bg-surface, #fff));
}
