/* Headings in the page text. Loaded by inc/typography.php.
 *
 * Only text headings are changed: the page title (h1.entry-title) and headings written directly in the
 * page text (.entry-content > h2 … h6). Headings inside the theme's blocks (bookmaker boxes, the "Важно"
 * box) keep their own styles; on phones the FAQ title follows the H2 size.
 *
 * Spacing everywhere: more space above a heading than below it, so it groups with the text it introduces
 * (the theme had 0 px above and 8 px below every heading). A heading right under another heading, or at
 * the very start of the text, gets little or no space above.
 *
 * Computers and tablets (768 px and wider) keep the theme's sizes (Bootstrap 4: 40 / 32 / 28 / 24 / 20 / 16 px);
 * only their spacing changes (1.1.0).
 * Phones get a smaller scale (ratio about 1.15–1.2) in rem, so the user's own text-size setting still works:
 *   H1 28 px · H2 24 px · H3 20 px · H4 18 px · H5 16 px · H6 14 px (body text stays 16 px / 1.5).
 *   H4–H6 are close to the body size there, so they get weight 600 to stay distinct from normal text.
 */

/* ---------- All screens ---------- */

h1.entry-title,
.entry-content > h2,
.entry-content > h3,
.entry-content > h4,
.entry-content > h5,
.entry-content > h6 {
	overflow-wrap: break-word;
	text-wrap: balance;
}

/* A heading directly under another heading (e.g. H2 then H3): keep them together. */
.entry-content > h2 + h3,
.entry-content > h2 + h4,
.entry-content > h3 + h4,
.entry-content > h3 + h5,
.entry-content > h4 + h5,
.entry-content > h5 + h6 {
	margin-top: 0.5rem;
}

/* No extra space when the text starts with a heading. */
.entry-content > h2:first-child,
.entry-content > h3:first-child,
.entry-content > h4:first-child,
.entry-content > h5:first-child,
.entry-content > h6:first-child {
	margin-top: 0;
}

/* ---------- Computers and tablets: theme sizes, new spacing ---------- */

@media (min-width: 768px) {
	h1.entry-title {
		margin-bottom: 0.75rem;
	}

	.entry-content > h2 {
		margin-top: 2.5rem;
		margin-bottom: 1rem;
	}

	.entry-content > h3 {
		margin-top: 2rem;
		margin-bottom: 0.75rem;
	}

	.entry-content > h4 {
		margin-top: 1.75rem;
		margin-bottom: 0.625rem;
	}

	.entry-content > h5,
	.entry-content > h6 {
		margin-top: 1.5rem;
		margin-bottom: 0.5rem;
	}
}

/* ---------- Phones: smaller scale and spacing ---------- */

@media (max-width: 767.98px) {
	.brs-faq .brs-faq__title {
		overflow-wrap: break-word;
		text-wrap: balance;
	}

	h1.entry-title {
		margin-bottom: 1rem;
		font-size: 1.75rem;
		line-height: 1.2;
		letter-spacing: -0.01em;
	}

	.entry-content > h2 {
		margin-top: 2rem;
		margin-bottom: 0.75rem;
		font-size: 1.5rem;
		line-height: 1.25;
	}

	.brs-faq .brs-faq__title {
		font-size: 1.5rem;
		line-height: 1.25;
	}

	.entry-content > h3 {
		margin-top: 1.5rem;
		margin-bottom: 0.5rem;
		font-size: 1.25rem;
		line-height: 1.3;
	}

	.entry-content > h4 {
		margin-top: 1.25rem;
		margin-bottom: 0.5rem;
		font-size: 1.125rem;
		font-weight: 600;
		line-height: 1.35;
	}

	.entry-content > h5 {
		margin-top: 1.25rem;
		margin-bottom: 0.375rem;
		font-size: 1rem;
		font-weight: 600;
		line-height: 1.4;
	}

	.entry-content > h6 {
		margin-top: 1.25rem;
		margin-bottom: 0.375rem;
		font-size: 0.875rem;
		font-weight: 600;
		line-height: 1.4;
		letter-spacing: 0.04em;
		text-transform: uppercase;
	}
}

/* ---------- Numbered lists in the page text: steps (1.2.0) ----------
   Lists written directly in the page text (.entry-content > ol) look like a step guide: soft grey card,
   dark number tiles (like the FAQ numbers) joined by a thin line. Reversed lists and lists with letters
   or Roman numerals (type attribute) keep the browser's look. The bookmakers list is not affected.
   The marker is a zero-width string, not "none", so Safari/VoiceOver still announce a list.
   A list with start="N" gets its counter from inc/typography.php. */

.entry-content > ol:not([reversed]):not([type]) {
	--brs-step-size: 28px;
	--brs-step-gap: 14px;

	margin: 1.25rem 0 1.5rem;
	padding: 18px 20px;
	list-style-type: "\200B";
	counter-reset: brs-step;
	background: #f7f7f9;
	border: 1px solid #ececf0;
	border-radius: 14px;
}

.entry-content > ol:not([reversed]):not([type]) > li {
	position: relative;
	min-height: var(--brs-step-size);
	margin: 0;
	padding: 0 0 var(--brs-step-gap) calc(var(--brs-step-size) + 14px);
	counter-increment: brs-step;
}

.entry-content > ol:not([reversed]):not([type]) > li:last-child {
	padding-bottom: 0;
}

/* Number tile, centred on the first line of text (text is 1rem with line-height 1.5). */
.entry-content > ol:not([reversed]):not([type]) > li::before {
	content: counter(brs-step);
	position: absolute;
	top: calc((1.5rem - var(--brs-step-size)) / 2);
	left: 0;
	width: var(--brs-step-size);
	height: var(--brs-step-size);
	border-radius: 8px;
	background: #262626;
	color: #fff;
	font-size: 13px;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	line-height: var(--brs-step-size);
	text-align: center;
}

/* Thin line from one number to the next. */
.entry-content > ol:not([reversed]):not([type]) > li:not(:last-child)::after {
	content: "";
	position: absolute;
	top: calc((1.5rem + var(--brs-step-size)) / 2 + 4px);
	bottom: 4px;
	left: calc(var(--brs-step-size) / 2 - 1px);
	width: 2px;
	border-radius: 2px;
	background: #dedee4;
}

@media (max-width: 767.98px) {
	.entry-content > ol:not([reversed]):not([type]) {
		--brs-step-size: 26px;
		--brs-step-gap: 12px;

		padding: 14px 14px 14px 12px;
	}

	.entry-content > ol:not([reversed]):not([type]) > li {
		padding-left: calc(var(--brs-step-size) + 12px);
	}
}
