.markdown-source-view.mod-cm6.is-readable-line-width.fountain .cm-sizer {
	--file-line-width: var(--fountain-line-width);
}

.markdown-source-view.fountain .cm-content {
	/* ----------------------------- main tokens ------------------------------ */

	.cm-fountain-scene-heading {
		font-weight: var(--font-bold);
	}

	.cm-fountain-parenthetical,
	.cm-fountain-character-extension,
	.cm-fountain-lyrics {
		font-style: italic;
	}

	.cm-fountain-transition {
		font-weight: var(--font-bold);
		text-align: right;
		.cm-quote-1:not(.cm-formatting) {
			color: var(--text-normal);
		}
	}

	.cm-fountain-centered {
		font-weight: var(--font-bold);
		text-align: center;
		.cm-quote-1:not(.cm-formatting) {
			color: var(--text-normal);
		}
	}

	/* transition and centered tokens, must override Obsidian blockquote styles */
	.cm-fountain-centered,
	.cm-fountain-transition {
		/* reset any styles set by plugins */
		font-style: normal;
		background-color: inherit;
		/* set on element.style by blockquote */
		text-indent: 0 !important;
		padding-inline-start: 0 !important;
		/* remove left border */
		&::before {
			display: none;
		}
	}

	.cm-fountain-character {
		/* in themes like Minimal, width is overridden by a more specific selector. We will need to set the CSS Variable instead. */
		--line-width: var(--fountain-character-line-width);
		width: var(--fountain-character-line-width);

		body:not(.fountain-theme-fix) & {
			left: calc(
				(var(--fountain-line-width) - var(--fountain-character-line-width)) / 2
			);
		}
	}

	.cm-fountain-lyrics,
	.cm-fountain-dialogue {
		--line-width: var(--fountain-dialogue-line-width);
		width: var(--fountain-dialogue-line-width);

		body:not(.fountain-theme-fix) & {
			left: calc(
				(var(--fountain-line-width) - var(--fountain-dialogue-line-width)) / 2
			);
		}
	}

	.cm-fountain-parenthetical {
		--line-width: var(--fountain-parenthetical-line-width);
		width: var(--fountain-parenthetical-line-width);

		body:not(.fountain-theme-fix) & {
			left: calc(
				(
						var(--fountain-line-width) -
							var(--fountain-parenthetical-line-width)
					) /
					2
			);
		}
	}

	/* ----------------------------- formatting ------------------------------- */

	/* FIXME */
	.cm-fountain-boneyard,
	.cm-fountain-formatting-boneyard-start,
	.cm-fountain-formatting-boneyard-end,
	.cm-formatting[class*="cm-fountain-formatting-"] {
		color: var(--text-faint);
	}

	.cm-line > *:not(.cm-formatting) {
		--code-comment: var(--fountain-code-comment, var(--text-muted));
	}
}

.markdown-source-view.mod-cm6.fountain .cm-line:not(.cm-active) {
	[class*="cm-fountain-formatting-"] {
		display: none;
	}

	.cm-fountain-formatting-centered {
		visibility: hidden;
		display: inherit;
	}
}
