@charset "UTF-8";

/**
 * spacing.css 2.1.0
 * Author: hybrid.
 * Type: core
 *
 * Vertical rhythm and content flow — margin-top between sibling elements.
 * Uses lobotomized owl pattern (A + B) on an explicit list: a component that
 * needs space after it is registered in COMPONENTS.
 * All rules use :where() (specificity 0): override them by redeclaring the rule
 * in styles.css, or by overriding the variables, with no !important.
 * Inside this file, order is the only arbiter: FLOW, COMPONENTS, TITLES, EXCEPTIONS.
 *
 * Sections
 * CONFIG      — tokens
 * CORE        — native HTML elements, framework classes, titles
 * EXCEPTIONS  — where the flow must not apply
 *
 * Tokens
 * --content-spacing      vertical rhythm between sibling elements (p, h, ul...)
 * --title-break-spacing  before an h1 / h2 that follows another element
 *                        (neutral default: same as --content-spacing)
 * --label-spacing        between a form label and its field
 *
 * Derived tokens (--label-spacing, --title-break-spacing) are declared on :root:
 * a container that overrides --content-spacing must redeclare them too.
 *
 * Classes
 * .short   title attached to the next element (no margin after it)
 *
 * Dependencies
 * none (self-contained)
 */



/* ================================================================================================== */
/* ============================================= CONFIG ============================================= */
/* ================================================================================================== */

:root {
	--content-spacing: 1.5rem;
	--title-break-spacing: var(--content-spacing);
	--label-spacing: calc(var(--content-spacing) / 3);
}



/* ================================================================================================ */
/* ============================================= CORE ============================================= */
/* ================================================================================================ */


/* ============================== FLOW ============================== */

:where(
	h1:not(.short) + *, .h1:not(.short) + *,
	h2:not(.short) + *, .h2:not(.short) + *,
	h3:not(.short) + *, .h3:not(.short) + *,
	h4:not(.short) + *, .h4:not(.short) + *,
	h5:not(.short) + *, .h5:not(.short) + *,
	h6:not(.short) + *, .h6:not(.short) + *,

	p + *,
	pre + *,
	blockquote + *,
	hr + *,
	ul + *,
	ol + *,

	figure + *,
	img + *,
	svg + *,

	table + *,

	form + *,
	form > * + *
) {
	margin-top: var(--content-spacing);
}


/* ============================== COMPONENTS ============================== */

:where(
	.columns + *,
	.columnizer + *,

	.is-limited + *,

	.grid-container + *,
	.grid + *,
	.grid .items + *,
	.results + *,
	.results-title + *,

	.swiper-container + *,

	nav + *,
	.nav + *,
	.buttons + *,
	.button + *,

	* + hr,

	.table + *,
	* + .table,

	.mediaplayer + *,
	.iframe-container + *,

	.collapsible + *,
	.collapsible-toggle + *,

	.tabs + *,

	fieldset + *
) {
	margin-top: var(--content-spacing);
}

:where(form label + *) { margin-top: var(--label-spacing); }


/* ============================== TITLES ============================== */

/* After FLOW and COMPONENTS so the break wins over the regular spacing; a first child has no previous sibling */

:where(* + h1, * + h2) { margin-top: var(--title-break-spacing); }



/* ====================================================================================================== */
/* ============================================= EXCEPTIONS ============================================= */
/* ====================================================================================================== */

/* After everything else: same specificity, so the last rule wins */

:where(
	h1.short + *, .h1.short + *,
	h2.short + *, .h2.short + *,
	h3.short + *, .h3.short + *,
	h4.short + *, .h4.short + *,
	h5.short + *, .h5.short + *,
	h6.short + *, .h6.short + *,

	.hidden:not(h1) + *,
	label.hidden + *,

	section + h1,
	section + h2
) {
	margin-top: 0;
}
