/* MoSeven + · Video Hover Kacheln */

/* Breite: Die Kacheln haben keine eigene Mindestbreite (alles darin ist absolut positioniert).
   Elementor schaltet Flexbox-Container auf Mobil auf „Umbruch". Ohne feste Breite misst der
   Container die Höhe des Widgets dann bei Breite 0 und wird viel zu niedrig, das Widget läuft
   unten heraus. Deshalb bekommt das Widget wie Elementors eigenes Video-Widget volle Breite. */
.elementor-element.elementor-widget-moseven-hover-video-tiles {
	width: 100%;
	flex-direction: column;
	/* „Container ausfüllen": in Spalten-Containern wächst das Widget in den freien Platz. */
	flex-grow: max(var(--msp-grow, 0), var(--flex-grow, 0));
	height: var(--msp-root-h, auto);
	min-height: var(--msp-min-h, 0);
}

/* Beim Ausfüllen wird die Höhe über verschachtelte Flexboxen nach innen gereicht. Das funktioniert
   auch, wenn der Container nur eine Mindesthöhe hat (Prozent-Höhen greifen dort nicht).
   :where() hält die Spezifität bei 0, damit Elementors Ausblenden je Gerät Vorrang behält. */
:where(.elementor-widget-moseven-hover-video-tiles) {
	display: var(--msp-chain, block);
}

/* Elementor setzt hier height: 100 %. Das verhindert das Strecken, sobald der Container nur eine
   Mindesthöhe hat. Deshalb auto, die Höhe kommt über flex. */
.elementor-element.elementor-widget.elementor-widget-moseven-hover-video-tiles > .elementor-widget-container {
	display: var(--msp-chain, block);
	flex: 1 1 auto;
	flex-direction: column;
	height: auto;
	min-height: 0;
}

.msp-hvt {
	--msp-cols: 4;
	--msp-gap: 16px;
	--msp-zoom: 1.04;
	--msp-speed: 400ms;
	display: var(--msp-chain, block);
	flex: 1 1 auto;
	flex-direction: column;
	width: 100%;
	min-height: 0;
}

@media (max-width: 1024px) {
	.msp-hvt {
		--msp-cols: 3;
	}
}

@media (max-width: 767px) {
	.msp-hvt {
		--msp-cols: 2;
	}
}

/* Raster (und Zustand vor dem Start des Skripts) */
.msp-hvt__grid {
	display: grid;
	grid-template-columns: repeat(var(--msp-cols), minmax(0, 1fr));
	grid-auto-rows: var(--msp-rows, auto);
	gap: var(--msp-gap);
	align-items: var(--msp-align, start);
	flex: 1 1 auto;
	min-height: 0;
}

/* Masonry: das Skript legt Spalten an und verteilt die Kacheln. */
.msp-hvt.is-masonry .msp-hvt__grid {
	display: flex;
	align-items: var(--msp-align, flex-start);
}

.msp-hvt__col {
	display: flex;
	flex: 1 1 0;
	flex-direction: column;
	gap: var(--msp-gap);
	min-width: 0;
}

/* Kachel */
.msp-hvt .msp-hvt__tile {
	position: relative;
	display: block;
	box-sizing: border-box;
	width: 100%;
	aspect-ratio: var(--msp-ar-on, var(--msp-ar, 16 / 9));
	flex: calc(var(--msp-fill, 0) * var(--msp-w, 1)) 1 var(--msp-basis, auto);
	min-height: 0;
	overflow: hidden;
	border: 0 solid transparent;
	border-radius: 12px;
	background-color: #111;
	color: #fff;
	text-decoration: none;
	isolation: isolate;
	transition: border-color var(--msp-speed) ease;
}

.msp-hvt a.msp-hvt__tile:hover,
.msp-hvt a.msp-hvt__tile:focus {
	color: #fff;
	text-decoration: none;
}

.msp-hvt a.msp-hvt__tile:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 3px;
}

.msp-hvt__media {
	position: absolute;
	inset: 0;
	display: block;
	overflow: hidden;
	border-radius: inherit;
}

.msp-hvt .msp-hvt__image,
.msp-hvt .msp-hvt__video {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	border: 0;
	object-fit: cover;
	object-position: center;
	transform: scale(1);
	transition: transform calc(var(--msp-speed) * 1.5) ease, opacity var(--msp-speed) ease;
}

.msp-hvt .msp-hvt__video {
	opacity: 0;
}

.msp-hvt .msp-hvt__tile.is-playing .msp-hvt__video {
	opacity: 1;
}

.msp-hvt .msp-hvt__tile:hover .msp-hvt__image,
.msp-hvt .msp-hvt__tile:hover .msp-hvt__video,
.msp-hvt .msp-hvt__tile:focus-visible .msp-hvt__image,
.msp-hvt .msp-hvt__tile:focus-visible .msp-hvt__video,
.msp-hvt .msp-hvt__tile.is-active .msp-hvt__image,
.msp-hvt .msp-hvt__tile.is-active .msp-hvt__video {
	transform: scale(var(--msp-zoom));
}

.msp-hvt__overlay {
	position: absolute;
	inset: 0;
	z-index: 1;
	display: block;
	pointer-events: none;
	background-image: linear-gradient(180deg, rgba(0, 0, 0, 0) 40%, rgba(0, 0, 0, 0.65) 100%);
}

.msp-hvt__content {
	position: absolute;
	inset: 0;
	z-index: 2;
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	align-items: flex-start;
	padding: clamp(12px, 2vw, 24px);
	text-align: left;
	pointer-events: none;
}

.msp-hvt .msp-hvt__pretext {
	display: block;
	margin: 0 0 0.4em;
	font-size: 0.75rem;
	line-height: 1.3;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: inherit;
}

.msp-hvt .msp-hvt__logo {
	display: block;
	flex: none;
	width: auto;
	max-width: 100%;
	height: 48px;
	margin: 0 0 8px;
	border: 0;
	border-radius: 0;
	object-fit: contain;
	object-position: left center;
}

.msp-hvt .msp-hvt__text {
	display: block;
	margin: 0;
	font-size: 0.8125rem;
	line-height: 1.3;
	letter-spacing: 0.03em;
	text-transform: uppercase;
	color: inherit;
}

.msp-hvt .msp-hvt__content > :last-child {
	margin-bottom: 0;
}

@media (prefers-reduced-motion: reduce) {
	.msp-hvt .msp-hvt__image,
	.msp-hvt .msp-hvt__video,
	.msp-hvt .msp-hvt__tile {
		transition: none;
	}

	.msp-hvt .msp-hvt__tile:hover .msp-hvt__image,
	.msp-hvt .msp-hvt__tile:hover .msp-hvt__video,
	.msp-hvt .msp-hvt__tile.is-active .msp-hvt__image,
	.msp-hvt .msp-hvt__tile.is-active .msp-hvt__video {
		transform: none;
	}
}
