/* Home hero (patterns/hero-home.php). */

.cw-section.cw-hero--home {
	padding-block: 0;
}

/*
 * Frame: the slideshow photos fill it, a dark tint sits over them, the content sits on top.
 * The tint is darkest on the left, behind the text, so white copy stays readable on light
 * photos. On phones the text spans the full width, so the tint is even.
 */
.cw-hero__frame {
	position: relative;
	isolation: isolate;
	display: flex;
	align-items: flex-end;
	padding: 200px 50px 119px;
	border-radius: var(--cw-radius-lg);
	overflow: hidden;
	background-color: var(--wp--preset--color--deep);
	color: var(--wp--preset--color--text);
}

.cw-hero__frame::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
	background: linear-gradient(90deg, rgb(0 0 0 / 0.65), rgb(0 0 0 / 0.3) 75%);
	pointer-events: none;
}

/*
 * Slides: stacked, all transparent but the active one (the first, until hero-slideshow.js
 * runs). Slides not yet due stay display: none so their lazy photos don't load. The repeated
 * gallery classes outrank core's figure rules; core's widths need !important.
 */
.cw-hero__frame > .cw-hero__slides {
	position: absolute;
	inset: 0;
	z-index: 0;
	display: block;
	margin: 0;
}

.wp-block-gallery.has-nested-images.cw-hero__slides > .wp-block-image {
	position: absolute;
	inset: 0;
	width: 100% !important;
	height: 100%;
	margin: 0;
	opacity: 0;
	transition: opacity 0.5s ease-in-out;
}

.wp-block-gallery.has-nested-images.cw-hero__slides > .wp-block-image:not(:first-child):not(.is-ready) {
	display: none;
}

.wp-block-gallery.has-nested-images.cw-hero__slides > .wp-block-image.is-active,
.wp-block-gallery.has-nested-images.cw-hero__slides:not(.is-playing) > .wp-block-image:first-child {
	opacity: 1;
}

.wp-block-gallery.has-nested-images.cw-hero__slides > .wp-block-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Captions have no place on a background; the editor still shows them. */
.cw-hero__slides figcaption {
	display: none;
}

.editor-styles-wrapper .cw-hero__slides figcaption {
	display: block;
}

@media (prefers-reduced-motion: reduce) {
	.wp-block-gallery.has-nested-images.cw-hero__slides > .wp-block-image {
		transition: none;
	}
}

.cw-hero__content {
	position: relative;
	z-index: 2;
	width: min(848px, 100%);
	margin: 0;
}

.cw-hero__content > * {
	margin-block: 0;
}

.cw-hero__content > * + * {
	margin-block-start: 20px;
}

.cw-hero--home .cw-hero__eyebrow {
	font-size: 16px;
	width: min(449px, 100%);
}

.cw-hero--home .cw-hero__eyebrow::after {
	flex: 1 1 auto;
}

.cw-hero--home h1 {
	max-width: 778px;
}

.cw-hero--home h1 + p {
	max-width: 616px;
}

.cw-hero--home .wp-block-separator.is-style-short {
	margin-block: 35px;
}

.cw-hero--home p + .wp-block-buttons {
	margin-block-start: 20px;
}

.cw-hero__tags {
	gap: 10px;
	max-width: 613px;
	margin-block-start: 0 !important;
}

/*
 * Editor: the first photo stays behind the content as on the front end; the others show as
 * thumbnails in the top corner, so each can be selected and replaced.
 */
.editor-styles-wrapper .cw-hero__frame > .cw-hero__slides {
	z-index: auto;
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	justify-content: flex-end;
	gap: 10px;
	padding: 20px;
}

.editor-styles-wrapper .wp-block-gallery.has-nested-images.cw-hero__slides > .wp-block-image:not(:first-child) {
	position: relative;
	z-index: 3;
	display: block;
	flex: none;
	width: 96px !important;
	height: 64px;
	border-radius: 6px;
	overflow: hidden;
	opacity: 1;
	box-shadow: 0 0 0 1px var(--cw-line);
}

@media (max-width: 1024px) {
	.cw-hero__frame {
		padding: 100px 30px 148px;
	}
}

@media (max-width: 767px) {
	.cw-hero__frame {
		padding: 100px 20px 116px;
	}

	.cw-hero__frame::before {
		background: rgb(0 0 0 / 0.5);
	}

	.cw-hero--home .cw-hero__eyebrow {
		font-size: 12px;
	}
}
