/**
 * References list: front end, block editor, and citation preview (admin).
 *
 * Hanging indent: padding on the item + negative text-indent on the first line.
 * text-indent on li does not affect inner blocks (e.g. p), so the first in-flow
 * child gets the same indent. li also keeps text-indent for inline-only content.
 */
.pulsetcm-references__list {
	list-style: none;
	margin: 0;
	padding: 0 2em;
	font-size: 0.875em;
}

.pulsetcm-references__item {
	padding-left: 2em;
	text-indent: -2em;
}

.pulsetcm-references__item > :first-child {
	text-indent: -2em;
}

.pulsetcm-references__item:not(:last-child) {
	margin-bottom: 0.75em;
}

.pulsetcm-references__item > p {
	margin-left: 0;
	margin-right: 0;
}

.pulsetcm-references__item > p:first-child {
	margin-top: 0;
}

.pulsetcm-references__item > p:last-child {
	margin-bottom: 0;
}

/**
 * Citation links stay on one line by default (DOI, PMCID, URLs).
 * Add class pulsetcm-cite-wrap on an <a> when that link should wrap instead.
 * .no-wrap on non-anchor elements (e.g. span) is still supported for legacy markup.
 */
.pulsetcm-references__item a,
.pulsetcm-citation-html-preview a {
	white-space: nowrap;
	word-break: normal;
	overflow-wrap: normal;
}

.pulsetcm-references__item a.pulsetcm-cite-wrap,
.pulsetcm-citation-html-preview a.pulsetcm-cite-wrap {
	white-space: normal;
	overflow-wrap: break-word;
	word-break: break-word;
}

.pulsetcm-references__item .no-wrap:not(a),
.pulsetcm-citation-html-preview .no-wrap:not(a) {
	white-space: nowrap;
	word-break: normal;
	overflow-wrap: normal;
}

/**
 * Admin citation preview: raw HTML only (no list wrapper).
 */
.pulsetcm-citation-html-preview {
	padding-left: 2em;
	text-indent: -2em;
	font-size: 13px;
	line-height: 1.5;
	max-height: 240px;
	overflow-x: auto;
	overflow-y: auto;
}

/* text-indent on the box does not move the first line of inner blocks (e.g. p). */
.pulsetcm-citation-html-preview > :first-child {
	text-indent: -2em;
}

.pulsetcm-citation-html-preview > p {
	margin-left: 0;
	margin-right: 0;
}

.pulsetcm-citation-html-preview > p:first-child {
	margin-top: 0;
}

.pulsetcm-citation-html-preview > p:last-child {
	margin-bottom: 0;
}

/* After :first-child so text-indent: 0 wins over the hang rule. */
.pulsetcm-citation-html-preview > .pulsetcm-citation-preview-empty {
	margin: 0 0 0 -2em;
	text-indent: 0;
	color: #646970;
	font-style: italic;
}
