/* Page sections share the same rhythm. Cards belong inside their containers. */
.amp-section,
:is(.is-style-amp-section-white, .is-style-amp-section-soft, .is-style-amp-section-gradient, .is-style-amp-section-dark, .is-style-amp-section-image) {
	--amp-section-space: var(--wp--preset--spacing--80);
	--amp-section-width: var(--wp--style--global--content-size);
	--amp-surface-text: var(--wp--preset--color--text);
	--amp-surface-heading: var(--wp--preset--color--dark);
	--amp-surface-link: var(--wp--preset--color--primary);
	box-sizing: border-box;
	margin-block: 0;
	padding-block: var(--amp-section-space);
	padding-inline: var(--wp--custom--layout--gutter);
	border-radius: 0;
	color: var(--amp-surface-text);
	background-color: var(--wp--preset--color--white);
}

.amp-section-space-compact { --amp-section-space: var(--wp--preset--spacing--70); }
.amp-section-space-large { --amp-section-space: var(--wp--preset--spacing--90); }
.amp-section-width-narrow { --amp-section-width: var(--wp--custom--layout--narrow); }
.amp-section-width-wide { --amp-section-width: var(--wp--style--global--wide-size); }
.amp-section-width-full { --amp-section-width: 100%; }

.is-style-amp-section-soft { background-color: var(--wp--custom--surface--purple-soft); }
.is-style-amp-section-gradient { background-image: var(--wp--preset--gradient--soft-purple); }

:is(.is-style-amp-section-dark, .is-style-amp-section-image) {
	--amp-surface-text: var(--wp--preset--color--white);
	--amp-surface-heading: var(--wp--preset--color--white);
	--amp-surface-link: var(--wp--preset--color--white);
	background-color: var(--wp--preset--color--dark);
}

/* Respect Core Cover's light-surface classification after a media/overlay change. */
.is-style-amp-section-image.is-light {
	--amp-surface-text: var(--wp--preset--color--text);
	--amp-surface-heading: var(--wp--preset--color--dark);
	--amp-surface-link: var(--wp--preset--color--primary);
}

.amp-section :where(h1, h2, h3, h4, h5, h6) { color: var(--amp-surface-heading); }
.amp-section :where(a:not(.wp-element-button):not(.wp-block-button__link)) { color: var(--amp-surface-link); }

/* The outer focus ring follows the section surface, including light Covers. */
.amp-section :where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
	outline-color: var(--amp-surface-heading);
}

:is(.is-style-amp-section-dark, .is-style-amp-section-image) :where(.wp-element-button, .wp-block-button__link) {
	background-color: var(--wp--preset--color--white);
	color: var(--wp--preset--color--primary);
	box-shadow: 0 8px 24px color-mix(in srgb, var(--wp--preset--color--black) 12%, transparent);
}

:is(.is-style-amp-section-dark, .is-style-amp-section-image) :where(.wp-element-button, .wp-block-button__link):hover {
	background-color: var(--wp--preset--color--soft);
	color: var(--wp--preset--color--primary-hover);
}

.is-style-amp-section-image.is-light :where(.wp-element-button, .wp-block-button__link) {
	background-color: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--white);
}

.is-style-amp-section-image.is-light :where(.wp-element-button, .wp-block-button__link):hover {
	background-color: var(--wp--preset--color--primary-hover);
	color: var(--wp--preset--color--white);
}

.amp-container.wp-block-group {
	box-sizing: border-box;
	inline-size: 100%;
	max-inline-size: var(--amp-section-width, var(--wp--style--global--content-size));
	min-inline-size: 0;
	margin-inline: auto;
	padding: 0;
}

.amp-section > .amp-container,
.amp-section > .wp-block-cover__inner-container > .amp-container {
	margin-block: 0;
}

/* Core Cover supplies media selection, responsive images, and the overlay. */
.is-style-amp-section-image.wp-block-cover {
	min-block-size: 0;
	color: var(--amp-surface-text);
}

.is-style-amp-section-image > .wp-block-cover__inner-container {
	inline-size: 100%;
	max-inline-size: var(--amp-section-width);
	margin-inline: auto;
}

/* Styles also work on a core Group selected directly, without a pattern wrapper. */
.amp-section.wp-block-group > :where(:not(.amp-container)) {
	max-inline-size: var(--amp-section-width);
	margin-inline: auto;
}

/* Retain nested gutters even when later Hero/library rules set section padding. */
.amp-section :is(.amp-section, .amp-hero.amp-section, .amp-library.amp-section) {
	padding-inline: 0;
	margin-inline: 0;
}

.amp-section .amp-section:first-child { padding-block-start: 0; }
.amp-section .amp-section:last-child { padding-block-end: 0; }

.is-style-amp-section-heading.wp-block-group {
	max-inline-size: 48rem;
	margin-block-end: var(--wp--preset--spacing--60);
}

.is-style-amp-section-heading > :first-child,
.is-style-amp-card > :first-child { margin-block-start: 0; }

.is-style-amp-section-heading > :last-child,
.is-style-amp-card > :last-child { margin-block-end: 0; }

.is-style-amp-section-heading:last-child { margin-block-end: 0; }

.is-style-amp-section-heading :where(h2, h3) {
	margin-block-end: var(--wp--preset--spacing--30);
}

.is-style-amp-section-heading :where(p) {
	max-inline-size: 42rem;
	color: var(--wp--custom--surface--muted);
}

:is(.is-style-amp-section-dark, .is-style-amp-section-image) .is-style-amp-section-heading :where(p) {
	color: color-mix(in srgb, var(--wp--preset--color--white) 78%, transparent);
}

.is-style-amp-grid.wp-block-group {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--wp--custom--layout--card-min)), 1fr));
	gap: var(--wp--preset--spacing--50);
	align-items: stretch;
}

.is-style-amp-grid.wp-block-group > * {
	min-inline-size: 0;
	margin-block: 0;
}

.is-style-amp-grid.wp-block-group > :only-child {
	max-inline-size: var(--wp--custom--layout--narrow);
}

.is-style-amp-grid:empty { display: none; }

.is-style-amp-card.wp-block-group {
	--amp-surface-text: var(--wp--preset--color--text);
	--amp-surface-heading: var(--wp--preset--color--dark);
	--amp-surface-link: var(--wp--preset--color--primary);
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--40);
	min-inline-size: 0;
	padding: clamp(1.25rem, 2.2vw, 1.75rem);
	border: 1px solid var(--wp--custom--border--color);
	border-radius: var(--wp--custom--radius--medium);
	background-color: var(--wp--preset--color--white);
	color: var(--amp-surface-text);
	box-shadow: var(--wp--preset--shadow--soft);
}

.is-style-amp-card.wp-block-group > * { margin-block: 0; }
.is-style-amp-card.wp-block-group > .wp-block-buttons:last-child { margin-block-start: auto; }

.is-style-amp-card :where(h2, h3) {
	font-size: var(--wp--preset--font-size--heading-small);
	line-height: 1.4;
}

.is-style-amp-card :where(p) {
	color: var(--wp--custom--surface--muted);
}

.is-style-amp-card :where(.wp-element-button, .wp-block-button__link) {
	background-color: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--white);
}

.is-style-amp-card :where(.wp-element-button, .wp-block-button__link):hover {
	background-color: var(--wp--preset--color--primary-hover);
	color: var(--wp--preset--color--white);
}

/* Let full-width editorial sections meet without the parent flow's block gap. */
.amp-section + .amp-section { margin-block-start: 0; }

/* Consecutive matching surfaces use one shared interval between their content. */
.amp-section.is-style-amp-section-white + .amp-section.is-style-amp-section-white,
.amp-section.is-style-amp-section-soft + .amp-section.is-style-amp-section-soft,
.amp-section.is-style-amp-section-dark + .amp-section.is-style-amp-section-dark {
	padding-block-start: 0;
}

@media (max-width: 47.99rem) {
	.amp-section,
	:is(.is-style-amp-section-white, .is-style-amp-section-soft, .is-style-amp-section-gradient, .is-style-amp-section-dark, .is-style-amp-section-image) {
		--amp-section-space: clamp(3rem, 11vw, 4rem);
	}

	.amp-section-space-compact { --amp-section-space: clamp(2.5rem, 9vw, 3.25rem); }
	.amp-section-space-large { --amp-section-space: clamp(3.5rem, 13vw, 4.75rem); }

	.is-style-amp-section-heading.wp-block-group {
		margin-block-end: var(--wp--preset--spacing--50);
	}
}

/* Shared editorial design: the approved topics/steps reference family.
 * Opt in with amp-reference-* classes; existing block styles retain their appearance.
 * Section rhythm and widths continue to use amp-section / amp-section-width-*.
 */
.amp-reference-section.amp-section {
	--amp-surface-heading: var(--wp--preset--color--primary);
	position: relative;
	isolation: isolate;
	overflow: clip;
	background: var(--wp--preset--color--white);
}


.amp-reference-heading.wp-block-group {
	max-inline-size: 52rem;
	margin-inline: auto;
	margin-block: 0 var(--wp--preset--spacing--70);
	text-align: center;
}
.amp-reference-heading > *,
.amp-reference-card-body > * { margin-block: 0; }
.amp-reference-heading > * + * { margin-block-start: var(--wp--preset--spacing--50); }
.amp-reference-heading h2 {
	font-size: var(--wp--preset--font-size--display);
	line-height: 1.3;
	text-wrap: balance;
}
.amp-reference-heading > p:not(.amp-reference-kicker) {
	text-wrap: pretty;
}
.amp-reference-heading .amp-reference-kicker {
	display: inline-flex;
	align-items: center;
	gap: var(--wp--preset--spacing--30);
	padding: var(--wp--preset--spacing--30) var(--wp--preset--spacing--50);
	border-radius: var(--wp--custom--radius--pill);
	background: color-mix(in srgb, var(--wp--preset--color--primary) 6%, transparent);
	color: var(--wp--preset--color--primary);
	font-size: var(--wp--preset--font-size--medium);
	font-weight: 700;
}

.amp-reference-grid.wp-block-group {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: var(--wp--preset--spacing--50);
	align-items: stretch;
	margin-block: 0;
}
.amp-reference-card.wp-block-group {
	position: relative;
	display: flex;
	flex-direction: column;
	min-inline-size: 0;
	margin-block: 0;
	padding: var(--wp--preset--spacing--20);
	border-radius: var(--wp--custom--radius--large);
	background: var(--wp--preset--color--white);
	box-shadow: var(--wp--preset--shadow--soft);
}
.amp-reference-media.wp-block-group {
	position: relative;
	margin: 0;
	min-inline-size: 0;
}
.amp-reference-image.wp-block-image {
	margin: 0;
	aspect-ratio: 8 / 5;
	border-radius: var(--wp--custom--radius--medium);
	overflow: hidden;
	background: color-mix(in srgb, var(--wp--preset--color--primary) 5%, var(--wp--preset--color--white));
}
.amp-reference-image img {
	display: block;
	inline-size: 100%;
	block-size: 100%;
	object-fit: cover;
}
.amp-reference-image:not(:has(img[src]:not([src=""]))) img { visibility: hidden; }
.wp-site-blocks .amp-reference-image:not(:has(img[src]:not([src=""]))) { display: none; }
.wp-site-blocks .amp-reference-media:where(:not(:has(img[src]:not([src=""]), :is(.amp-step-number, .amp-reference-badge):not(:empty)))) { display: none; }

.amp-reference-card-body.wp-block-group {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: var(--wp--preset--spacing--30);
	margin: 0;
	padding: var(--wp--preset--spacing--70) var(--wp--preset--spacing--40) var(--wp--preset--spacing--50);
	text-align: start;
}
.amp-reference-card-body h3 { font-size: var(--wp--preset--font-size--heading-small); line-height: 1.5; }
.amp-reference-heading > p:not(.amp-reference-kicker),
.amp-reference-card-body > p {
	color: var(--wp--custom--surface--muted);
	font-size: var(--wp--preset--font-size--large);
	line-height: 1.8;
}
.amp-reference-actions.wp-block-buttons { margin-block-start: auto; padding-block-start: var(--wp--preset--spacing--40); }
.amp-reference-actions > .wp-block-button { inline-size: 100%; }
.amp-reference-actions .wp-block-button__link {
	position: relative;
	display: flex;
	justify-content: center;
	inline-size: 100%;
	padding: var(--wp--preset--spacing--30) 3.75rem;
	border-radius: var(--wp--custom--radius--large);
	background: var(--wp--preset--color--soft);
	color: var(--wp--preset--color--primary);
	box-shadow: none;
	font-size: var(--wp--preset--font-size--large);
}

.amp-reference-actions .wp-block-button__link:hover { background: var(--wp--preset--color--primary); color: var(--wp--preset--color--white); box-shadow: none; }
.amp-reference-actions .wp-block-button__link:focus-visible { outline: 3px solid var(--wp--preset--color--primary); outline-offset: 3px; }

/* Optional numeric badges: presentation only; empty blocks render nothing. */
.amp-reference-badge,
.amp-step-card .amp-step-number {
	display: grid;
	place-items: center;
	inline-size: 5rem;
	block-size: 5rem;
	margin: 0;
	border-radius: var(--wp--custom--radius--pill);
	background: color-mix(in srgb, var(--wp--preset--color--soft) 95%, transparent);
	color: var(--wp--preset--color--primary);
	font-size: var(--wp--preset--font-size--heading);
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	direction: ltr;
}
.amp-reference-badge:empty,
.amp-step-card .amp-step-number:empty { display: none; }
.amp-reference-media:not(:has(img[src]:not([src=""]))) :is(.amp-step-number, .amp-reference-badge) {
	position: static;
}

/* Shared extensions: optional content, split sections and grid variations. */
.amp-reference-kicker:empty,
.amp-reference-label:empty,
.amp-reference-actions:not(:has(.wp-block-button)) { display: none; }

.amp-reference-grid.amp-reference-grid--two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.amp-reference-grid.amp-reference-grid--four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.amp-reference-grid.amp-reference-grid--three-notes { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.amp-reference-tone-green { --amp-reference-accent: var(--wp--preset--color--green); }
.amp-reference-tone-orange { --amp-reference-accent: var(--wp--preset--color--accent); }
.amp-reference-card.amp-reference-card--tinted {
	background: color-mix(in srgb, var(--amp-reference-accent, var(--wp--preset--color--primary)) 5%, var(--wp--preset--color--white));
	box-shadow: none;
}
.amp-reference-card--tinted h3 { color: color-mix(in srgb, var(--amp-reference-accent, var(--wp--preset--color--primary)) 70%, var(--wp--preset--color--dark)); }
.amp-reference-card--compact .amp-reference-card-body { padding: var(--wp--preset--spacing--50); }

.amp-reference-split.wp-block-group {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--wp--preset--spacing--70);
	align-items: center;
	margin-block: 0;
}
.amp-reference-split > * { min-inline-size: 0; margin-block: 0; }
.amp-reference-split .amp-reference-image { aspect-ratio: 4 / 5; box-shadow: var(--wp--preset--shadow--soft); }
.amp-reference-split--support .amp-reference-image { aspect-ratio: 1; }
.amp-reference-copy.wp-block-group { display: flex; flex-direction: column; gap: var(--wp--preset--spacing--50); }
.amp-reference-copy .amp-reference-heading { margin: 0; text-align: start; }
.amp-reference-copy .amp-reference-heading h2 { font-size: var(--wp--preset--font-size--heading); }
.amp-reference-copy > * { margin-block: 0; }
.amp-reference-label {
	position: absolute;
	inset-inline-start: var(--wp--preset--spacing--40);
	inset-block-end: var(--wp--preset--spacing--40);
	max-inline-size: min(75%, 16rem);
	margin: 0;
	padding: var(--wp--preset--spacing--30) var(--wp--preset--spacing--40);
	border-radius: var(--wp--custom--radius--medium);
	background: var(--wp--preset--color--white);
	box-shadow: var(--wp--preset--shadow--soft);
	color: var(--wp--preset--color--primary);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 700;
}
.wp-site-blocks .amp-reference-split:not(:has(.amp-reference-media img[src]:not([src=""]))) {
	grid-template-columns: minmax(0, 1fr);
}
.amp-reference-list.wp-block-list {
	margin-block: 0;
	padding-inline-start: var(--wp--preset--spacing--50);
	color: var(--wp--custom--surface--muted);
	font-size: var(--wp--preset--font-size--body);
	line-height: 1.9;
}
.amp-reference-list li + li { margin-block-start: var(--wp--preset--spacing--20); }
.amp-reference-list li::marker { color: color-mix(in srgb, var(--amp-reference-accent, var(--wp--preset--color--green)) 70%, var(--wp--preset--color--dark)); }
.amp-reference-card-body > .amp-reference-list {
	padding-block-start: var(--wp--preset--spacing--30);
	border-block-start: 1px solid var(--wp--custom--border--color);
}
.amp-reference-actions.amp-reference-actions--inline {
	display: flex;
	flex-wrap: wrap;
	gap: var(--wp--preset--spacing--30);
}
.amp-reference-actions.amp-reference-actions--inline > .wp-block-button { inline-size: auto; flex: 1 1 12rem; }
.amp-reference-actions--inline .wp-block-button__link { padding-inline: var(--wp--preset--spacing--50); }
.amp-reference-actions.amp-reference-actions--inline:not(:has(.wp-block-button)) { display: none; }
.amp-reference-actions .amp-reference-action-primary .wp-block-button__link { background: var(--wp--preset--color--primary); color: var(--wp--preset--color--white); }
.amp-reference-actions .amp-reference-action-primary .wp-block-button__link:hover { background: var(--wp--preset--color--primary-hover); }
.amp-reference-actions .amp-reference-action-outline .wp-block-button__link {
	border: 1px solid var(--wp--preset--color--primary);
	background: var(--wp--preset--color--white);
	color: var(--wp--preset--color--primary);
}
.amp-reference-actions .amp-reference-action-outline .wp-block-button__link:hover { background: var(--wp--preset--color--soft); }
.amp-reference-note { text-align: center; }
.amp-reference-note > * { margin-block: 0; }
.amp-reference-note h3 { font-size: var(--wp--preset--font-size--body); line-height: 1.5; }
.amp-reference-note p { font-size: var(--wp--preset--font-size--small); color: var(--wp--custom--surface--muted); }
.amp-reference-split + .amp-reference-grid--three-notes { margin-block-start: var(--wp--preset--spacing--60); }
.amp-reference-card--stat { text-align: center; }
.amp-reference-card--stat .amp-reference-stat-value {
	color: color-mix(in srgb, var(--amp-reference-accent, var(--wp--preset--color--primary)) 70%, var(--wp--preset--color--dark));
	font-size: var(--wp--preset--font-size--heading);
	font-weight: 700;
	line-height: 1.3;
	font-variant-numeric: tabular-nums;
}
.amp-reference-card--stat h3 { font-size: var(--wp--preset--font-size--body); }
.amp-reference-card--stat .amp-reference-card-body > p:not(.amp-reference-stat-value) { font-size: var(--wp--preset--font-size--small); }

/* Optional journey numbers and editorial quotes reuse the reference surfaces. */
.amp-reference-journey-step.wp-block-group {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--wp--preset--spacing--40);
	position: relative;
	margin: 0;
	text-align: center;
}
.amp-reference-journey-step > * { margin-block: 0; }
.amp-reference-journey-step .amp-reference-badge {
	background: color-mix(in srgb, var(--amp-reference-accent, var(--wp--preset--color--primary)) 7%, var(--wp--preset--color--white));
	color: color-mix(in srgb, var(--amp-reference-accent, var(--wp--preset--color--primary)) 70%, var(--wp--preset--color--dark));
}
.amp-reference-journey-step h3 { font-size: var(--wp--preset--font-size--heading-small); line-height: 1.5; }
.amp-reference-journey-step > p:not(.amp-reference-badge) { color: var(--wp--custom--surface--muted); line-height: 1.8; }
.amp-reference-quote.wp-block-quote {
	margin: 0;
	padding: var(--wp--preset--spacing--50);
	border: 0;
	border-radius: var(--wp--custom--radius--medium);
	background: var(--wp--preset--color--soft);
	color: var(--wp--preset--color--primary);
	font-size: var(--wp--preset--font-size--large);
	line-height: 1.8;
}
.amp-reference-quote > * { margin-block: 0; }
.amp-reference-card--contact .amp-reference-card-body { text-align: center; }
.amp-reference-card--contact h3 { font-size: var(--wp--preset--font-size--large); }
.amp-reference-card--contact .amp-reference-card-body > p { font-size: var(--wp--preset--font-size--small); }
.amp-reference-grid--fluid:empty { display: none; }
@media (min-width: 64.01rem) {
	.amp-reference-journey-step:has(.amp-reference-badge:not(:empty)) + .amp-reference-journey-step:has(.amp-reference-badge:not(:empty))::before {
		content: "";
		position: absolute;
		inset-block-start: 2.5rem;
		inset-inline-start: calc(-50% - var(--wp--preset--spacing--50) / 2 + 2.5rem);
		inline-size: calc(100% + var(--wp--preset--spacing--50) - 5rem);
		border-block-start: 1px dashed color-mix(in srgb, var(--wp--preset--color--primary) 20%, transparent);
		pointer-events: none;
	}
}

/* Editorial feeds use the reference card tokens without changing their data source. */
.amp-reference-articles .wp-block-post-template { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--wp--preset--spacing--50); padding: 0; margin: 0; list-style: none; }
.amp-reference-articles .wp-block-post-template > li { min-inline-size: 0; }
.amp-reference-articles .amp-article-card {
 display: flex; flex-direction: column; gap: var(--wp--preset--spacing--30); height: 100%;
 margin: 0; padding: var(--wp--preset--spacing--30); border: 0;
 border-radius: var(--wp--custom--radius--large); background: var(--wp--preset--color--white); box-shadow: var(--wp--preset--shadow--soft);
}
.amp-reference-articles .amp-article-card > * { margin-block: 0; }
.amp-reference-articles .amp-article-card figure img { width: 100%; aspect-ratio: 8 / 5; object-fit: cover; border-radius: var(--wp--custom--radius--medium); box-shadow: none; }
.amp-reference-articles .amp-related-category { align-self: flex-start; padding: var(--wp--preset--spacing--10) var(--wp--preset--spacing--30); border-radius: var(--wp--custom--radius--pill); background: var(--wp--preset--color--soft); color: var(--wp--preset--color--primary); font-size: var(--wp--preset--font-size--small); }
.amp-reference-articles .amp-article-card .wp-block-post-title { font-size: var(--wp--preset--font-size--heading-small); line-height: 1.5; }
.amp-reference-articles .amp-article-card .wp-block-post-title a { color: var(--wp--preset--color--primary); text-decoration: none; }
.amp-reference-articles .amp-article-card time { margin-block-start: auto; padding-block-start: var(--wp--preset--spacing--40); color: var(--wp--custom--surface--muted); font-size: var(--wp--preset--font-size--small); }
.amp-reference-actions .amp-reference-action-warm .wp-block-button__link { background: var(--wp--preset--color--accent); color: var(--wp--preset--color--dark); }
.amp-reference-actions .amp-reference-action-warm .wp-block-button__link:hover { background: var(--wp--preset--color--accent-hover); color: var(--wp--preset--color--dark); }
.amp-reference-articles .amp-feed-heading { justify-content: center; margin-block-end: var(--wp--preset--spacing--60); text-align: center; }
.amp-reference-articles .amp-feed-heading h2 { font-size: var(--wp--preset--font-size--heading); color: var(--wp--preset--color--primary); }
