body {
	--heading-letter-spacing: 1.5px;
}

/* ────────────────────────────────────────────────────────────────────────── */

.markdown-rendered :is(h1, h2, h3, h4, h5, h6) {
	margin-top: 1em;
	margin-bottom: 0.3em;
}

body p {
	margin-block-start: 0.3em;
}

.inline-title.inline-title,
.HyperMD-header.HyperMD-header,
.markdown-rendered.markdown-rendered :is(h1, h2, h3, h4, h5, h6) {
	font-weight: 700;
	letter-spacing: var(--heading-letter-spacing);
}

.cm-formatting-header {
	color: var(--text-faint);
}

body:not(.no-alternating-header-colors)
	:is(.cm-header-1, .cm-header-3, .cm-header-5):not(.cm-formatting-header),
body:not(.no-alternating-header-colors) .view-content :is(h1, h3, h5) {
	color: var(--alt-heading-color);
}

/* ────────────────────────────────────────────────────────────────────────── */

/* Live Preview Heading Level Indicator */
body:not(.no-lp-heading-level-indicator) .is-live-preview {
	& .HyperMD-header::before {
		position: relative;
		bottom: 1px;
		left: -2px;
		padding-right: 4px;
		padding-left: 4px;
		font-family: var(--font-monospace);
		font-size: 0.8rem;
		font-style: normal;
		line-height: 1em;
		color: var(--text-muted);
	}

	/* biome-ignore format: more condensed */
	& .cm-line:not(.cm-active) {
		&.HyperMD-header-1::before { content: "H1" }
		&.HyperMD-header-2::before { content: "H2" }
		&.HyperMD-header-3::before { content: "H3" }
		&.HyperMD-header-4::before { content: "H4" }
		&.HyperMD-header-5::before { content: "H5" }
		&.HyperMD-header-6::before { content: "H6" }
	}
}

/* ────────────────────────────────────────────────────────────────────────── */

/* Headers with background colors */
body:not(.no-heading-background) .markdown-source-view .cm-line.HyperMD-header,
body:not(.no-heading-background) .markdown-preview-view :is(h1, h2, h3, h4, h5, h6) {
	background-color: var(--bg4);
	border: var(--thin-border);
	border-radius: var(--radius-s);
	padding-left: 6px;
	padding-top: 0; /* remove padding of first heading */
}
