/* ──────────────────────────────────────────────────────────────────────────
   Text Over Image Hero block
   White hero: nav (light) + breadcrumb + two-tone heading + up to 2 CTAs,
   then a wide rounded banner image below. Tokens only.
   ────────────────────────────────────────────────────────────────────────── */

.uw-toi {
	position: relative;
	background: var(--wp--preset--color--porcelain);
	color: var(--wp--preset--color--deep-navy);
}

.uw-toi__inner {
	padding-top: calc(var(--uw-nav-height) + 20px);
	padding-bottom: clamp(40px, 5vw, 80px);
	display: flex;
	flex-direction: column;
	gap: clamp(2rem, 4vw, 2.5rem);
}

/* ── Breadcrumb ── */
/* The component itself is .uw-crumb in custom-styles.css; the hero only adds
   where it sits. */
.uw-toi__breadcrumb { margin-top: clamp(1rem, 2vw, 1.5rem); }

/* ── Head: heading left, CTAs bottom-right ── */
.uw-toi__head {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 2rem;
	flex-wrap: wrap;
	/* Figma 1664-20734: ~110px between the breadcrumb and the heading (inner
	   gap supplies ~40, this adds the remainder). */
	margin-top: clamp(2rem, 4.3vw, 50px);
}
.uw-toi__heading {
	margin: 0;
	max-width: 965px;
	font-family: var(--wp--preset--font-family--marr-sans-cond);
	font-weight: 600;
	line-height: 0.96;
	letter-spacing: -0.02em;
	color: var(--wp--preset--color--deep-navy);
	text-wrap: balance;
}
.uw-toi--h-small .uw-toi__heading { font-size: clamp(40px, 6.2vw, var(--wp--preset--font-size--heading-1)); }
.uw-toi--h-large .uw-toi__heading { font-size: clamp(48px, 7.9vw, var(--wp--preset--font-size--hero-3)); }
.uw-toi__accent { color: var(--wp--preset--color--red); }

/* Inline heading region (one core/heading). .uw-toi__head is a flex row, so the
   InnerBlocks wrapper has to be transparent to layout: as a real flex item it
   would size to the h1's max-content (max-width: 965px lives on the h1, not the
   wrapper) and push the CTAs off the right edge. display: contents makes the h1
   itself the flex item, so max-width and align-items: flex-end behave exactly as
   they did with the ACF heading. Legacy instances keep .uw-toi__accent above. */
.uw-toi__flow { display: contents; }

/* Editor bridge: display: contents on our own wrapper does not flatten the
   block-editor wrappers Gutenberg renders inside it, so they would become the
   flex items instead. Canvas only: neither class exists on the front end. */
.uw-toi__flow > .block-editor-inner-blocks,
.uw-toi__flow > .block-editor-inner-blocks > .block-editor-block-list__layout { display: contents; }

/* A heading that is never filled in still serializes as an empty <h1>, which is
   a WCAG "empty heading" failure and an empty flex item. Hide it, but only
   where it is not editable, so the block editor's own placeholder (drawn on the
   empty element itself) stays clickable in the canvas, which loads this same
   stylesheet. */
.uw-toi__heading:empty:not([contenteditable]) { display: none; }

/* The accent is a <mark> the editor writes with an inline transparent
   background; hand-written pattern markup that omits that inline style would
   otherwise get the UA yellow highlight. A deliberate highlight still wins,
   because an inline style beats this rule. */
.uw-toi__heading mark { background-color: transparent; }

/* ── CTAs ── */
.uw-toi__ctas {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
}
/* .uw-toi__cta shape only — colour/arrow handled by the shared uw-pill-btn*
   system (unitedway_cb_cta()); see custom-styles.css. */
/* Shape and colour are the shared .uw-pill-btn component (custom-styles.css);
   this hero adds nothing to the button itself. */

/* ── Banner image ── */
.uw-toi__image {
	position: relative;
	margin: 0;
	width: 100%;
	height: clamp(300px, 38vw, 700px);
	border-radius: 12px;
	overflow: hidden;
	background: color-mix(in srgb, black 20%, transparent);
}
.uw-toi__image-img,
.uw-toi__image img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

/* ── Jump-nav pills (overlaid on the banner bottom) ── */
.uw-toi__jump {
	position: absolute;
	left: 50%;
	transform: translateX(-50%);
	bottom: clamp(16px, 2.5vw, 32px);
	max-width: calc(100% - clamp(32px, 6vw, 96px));
}
.uw-toi__jump-list {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	padding: 8px;
	list-style: none;
	border-radius: 10000px;
	background: color-mix(in srgb, var(--wp--preset--color--parchment) 70%, transparent);
	-webkit-backdrop-filter: blur(10px);
	backdrop-filter: blur(10px);
	overflow-x: auto;
	scrollbar-width: none;
}
.uw-toi__jump-list::-webkit-scrollbar { display: none; }
.uw-toi__jump-item {
	display: flex;
	align-items: center;
	flex: 0 0 auto;
}
.uw-toi__jump-item:not(:first-child) { padding-left: 8px; }

/* Dashed divider between adjacent text items… */
.uw-toi__jump-item + .uw-toi__jump-item {
	border-left: 1px dashed color-mix(in srgb, var(--wp--preset--color--deep-navy) 12%, transparent);
}
/* …but drop it on the active pill and the item right after it. */
.uw-toi__jump-item:has(.is-active) {
	border-left-color: transparent;
}
.uw-toi__jump-link {
	display: inline-flex;
	align-items: center;
	padding: 12px 16px;
	border-radius: 10000px;
	font-family: var(--wp--preset--font-family--marr-sans-cond);
	font-weight: 600;
	font-size: 20px;
	line-height: 1;
	color: var(--wp--preset--color--deep-navy);
	text-decoration: none;
	white-space: nowrap;
	transition: background 0.18s ease, color 0.18s ease;
}
.uw-toi__jump-link.is-active {
	background: var(--wp--preset--color--cobalt-blue);
	color: var(--wp--preset--color--white);
}
a.uw-toi__jump-link:hover:not(.is-active) {
	background: color-mix(in srgb, var(--wp--preset--color--deep-navy) 8%, transparent);
}

/* ── Inline path: heading + jump list in one inner-blocks region ─────────────
   Two rendering paths share this file:
   - legacy  .uw-toi__head > h1.uw-toi__heading + .uw-toi__ctas, and
             figure.uw-toi__image > nav.uw-toi__jump > ul.uw-toi__jump-list
   - inline  .uw-toi__head > .uw-toi__flow > (h1 + ul.wp-block-list) + .uw-toi__ctas
   WordPress allows one inner-blocks region per block, so the jump list has to
   sit in the same region as the heading even though it paints over the banner
   further down the page. Grid is what separates them, from 782px up only: below
   that breakpoint the bar is hidden (.uw-toi__jump already is, and the list
   follows it), so .uw-toi__head stays the flex column it always was and nothing
   in the mobile rendering moves.
   core/list-item declares "className": false, so a row an editor adds can never
   carry uw-toi__jump-item, and a list deleted and re-inserted from the inserter
   would drop a seeded class off the <ul> too. Every rule below therefore hangs
   off .uw-toi__flow, the inner-blocks region wrapper, and reaches the rows with
   element selectors. Descendant combinators, never `>`: the editor canvas
   inserts inner-block wrappers between .uw-toi__flow and the list. */

/* Was ul.uw-toi__jump-list: the frosted pill bar itself. */
.uw-toi__flow :is(ul, ol) {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	padding: 8px;
	list-style: none;
	border-radius: 10000px;
	background: color-mix(in srgb, var(--wp--preset--color--parchment) 70%, transparent);
	-webkit-backdrop-filter: blur(10px);
	backdrop-filter: blur(10px);
	overflow-x: auto;
	scrollbar-width: none;
}
.uw-toi__flow :is(ul, ol)::-webkit-scrollbar { display: none; }

/* Was li.uw-toi__jump-item, plus the type .uw-toi__jump-link carried, so text an
   editor has not linked yet still sets the row's height and colour. min-height
   holds the bar to the 44px row the old markup got from the link's own padding,
   which a bare list item has no inner element to reproduce. */
.uw-toi__flow li {
	display: flex;
	align-items: center;
	flex: 0 0 auto;
	min-height: 44px;
	margin: 0;
	font-family: var(--wp--preset--font-family--marr-sans-cond);
	font-weight: 600;
	font-size: 20px;
	line-height: 1;
	color: var(--wp--preset--color--deep-navy);
}
.uw-toi__flow li:not(:first-child) { padding-left: 8px; }

/* Dashed divider between adjacent items, exactly as .uw-toi__jump-item + did.
   The first pill carries the active fill and has no preceding sibling, so it
   never draws one, which is the same result the legacy
   .uw-toi__jump-item:has(.is-active) rule gave. */
.uw-toi__flow li + li {
	border-left: 1px dashed color-mix(in srgb, var(--wp--preset--color--deep-navy) 12%, transparent);
}

/* Was a.uw-toi__jump-link. theme.json's elements.link paints every <a>
   cobalt-blue, so deep-navy is restated here; one class plus two elements
   out-ranks theme.json's :root :where(a). */
.uw-toi__flow li a {
	display: inline-flex;
	align-items: center;
	padding: 12px 16px;
	border-radius: 10000px;
	font-family: var(--wp--preset--font-family--marr-sans-cond);
	font-weight: 600;
	font-size: 20px;
	line-height: 1;
	color: var(--wp--preset--color--deep-navy);
	text-decoration: none;
	white-space: nowrap;
	transition: background 0.18s ease, color 0.18s ease;
}

/* The active pill. view.js drives it on both shapes now - it reads the target
   from a plain href when there is no data-uw-jump-target - and marks the list
   .uw-jump-live once it has. Until then, or with JS off, the first item carries
   the fill: the state the server-rendered bar painted on load.
   Hover skips whichever pill is active, as :not(.is-active) always did. */
.uw-toi__flow :is(ul, ol):not(.uw-jump-live) li:first-child a,
.uw-toi__flow li a.is-active {
	background: var(--wp--preset--color--cobalt-blue);
	color: var(--wp--preset--color--white);
}
.uw-toi__flow :is(ul, ol):not(.uw-jump-live) li:not(:first-child) a:hover,
.uw-toi__flow .uw-jump-live li a:not(.is-active):hover {
	background: color-mix(in srgb, var(--wp--preset--color--deep-navy) 8%, transparent);
}

/* ── Desktop layout ────────────────────────────────────────────────────────── */
@media (min-width: 782px) {
	/* .uw-toi__head stays the wrapping flex row it has been since the block was
	   built: the heading takes its natural width and the CTAs sit beside it,
	   dropping to their own line when the two together exceed the container.
	   That wrap is load-bearing - a long heading is 965px wide and the buttons
	   364px, so on most pages they do NOT fit and the buttons belong underneath.
	   An earlier version of this file dissolved the head into a two-column grid
	   so the jump list could leave it for the banner row; that pinned the heading
	   to a 1fr track, which can never overflow, so the CTAs never wrapped and
	   every hero with buttons came out 86px shorter than it should be.
	   The list reaches the banner by being positioned instead - which is what the
	   legacy markup did with it inside the <figure>. */
	.uw-toi__inner { position: relative; }

	/* The bar sits centred over the bottom of the banner. Absolute against
	   .uw-toi__inner rather than the figure, because on the inline path it is the
	   figure's sibling: same left: 50% + translateX + bottom the legacy nav used,
	   offset by the inner's own bottom padding so it lands inside the image.
	   z-index paints it over the figure, which no longer clips it. */
	.uw-toi__flow :is(ul, ol) {
		position: absolute;
		left: 50%;
		transform: translateX(-50%);
		bottom: calc(clamp(40px, 5vw, 80px) + clamp(16px, 2.5vw, 32px));
		z-index: 1;
		margin: 0;
		max-width: calc(100% - clamp(32px, 6vw, 96px));
	}
}

/* ── Mobile ── */
@media (max-width: 781px) {
	.uw-toi__head { flex-direction: column; align-items: flex-start; gap: 1.5rem; }
	.uw-toi--h-small .uw-toi__heading { font-size: clamp(36px, 11vw, 56px); }
	.uw-toi--h-large .uw-toi__heading { font-size: clamp(40px, 13vw, 64px); }
	.uw-toi__image { height: clamp(400px, 56vw, 360px); }
	.uw-toi__jump {
		display: none;
	}
	/* The inline list is the same bar, so it goes wherever .uw-toi__jump goes.
	   Hiding it is also what lets .uw-toi__head stay a plain flex column here:
	   with nothing to lift out of the head, no grid is needed below 782px. */
	.uw-toi__flow :is(ul, ol) { display: none; }
	.uw-toi__jump-link { font-size: 16px; }
	
}
