/*!
 * VisualEditor ContentEditable ParagraphNode styles.
 *
 * @copyright See AUTHORS.txt
 */

.ve-ce-paragraphNode.ve-ce-generated-wrapper {
	/* Remove margin around wrapper paragraphs generated by our CE code,
	   to keep the rendering consistent with the view mode where these wrappers are missing */
	margin-left: 0;
	margin-right: 0;

	/* Maintain separation between wrapper paragraphs and start/end of document */

	/* stylelint-disable no-descending-specificity */
	:not( .ve-ce-attachedRootNode ):not( .ve-ui-surface-placeholder ) > &,
	&:not( :first-child ) {
		/*
		   Keep top margin when:
		     - [child of attachedRoot OR child of placeholder] AND first child in the doc
		   this means we clear the top margin when
		     - [NOT child of attachedRoot AND NOT child of placeholder] OR NOT first child in the doc
		*/
		margin-top: 0;
		padding-top: 0;
	}

	:not( .ve-ce-attachedRootNode ):not( .ve-ui-surface-placeholder ) > &,
	&:not( :last-child ) {
		/* Same for bottom margin */
		margin-bottom: 0;
		padding-bottom: 0;
	}
	/* stylelint-enable no-descending-specificity */
}
