/* AFFLAYDAS: the video fills the screen and loops; the logo sits in the
   middle. Screens taller than wide (orientation: portrait) play the vertical
   video, chosen in index.php. */

:root {
	/* Width of the logo (logo.svg is 1000 x 96). To change it without
	   editing the theme, put the same lines in Appearance > Customize >
	   Additional CSS with new values. */
	--logo-width: min(22.4vw, 537.6px);            /* landscape screens */
	--logo-width-portrait: min(42.56vw, 313.6px);  /* portrait screens, e.g. a phone held upright */

	background: #000;
	color-scheme: dark;
}

body {
	margin: 0;
	background: #000;
}

.hero {
	position: fixed;
	inset: 0;
	display: grid;
	place-items: center;
	overflow: hidden;
	background: #000;
	-webkit-touch-callout: none;
	-webkit-user-select: none;
	user-select: none;
}

.hero__video {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	pointer-events: none;
}

/* When autoplay is blocked (iPhone's Low Power Mode, for one), Safari puts a
   play button over the video. The page starts the video on the first tap
   instead (theme.js), so the button is hidden. */
.hero__video::-webkit-media-controls,
.hero__video::-webkit-media-controls-start-playback-button {
	display: none !important;
	-webkit-appearance: none;
}

.hero__title {
	position: relative; /* above the video */
	width: var(--logo-width);
	margin: 0;
	line-height: 0;
	/* 1em is 1/40 of the logo's width, so the haze of the opening (below)
	   looks the same on every screen. */
	font-size: calc(var(--logo-width) / 40);
}

.hero__logo {
	display: block;
	width: 100%;
	height: auto;
}

@media (orientation: portrait) {
	.hero__title {
		width: var(--logo-width-portrait);
		font-size: calc(var(--logo-width-portrait) / 40);
	}
}


/* The opening
   While the video loads, the logo surfaces out of a haze, rising a little as
   it comes (logo-emerge, 2 seconds), then drifts in the haze (logo-breathe).
   theme.js holds the video until the logo has surfaced, and brings the logo
   into focus when the video starts playing (afflaydas-logo-sharp). The class
   afflaydas-opening on <html> is set in the head (functions.php); without
   JavaScript the logo is simply sharp. */

.afflaydas-opening .hero__logo {
	animation:
		logo-emerge 2s cubic-bezier(0.3, 0, 0.2, 1) both,
		logo-breathe 3.6s ease-in-out 2s infinite alternate;
	will-change: opacity, filter, transform;
}

.afflaydas-opening.afflaydas-logo-sharp .hero__logo {
	animation: none;
	will-change: auto;
}

@keyframes logo-emerge {
	0% {
		opacity: 0;
		filter: blur(1.8em);
		transform: translateY(30%) scale(1.08);
	}
	55% {
		opacity: 0.4;
		filter: blur(0.95em);
	}
	100% {
		opacity: 0.62;
		filter: blur(0.52em);
		transform: none;
	}
}

@keyframes logo-breathe {
	from {
		opacity: 0.62;
		filter: blur(0.52em);
		transform: none;
	}
	to {
		opacity: 0.4;
		filter: blur(0.82em);
		transform: scale(1.015);
	}
}

/* Screens set to reduce motion: the haze without the rise and the drift. */
@media (prefers-reduced-motion: reduce) {
	.afflaydas-opening .hero__logo {
		animation: logo-emerge 2s ease-out both;
	}

	@keyframes logo-emerge {
		from {
			opacity: 0;
			filter: blur(1.8em);
		}
		to {
			opacity: 0.62;
			filter: blur(0.52em);
		}
	}
}
