/* Texts from the admin's visual editor (<div class="text">) inside the old layout. New file, the old CSS is untouched. */

/*
 * The old site showed the space between lines, photos and paragraphs as empty lines (<br />).
 * Here a paragraph and a photo are followed by a gap of one such line (--gap: the text's line
 * height), and every further empty line is an empty paragraph from the editor, one line high.
 */
.text { --gap: 1.15em; }
#first .text { --gap: 30px; }

.text p, .text .block { margin: 0 0 var(--gap); }
.text p:empty { margin: 0; }
.text p:empty::before { content: "\a0"; }

/* «Вплотную к тексту сверху»: the photo takes back the gap after the paragraph or photo above it.
   Nothing to take back at the start of a text, in a list item or after a heading, line or list. */
.text .tight-top { margin-top: calc(-1 * var(--gap)); }
.text > .tight-top:first-child, .text li .tight-top,
.text :is(h1, h2, h3, h4, h5, h6, hr, ul, ol) + .tight-top { margin-top: 0; }

/* Nothing followed the last line or photo of a text: no gap after it. Empty lines at the end of a
   text are empty paragraphs after it, and the last of them only keeps the gap in front of it. */
.text > p:last-child, .text > .block:last-child { margin-bottom: 0; }
.text > p:empty:last-child::before { content: none; }

/* List items followed each other without gaps; the empty lines between them are empty paragraphs too.
   A list has no top margin: in front of it the editor keeps the empty line the old list margin made. */
.text li p, .text li .block { margin-bottom: 0; }
.text ul, .text ol { margin-top: 0; }

/* The editor needs a paragraph at the start of an item that begins with a photo: it shows nothing. */
.text li > p:first-child:empty::before { content: none; }

/* <hr> from the editor is the old dotted line <div id="linefirst">. */
.text hr {
	height: 0;
	border: 0;
	border-bottom: 1px dotted #a86109;
	margin: 0 0 25px;
	background: none;
}
