/*
 * Karten-Slider ALB element - kl_card_slider.php / kl_card_slider.js
 *
 * >= 1100px: header row (heading + intro left, orange arrows right), then 5 cards per view
 *            with 16px gaps (Figma: 229.2px cards in the 1210px column).
 * 768-1099px: 3 cards per view.
 * < 768px:   the row bleeds to the screen edges and is swiped, the next card peeks in;
 *            the arrows move below it, right-aligned (as in Prozess-Schritte).
 * The track is a native scroll-snap row in every size; the arrows only scroll it by one
 * card (kl_card_slider.js) and are hidden while everything fits.
 *
 * Self-contained (fonts, colors) so it also looks right without "Neues Design".
 * Selectors use "html #top #wrap_all .kl-cards" to beat Enfold's theme-option CSS.
 */

@font-face {
	font-family: 'Host Grotesk';
	src: url('../../assets/fonts/host-grotesk-latin.woff2') format('woff2');
	font-weight: 300 800;
	font-style: normal;
	font-display: swap;
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

.kl-cards {
	--kl-cards-orange: #f08400;
	--kl-cards-orange-hover: #d97700;
	--kl-cards-ink: #222;
	--kl-cards-ink-strong: #171717;
	--kl-cards-text: #444;
	--kl-cards-font: 'Host Grotesk', 'Helvetica Neue', Helvetica, Arial, sans-serif;
	--kl-cards-gap: 16px;
	--kl-cards-per-view: 5;

	container-type: inline-size;
	font-family: var(--kl-cards-font);
}

/* Header row */

.kl-cards__header {
	display: flex;
	align-items: center;
	gap: 50px;
	margin-bottom: 40px;
}

.kl-cards__intro {
	flex: 1 1 auto;
	min-width: 0;
}

html #top #wrap_all .kl-cards :is(h2, h3).kl-cards__heading {
	margin: 0;
	padding: 0;
	font-family: var(--kl-cards-font);
	font-size: clamp(30px, 1.25rem + 1.95vw, 48px);
	font-weight: 700;
	line-height: 1.3;
	letter-spacing: 1px;
	text-transform: none;
	color: var(--kl-cards-ink);
}

html #top #wrap_all .kl-cards p.kl-cards__lead {
	margin: 8px 0 0;
	padding: 0;
	font-family: var(--kl-cards-font);
	font-size: 16px;
	line-height: 26.4px;
	color: var(--kl-cards-text);
}

/* Arrows: two 36px orange squares, 4.5px apart (77px wide in Figma) */

.kl-cards__nav {
	flex: 0 0 auto;
	display: flex;
	gap: 4.5px;
}

.kl-cards__nav[hidden] {
	display: none;
}

html #top #wrap_all .kl-cards .kl-cards__arrow {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36.36px;
	height: 36.36px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 8px;
	background: var(--kl-cards-orange);
	cursor: pointer;
	transition: background-color 0.2s ease, opacity 0.2s ease;
}

html #top #wrap_all .kl-cards .kl-cards__arrow img {
	display: block;
	width: 7.1px;
	height: 15.16px;
	max-width: none;
}

html #top #wrap_all .kl-cards .kl-cards__arrow:is(:hover, :focus-visible) {
	background: var(--kl-cards-orange-hover);
}

html #top #wrap_all .kl-cards .kl-cards__arrow:focus-visible {
	outline: 2px solid var(--kl-cards-ink);
	outline-offset: 2px;
}

html #top #wrap_all .kl-cards .kl-cards__arrow:disabled {
	opacity: 0.4;
	cursor: default;
	background: var(--kl-cards-orange);
}

/* Track */

html #top #wrap_all .kl-cards .kl-cards__track {
	display: flex;
	gap: var(--kl-cards-gap);
	margin: 0;
	padding: 0;
	list-style: none;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	overscroll-behavior-x: contain;
	scrollbar-width: none;
}

html #top #wrap_all .kl-cards .kl-cards__track::-webkit-scrollbar {
	display: none;
}

html #top #wrap_all .kl-cards .kl-cards__card {
	position: relative;
	flex: 0 0 calc((100cqw - (var(--kl-cards-per-view) - 1) * var(--kl-cards-gap)) / var(--kl-cards-per-view));
	display: flex;
	flex-direction: column;
	gap: 16px;
	min-width: 0;
	margin: 0;
	padding: 0;
	list-style: none;
	background: transparent;
	scroll-snap-align: start;
}

/* Image: 229.2 x 149 in Figma, 8px corners */

.kl-cards__media {
	aspect-ratio: 229.2 / 149;
	overflow: hidden;
	border-radius: 8px;
}

html #top #wrap_all .kl-cards .kl-cards__img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	border-radius: 0;
	transition: transform 0.4s ease;
}

html #top #wrap_all .kl-cards .kl-cards__card--linked:hover .kl-cards__img {
	transform: scale(1.04);
}

.kl-cards__body {
	display: flex;
	flex-direction: column;
	gap: 13.25px;
	padding: 0 7px 24px;
}

html #top #wrap_all .kl-cards :is(h3, h4).kl-cards__title {
	margin: 0;
	padding: 0;
	font-family: var(--kl-cards-font);
	font-size: 19px;
	font-weight: 500;
	line-height: 1.3;
	letter-spacing: 0;
	text-transform: none;
	color: var(--kl-cards-ink-strong);
	overflow-wrap: break-word;
}

html #top #wrap_all .kl-cards .kl-cards__link {
	color: inherit;
	text-decoration: none;
}

/* The title link covers the whole card. */
html #top #wrap_all .kl-cards .kl-cards__link::after {
	content: '';
	position: absolute;
	inset: 0;
	border-radius: 8px;
}

html #top #wrap_all .kl-cards .kl-cards__card--linked:hover .kl-cards__link {
	color: var(--kl-cards-orange);
}

html #top #wrap_all .kl-cards .kl-cards__link:focus-visible {
	outline: none;
}

html #top #wrap_all .kl-cards .kl-cards__link:focus-visible::after {
	outline: 2px solid var(--kl-cards-ink);
	outline-offset: 2px;
}

html #top #wrap_all .kl-cards p.kl-cards__text {
	margin: 0;
	padding: 0;
	font-family: var(--kl-cards-font);
	font-size: 15px;
	line-height: 1.4;
	color: var(--kl-cards-ink-strong);
	overflow-wrap: break-word;
}

/* Tablet: 3 cards per view */

@media (max-width: 1099px) {
	.kl-cards {
		--kl-cards-per-view: 3;
	}
}

/* Mobile: swipe row that bleeds to the screen edges, arrows below it on the right (as in
   Prozess-Schritte). The header is unwrapped so the nav can be ordered after the track. */

@media (max-width: 767px) {
	.kl-cards {
		display: flex;
		flex-direction: column;
	}

	.kl-cards__header {
		display: contents;
	}

	.kl-cards__intro {
		margin-bottom: 32px;
	}

	.kl-cards__nav {
		order: 1;
		align-self: flex-end;
		margin-top: 24px;
	}

	html #top #wrap_all .kl-cards .kl-cards__track {
		/* 100cqw = column width (.kl-cards is the container); a % in scroll-padding would
		   refer to the scroller itself. */
		--kl-cards-gutter: calc((100vw - 100cqw) / 2);
		margin-inline: calc(-1 * var(--kl-cards-gutter));
		padding-inline: var(--kl-cards-gutter);
		scroll-padding-inline: var(--kl-cards-gutter);
	}

	html #top #wrap_all .kl-cards .kl-cards__card {
		flex-basis: 72%;
	}
}

@media (prefers-reduced-motion: reduce) {
	html #top #wrap_all .kl-cards .kl-cards__track {
		scroll-behavior: auto;
	}

	html #top #wrap_all .kl-cards .kl-cards__img {
		transition: none;
	}
}
