/**
 * Gutenberg compatibility boundary for the reference component patterns.
 *
 * Component packages own layout, typography, colour, responsive geometry and
 * provider presentation. This file only removes wrappers and defaults that
 * WordPress adds around those source-owned slots. Keep every rule below a
 * named reference root; generic Core and legacy content must remain unchanged.
 */

/*
 * Native/protected routes preserve their stored content and can therefore
 * contain legacy intrinsic dimensions (for example an Elementor image or a
 * site logo wider than a phone viewport). Keep this boundary on the route
 * root so managed Gutenberg canvases and Core's global defaults are untouched.
 * No clipping or hidden overflow is used: content remains visible and can
 * shrink to the available inline size.
 */
body.sequoia-native-route .entry-content > *,
body.sequoia-native-route .entry-content :where(
	.elementor,
	.elementor-widget,
	.elementor-widget-container,
	.wp-block-group,
	.wp-block-columns,
	.wp-block-column,
	.wp-block-media-text,
	figure,
	table
) {
	min-inline-size: 0;
}

body.sequoia-native-route .entry-content :where(
	figure.alignleft,
	figure.alignright,
	figure.aligncenter
) {
	display: block;
	max-inline-size: 100%;
}

body.sequoia-native-route .entry-content :where(
	img,
	picture,
	svg,
	video,
	iframe,
	embed,
	object
) {
	max-inline-size: 100%;
	block-size: auto;
}

body.sequoia-native-route :where(.r-header .logo, .r-footer__logo) {
	min-inline-size: 0;
	max-inline-size: 100%;
}

body.sequoia-native-route :where(.r-header .logo, .r-footer__logo) :where(
	img,
	picture,
	svg
) {
	max-inline-size: 100%;
}

/* Named pattern roots must own their outer measure, not the entry wrapper. */
.entry-content > :where(
	.h-hero,
	.lt-hero,
	.cs-hero,
	.h-trust,
	.h-serv,
	.lt-serv,
	.h-map,
	.lt-map,
	.h-proc,
	.lt-proc,
	.faq,
	.fq-2col,
	.dark-cta,
	.c-2col,
	.ge-2col,
	.r-page,
	.r-header,
	.r-footer
) {
	max-width: none;
	margin-block-start: 0;
	margin-block-end: 0;
}

/* Corrected C/D/E package roots use the same wrapper contract. */
.entry-content > :where(
	.sequoia-process-rail,
	.cs-gal,
	.ci-grid,
	.hi-grid,
	.r-surface-band,
	.r-cutaway,
	.r-tracker,
	.r-pricing,
	.r-value-context,
	.r-diligence,
	.r-paver-inspiration
) {
	max-width: none;
	margin-block-start: 0;
	margin-block-end: 0;
}

:where(
	.sequoia-process-rail,
	.cs-gal,
	.ci-grid,
	.hi-grid,
	.r-surface-band,
	.r-cutaway,
	.r-tracker,
	.r-pricing,
	.r-value-context,
	.r-diligence,
	.r-paver-inspiration
) .is-layout-constrained > :where(:not(.alignleft):not(.alignright):not(.alignfull)) {
	max-width: none;
}

.editor-styles-wrapper :where(
	.sequoia-process-rail,
	.cs-gal,
	.ci-grid,
	.hi-grid,
	.r-surface-band,
	.r-cutaway,
	.r-tracker,
	.r-pricing,
	.r-value-context,
	.r-diligence,
	.r-paver-inspiration
) > :where(.block-editor-inner-blocks, .block-editor-block-list__layout) {
	max-width: none;
	width: 100%;
}

/* Neutralise constrained-layout wrappers generated by Group/Columns. */
:where(
	.h-hero,
	.lt-hero,
	.cs-hero,
	.h-trust,
	.h-serv,
	.lt-serv,
	.h-map,
	.lt-map,
	.h-proc,
	.lt-proc,
	.faq,
	.fq-2col,
	.dark-cta,
	.c-2col,
	.ge-2col,
	.r-page,
	.r-header,
	.r-footer
) > .wp-block-group__inner-container,
:where(
	.h-hero,
	.lt-hero,
	.cs-hero,
	.h-trust,
	.h-serv,
	.lt-serv,
	.h-map,
	.lt-map,
	.h-proc,
	.lt-proc,
	.faq,
	.fq-2col,
	.dark-cta,
	.c-2col,
	.ge-2col,
	.r-page,
	.r-header,
	.r-footer
) .is-layout-constrained > :where(:not(.alignleft):not(.alignright):not(.alignfull)) {
	max-width: none;
}

/* Core's default block margins must not create an extra band seam. */
:is(
	.h-hero,
	.lt-hero,
	.cs-hero,
	.h-trust,
	.h-serv,
	.lt-serv,
	.h-map,
	.lt-map,
	.h-proc,
	.lt-proc,
	.faq,
	.fq-2col,
	.dark-cta,
	.c-2col,
	.ge-2col,
	.r-page,
	.r-header,
	.r-footer
) > :where(.wp-block-group, .wp-block-columns, .wp-block-cover),
:where(
	.h-hero,
	.lt-hero,
	.cs-hero,
	.h-trust,
	.h-serv,
	.lt-serv,
	.h-map,
	.lt-map,
	.h-proc,
	.lt-proc,
	.faq,
	.fq-2col,
	.dark-cta,
	.c-2col,
	.ge-2col,
	.r-page,
	.r-header,
	.r-footer
) > .wp-block-group__inner-container > :where(.wp-block-group, .wp-block-columns, .wp-block-cover) {
	margin-block-start: 0;
	margin-block-end: 0;
}

:where(
	.sequoia-process-rail,
	.cs-gal,
	.ci-grid,
	.hi-grid,
	.r-surface-band,
	.r-cutaway,
	.r-tracker,
	.r-pricing,
	.r-value-context,
	.r-diligence,
	.r-paver-inspiration
) > :where(.wp-block-group, .wp-block-columns, .wp-block-cover),
:where(
	.sequoia-process-rail,
	.cs-gal,
	.ci-grid,
	.hi-grid,
	.r-surface-band,
	.r-cutaway,
	.r-tracker,
	.r-pricing,
	.r-value-context,
	.r-diligence,
	.r-paver-inspiration
) > .wp-block-group__inner-container > :where(.wp-block-group, .wp-block-columns, .wp-block-cover) {
	margin-block-start: 0;
	margin-block-end: 0;
}

/* Editor canvas wrappers receive the same neutralisation as the frontend. */
.editor-styles-wrapper :where(
	.h-hero,
	.lt-hero,
	.cs-hero,
	.h-trust,
	.h-serv,
	.lt-serv,
	.h-map,
	.lt-map,
	.h-proc,
	.lt-proc,
	.faq,
	.fq-2col,
	.dark-cta,
	.c-2col,
	.ge-2col,
	.r-page,
	.r-header,
	.r-footer
) > .block-editor-inner-blocks,
.editor-styles-wrapper :where(
	.h-hero,
	.lt-hero,
	.cs-hero,
	.h-trust,
	.h-serv,
	.lt-serv,
	.h-map,
	.lt-map,
	.h-proc,
	.lt-proc,
	.faq,
	.fq-2col,
	.dark-cta,
	.c-2col,
	.ge-2col,
	.r-page,
	.r-header,
	.r-footer
) > .block-editor-block-list__layout,
.editor-styles-wrapper :where(
	.h-hero,
	.lt-hero,
	.cs-hero,
	.h-trust,
	.h-serv,
	.lt-serv,
	.h-map,
	.lt-map,
	.h-proc,
	.lt-proc,
	.faq,
	.fq-2col,
	.dark-cta,
	.c-2col,
	.ge-2col,
	.r-page,
	.r-header,
	.r-footer
) .wp-block-group__inner-container {
	max-width: none;
	width: 100%;
}

/* Preserve source CTA classes while dropping Core's generated button defaults.
 *
 * This rule has to WIN against `global-styles-inline-css`, whose generated
 * `:root :where(.wp-element-button, .wp-block-button__link)` sits at (0,1,0).
 * Wrapped in `:where()` it was (0,1,0) as well and lost on document order --
 * which is how Core's #32373c/#fff button default reached composed CTAs at
 * all. Written out as plain class selectors it is (0,2,0) and wins outright.
 * Colour is deliberately NOT reset here any more: `components/cta-authority.css`
 * is the single owner of CTA colour. */
.r-cta-filled .wp-element-button,
.r-cta-outline .wp-element-button {
	padding: 0;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	font: inherit;
	line-height: inherit;
	text-decoration: none;
}

/*
 * Native Contact and Estimate presentation boundary.
 *
 * These routes keep their stored Page body and Gravity Forms owner. The
 * template contributes only the route class; this sheet supplies the frozen
 * wrapper geometry from trust-contact/trust-get-estimate.dc.html. Scope every
 * rule to the native route so ordinary Pages and composed reference bands retain
 * their existing layout.
 */
body.sequoia-native-route .native-contact-content,
body.sequoia-native-route .native-estimate-content {
	box-sizing: border-box;
	max-width: none;
	margin: 0;
	background: var(--sq-cream, #f6f4ee);
	color: var(--sq-body, #3f3d34);
}

body.sequoia-native-route .native-contact-content {
	padding: 64px var(--sq-gutter, 48px) 90px;
}

body.sequoia-native-route .native-estimate-hero {
	box-sizing: border-box;
	max-width: none;
	margin: 0;
	padding: 160px var(--sq-gutter, 48px) 64px;
	background: var(--sq-white, #fff);
	border-bottom: 1px solid var(--sq-line3, #e6e2d6);
}

body.sequoia-native-route .native-estimate-hero > * {
	box-sizing: border-box;
	max-width: var(--sq-wide, 1180px);
	margin-inline: auto;
}

body.sequoia-native-route .native-estimate-hero .entry-title {
	max-width: 820px;
	margin: 0;
	color: var(--sq-ink, #17160f);
	font: 700 56px/1.03 var(--sq-font-display, "Montserrat", Arial, sans-serif);
	letter-spacing: -.024em;
	text-wrap: balance;
}

body.sequoia-native-route .native-contact-content > *,
body.sequoia-native-route .native-estimate-content > * {
	box-sizing: border-box;
}

body.sequoia-native-route .native-contact-content :is(.c-2col, .ge-2col),
body.sequoia-native-route .native-estimate-content :is(.c-2col, .ge-2col) {
	box-sizing: border-box;
	max-width: var(--sq-wide, 1180px);
	margin-inline: auto;
	min-inline-size: 0;
}

/* Frozen Contact wrapper: two columns at desktop, one at <=900px. */
body.sequoia-native-route .native-contact-content .c-2col {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	align-items: start;
	gap: 44px;
}

body.sequoia-native-route .native-contact-content .c-lines {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	gap: 2px;
	min-inline-size: 0;
}

/* Frozen Estimate wrapper: copy/form ratio and two-column form rows. */
body.sequoia-native-route .native-estimate-content #ge-form {
	box-sizing: border-box;
	max-width: none;
	margin: 0;
	padding: 40px var(--sq-gutter, 48px) 100px;
	background: var(--sq-cream, #f6f4ee);
}

body.sequoia-native-route .native-estimate-content .ge-2col {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
	align-items: start;
	gap: 44px;
}

body.sequoia-native-route .native-estimate-content .ge-form-2 {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	gap: 14px;
}

/* Core block layout support is printed after theme styles. Keep these native
 * layout declarations at higher specificity and repeat the source ladder. */
@media (max-width: 940px) {
	body.sequoia-native-route .native-estimate-content .ge-2col,
	body.sequoia-native-route .native-estimate-content .ge-form-2 {
		grid-template-columns: minmax(0, 1fr);
	}
}

@media (max-width: 900px) {
	body.sequoia-native-route .native-contact-content .c-2col {
		grid-template-columns: minmax(0, 1fr);
	}
}

@media (max-width: 520px) {
	body.sequoia-native-route .native-contact-content .c-lines {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* Provider wrappers cannot impose a second measure or margin on their slot. */
:where(
	.h-map,
	.lt-map,
	.cs-hero,
	.r-page,
	.h-hero,
	.lt-hero,
	.ci-grid,
	.hi-grid,
	.r-paver-inspiration
) :where(
	.wp-block-sequoia-projects,
	.wp-block-sequoia-projects-map,
	.wp-block-sequoia-reviews,
	.wp-block-sequoia-inspirations
) {
	max-width: none;
	margin-block-start: 0;
	margin-block-end: 0;
}

/* The legacy site stylesheet carries a float clearfix,
 * `.wp-block-group:before, .wp-block-group:after { content: ""; display: block;
 * clear: both }` (style.css:2590). On a flow container those pseudo-elements are
 * invisible, which is why it survived. On a Core Group that the reference sheets lay
 * out as grid or flex they are GRID ITEMS: `.r-services` renders four cards into
 * three tracks as [::before, card, card] / [card, card, ::after], so the fourth
 * card is genuinely on a second row and the band reads as two per row.
 *
 * Neutralised here rather than in style.css because the clearfix is still doing
 * its job for legacy float content elsewhere on the site; this is exactly the
 * generic-Gutenberg-wrapper contamination this sheet exists to contain. Scoped
 * to the named reference layout roots, so unrelated Core Groups keep the clearfix.
 *
 * SCOPE, and this is load-bearing: only bands whose layout ladder actually WINS
 * are listed. On a band whose breakpoint rules are still dead, the stolen cell
 * is accidentally COMPENSATING -- `.r-2col`, `.r-cutaway-layout`,
 * `.r-tracker-layout`, `.r-value-layout`, `.r-diligence-lower` and `.r-services`
 * render one card per row at narrow widths only because the pseudo-element
 * pushes the second card down, and neutralising the clearfix there moves them
 * from accidentally-right to visibly wrong (measured: 1 -> 2 per row at 520
 * where the contract wants 1). The paver family is therefore excluded until its
 * ladder is raised; whoever raises it must add those roots here in the SAME
 * change, or the band swaps one defect for another.
 *
 * `.r-tracker-stage-rail` and `.r-tracker-records` were added under exactly that
 * rule, in the commit that raised them. They are INNER grids of the tracker
 * visualization, not outer bands, which is why the original sweep missed them:
 * the band root `.r-tracker-layout` was listed here from the start. Three-way
 * control on the rendered production document, 1440/900/861/860/520/390, both
 * canvases: as authored, one track and rows [1,1,1,1]; raised only, four tracks
 * but rows [3,1] with the pseudo-element holding the fourth cell; raised plus
 * these two roots, four tracks and rows [4], matching source `:334`. */
:is(.entry-content, .editor-styles-wrapper) :is(
	.h-map,
	.lt-map,
	.h-trust,
	.ci-grid,
	.hi-grid,
	.cs-gal,
	.rv-plat,
	.hs-grid,
	.hs-grid-inner,
	.hl-cols-inner,
	.r-services,
	.r-pricebar,
	.r-cutaway-layout,
	.r-tracker-layout,
	.r-value-layout,
	.r-diligence-lower,
	.r-value-row,
	.r-diligence-row,
	.r-work,
	.r-cutaway-cards,
	.r-tracker-stage-rail,
	.r-tracker-records
)::before,
:is(.entry-content, .editor-styles-wrapper) :is(
	.h-map,
	.lt-map,
	.h-trust,
	.ci-grid,
	.hi-grid,
	.cs-gal,
	.rv-plat,
	.hs-grid,
	.hs-grid-inner,
	.hl-cols-inner,
	.r-services,
	.r-pricebar,
	.r-cutaway-layout,
	.r-tracker-layout,
	.r-value-layout,
	.r-diligence-lower,
	.r-value-row,
	.r-diligence-row,
	.r-work,
	.r-cutaway-cards,
	.r-tracker-stage-rail,
	.r-tracker-records
)::after {
	content: none;
}
