/**
 * Vibrant Partners - Article text
 *
 * The text of a partner page: plain blocks, no per-block settings needed.
 * Font, size, colour, links and the reading width all come from theme.json,
 * so a partner reads like the rest of the site. What is set here is the
 * vertical rhythm, and one step down the heading scale.
 *
 * Why the rhythm needs saying at all: a flow layout puts the same block gap
 * between every pair of blocks, so a heading ends up as far from the
 * paragraph it introduces as from the one it follows. A heading should own
 * the space above it. Same for an image or a row of buttons: they read as a
 * break in the text, not as another paragraph.
 *
 * Two scopes, one set of rules. .vb-article__body is the frontend wrapper
 * from the single template, .editor-styles-wrapper is the editor canvas.
 * This file loads in both, so writing a partner shows what it will be.
 *
 * Everything here is a class deeper than the layout css it overrides, and
 * preset classes from the block toolbar carry !important, so a conscious
 * choice in the editor still wins.
 *
 * @author  Accent - https://accentinteractive.nl
 * @package Vibrant
 * @since   1.2.0
 */

.vb-article__body,
.editor-styles-wrapper {
	/* The theme's block gap: the baseline space between two paragraphs. */
	--vb-article-flow: 1rem;
	--vb-article-space-h2: 2.5rem;
	--vb-article-space-h3: 2rem;
	--vb-article-space-h4: 1.5rem;
	--vb-article-space-media: 2rem;
}

/* ==========================================================================
   Headings
   ==========================================================================
   One step down from the theme scale. The page title is already 32-48px, and
   the theme's own h2 lands in exactly that range: in a 790px column the two
   would read as equals. So an h2 here takes the size the theme gives an h3,
   an h3 takes the h4, and so on. Family, weight and colour stay the theme's,
   so the page still speaks the same language as every other page. */

.vb-article__body :is(h2, h3, h4, h5, h6),
.editor-styles-wrapper :is(h2, h3, h4, h5, h6) {
	margin-block-end: var(--vb-article-flow);
	text-wrap: balance;
}

.vb-article__body h2,
.editor-styles-wrapper h2 {
	margin-block-start: var(--vb-article-space-h2);
	font-size: var(--wp--preset--font-size--display-subsection, 1.75rem);
	line-height: 1.2;
}

.vb-article__body h3,
.editor-styles-wrapper h3 {
	margin-block-start: var(--vb-article-space-h3);
	font-size: var(--wp--preset--font-size--heading-large, 1.5rem);
	line-height: 1.25;
}

.vb-article__body h4,
.editor-styles-wrapper h4 {
	margin-block-start: var(--vb-article-space-h4);
	font-size: var(--wp--preset--font-size--heading-medium, 1.25rem);
	line-height: 1.3;
}

.vb-article__body :is(h5, h6),
.editor-styles-wrapper :is(h5, h6) {
	margin-block-start: var(--vb-article-space-h4);
}

/* ==========================================================================
   Text
   ==========================================================================
   A paragraph and a list item are the same sentence in a different shape, so
   they are the same size, weight and colour: the theme's body text. Nothing
   is declared here, that is the point - the rules below only put the spacing
   back that the flow layout flattens. */

.vb-article__body :is(p, ul, ol, dl, pre, blockquote),
.editor-styles-wrapper :is(p, ul, ol, dl, pre) {
	margin-block-end: var(--vb-article-flow);
}

.vb-article__body :is(ul, ol),
.editor-styles-wrapper :is(ul, ol) {
	/* Far enough for the bullet to hang outside the text, no further. */
	padding-inline-start: 1.5rem;
}

/* The terracotta bullet from the design, the same one the cards use. */
.vb-article__body ul li::marker,
.editor-styles-wrapper ul li::marker {
	color: var(--wp--preset--color--terracotta, #A23E2B);
}

/* ==========================================================================
   Media and buttons
   ==========================================================================
   A break in the text, so more air than a paragraph gets. Named on the child
   of the flow container, not on every figure, or a figure inside a gallery
   would be spaced twice. */

.vb-article__body > :is(figure, .wp-block-image, .wp-block-gallery, .wp-block-embed, .wp-block-video, .wp-block-buttons, .wp-block-table, .wp-block-media-text, .wp-block-columns, .wp-block-details),
.vb-article__body .entry-content > :is(figure, .wp-block-image, .wp-block-gallery, .wp-block-embed, .wp-block-video, .wp-block-buttons, .wp-block-table, .wp-block-media-text, .wp-block-columns, .wp-block-details),
.editor-styles-wrapper .is-root-container > :is(figure, .wp-block-image, .wp-block-gallery, .wp-block-embed, .wp-block-video, .wp-block-buttons, .wp-block-table, .wp-block-media-text, .wp-block-columns, .wp-block-details) {
	margin-block: var(--vb-article-space-media);
}

/* A caption belongs to its image, so it stays close to it. */
.vb-article__body figcaption,
.editor-styles-wrapper figcaption {
	margin-block: 0.5rem 0;
}

/* ==========================================================================
   Edges
   ==========================================================================
   The wrapper already spaces the body against the hero and the footer, so
   the first and last block add nothing on top of that. Last in the file and
   a class deeper, so they beat every rule above whatever block it is. */

.vb-article__body > :first-child,
.vb-article__body .entry-content > :first-child,
.editor-styles-wrapper .is-root-container > :first-child {
	margin-block-start: 0;
}

.vb-article__body > :last-child,
.vb-article__body .entry-content > :last-child,
.editor-styles-wrapper .is-root-container > :last-child {
	margin-block-end: 0;
}

/* ==========================================================================
   Desktop
   ==========================================================================
   Wider column, so the same rhythm needs a little more of everything to keep
   its proportions. */

@media (min-width: 1024px) {

	.vb-article__body,
	.editor-styles-wrapper {
		--vb-article-space-h2: 3rem;
		--vb-article-space-h3: 2.5rem;
		--vb-article-space-h4: 2rem;
		--vb-article-space-media: 2.5rem;
	}
}
