/**
 * Hanging Indent — shared front-end + editor styles.
 *
 * Three custom properties, set inline on the block-root <div> by save(), drive
 * everything (custom properties inherit, so the list and its items pick them up):
 *   --hanging-indent-depth  the hang: how far WRAPPED lines indent from the
 *                           flush-left first line
 *   --hanging-indent-gap    vertical space between entries
 *   --hanging-indent-start  (numbered only) one less than the first entry's
 *                           number, so the CSS counter begins there
 *
 * The hang is a true hanging indent: the first line sits flush at the margin
 * (the number, when present, rides on it) and the wrapped lines indent. Built
 * from a negative text-indent on the first line pulled back by an equal left
 * padding, so it holds at any width or font size.
 *
 * Everything is scoped as `.hanging-indent > ol/ul` (the list is the direct
 * child of the block-root div). This is the ONE structure shared by the editor
 * canvas and the front end — RichText `multiline` leaves the list itself
 * class-less in the editor, so styling it via its own class can't match both.
 * The marker reset is !important so no theme list style can leak a stray bullet
 * or a double number through the counter.
 */

.hanging-indent > ol,
.hanging-indent > ul {
	margin: 0;
	/* Left padding is the optional whole-block indent (0 by default, set by the
	   Block indent control); the per-entry hang is added on the items below.
	   Applied here in our own CSS so the editor and front end always match. */
	padding: 0 0 0 var( --hanging-indent-block, 0 );
	list-style: none !important;
}

.hanging-indent li {
	margin: 0 0 var( --hanging-indent-gap, 0.75em );
	padding-left: var( --hanging-indent-depth, 2.5em );
	text-indent: calc( -1 * var( --hanging-indent-depth, 2.5em ) );
}

.hanging-indent li:last-child {
	margin-bottom: 0;
}

/* text-indent is inherited. A plain inline element ignores it, but many themes
 * render links as display:inline-block (EIC does), and an inline-block applies
 * the inherited negative text-indent to its OWN content, dragging the link text
 * left over the preceding words. Reset it so links sit correctly in the hang. */
.hanging-indent li a {
	text-indent: 0;
}

/* ---- Numbered: an inline counter prefix rides the flush first line, so the
 * number reads as "1. Author…", not a lonely marker in a gutter. ---- */
.hanging-indent > ol {
	counter-reset: hanging-indent-counter var( --hanging-indent-start, 0 );
}

.hanging-indent > ol > li {
	counter-increment: hanging-indent-counter;
}

.hanging-indent > ol > li::before {
	content: counter( hanging-indent-counter ) ". ";
}
