/**
 * CHGA Hero block.
 *
 * The text panel is a size container, so every element inside it scales against
 * the panel rather than the viewport. That keeps the hero faithful to the
 * 1920px design at any width and at any "Image width" setting.
 */

.chga-hero {
	--chga-hero-bg: var(--chga-navy);
	--chga-hero-media-width: 50%;
	--chga-hero-min-height: 92vh;
	--chga-hero-overlay-opacity: 1;

	position: relative;
	color: var(--chga-white);
	background-color: var(--chga-hero-bg);
	isolation: isolate;
	overflow: hidden;
}

.chga-hero__inner {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	align-items: stretch;
}

/* ---------------------------------------------------------------------------
 * Panel
 * ------------------------------------------------------------------------ */

.chga-hero__panel {
	container-type: inline-size;
	container-name: chga-hero-panel;
	position: relative;
	display: flex;
	background-color: var(--chga-hero-bg);
	overflow: hidden;
	z-index: 1;
}

.chga-hero__panel-bg {
	position: absolute;
	inset: 0;
	pointer-events: none;
	z-index: 0;
}

.chga-hero__panel-bg::before {
	content: "";
	position: absolute;
	inset: 0;
	background:
		radial-gradient(120% 90% at 18% 12%, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0) 55%),
		linear-gradient(155deg, rgba(255, 255, 255, 0.04) 0%, rgba(0, 0, 0, 0.3) 100%);
	z-index: 2;
}

.chga-hero__overlay {
	position: absolute;
	inset: -6% -8%;
	width: 116%;
	height: 112%;
	max-width: none;
	object-fit: cover;
	object-position: center;
	opacity: var(--chga-hero-overlay-opacity);
	z-index: 1;
	will-change: transform;
}

.chga-hero__glow {
	position: absolute;
	border-radius: 50%;
	pointer-events: none;
	z-index: 3;
	mix-blend-mode: screen;
}

.chga-hero__glow--one {
	top: 30%;
	left: 8%;
	width: min(60cqw, 30rem);
	aspect-ratio: 1;
	background: radial-gradient(circle, rgba(255, 204, 111, 0.26) 0%, rgba(255, 204, 111, 0) 62%);
}

.chga-hero__glow--two {
	bottom: -14%;
	right: -10%;
	width: min(70cqw, 34rem);
	aspect-ratio: 1;
	background: radial-gradient(circle, rgba(102, 163, 255, 0.22) 0%, rgba(102, 163, 255, 0) 66%);
}

.chga-hero__panel-inner {
	position: relative;
	z-index: 4;
	display: flex;
	align-items: center;
	width: 100%;
	/* Top padding reserves room for the overlaid CHGA Header, whose height is
	   driven by the viewport rather than by this panel. */
	padding: min(max(7.5rem, 24vw), 10rem) clamp(1.5rem, 6vw, 3rem) clamp(3rem, 9vw, 4.5rem);
}

.chga-hero__content {
	max-width: 46rem;
}

.chga-hero__content {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
}

/* Eyebrow ---------------------------------------------------------------- */

.chga-hero__eyebrow {
	margin: 0 0 0.6em;
	font-size: clamp(0.9375rem, 2.3cqw, 1.375rem);
	font-weight: 500;
	line-height: 1.35;
	letter-spacing: 0.005em;
	color: var(--chga-gold-mid);
}

.chga-hero__eyebrow-highlight {
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	color: var(--chga-gold-mid);
}

/* Headline --------------------------------------------------------------- */

.chga-hero__title {
	margin: 0;
	font-size: clamp(2rem, 7.2cqw, 4.375rem);
	font-weight: 800;
	line-height: 1.07;
	letter-spacing: -0.022em;
	color: var(--chga-white);
}

.chga-hero__line {
	display: block;
	overflow: hidden;
	padding-bottom: 0.09em;
	margin-bottom: -0.09em;
}

.chga-hero__line-inner {
	display: block;
	will-change: transform;
}

.chga-hero__line--gold .chga-hero__line-inner {
	color: var(--chga-gold-mid);
}

/* Rule ------------------------------------------------------------------- */

.chga-hero__rule {
	display: block;
	width: min(29.5cqw, 22rem);
	min-width: 11rem;
	height: 1px;
	margin: clamp(1.5rem, 6.9cqw, 4.25rem) 0 clamp(1.5rem, 6.4cqw, 4rem);
	background: linear-gradient(90deg, rgba(255, 255, 255, 0.85) 0%, rgba(255, 255, 255, 0.5) 68%, rgba(255, 255, 255, 0) 100%);
	transform-origin: left center;
}

/* Body ------------------------------------------------------------------- */

.chga-hero__body {
	max-width: 44rem;
	font-size: clamp(1rem, 1.95cqw, 1.1875rem);
	line-height: 1.58;
	color: rgba(255, 255, 255, 0.92);
}

.chga-hero__body > :first-child {
	margin-top: 0;
}

.chga-hero__body > :last-child {
	margin-bottom: 0;
}

.chga-hero__body p {
	margin: 0 0 1em;
}

.chga-hero__body a {
	color: var(--chga-gold-light);
	text-underline-offset: 0.2em;
}

/* Call to action --------------------------------------------------------- */

.chga-hero__actions {
	margin-top: clamp(1.5rem, 5.4cqw, 3.25rem);
	max-width: 100%;
}

.chga-hero__cta {
	min-width: min(49cqw, 100%);
	padding-block: clamp(0.8rem, 1.65cqw, 1.05rem);
	font-size: clamp(0.9375rem, 2.05cqw, 1.25rem);
}

.chga-hero__note {
	max-width: 34rem;
	margin: clamp(1rem, 3.3cqw, 2rem) 0 0;
	font-size: clamp(0.75rem, 1.28cqw, 0.8125rem);
	line-height: 1.55;
	color: rgba(255, 255, 255, 0.7);
}

/* ---------------------------------------------------------------------------
 * Media / slider
 * ------------------------------------------------------------------------ */

.chga-hero__media {
	position: relative;
	aspect-ratio: 4 / 3;
	overflow: hidden;
	background-color: var(--chga-navy-deep);
}

.chga-hero__slides {
	position: absolute;
	inset: 0;
}

.chga-hero__slide {
	position: absolute;
	inset: 0;
	margin: 0;
	opacity: 0;
	visibility: hidden;
	will-change: opacity, transform;
}

.chga-hero__slide.is-active {
	opacity: 1;
	visibility: visible;
}

/* Without JavaScript only the first slide is ever shown. */
.chga-hero__slides > .chga-hero__slide:first-child {
	opacity: 1;
	visibility: visible;
}

.chga-hero__image {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	object-position: var(--chga-hero-focus, center);
}

/* Arrows ----------------------------------------------------------------- */

.chga-hero__arrows {
	position: absolute;
	inset: auto 0 clamp(1.5rem, 3.4vw, 3.25rem);
	display: flex;
	justify-content: space-between;
	padding: 0 clamp(1rem, 2.6vw, 2.75rem);
	z-index: 3;
	pointer-events: none;
}

.chga-hero__arrow {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: clamp(2.5rem, 2.1rem + 1.1vw, 3rem);
	height: clamp(2.5rem, 2.1rem + 1.1vw, 3rem);
	padding: 0;
	color: var(--chga-white);
	background: var(--chga-gold-gradient-vertical);
	border: 0;
	border-radius: 50%;
	box-shadow: 0 10px 24px -12px rgba(0, 0, 0, 0.55);
	cursor: pointer;
	pointer-events: auto;
	transition:
		transform 0.45s var(--chga-ease),
		box-shadow 0.45s var(--chga-ease),
		filter 0.45s var(--chga-ease);
}

.chga-hero__arrow svg {
	display: block;
	width: 0.6875rem;
	height: 0.8125rem;
}

.chga-hero__arrow--prev svg {
	margin-right: 0.125rem;
}

.chga-hero__arrow--next svg {
	margin-left: 0.125rem;
}

.chga-hero__arrow:hover,
.chga-hero__arrow:focus-visible {
	transform: scale(1.08);
	filter: brightness(1.06);
	box-shadow: 0 14px 30px -12px rgba(0, 0, 0, 0.6);
}

.chga-hero__arrow:focus-visible {
	outline: 2px solid var(--chga-white);
	outline-offset: 3px;
}

.chga-hero__arrow:active {
	transform: scale(0.97);
}

/* Progress --------------------------------------------------------------- */

.chga-hero__progress {
	position: absolute;
	inset: auto 0 0;
	height: 0.375rem;
	background: rgba(0, 31, 83, 0.35);
	overflow: hidden;
	z-index: 3;
}

.chga-hero__progress-fill {
	display: block;
	width: 100%;
	height: 100%;
	background: var(--chga-gold-gradient);
	transform-origin: left center;
	transform: scaleX(calc(1 / var(--chga-hero-slide-count, 1)));
}

/* ---------------------------------------------------------------------------
 * Desktop
 * ------------------------------------------------------------------------ */

@media (min-width: 62rem) {
	.chga-hero__inner {
		grid-template-columns:
			minmax(0, calc(100% - var(--chga-hero-media-width)))
			minmax(0, var(--chga-hero-media-width));
		min-height: clamp(38.75rem, var(--chga-hero-min-height), 60rem);
	}

	.chga-hero__panel-inner {
		padding:
			min(max(11rem, 18.5cqw), 14rem)
			clamp(1.75rem, 5.5cqw, 4.5rem)
			clamp(3rem, 6.5cqw, 5rem)
			clamp(2rem, 15.6cqw, 9.375rem);
	}

	.chga-hero__media {
		aspect-ratio: auto;
	}
}

/* ---------------------------------------------------------------------------
 * Small screens
 * ------------------------------------------------------------------------ */

@media (min-width: 37.5rem) and (max-width: 61.999rem) {
	.chga-hero__media {
		aspect-ratio: 16 / 9;
	}
}

@media (max-width: 37.5rem) {
	.chga-hero__media {
		aspect-ratio: 4 / 3;
	}

	.chga-hero__cta {
		width: 100%;
		min-width: 0;
	}
}

/* ---------------------------------------------------------------------------
 * Tracked headline (Care Growth Academy)
 *
 * Semibold, XD tracking 40 (0.04em), 55px as typed or 50px in capitals on the
 * 1920 artboard, where the panel is about 960px wide. Body copy is 24/30.
 * ------------------------------------------------------------------------ */

.chga-hero--title-tracked .chga-hero__title {
	font-size: clamp(1.875rem, 5.75cqw, 3.4375rem);
	font-weight: 600;
	line-height: 1.18;
	letter-spacing: 0.04em;
}

.chga-hero--title-caps .chga-hero__title {
	font-size: clamp(1.625rem, 5.2cqw, 3.125rem);
	line-height: 1.3;
	text-transform: uppercase;
}

.chga-hero--title-tracked .chga-hero__rule {
	margin-block: clamp(1.25rem, 3.6cqw, 2.25rem) clamp(1.25rem, 3.4cqw, 2.125rem);
}

.chga-hero--title-tracked .chga-hero__body {
	font-size: clamp(1rem, 2.5cqw, 1.5rem);
	line-height: 1.3;
}

.chga-hero--title-tracked .chga-hero__cta {
	min-width: 0;
	padding-inline: clamp(1.25rem, 2.6cqw, 2rem);
	font-size: clamp(0.875rem, 2.3cqw, 1.375rem);
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

/* ---------------------------------------------------------------------------
 * Image fade
 *
 * A panel-coloured wash over the edge of the photograph where it meets the
 * panel, so the two read as one surface. Purely decorative and static.
 * ------------------------------------------------------------------------ */

.chga-hero--fade .chga-hero__media::before {
	content: "";
	position: absolute;
	inset: 0 0 auto;
	height: 28%;
	background: linear-gradient(180deg, var(--chga-hero-bg) 0%, transparent 100%);
	pointer-events: none;
	z-index: 2;
}

@media (min-width: 62rem) {
	.chga-hero--fade .chga-hero__media::before {
		inset: 0 auto 0 0;
		width: 34%;
		height: auto;
		background: linear-gradient(90deg, var(--chga-hero-bg) 0%, color-mix(in srgb, var(--chga-hero-bg) 55%, transparent) 38%, transparent 100%);
	}

	/*
	 * The wash starts as flat hero colour, so the panel's texture and shading
	 * ease out to that same flat colour before the edge. Without this the waves
	 * and the darker lower corner stop dead in a visible vertical line.
	 */
	.chga-hero--fade .chga-hero__panel-bg {
		-webkit-mask-image: linear-gradient(90deg, #000 0%, #000 62%, transparent 100%);
		mask-image: linear-gradient(90deg, #000 0%, #000 62%, transparent 100%);
	}
}

/* ---------------------------------------------------------------------------
 * Full-width photograph
 *
 * For artwork that carries its own fade (transparent on its left), laid across
 * the whole hero behind the text so it melts into the navy with no seam. The
 * panel and the media box share the hero colour for the same reason.
 * ------------------------------------------------------------------------ */

.chga-hero--media-full .chga-hero__media {
	background-color: var(--chga-hero-bg);
}

.chga-hero--media-full .chga-hero__image {
	object-position: right center;
}

/*
 * Stacked under the copy, a 4:3 box crops away most of the artwork's
 * transparent side, and a wash at the top edge joins it to the panel above.
 */
@media (max-width: 61.999rem) {
	.chga-hero--media-full .chga-hero__media {
		aspect-ratio: 4 / 3;
	}

	.chga-hero--media-full .chga-hero__media::before {
		content: "";
		position: absolute;
		inset: 0 0 auto;
		height: 22%;
		background: linear-gradient(180deg, var(--chga-hero-bg) 0%, transparent 100%);
		pointer-events: none;
		z-index: 2;
	}
}

@media (min-width: 62rem) {
	.chga-hero--media-full .chga-hero__inner {
		position: relative;
		grid-template-columns: minmax(0, calc(100% - var(--chga-hero-media-width))) minmax(0, var(--chga-hero-media-width));
	}

	/*
	 * Layer order: the panel's navy texture, then the photograph, then the copy.
	 * The panel stops being a stacking context so its texture and its copy can
	 * sit either side of the photograph, whose own soft edge then blends over the
	 * texture exactly as the design has it.
	 */
	.chga-hero--media-full .chga-hero__media {
		position: absolute;
		inset: 0;
		z-index: 1;
		background-color: transparent;
	}

	.chga-hero--media-full .chga-hero__panel {
		grid-column: 1;
		z-index: auto;
		background-color: transparent;
	}

	.chga-hero--media-full .chga-hero__panel-bg {
		z-index: 0;
	}

	.chga-hero--media-full .chga-hero__panel-inner {
		z-index: 2;
	}

	/*
	 * On squarer windows (tablets in landscape, small laptops) the cover crop
	 * cuts away the artwork's own transparent side, so the people would sit
	 * under the headline. A navy wash behind the copy keeps it readable there;
	 * at wide desktop proportions the artwork's fade does the job alone.
	 */
	@media (max-aspect-ratio: 3 / 2) {
		.chga-hero--media-full .chga-hero__media::after {
			content: "";
			position: absolute;
			inset: 0;
			background: linear-gradient(90deg, var(--chga-hero-bg) 0%, color-mix(in srgb, var(--chga-hero-bg) 88%, transparent) calc(100% - var(--chga-hero-media-width) - 8%), transparent calc(100% - var(--chga-hero-media-width) + 18%));
			pointer-events: none;
			z-index: 2;
		}
	}

	.chga-hero--media-full .chga-hero__arrows,
	.chga-hero--media-full .chga-hero__progress {
		left: calc(100% - var(--chga-hero-media-width));
	}
}

/* ---------------------------------------------------------------------------
 * Editor preview
 * ------------------------------------------------------------------------ */

.chga-hero--preview {
	--chga-hero-min-height: 74vh;
}

.chga-hero--preview .chga-hero__arrows {
	pointer-events: none;
}
