/* ──────────────────────────────────────────────────────────────────────────
   Page Hero block
   Nav + optional breadcrumb + two-column row: image (left/right/none) + text.
   Text column: top divider line, heading (h1 or h2), body, one CTA pill.
   Tokens only — no raw hex.
   ────────────────────────────────────────────────────────────────────────── */

.uw-ph {
	position: relative;
}

/* ── Colour variants ── */
.uw-ph--navy {
	background: var(--wp--preset--color--deep-navy);
	color: var(--wp--preset--color--white);
}
.uw-ph--white {
	background: var(--wp--preset--color--porcelain);
	color: var(--wp--preset--color--deep-navy);
}
.uw-ph--blue {
	background: var(--wp--preset--color--cobalt-blue);
	color: var(--wp--preset--color--white);
}
.uw-ph--red {
	background: var(--wp--preset--color--red);
	color: var(--wp--preset--color--white);
}

.uw-ph--icy {
	background: var(--wp--preset--color--icy-blue);
	color: var(--wp--preset--color--deep-navy);
}

/* ── Outer wrapper ── */
.uw-ph__inner {
	padding-top: calc(var(--uw-nav-height) + 10px);
	padding-bottom: clamp(48px, 6vw, 96px);
	display: flex;
	flex-direction: column;
	gap: clamp(1.5rem, 3vw, 2.5rem);
	min-height: 510px;
    justify-content: flex-end;
}

/* ── Breadcrumb ── */
.uw-ph__breadcrumb {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem; 
	font-family: var(--wp--preset--font-family--pp-mori);
	font-size: 15px;
	letter-spacing: -0.01em;
}
.uw-ph--navy .uw-ph__breadcrumb,
.uw-ph--blue .uw-ph__breadcrumb,
.uw-ph--red .uw-ph__breadcrumb  { color: var(--wp--preset--color--white); }
.uw-ph--white .uw-ph__breadcrumb { color: var(--wp--preset--color--deep-navy); }

.uw-ph__crumb-home { display: inline-flex; color: inherit !important; }
.uw-ph__crumb-home svg { width: 18px; height: 18px; display: block; transition: transform 0.2s ease; }
.uw-ph__crumb-home:hover svg { transform: scale(1.15); }
.uw-ph__crumb-sep { opacity: 0.6; }
.uw-ph__crumb-link { color: inherit; text-decoration: none; }
.uw-ph__crumb-link:hover { color: inherit; text-decoration: underline; }
.uw-ph__crumb-current { font-weight: 600; }

/* ── Two-column row ── */
.uw-ph__row {
	display: flex;
	align-items: stretch;
	gap: clamp(2rem, 9vw, 148px);
}

/* Image left (default) */
.uw-ph--img-left  .uw-ph__row { flex-direction: row; }
/* Image right */
.uw-ph--img-right .uw-ph__row { flex-direction: row-reverse; }
/* No image: single column */
.uw-ph--img-none  .uw-ph__row { flex-direction: column; align-items: flex-start; }

/* ── Image column ── */
.uw-ph__image {
	margin: 0;
	flex: 0 0 clamp(280px, 40vw, 594px);
	width: clamp(280px, 40vw, 594px);
	aspect-ratio: 594 / 620;
	border-radius: 12px;
	overflow: hidden;
	background: color-mix(in srgb, black 20%, transparent);
}
.uw-ph__image-img,
.uw-ph__image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	border-radius: 12px;
}

/* ── Text column: heading group top, body/CTA group bottom ── */
.uw-ph__text {
	flex: 1 1 0;
	min-width: 0;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	gap: clamp(2rem, 4vw, 3rem);
}
.uw-ph__text-top {
	display: flex;
	flex-direction: column;
	gap: clamp(1rem, 1.7vw, 24px);
}
.uw-ph__text-bottom {
	display: flex;
	flex-direction: column;
	gap: clamp(1.25rem, 2.1vw, 30px);
}
.uw-ph--img-none .uw-ph__text {
	max-width: 100%;
	justify-content: flex-start;
	gap: clamp(1.5rem, 3vw, 2.5rem);
}

/* ── Dividers ──
   Both bars resolve their colour from two custom properties so that the legacy
   markup (<div class="uw-ph__divider">) and the inline markup (borders on the
   inner blocks) draw from one source of truth. Computed colours are identical to
   the per-variant rules these replace: white on navy/blue/red, deep navy on
   white/icy. */
.uw-ph {
	--uw-ph-line: var(--wp--preset--color--white);
	--uw-ph-rule: color-mix(in srgb, var(--wp--preset--color--white) 20%, transparent);
}
.uw-ph--white,
.uw-ph--icy {
	--uw-ph-line: var(--wp--preset--color--deep-navy);
	--uw-ph-rule: color-mix(in srgb, var(--wp--preset--color--deep-navy) 20%, transparent);
}
.uw-ph__divider {
	height: 8px;
	width: 100%;
	background: var(--uw-ph-line);
}
.uw-ph__rule {
	height: 1px;
	width: 100%;
	background: var(--uw-ph-rule);
}

/* ── Inline editing: heading + body as inner blocks ──
   WordPress allows one InnerBlocks region per block and a region cannot be split
   across two wrapper divs, so .uw-ph__text-top / .uw-ph__text-bottom and their
   two decorative bars do not exist on this path. The bars become borders, which
   is geometrically identical: both were height-only, width:100% flex items, and
   each border carries the flex gap that followed its bar as padding.

   The 8px divider sits on .uw-ph__flow rather than on the heading so that it
   still draws when the heading is empty — which is what the legacy markup did,
   unconditionally.

   Source order matters: these must stay below `.uw-ph--img-none .uw-ph__text`
   above, which is the same specificity (0,2,0). */
.uw-ph__text:has(> .uw-ph__flow) {
	justify-content: flex-start;
	gap: clamp(1.25rem, 2.1vw, 30px);
}
.uw-ph__flow {
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	border-top: 8px solid var(--uw-ph-line);
	padding-top: clamp(1rem, 1.7vw, 24px);
}
.uw-ph__flow > * { margin: 0; }
/* Heading top, everything after it pinned to the bottom — the legacy column used
   justify-content: space-between for the same effect. Descendant, not child, so
   the rule also matches through the editor's inner-block wrappers. */
.uw-ph__flow .uw-ph__heading { margin-bottom: auto; }
/* The 1px rule is drawn by a pseudo-element that is itself a flex item of
   .uw-ph__flow, ordered between the heading and the body, NOT as a border on the
   body. The body carries `max-width: 470px`, so a border on it stopped ~20px
   short of where the legacy .uw-ph__rule div (width:100% of the column) ended -
   a visible difference caught by pixel-diffing the two renderings. A pseudo-element
   flex item stretches to the full column width the way the old div did. */
.uw-ph__flow .uw-ph__heading { order: 0; }
.uw-ph__flow::after {
	content: "";
	order: 1;
	height: 2px;
	background: var(--uw-ph-rule);
	margin-top: clamp(2rem, 4vw, 3rem);
}
.uw-ph__flow .uw-ph__body {
	order: 2;
	padding-top: clamp(1.25rem, 2.1vw, 30px);
}
/* An untouched template placeholder serializes as an empty element: an empty
   <h1> is a WCAG violation, and an empty body would draw the 1px rule over
   nothing. Hiding them also takes them out of the accessibility tree. The
   contenteditable guard keeps this off the editor canvas, where an empty block
   must stay visible and clickable. */
.uw-ph__heading:empty:not([contenteditable]),
.uw-ph__body:empty:not([contenteditable]) { display: none; }
/* Heading empty: the auto margin above has nothing to push against, so pin the
   rest of the stack to the bottom the way the legacy layout did. */
.uw-ph__flow:has(.uw-ph__heading:empty) { justify-content: flex-end; }
/* Body empty or deleted but CTAs present — the 1px rule still has to draw, above
   the CTAs. */
.uw-ph__text:has(> .uw-ph__flow):not(:has(.uw-ph__body:not(:empty))) .uw-ph__ctas {
	border-top: 1px solid var(--uw-ph-rule);
	padding-top: clamp(1.25rem, 2.1vw, 30px);
	margin-top: clamp(2rem, 4vw, 3rem);
}

/* No image: the column is content-sized, not stretched, so nothing spreads. */
.uw-ph--img-none .uw-ph__text:has(> .uw-ph__flow) { gap: clamp(1.25rem, 2.1vw, 30px); }
.uw-ph--img-none .uw-ph__flow { flex: 0 0 auto; }
.uw-ph--img-none .uw-ph__flow .uw-ph__heading { margin-bottom: 0; }
.uw-ph--img-none .uw-ph__flow .uw-ph__body { margin-top: clamp(1.5rem, 3vw, 2.5rem); }

/* Editor bridge. In the canvas ACF nests the blocks inside
   .block-editor-inner-blocks > .block-editor-block-list__layout, which would sit
   between .uw-ph__flow and its flex children; on the front end the blocks are
   direct children. display:contents makes both DOMs lay out identically. */
.uw-ph__flow > .block-editor-inner-blocks,
.uw-ph__flow > .block-editor-inner-blocks > .block-editor-block-list__layout { display: contents; }

/* ── Heading ── */
.uw-ph__heading {
	margin: 0;
	font-family: var(--wp--preset--font-family--marr-sans-cond);
	font-weight: 600;
	line-height: 0.9;
	letter-spacing: -0.02em;
	text-wrap: balance;
}
.uw-ph--h1 .uw-ph__heading { font-size: clamp(56px, 9.1vw, var(--wp--preset--font-size--heading-1)); }
.uw-ph--h1-large .uw-ph__heading { font-size: clamp(56px, 9.1vw, var(--wp--preset--font-size--hero-2)); }
.uw-ph--h2 .uw-ph__heading { font-size: clamp(40px, 5.5vw, var(--wp--preset--font-size--heading-2)); }

.uw-ph--navy .uw-ph__heading  { color: var(--wp--preset--color--white); }
.uw-ph--blue .uw-ph__heading  { color: var(--wp--preset--color--white); }
.uw-ph--red .uw-ph__heading   { color: var(--wp--preset--color--white); }
.uw-ph--white .uw-ph__heading { color: var(--wp--preset--color--deep-navy); }

/* Accent words in the heading get a colour per section colour. <span> is what the
   legacy *marker* syntax produced; <mark> is what the editor's inline colour
   control produces on the inline path. Both are covered, at unchanged
   specificity (0,2,0). When the editor picks a colour it emits .has-*-color with
   !important and wins, so these act as the no-class fallback. */
.uw-ph--navy .uw-ph__heading :is(span, mark),
.uw-ph--blue .uw-ph__heading :is(span, mark),
.uw-ph--red .uw-ph__heading :is(span, mark),
.uw-ph--white .uw-ph__heading :is(span, mark) { color: var(--wp--preset--color--icy-blue); }
.uw-ph--icy .uw-ph__heading :is(span, mark)   { color: var(--wp--preset--color--cobalt-blue); }
/* <mark> carries a yellow UA highlight. The editor writes an inline
   background-color that overrides this; hand-written pattern markup may not. */
.uw-ph__heading mark { background-color: transparent; }

/* ── Body ── */
.uw-ph__body {
	margin: 0;
	font-family: var(--wp--preset--font-family--pp-mori);
	font-weight: 400;
	font-size: var(--wp--preset--font-size--body);
	line-height: 1.4;
	letter-spacing: -0.01em;
	max-width: 470px;
}
.uw-ph--navy .uw-ph__body  { color: var(--wp--preset--color--white); }
.uw-ph--blue .uw-ph__body  { color: var(--wp--preset--color--white); }
.uw-ph--red .uw-ph__body   { color: var(--wp--preset--color--white); }
.uw-ph--white .uw-ph__body { color: var(--wp--preset--color--deep-navy); }

/* ── CTAs ── */
.uw-ph__ctas {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 1.3rem;
}
/* .uw-ph__cta shape/colour handled by uw-pill-btn* in custom-styles.css */

/* Button 3: text link colour per section colour */
.uw-ph__link {
	font-family: var(--wp--preset--font-family--test-national-2-condensed);
	font-weight: 500;
	font-size: 20px;
}
.uw-ph--navy .uw-ph__link,
.uw-ph--blue .uw-ph__link,
.uw-ph--red .uw-ph__link  { color: var(--wp--preset--color--white); }
.uw-ph--white .uw-ph__link, .uw-read-more { color: var(--wp--preset--color--deep-navy); }



/* ── Mobile ── */
@media (max-width: 781px) {
	.uw-ph__row {
		flex-direction: column !important;
		align-items: flex-start;
		gap: 2rem;
	}
	.uw-ph__image {
		flex: none;
		width: 100%; 
		order: 2;
		min-height: 400px;
	}
	.uw-ph__inner { min-height: 410px; justify-content: flex-start; }
	.uw-ph__text { order: 1; }
	.uw-ph--h1 .uw-ph__heading { font-size: clamp(40px, 13vw, 64px); }
	.uw-ph--h2 .uw-ph__heading { font-size: clamp(32px, 10vw, 52px); }
}
