/**
 * Block: Hero.
 *
 * Mobile: text panel, then the photo. Desktop (960px+): full-bleed photo with
 * the navy panel cut in on a diagonal from the left.
 */

.ci-hero {
	--ci-hero-interval: 7000ms;
	position: relative;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	isolation: isolate;
	background-color: var(--wp--preset--color--navy);
}

/* Media */
.ci-hero__media {
	position: relative;
	order: 2;
	aspect-ratio: 4 / 3;
}

.ci-hero__media::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 2;
	background: linear-gradient(180deg, var(--wp--preset--color--navy) 0, rgb(1 18 34 / 0) 28%);
	pointer-events: none;
}

.ci-hero__slider,
.ci-hero__slide {
	width: 100%;
	height: 100%;
	margin: 0;
}

.ci-hero__image {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Before Swiper runs (or without JavaScript) only the first photo shows. */
.ci-hero__slider:not(.swiper-initialized) .ci-hero__slide:not(:first-child) {
	display: none;
}

/* Caption chip */
.ci-hero__caption {
	position: absolute;
	right: var(--ci-gutter);
	bottom: var(--ci-gutter);
	z-index: 3;
	max-width: calc(100% - (var(--ci-gutter) * 2));
}

.ci-hero__caption-link,
.ci-hero__caption > .ci-hero__caption-title {
	display: grid;
	grid-template-columns: 1fr auto;
	align-items: center;
	gap: .125rem 1.25rem;
	padding: .875rem 1.125rem;
	border: 1px solid rgb(255 255 255 / .14);
	background-color: rgb(1 18 34 / .62);
	backdrop-filter: blur(10px);
	color: var(--wp--preset--color--white);
	text-decoration: none;
	transition: background-color .2s var(--ci-ease);
}

.ci-hero__caption-link:hover {
	background-color: rgb(1 18 34 / .85);
}

.ci-hero__caption-title {
	font-family: var(--wp--preset--font-family--heading);
	font-size: 1.0625rem;
	line-height: 1.2;
}

.ci-hero__caption-meta {
	grid-column: 1;
	color: rgb(255 255 255 / .72);
	font-size: .75rem;
	letter-spacing: .06em;
}

.ci-hero__caption-link .ci-icon {
	grid-row: 1 / span 2;
	grid-column: 2;
	transition: transform .2s var(--ci-ease);
}

.ci-hero__caption-link:hover .ci-icon {
	transform: translateX(3px);
}

/* Text panel */
.ci-hero__inner {
	position: relative;
	z-index: 3;
	order: 1;
	padding-block: var(--wp--preset--spacing--section-s) var(--wp--preset--spacing--md);
}

.ci-hero__content {
	max-width: 36rem;
}

.ci-hero__title {
	margin: 0 0 1.25rem;
	font-size: var(--wp--preset--font-size--display);
	font-weight: 400;
	letter-spacing: .01em;
	line-height: 1.04;
	text-transform: uppercase;
	text-wrap: balance;
}

.ci-hero__accent {
	display: block;
	color: var(--wp--preset--color--sky);
}

.ci-hero__intro {
	max-width: 30rem;
	margin: 0 0 2rem;
	color: rgb(255 255 255 / .82);
	font-size: var(--wp--preset--font-size--lead);
	line-height: 1.55;
}

/* Slide controls: progress bars and a pause button (WCAG 2.2.2). */
.ci-hero__controls {
	display: flex;
	align-items: center;
	gap: 1.25rem;
	margin-top: 2.5rem;
}

.ci-hero__controls[hidden] {
	display: none;
}

.ci-hero .ci-hero__controls .ci-hero__pagination {
	position: static;
	display: flex;
	gap: .5rem;
	width: auto;
	transform: none;
}

.ci-hero .ci-hero__pagination .swiper-pagination-bullet {
	position: relative;
	width: 2rem;
	height: 1.5rem;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: none;
	opacity: 1;
	cursor: pointer;
}

.ci-hero .ci-hero__pagination .swiper-pagination-bullet::before,
.ci-hero .ci-hero__pagination .swiper-pagination-bullet::after {
	content: "";
	position: absolute;
	inset: auto 0 calc(50% - 1px);
	height: 2px;
	background-color: rgb(255 255 255 / .28);
}

.ci-hero .ci-hero__pagination .swiper-pagination-bullet::after {
	background-color: var(--wp--preset--color--white);
	transform: scaleX(0);
	transform-origin: left;
}

.ci-hero .ci-hero__pagination .swiper-pagination-bullet-active::after {
	animation: ci-hero-progress var(--ci-hero-interval) linear forwards;
}

.ci-hero.is-paused .ci-hero__pagination .swiper-pagination-bullet-active::after {
	animation-play-state: paused;
}

.ci-hero.is-stopped .ci-hero__pagination .swiper-pagination-bullet-active::after {
	animation: none;
	transform: scaleX(1);
}

@keyframes ci-hero-progress {
	to {
		transform: scaleX(1);
	}
}

.ci-hero__toggle {
	display: inline-grid;
	place-items: center;
	width: 2.5rem;
	height: 2.5rem;
	padding: 0;
	border: 1px solid rgb(255 255 255 / .35);
	border-radius: 50%;
	background: none;
	color: var(--wp--preset--color--white);
	cursor: pointer;
	transition: border-color .2s var(--ci-ease);
}

.ci-hero__toggle:hover {
	border-color: var(--wp--preset--color--white);
}

.ci-hero__toggle .ci-hero__toggle-play,
.ci-hero.is-stopped .ci-hero__toggle .ci-hero__toggle-pause {
	display: none;
}

.ci-hero.is-stopped .ci-hero__toggle .ci-hero__toggle-play {
	display: inline-block;
}

/*
 * Desktop: photo full-bleed behind a translucent navy panel with a diagonal
 * edge. The panel is sized from the content container, not the window, so on
 * ultra-wide screens it still covers the text.
 */
@media (min-width: 960px) {
	.ci-hero {
		--ci-hero-pad: 3.5rem;
		--ci-hero-slant: 7rem;
		--ci-hero-wrap: min(100%, calc(var(--wp--style--global--wide-size, 1520px) + (var(--ci-gutter) * 2)));
		--ci-hero-text: min(44rem, calc((var(--ci-hero-wrap) - (var(--ci-gutter) * 2)) * .52));
		display: grid;
	}

	.ci-hero__media {
		position: absolute;
		inset: 0;
		aspect-ratio: auto;
	}

	/* Light wash across the whole photo, so the panel's edge isn't a hard line. */
	.ci-hero__media::before {
		content: "";
		position: absolute;
		inset: 0;
		z-index: 2;
		background: linear-gradient(90deg, rgb(1 18 34 / .45) 0, rgb(1 18 34 / 0) 70%);
		pointer-events: none;
	}

	.ci-hero__media::after {
		inset: 0 auto 0 0;
		width: calc(((100% - var(--ci-hero-wrap)) / 2) + var(--ci-gutter) + var(--ci-hero-text) + var(--ci-hero-slant));
		background: linear-gradient(90deg, rgb(1 18 34 / .94) 0, rgb(1 18 34 / .88) 60%, rgb(1 18 34 / .7) 100%);
		clip-path: polygon(0 0, 100% 0, calc(100% - var(--ci-hero-slant)) 100%, 0 100%);
	}

	.ci-hero__inner {
		display: flex;
		align-items: center;
		padding-block: var(--ci-hero-pad);
	}

	.ci-hero__content {
		max-width: min(43rem, 46%);
	}

	.ci-hero--no-media .ci-hero__content {
		max-width: 48rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ci-hero .ci-hero__pagination .swiper-pagination-bullet-active::after {
		animation: none;
		transform: scaleX(1);
	}
}
