/*
 * The `elspc-js` class is added to <html> by a small script in <head> and is
 * removed again if frontend.js does not start, so every rule that hides or
 * rearranges content depends on it.
 *
 * `elspc-section` is added on the server to cover blocks and full-width group
 * blocks of the post content (not to the theme's own template groups).
 *
 * Cover blocks: the core "Fixed background" option is left to core's own
 * styles (including its iOS and reduced-motion fallbacks).
 */

/* Default background for full-width group blocks (set by frontend.js). */
.wp-block-group.alignfull.elspc-parallax {
	background-size: cover;
	background-position: center center;
	background-repeat: no-repeat;
	background-attachment: fixed;
}

@supports (-webkit-touch-callout: inherit) {
	.wp-block-group.alignfull.elspc-parallax {
		background-attachment: scroll;
	}
}

@media (prefers-reduced-motion: reduce), (hover: none) {
	.wp-block-group.alignfull.elspc-parallax {
		background-attachment: scroll;
	}
}

/* Text fade-in. Keep the selector in sync with TEXT_SELECTOR in frontend.js. */
@media (prefers-reduced-motion: no-preference) {
	.elspc-js .elspc-section h2,
	.elspc-js .elspc-section h3,
	.elspc-js .elspc-section p {
		opacity: 0;
		transform: translateY(50px);
		transition: opacity 1s ease-out, transform 1s ease-out;
	}

	.elspc-js .elspc-section h2.elspc-visible,
	.elspc-js .elspc-section h3.elspc-visible,
	.elspc-js .elspc-section p.elspc-visible {
		opacity: 1;
		transform: none;
	}
}

/*
 * Carousel. The gallery <figure> gets `elspc-carousel` on the server; until
 * frontend.js adds `is-initialized`, only its first image is shown, at the size
 * the carousel will have, so the page does not jump when the script runs.
 */
.elspc-js .wp-block-gallery.elspc-carousel:not(.is-initialized) {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 0;
	overflow: hidden;
}

.elspc-js .wp-block-gallery.elspc-carousel:not(.is-initialized) > figure.wp-block-image:not(#elspc-slide) {
	grid-area: 1 / 1;
}

.elspc-js .wp-block-gallery.elspc-carousel:not(.is-initialized) > figure.wp-block-image ~ figure.wp-block-image {
	visibility: hidden;
}

.elspc-js .wp-block-gallery.elspc-carousel:not(.is-initialized) > figcaption {
	grid-row: 2;
}

.elspc-js .wp-block-gallery.elspc-carousel.is-initialized {
	display: block;
	position: relative;
}

.elspc-carousel__stage {
	position: relative;
}

.elspc-carousel__viewport {
	overflow: hidden;
	touch-action: pan-y;
}

.elspc-carousel__track {
	display: flex;
	will-change: transform;
}

/* Slides: the gallery's own image figures. */
.elspc-js .wp-block-gallery.elspc-carousel figure.wp-block-image:not(#elspc-slide) {
	flex: 0 0 100%;
	width: 100%;
	max-width: 100%;
	margin: 0;
	display: flex;
	flex-direction: column;
	justify-content: center;
	position: relative;
	box-sizing: border-box;
	user-select: none;
	-webkit-user-select: none;
}

.elspc-js .wp-block-gallery.elspc-carousel figure.wp-block-image > a {
	display: flex;
	flex: 1 1 auto;
	width: 100%;
}

.elspc-js .wp-block-gallery.elspc-carousel figure.wp-block-image img {
	display: block;
	flex: 1 1 auto;
	width: 100%;
	height: 100%;
	object-fit: cover;
	-webkit-user-drag: none;
}

/* Image captions, shown over the bottom of the slide (replaces core's gallery caption overlay). */
.elspc-js .wp-block-gallery.elspc-carousel figure.wp-block-image::before {
	content: none;
	display: none;
}

.elspc-js .wp-block-gallery.elspc-carousel figure.wp-block-image figcaption {
	position: absolute;
	top: auto;
	bottom: 30px;
	left: 20px;
	right: 20px;
	width: auto;
	max-height: none;
	margin: 0;
	padding: 15px;
	overflow: visible;
	border-radius: 5px;
	background: rgba(0, 0, 0, 0.2);
	color: #fff;
	text-shadow: none;
	font-size: 1.5em;
	text-align: start;
	box-sizing: border-box;
	backdrop-filter: none;
}

.elspc-js .wp-block-gallery.elspc-carousel figure.wp-block-image figcaption strong {
	display: block;
	font-size: 2em;
	margin-bottom: 8px;
}

.elspc-js .wp-block-gallery.elspc-carousel figure.wp-block-image figcaption a {
	color: #fff;
}

/* Arrows. */
.elspc-carousel .elspc-carousel__prev,
.elspc-carousel .elspc-carousel__next {
	position: absolute;
	top: 50%;
	z-index: 2;
	width: 40px;
	height: 40px;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.5);
	color: #fff;
	box-shadow: none;
	cursor: pointer;
	transform: translateY(-50%);
}

.elspc-carousel .elspc-carousel__prev {
	inset-inline-start: 10px;
}

.elspc-carousel .elspc-carousel__next {
	inset-inline-end: 10px;
}

.elspc-carousel .elspc-carousel__prev::before,
.elspc-carousel .elspc-carousel__next::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 10px;
	height: 10px;
	border-top: 2px solid currentColor;
	border-right: 2px solid currentColor;
}

.elspc-carousel .elspc-carousel__prev::before,
.elspc-carousel.is-rtl .elspc-carousel__next::before {
	transform: translate(-30%, -50%) rotate(-135deg);
}

.elspc-carousel .elspc-carousel__next::before,
.elspc-carousel.is-rtl .elspc-carousel__prev::before {
	transform: translate(-70%, -50%) rotate(45deg);
}

.elspc-carousel .elspc-carousel__prev:disabled,
.elspc-carousel .elspc-carousel__next:disabled {
	opacity: 0.35;
	cursor: default;
}

/* Dots. */
.elspc-carousel__pagination {
	position: absolute;
	bottom: 10px;
	left: 0;
	right: 0;
	z-index: 2;
	display: flex;
	justify-content: center;
	gap: 8px;
}

.elspc-carousel .elspc-carousel__dot {
	width: 10px;
	height: 10px;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #fff;
	color: #000;
	box-shadow: none;
	opacity: 0.6;
	cursor: pointer;
}

.elspc-carousel .elspc-carousel__dot[aria-current="true"] {
	opacity: 1;
}

.elspc-carousel button:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
	box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.6);
}

@media (max-width: 768px) {
	.elspc-js .wp-block-gallery.elspc-carousel figure.wp-block-image figcaption {
		padding: 10px;
		font-size: 1.2em;
	}

	.elspc-js .wp-block-gallery.elspc-carousel figure.wp-block-image figcaption strong {
		font-size: 1.5em;
	}
}
