/* Shared content-only styles, including the iframe editor canvas. */
/* The legacy `text` preset generates .has-text-color, which is also core's
 * generic marker for every explicit text colour. Keep the preset for saved
 * content, but let specific palette choices beat that !important marker rule
 * in both the editor and frontend, regardless of generated CSS order. */
:is(.editor-styles-wrapper, .bw-block-content) .has-primary-color.has-text-color {
	color: var(--wp--preset--color--primary) !important;
}

:is(.editor-styles-wrapper, .bw-block-content) .has-secondary-color.has-text-color {
	color: var(--wp--preset--color--secondary) !important;
}

:is(.editor-styles-wrapper, .bw-block-content) .has-accent-color.has-text-color {
	color: var(--wp--preset--color--accent) !important;
}

:is(.editor-styles-wrapper, .bw-block-content) .has-background-color.has-text-color {
	color: var(--wp--preset--color--background) !important;
}

:is(.editor-styles-wrapper, .bw-block-content) .has-surface-color.has-text-color {
	color: var(--wp--preset--color--surface) !important;
}

:is(.editor-styles-wrapper, .bw-block-content) .has-muted-color.has-text-color {
	color: var(--wp--preset--color--muted) !important;
}

:is(.editor-styles-wrapper, .bw-block-content) .has-border-color.has-text-color {
	color: var(--wp--preset--color--border) !important;
}

.editor-styles-wrapper,
.bw-block-content {
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--base);
	font-weight: var(--wp--custom--bw--body-weight);
	line-height: var(--wp--custom--bw--line-height);
	color: var(--wp--preset--color--text);
}

:where(.editor-styles-wrapper, .bw-block-content) :is(h1, h2, h3, h4, h5, h6) {
	font-family: var(--wp--preset--font-family--heading);
	font-weight: var(--wp--custom--bw--heading-weight);
}

:where(.editor-styles-wrapper, .bw-block-content) :where(p, li, figcaption) > a {
	color: var(--wp--preset--color--accent);
	text-underline-offset: 0.15em;
}

:where(.editor-styles-wrapper, .bw-block-content) :where(a, button):focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 3px;
}

/* Top-level classic PHP content needs a layout container. Nested block layouts
 * remain owned by WordPress, including Columns, Query Loop and Woo blocks.
 * Gutters belong to constrained children: the parent stays unpadded so blocks
 * with an explicit width: 100% (such as Cover) can span the full page. */
.bw-block-content > :where(:not(.alignfull, .alignleft, .alignright)) {
	max-width: min(calc(100% - 2 * var(--wp--preset--spacing--md)), var(--wp--style--global--content-size));
	margin-inline: auto;
}

.bw-block-content > .alignwide {
	max-width: min(calc(100% - 2 * var(--wp--preset--spacing--md)), var(--wp--style--global--wide-size));
}

.bw-block-content {
	display: flow-root;
}

.bw-block-content > .alignfull {
	max-width: none;
	margin-inline: 0;
}

.bw-block-content > * + * {
	margin-block-start: var(--wp--preset--spacing--lg);
}

/* No animation hook hides content. Motion is a JavaScript enhancement only. */

/* BW Woo patterns: structural rules only; colour and type come from theme.json. */
:where(.bw-pattern-hero, .bw-pattern-section, .bw-pattern-cta, .bw-pattern-trust-strip) {
	padding-block: var(--bw-section-spacing-top) var(--bw-section-spacing-bottom);
}

:where(.bw-pattern-hero__inner, .bw-pattern-image-text__inner) {
	align-items: center;
	gap: clamp(var(--bw-space-xl), 6vw, var(--bw-space-3xl));
}

.bw-pattern-hero__content,
.bw-pattern-image-text__content {
	min-width: 0;
}

.bw-pattern-hero__media,
.bw-pattern-image-text__media {
	min-height: clamp(20rem, 42vw, 36rem);
}

.bw-pattern-eyebrow {
	margin-block-end: var(--wp--preset--spacing--sm);
}

:where(.bw-pattern-card-grid, .bw-pattern-logo-grid, .bw-pattern-trust-strip__items) {
	gap: var(--bw-space-component);
}

:where(.bw-pattern-card-grid, .bw-pattern-logo-grid) > .wp-block-column {
	display: flex;
	min-width: 0;
}

.bw-pattern-card {
	display: flex;
	flex: 1;
	flex-direction: column;
	padding: var(--bw-space-content);
}

.bw-pattern-logo {
	display: grid;
	flex: 1;
	min-height: 9rem;
	padding: var(--bw-space-content);
	place-items: center;
	text-align: center;
}

.bw-pattern-intro {
	max-width: var(--wp--style--global--content-size);
}

.bw-pattern-cta__inner {
	max-width: var(--wp--style--global--content-size);
	text-align: center;
}

.bw-pattern-cta .wp-block-buttons {
	justify-content: center;
}

.bw-pattern-trust-strip__items > .wp-block-column {
	min-width: 0;
}

@media (max-width: 63.99rem) {
	:where(.bw-pattern-card-grid--four, .bw-pattern-logo-grid, .bw-pattern-trust-strip__items) {
		flex-wrap: wrap !important;
	}

	:where(.bw-pattern-card-grid--four, .bw-pattern-logo-grid, .bw-pattern-trust-strip__items) > .wp-block-column {
		flex-basis: calc(50% - var(--bw-space-component)) !important;
	}
}

@media (max-width: 37.5rem) {
	:where(.bw-pattern-hero, .bw-pattern-section, .bw-pattern-cta, .bw-pattern-trust-strip) {
		padding-block: var(--bw-space-3xl);
	}

	:where(.bw-pattern-card-grid--four, .bw-pattern-logo-grid, .bw-pattern-trust-strip__items) > .wp-block-column {
		flex-basis: 100% !important;
	}

	.bw-pattern-cta :where(.wp-block-button, .wp-block-button__link) {
		width: 100%;
	}
}
