/*
 * Spacca - Issue hero
 * Full-viewport section with a Vimeo background video (covering the 16:9 with no
 * black bars), a WebP fallback image behind it, two side texts and a floating
 * arrow that links to the contents section.
 */

.spacca-hero {
	position: relative;
	/* 100vh first as a fallback: dvh lands in Safari 15.4, and without it the
	   hero would have no height at all, since its content is absolutely
	   positioned. */
	height: 100vh;
	height: 100dvh;
	overflow: hidden;
	background-position: center;
	background-size: cover;
	background-color: var(--text);
	margin-bottom:8rem;
}

.spacca-hero--issue-1 {
	background-image: url("../img/fallback-image-issue1.webp");
}

.spacca-hero--issue-2 {
	background-image: url("../img/fallback-image-issue2.webp");
}

/* Issue 3: square (1:1) background video. The fallback image is 16:9 like the
   others and does not need to match the video: background-size: cover crops it
   to the hero either way. */
.spacca-hero--issue-3 {
	--hero-ratio: 1;
	background-image: url("../img/fallback-image-issue3.webp");
}

.spacca-hero--issue-4 {
	background-image: url("../img/fallback-image-issue4.webp");
}

.spacca-hero::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
	pointer-events: none;
	background: var(--overlay);
}

/* Cover the hero with the video regardless of its aspect ratio: size the iframe
   to the video's ratio (--hero-ratio, default 16:9) and oversize it so it always
   fills the hero. Vimeo fits the video to the same-ratio iframe (no letterbox),
   and the iframe overflow is clipped by the hero. No black bars, no distortion. */
.spacca-hero__iframe {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: max(100vw, calc(100vh * var(--hero-ratio, 1.7778)));
	height: max(100vh, calc(100vw / var(--hero-ratio, 1.7778)));
	border: 0;
	pointer-events: none;
}

.spacca-hero__content {
	position: absolute;
	inset: 0;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding-inline: 1rem;
	color: var(--white);
	pointer-events: none;
}

.spacca-hero__issue {
	margin: 0;
	font-family: var(--font-inter);
	font-weight: 500;
	font-size: 2.5rem;
	line-height: 1;
	color: var(--white);
}

.spacca-hero__season {
	font-family: var(--font-inter);
	font-weight: 400;
	font-size: 2.25rem;
	line-height: 1;
	color: var(--white);
}

.spacca-hero__arrow {
	position: absolute;
	left: 50%;
	bottom: 0;
	transform: translateX(-50%);
	z-index: 3;
	display: inline-flex;
	padding-bottom: 1rem;
	margin-bottom: 1rem;
}

.spacca-hero__arrow img {
	height: 3rem;
	width: auto;
	animation: spacca-hero-float 2s ease-in-out infinite;
}

@keyframes spacca-hero-float {
	0%,
	100% {
		transform: translateY(0);
	}
	50% {
		transform: translateY(0.5rem);
	}
}

@media (prefers-reduced-motion: reduce) {
	.spacca-hero__arrow img {
		animation: none;
	}
}

@media (max-width: 767px) {
	.spacca-hero__issue {
		font-size: 1.75rem;
	}

	.spacca-hero__season {
		font-size: 1.5rem;
	}

	.spacca-hero__arrow img {
		height: 2.5rem;
	}
}

/* Entrance: the hero slides down from fully above the viewport and decelerates
   as it settles into place (ease-out), travelling the whole screen height.
   Runs once on load; only the hero is affected. Skipped for reduced motion. */
@media (prefers-reduced-motion: no-preference) {
	.spacca-hero {
		animation: spacca-hero-in 1.5s cubic-bezier(0.16, 1, 0.3, 1) both;
	}

	@keyframes spacca-hero-in {
		from {
			transform: translateY(-100%);
		}
		to {
			transform: translateY(0);
		}
	}
}
