/* ──────────────────────────────────────────────────────────────────────────
   Homepage Hero block
   Three layout presets place three content slots — headline, lede, news —
   onto a 12-col × 3-row grid sized to the Figma frame (1620×1000) proportions.
   Mobile collapses to a single bottom-anchored stack.
   Colors come from theme.json palette tokens only (scrim via color-mix).
   ────────────────────────────────────────────────────────────────────────── */

.uw-hero {
	position: relative;
	min-height: min(94vh, 1000px);
	overflow: hidden;
	color: var(--wp--preset--color--white);
	isolation: isolate;
	display: flex;
}

.uw-hero__cover { width: 100%; }
 
/* ── Background media ──
   .uw-hero__media is the clipping window (flush with the section, never
   moves; the section itself is overflow:hidden too as a backstop). */
.uw-hero__media {
	position: absolute;
	inset: 0;
	z-index: 0;
	overflow: hidden;
}
.uw-hero__media img,
.uw-hero__media video,
.uw-hero__video-fallback {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}
.uw-hero__video { z-index: 1; }
.uw-hero__video-fallback { z-index: 0; }

/* Pause/play control for the auto-playing background video (WCAG 2.2.2). */
.uw-hero__video-toggle {
	position: absolute;
	right: clamp(16px, 3vw, 40px);
	bottom: clamp(16px, 3vw, 40px);
	z-index: 5;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 1px solid color-mix(in srgb, var(--wp--preset--color--white) 50%, transparent);
	border-radius: 50%;
	background: color-mix(in srgb, var(--wp--preset--color--deep-navy) 45%, transparent);
	color: var(--wp--preset--color--white);
	cursor: pointer;
	-webkit-backdrop-filter: blur(4px);
	backdrop-filter: blur(4px);
	transition: background 0.2s ease;
}
.uw-hero__video-toggle:hover,
.uw-hero__video-toggle:focus-visible { background: color-mix(in srgb, var(--wp--preset--color--deep-navy) 65%, transparent); }
.uw-hero__video-icon { width: 20px; height: 20px; display: block; }
.uw-hero__video-icon--play { display: none; }
.uw-hero__video-toggle.is-paused .uw-hero__video-icon--pause { display: none; }
.uw-hero__video-toggle.is-paused .uw-hero__video-icon--play { display: block; }

@media (prefers-reduced-motion: reduce) {
	.uw-hero__video { display: none; }
	.uw-hero__video-fallback { position: relative; }
	/* Video is hidden (static fallback shown); the control has nothing to pause. */
	.uw-hero__video-toggle { display: none; }
}

/* ── Scrim (WCAG-AA contrast, baked in, not editor-controlled) ── */
.uw-hero__scrim {
	position: absolute;
	inset: 0;
	z-index: 1;
	background: rgba(0, 0, 0, .4);
}

/* ── Content grid (matches Figma frame proportions) ── */
.uw-hero__inner {
	position: relative;
	inset: 0;
	z-index: 2;
	/* .uw-hero__cover (the flex child that stretches to .uw-hero's full
	   height) is this element's containing block, not .uw-hero itself — set
	   height explicitly so the grid's middle 1fr row still pushes content to
	   the bottom. */
	height: 100%;
	display: grid;
	grid-template-columns: repeat(12, 1fr);
	grid-template-rows: auto 1fr auto;
	column-gap: clamp(1rem, 2.4vw, 2.5rem);
	row-gap: 1.5rem;
	/* pad-x 80/1620, pad-top 149/1000, pad-bottom 56/1000 of the frame */
	padding-top: clamp(96px, 14.9vw, 140px);
	padding-bottom: clamp(32px, 5.6vw, 56px);
}

/* ── Headline (eyebrow + title) ──
   This element is also the block's single InnerBlocks region (see render.php):
   the eyebrow and the H1 are inner blocks, and the region carries this class so
   it stays the direct grid child that all three layout presets below place —
   the inline path covers every layout, not one of them.

   The lede keeps its ACF subheading, and render.php carries the proof. Short
   version, because it is a CSS fact and belongs here too: the presets put the
   headline and the lede in the SAME row, bottom-aligned. Splitting the
   subheading out as its own grid item needs that row to be sized by the CTA's
   box (so the subheading has a boundary one lede-gap above the pill), while the
   eyebrow needs the very same row sized by the H1's box (so its boundary lands
   one headline-gap above the H1). One row, two incompatible sizes — so the
   subheading and the pill have to stay in one element, and the pill is the
   shared unitedway_cb_cta() component, not a core block. */
/* Inline path. ACF wraps the region in a div; `display: contents` dissolves it so
   the two groups inside - .uw-hero__headline and .uw-hero__lede - are the grid
   items the layout presets place, exactly as the server-rendered divs were. The
   editor nests the same blocks one level deeper again, so those wrappers get the
   same treatment. Core blocks also arrive with the editor's default block margin,
   which these columns have never used. */
.uw-hero__flow,
.uw-hero__flow > .block-editor-inner-blocks,
.uw-hero__flow > .block-editor-inner-blocks > .block-editor-block-list__layout { display: contents; }
.uw-hero__headline > :is(.uw-hero__eyebrow, .uw-hero__title),
.uw-hero__lede > :is(.uw-hero__subheading, .uw-button) { margin-block: 0; }
/* An untouched placeholder serializes as an empty element; the legacy markup
   emitted nothing at all when a field was blank. */
.uw-hero__eyebrow:empty:not([contenteditable]),
.uw-hero__title:empty:not([contenteditable]),
.uw-hero__subheading:empty:not([contenteditable]) { display: none; }

.uw-hero__headline {
	display: flex;
	flex-direction: column;
	gap: clamp(1.25rem, 2.5vw, 2.5rem);
}
/* Editor canvas only. If ACF wraps the inner blocks in its own containers there,
   they would sit between this flex container and its two items and swallow the
   gap above; `display: contents` removes them from layout without touching the
   front end, where no such wrappers exist. Inert if ACF already flattens. */
.uw-hero__headline > .block-editor-inner-blocks,
.uw-hero__headline > .block-editor-inner-blocks > .block-editor-block-list__layout {
	display: contents;
}
/* Empty state. A template placeholder that is never typed into still serialises
   as an empty element, and an empty <p class="uw-hero__eyebrow"> would draw a
   bare red dot while an empty <h1> is an accessibility violation. Hiding them
   also removes them from the accessibility tree. The legacy branch rendered
   nothing at all for an empty value, so this is parity, not a new behaviour. */
.uw-hero__eyebrow:empty,
.uw-hero__title:empty {
	display: none;
}
.uw-hero__eyebrow {
	/* The eyebrow is a paragraph now, so reset the UA margin: it would add to
	   the flex gap above. `display: inline-flex` blockifies to `flex` as a flex
	   item, exactly as the legacy <span> did. */
	margin: 0;
	display: inline-flex;
	align-items: center;
	gap: 0.75rem;
	font-family: var(--wp--preset--font-family--marr-sans-cond);
	font-weight: 600;
	font-size: 20px;
	line-height: 1;
	letter-spacing: 0.02em;
	text-transform: uppercase;
}
.uw-hero__eyebrow::before {
	content: "";
	width: 12px;
	height: 12px;
	border-radius: 50%;
	background: var(--wp--preset--color--red);
	flex: none;
}
.uw-hero__title {
	margin: 0;
	font-family: var(--wp--preset--font-family--marr-sans-cond);
	font-weight: 600;
	font-size: clamp(56px, 8.15vw, var(--wp--preset--font-size--hero-1)); /* 132px at the 1620 frame */
	line-height: 0.9;
	letter-spacing: 0;
	color: var(--wp--preset--color--white);
}

/* ── Lede (subheading + CTA) ── */
.uw-hero__lede {
	display: flex;
	flex-direction: column;
	gap: clamp(1.25rem, 2vw, 2rem);
}
.uw-hero__subheading {
	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.3;
	color: var(--wp--preset--color--white);
}
.uw-hero__cta { align-self: flex-start; }

/* CTA row: main button + optional secondary button, side by side, wrapping on
   narrow screens. The group is a flex row (layout support); this sets the gap
   and keeps the buttons at their own width. */
.uw-hero__ctas {
	gap: 12px;
	align-items: center;
	margin-block: 0;
}
.uw-hero__ctas > .uw-button { margin-block: 0; }

/* Secondary button over the hero photo: white fill with navy text at rest; on
   hover and keyboard focus it turns navy (fill and border) with white text.
   The arrow circle flips to white with a navy arrow, and keyboard focus adds a
   white focus ring (WCAG 2.4.7). */
.uw-hero__cta--secondary .uw-pill-btn {
	background: var(--wp--preset--color--white);
	border-color: var(--wp--preset--color--white);
	color: var(--wp--preset--color--deep-navy);
}
.uw-hero__cta--secondary .uw-pill-btn:hover,
.uw-hero__cta--secondary .uw-pill-btn:focus-visible {
	background: var(--wp--preset--color--deep-navy);
	border-color: var(--wp--preset--color--deep-navy);
	color: var(--wp--preset--color--white);
}
.uw-hero__cta--secondary .uw-pill-btn:hover :is(.uw-cb__arrow, .uw-arrow),
.uw-hero__cta--secondary .uw-pill-btn:focus-visible :is(.uw-cb__arrow, .uw-arrow) {
	background: var(--wp--preset--color--white);
	color: var(--wp--preset--color--deep-navy);
}
.uw-hero__cta--secondary .uw-pill-btn:focus-visible {
	outline: 2px solid var(--wp--preset--color--white);
	outline-offset: 3px;
}

/* ── News carousel ── */
.uw-hero-news {
	display: flex;
	align-items: stretch;
	gap: 0.25rem;
}
.uw-hero-news__viewport {
	flex: 1 1 auto;
	overflow: hidden;
	border-radius: 16px;
}
.uw-hero-news__track {
	display: flex;
	margin: 0;
	padding: 0;
	list-style: none;
	transition: transform 0.35s ease;
}
.uw-hero-news__slide {
	flex: 0 0 100%;
	min-width: 100%;
	margin: 0;
	list-style: none;
}
.uw-hero-news__controls {
	flex: 0 0 auto;
	display: flex;
	flex-direction: column;
	justify-content: center;
	border-left: 1px solid color-mix(in srgb, var(--wp--preset--color--deep-navy) 10%, transparent);
}
.uw-hero-news__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 100%;
	padding: 0;
	border: 0;
	color: var(--wp--preset--color--deep-navy);
	cursor: pointer;
	transition: background 0.2s ease;
	background: none;
}

.uw-hero-news__btn:not(:first-child) {
	border-top: 1px solid color-mix(in srgb, var(--wp--preset--color--deep-navy) 10%, transparent);
}


.uw-hero-news__btn svg {
	width: 18px;
	height: 18px;
	display: block;
}
.uw-hero-news__btn:focus-visible {
	outline: 2px solid var(--wp--preset--color--white);
	outline-offset: 2px;
}

.uw-hero-news__btn:hover {
	background: rgba(0,0,0,0.06);
}


@media (prefers-reduced-motion: reduce) {
	.uw-hero-news__track { transition: none; }
}

/* ── News card ── */
.uw-hero-news-card {
	display: flex;
	gap: 1rem;
	padding: 0.5rem;
	text-decoration: none;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}


.uw-hero-news-card__thumb {
	flex: none;
	width: 160px;
	height: 160px;
	border-radius: 0;
	overflow: hidden;
}
.uw-hero-news-card__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}
.uw-hero-news-card__body {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	justify-content: space-between;
	padding: 10px 0.5rem 5px 0;

}
.uw-hero-news-card__label {
	font-family: var(--wp--preset--font-family--test-national-2-condensed);
	font-weight: 500;
	font-size: 24px;
	line-height: 1.1;
	color: var(--wp--preset--color--deep-navy);
}
/* Animated underline via shared pseudo-element pattern in custom-styles.css. */
.uw-hero-news-card__link {
	font-family: var(--wp--preset--font-family--test-national-2-condensed);
	font-weight: 500;
	font-size: 20px;
	color: var(--wp--preset--color--deep-navy);
	align-self: flex-start;
}

.uw-hero-news {
	border-radius: 8px;
	background: var(--wp--preset--color--white);
}

/* ──────────────────────────────────────────────────────────────────────────
   Layout presets — slot placement (12-col grid; rows: 1 top · 2 fill · 3 bottom)
   Column spans mirror Figma widths; the eyebrow is hidden on Option 2 by content.
   ────────────────────────────────────────────────────────────────────────── */

/* Option 1: headline bottom-left (≈66%w), lede bottom-right (≈33%w), no news */
.uw-hero--opt1 .uw-hero__headline { grid-column: 1 / 9;  grid-row: 3; align-self: end; }
.uw-hero--opt1 .uw-hero__lede     { grid-column: 9 / 13; grid-row: 3; align-self: end; max-width: 475px; align-items: flex-start; }
.uw-hero--opt1 .uw-hero__news     { grid-column: 9 / 13; grid-row: 1; align-self: start; justify-self: end; max-width: 476px; }

/* Option 2: heading top-left (≈58%w), news bottom-left, lede bottom-right */
.uw-hero--opt2 .uw-hero__headline { grid-column: 1 / 8;  grid-row: 1; align-self: start; }
.uw-hero--opt2 .uw-hero__lede     { grid-column: 8 / 13; grid-row: 3; align-self: end; max-width: 553px; }
.uw-hero--opt2 .uw-hero__news     { grid-column: 1 / 6;  grid-row: 3; align-self: end; max-width: 476px; }

/* Option 3: headline + lede stacked bottom-left (≈66%w), news bottom-right */
.uw-hero--opt3 .uw-hero__headline { grid-column: 1 / 9;  grid-row: 2; align-self: end; }
.uw-hero--opt3 .uw-hero__lede     { grid-column: 1 / 9;  grid-row: 3; align-self: end; max-width: 568px; }
.uw-hero--opt3 .uw-hero__news     { grid-column: 9 / 13; grid-row: 3; align-self: end; justify-self: end; max-width: 476px; }

/* ── Mobile: single bottom-anchored stack (headline → lede → news) ── */
@media (max-width: 781px) {
	.uw-hero { min-height: min(88vh, 780px); }
	.uw-hero__inner {
		display: flex;
		flex-direction: column;
		justify-content: flex-end;
		gap: 1.5rem;
		padding: 6rem 24px 2.5rem;
		width: 100%;
	}
	.uw-hero__headline { order: 1; gap: 1.25rem; max-width: 100%; }
	.uw-hero__lede     { order: 2; max-width: 100% !important; }
	.uw-hero__news     { order: 3; max-width: 100% !important; }
	.uw-hero__eyebrow  { font-size: 16px; }
	.uw-hero-news-card__thumb { width: 90px; height: 90px; } 
	.uw-hero__inner { position: relative; padding-top: 6rem; padding-bottom: 1.5rem; }
	.uw-hero-news-card__body { padding-top: 0; }
	.uw-hero-news-card__label { font-size: 20px; }
}