/*!
 * VisualEditor Surface styles.
 *
 * @copyright See AUTHORS.txt
 */

.ve-ui-surface {
	position: relative;
	display: flex;
	flex-wrap: wrap;
	align-items: stretch;

	.ve-ce-attachedRootNode {
		/* Use an non-zero padding to disable margin collapse */
		padding: 0.05px 0;
	}

	&-source-font {
		/* Support: Blink, Gecko, Webkit */
		/* Specify a valid second value to fix size, see T176636 */
		font-family: monospace, monospace;
	}

	&-source {
		.ve-ce-paragraphNode {
			/* Clear paragraph margin/padding, regardless of specificity, so it looks more like a textarea */
			/* stylelint-disable-next-line declaration-no-important */
			margin: 0 !important;
			/* stylelint-disable-next-line declaration-no-important */
			padding: 0 !important;
			word-wrap: break-word;
			/* Support: Chrome<76, Firefox<69 */
			/* Fallback for browsers which don't support break-spaces */
			white-space: pre-wrap;
			/* T348006 */
			white-space: break-spaces;
		}

		.ve-ce-attachedRootNode {
			-moz-tab-size: 4;
			tab-size: 4;
		}
	}
}

/*
 * Placeholder text, drawn on the document's first node so it inherits that node's box, font
 * and direction. Out of flow, or the caret would sit after it; `left` and `right` then make
 * long text wrap rather than overflow, and #getPlaceholderHeight reserves the height.
 *
 * Not nested inside .ve-ui-surface: skins override the colour with a descendant selector
 */
.ve-ce-attachedRootNode > [ data-ve-placeholder ] {
	position: relative;
}

.ve-ce-attachedRootNode > [ data-ve-placeholder ]::before {
	content: attr( data-ve-placeholder );
	position: absolute;
	left: 0;
	right: 0;
	opacity: 0.33;
	pointer-events: none;
	user-select: none;
}
