/* ──────────────────────────────────────────────────────────────────────────
   Text Block
   heading-body — eyebrow + heading (left) / body + CTA (right).
   paragraph    — large centered two-tone statement.
   Tokens only — no raw hex.
   ────────────────────────────────────────────────────────────────────────── */

.uw-tb {
	color: var(--wp--preset--color--deep-navy);
}
.uw-tb--bg-porcelain { background: var(--wp--preset--color--porcelain); }
.uw-tb--bg-white { background: var(--wp--preset--color--white); }
.uw-tb--bg-parchment { background: var(--wp--preset--color--parchment); }
/* ── heading-body ── */
.uw-tb--heading-body .uw-tb__inner {
	padding-top: clamp(56px, 5vw, 80px);
	padding-bottom: clamp(64px, 9vw, 120px);
	display: flex;
	flex-direction: column;
	gap: clamp(1.5rem, 2.5vw, 40px);
}
 
.uw-tb__eyebrow {
	display: inline-flex;
	align-items: center;
	gap: 12px;
	margin: 0;
	font-family: var(--wp--preset--font-family--marr-sans-cond);
	font-weight: 600;
	font-size: 20px;
	line-height: 1;
	text-transform: uppercase;
}
.uw-tb__eyebrow-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--wp--preset--color--red); flex: none; }

.uw-tb__row {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: clamp(2rem, 2vw, 30px);
}
.uw-tb__heading {
	flex: 0 1 715px;
	margin: 0;
	font-family: var(--wp--preset--font-family--marr-sans-cond);
	font-weight: 600;
	font-size: clamp(44px, 5.5vw, var(--wp--preset--font-size--heading-3));
	line-height: 1.1;
	letter-spacing: -0.01em;
	color: var(--wp--preset--color--deep-navy);
}
.uw-tb__col {
	flex: 0 1 716px;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: clamp(1.5rem, 2.5vw, 40px);
	align-items: flex-start;
}
.uw-tb__body {
	font-family: var(--wp--preset--font-family--pp-mori);
	font-weight: 400;
	font-size: var(--wp--preset--font-size--body-small);
	line-height: 1.4;
	color: var(--wp--preset--color--deep-navy);
}
.uw-tb__body p { margin: 0 0 1.25rem; }
.uw-tb__body p:last-child { margin-bottom: 0; }
.uw-tb__body p:first-child { font-size: var(--wp--preset--font-size--heading-7); line-height: 1.4; }

/* ── heading-body, inline-editing shape ──────────────────────────────────────
   A block gets exactly ONE inner-block region, and a region cannot be split
   across two wrapper elements, so the eyebrow, heading, body and button are one
   flat list of inner blocks and CSS grid places them into the two columns the
   legacy `.uw-tb__row` + `.uw-tb__col` markup built by nesting. Same technique,
   and the same reasoning, as unitedway/content-inline.

   The container rule is scoped to a `.uw-tb__row` with NO `.uw-tb__col` child —
   the one element the legacy branch always emits — so the flex row above is left
   exactly as it was. The child rules below need no such scope: `grid-*` is inert
   on the flex items a legacy row contains, and the classes they name (eyebrow,
   body) only ever appear inside the region. The two that would otherwise reach
   `.uw-tb__col` carry the scope. */
.uw-tb__row:not(:has(> .uw-tb__col)) {
	display: grid;
	/* The legacy flex bases were `0 1 715px` / `0 1 716px`. Those bases plus the
	   32px gap come to 1463px, which is wider than this container ever gets
	   (1620px cap less 2x80px padding = 1460px), so the row is ALWAYS
	   over-constrained and the columns always shrink.
	   That matters for which unit reproduces it: flex shrinks each column in
	   PROPORTION to its basis, giving 632.43 / 633.32, while `minmax(0, 715px)`
	   grid tracks shrink EQUALLY, giving 632.875 / 632.875. The 0.44px offset
	   that leaves moves every glyph in the body column off its live position -
	   invisible to the eye, but a real difference under a pixel diff. `fr` tracks
	   in the same 715:716 ratio divide the space exactly the way flex-shrink
	   does. */
	grid-template-columns: minmax(0, 715fr) minmax(0, 716fr);
	justify-content: space-between;
	column-gap: clamp(2rem, 2vw, 30px);
	/* row-gap MUST stay 0. The heading spans a large number of implicit rows (see
	   below) and a row-gap would be inserted between every one of them, inflating
	   the heading far beyond the text. Vertical rhythm comes from the margins at
	   the end of this section instead. */
	row-gap: 0;
	grid-auto-rows: min-content;
	align-items: start;
}
/* Eyebrow: full-width first row, where `.uw-tb__inner`'s flex column used to put
   it. Its margin-bottom IS that column's gap, and it leaves with the eyebrow
   itself — which is what lets the heading and the body auto-place into row 1
   when an instance has no eyebrow at all. */
.uw-tb__row > .uw-tb__eyebrow {
	grid-column: 1 / -1;
	margin-bottom: clamp(1.5rem, 2.5vw, 40px);
}
/* The red dot is drawn, not typed: an inner-block eyebrow has no
   `.uw-tb__eyebrow-dot` span to carry it, and a drawn dot cannot be deleted by
   accident or announced by a screen reader. Told apart from the legacy eyebrow,
   which does have the span, by testing for the span - NOT by position. The
   equivalent rule in stats was scoped to a direct child of the region, and it
   stopped matching the moment that eyebrow moved into a group, silently
   dropping the dot. */
.uw-tb__eyebrow:not(:has(> .uw-tb__eyebrow-dot))::before {
	content: "";
	width: 12px;
	height: 12px;
	border-radius: 50%;
	background: var(--wp--preset--color--red);
	flex: none;
}
/* The heading holds the left column and spans every row, so the right-hand stack
   sizes its own rows instead of being spaced out to match the heading — the
   legacy `.uw-tb__col` was independent of the heading's height in exactly that
   way. `span 100` with NO explicit start line is deliberate: auto-placement then
   puts the heading in row 1 when there is no eyebrow and row 2 when there is.
   `1 / span 100` would only ever reach the explicit grid and pin it to row 1. */
.uw-tb__row > .uw-tb__heading {
	grid-column: 1;
	grid-row: span 100;
	align-self: start;
}
/* Everything else is the right-hand column, one row each. Written without naming
   a class so it also catches the Button block, whose front-end `.uw-button`
   wrapper sits inside an `.acf-block-preview` in the editor. */
.uw-tb__row > :not(.uw-tb__eyebrow):not(.uw-tb__heading) {
	grid-column: 2;
	margin: 0;
}
/* Right-hand column rhythm, in place of the row-gap the heading's span rules out.
   1.25rem between consecutive body paragraphs is the margin the legacy WYSIWYG's
   own <p>s carried; the larger step before whatever follows the copy is the gap
   the legacy `.uw-tb__col` kept between its body and its CTA. */
.uw-tb__row > .uw-tb__body + .uw-tb__body { margin-top: 1.25rem; }
.uw-tb__row > .uw-tb__body ~ :not(.uw-tb__body) { margin-top: clamp(1.5rem, 2.5vw, 40px); }
/* The first body paragraph is the lede — the size `.uw-tb__body p:first-child`
   gives it inside the legacy WYSIWYG. Inline, each paragraph IS a `.uw-tb__body`
   element, so the rule moves onto the element itself and later paragraphs step
   back down. Both stay well under the `!important` the editor's own font-size
   control emits, so a per-instance size still wins. */
.uw-tb__row > .uw-tb__body { font-size: var(--wp--preset--font-size--heading-7); }
.uw-tb__row > .uw-tb__body ~ .uw-tb__body { font-size: var(--wp--preset--font-size--body-small); }

/* ── paragraph (centered statement) ── */
.uw-tb--paragraph .uw-tb__inner {
	padding-top: clamp(56px, 6vw, 80px);
	padding-bottom: clamp(56px, 6vw, 80px);
	display: flex;
	justify-content: center;
}
.uw-tb__statement {
	margin: 0;
	max-width: 1152px;
	text-align: center;
	text-wrap: balance;
	font-family: var(--wp--preset--font-family--marr-sans-cond);
	font-weight: 600;
	font-size: clamp(30px, 3.6vw, 52px);
	line-height: 1.12;
	letter-spacing: -0.02em;
	color: var(--wp--preset--color--deep-navy);
}
/* Inner blocks (and, on legacy instances, the WYSIWYG's own <p> tags) inherit the
   statement type from the container above, so they read as one tight, centered
   block rather than as ordinary body copy or theme-sized headings.

   Specificity is deliberate. These declarations sit at one class (0,1,0), which
   beats the bare `h2 { font-size: ... }` element rule that theme.json emits, so a
   heading dropped in here still looks like a statement. Every editor-facing
   control WordPress generates - `.has-red-color`, `.has-heading-2-font-size` and
   the rest - is emitted with `!important`, so an editor's own colour, size and
   alignment choices still override everything here. That is what makes the block
   restylable in place instead of locked to one look. */
.uw-tb__statement :where(p, h1, h2, h3, h4, h5, h6) {
	margin: 0;
	font-family: inherit;
	font-weight: inherit;
	font-size: inherit;
	line-height: inherit;
	letter-spacing: inherit;
}
.uw-tb__statement :where(p, h1, h2, h3, h4, h5, h6):not(:last-child) {
	margin-bottom: 0.3em;
}
/* Legacy two-tone markup, kept for any instance not yet migrated to inner blocks. */
.uw-tb__accent { color: var(--wp--preset--color--red); }

/* Optional per-instance padding removal (both layouts). */
.uw-tb--no-top-pad .uw-tb__inner { padding-top: 0; }
.uw-tb--no-bottom-pad .uw-tb__inner { padding-bottom: 0; }

/* Empty state. The heading-body template seeds an eyebrow, a heading and a body,
   and an untouched one still serializes and renders as an empty element: the
   eyebrow paints a bare red dot (the dot is drawn on the element itself), an empty
   heading goes into the accessibility tree, and each one takes a row of the grid
   the heading is sized against. `:not([contenteditable])` keeps this off the editor
   canvas, where an empty block is precisely what the author has to be able to click
   into. */
.uw-tb__eyebrow:empty:not([contenteditable]),
.uw-tb__heading:empty:not([contenteditable]),
.uw-tb__body:empty:not([contenteditable]),
.uw-tb__statement:empty:not([contenteditable]) { display: none; }

/* ── Mobile ── */
@media (max-width: 900px) {
	.uw-tb__row { flex-direction: column; gap: 1.5rem; }
	.uw-tb__heading, .uw-tb__col { flex: none; width: 100%; }
	.uw-tb__heading { font-size: clamp(36px, 9vw, 56px); }

	/* Inline shape: one column, and the heading back in normal flow so it stops
	   spanning. The scoped rule is the stacked equivalent of the row's own
	   `gap: 1.5rem` above, which only the legacy flex row gets. */
	.uw-tb__row:not(:has(> .uw-tb__col)) { grid-template-columns: minmax(0, 1fr); }
	.uw-tb__row > .uw-tb__heading { grid-row: auto; }
	.uw-tb__row > :not(.uw-tb__eyebrow):not(.uw-tb__heading) { grid-column: 1; }
	.uw-tb__row:not(:has(> .uw-tb__col)) > .uw-tb__heading + * { margin-top: 1.5rem; }
}
