/**
 * Leistungskacheln auf der Startseite (ds/leistungskacheln.php).
 *
 * Desktop: Bento-Raster mit 4 Spalten, Bild füllt die Kachel, Text unten auf
 * dunklem Verlauf. Der Verlauf hängt am Textblock und nicht an der Kachel,
 * damit weiße Schrift auch über hellen Bildern mindestens 4,5 : 1 erreicht.
 * Tablet: 2 Spalten. Handy: eine Spalte, Bild als Vorschau links neben dem Text.
 */

.ps-kacheln {
	--ps-k-gap: 16px;
	--ps-k-row: 270px;
	--ps-k-accent: #697787;
	--ps-k-dunkel: 20, 25, 31;
	width: 100%;
}

.ps-kacheln .ps-kacheln__grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	grid-auto-rows: var(--ps-k-row);
	grid-auto-flow: row dense;
	gap: var(--ps-k-gap);
	margin: 0;
	padding: 0;
	list-style: none;
}

.ps-kacheln .ps-kachel {
	min-width: 0;
	margin: 0;
	padding: 0;
}

.ps-kachel--xl {
	grid-column: span 2;
	grid-row: span 2;
}

.ps-kachel--wide {
	grid-column: span 2;
}

.ps-kachel--tall {
	grid-row: span 2;
}

/* ---------- Kachel ---------- */

.ps-kacheln .ps-kachel__link {
	position: relative;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	height: 100%;
	overflow: hidden;
	border-radius: 5px;
	background: #3d4650;
	color: #fff;
	text-decoration: none;
	isolation: isolate;
}

.ps-kachel__media {
	position: absolute;
	inset: 0;
	z-index: -1;
	display: block;
}

.ps-kachel__media::after {
	content: "";
	position: absolute;
	inset: 0;
	background: rgba(var(--ps-k-dunkel), .18);
	transition: background-color .35s ease;
}

.ps-kacheln .ps-kachel__img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	border-radius: 0;
	transition: transform .6s cubic-bezier(.2, .7, .3, 1);
}

.ps-kachel__body {
	display: block;
	padding: 48px 24px 22px;
	background: linear-gradient(180deg,
		rgba(var(--ps-k-dunkel), 0) 0,
		rgba(var(--ps-k-dunkel), .62) 40px,
		rgba(var(--ps-k-dunkel), .86) 100%);
}

.ps-kachel__eyebrow {
	display: block;
	margin-bottom: 8px;
	color: #e6e9ec;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: .17em;
	line-height: 1.2;
	text-transform: uppercase;
}

.ps-kachel__title {
	display: block;
	color: #fff;
	font-size: 19px;
	font-weight: 500;
	letter-spacing: .01em;
	line-height: 1.2;
	text-transform: uppercase;
	overflow-wrap: anywhere;
	hyphens: auto;
}

.ps-kachel__text {
	display: -webkit-box;
	overflow: hidden;
	margin-top: 8px;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 4; /* nur Notbremse, die Texte sind auf zwei bis drei Zeilen ausgelegt */
	color: rgba(255, 255, 255, .92);
	font-size: 15px;
	font-weight: 400;
	line-height: 1.45;
}

.ps-kachel__arrow {
	position: absolute;
	top: 16px;
	right: 16px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: rgba(255, 255, 255, .92);
	color: var(--ps-k-accent);
	font-size: 18px;
	line-height: 1;
	transition: background-color .25s ease, color .25s ease, transform .25s ease;
}

/* Große Kacheln */

.ps-kachel--xl .ps-kachel__body {
	padding: 80px 36px 32px;
	background: linear-gradient(180deg,
		rgba(var(--ps-k-dunkel), 0) 0,
		rgba(var(--ps-k-dunkel), .62) 68px,
		rgba(var(--ps-k-dunkel), .86) 100%);
}

.ps-kachel--xl .ps-kachel__title {
	font-size: 30px;
}

.ps-kachel--xl .ps-kachel__text {
	max-width: 34em;
	font-size: 17px;
}

.ps-kachel--wide .ps-kachel__title {
	font-size: 22px;
}

.ps-kachel--wide .ps-kachel__text {
	max-width: 34em;
}

/* Hover und Fokus */

.ps-kachel__link:hover .ps-kachel__img,
.ps-kachel__link:focus-visible .ps-kachel__img {
	transform: scale(1.05);
}

.ps-kachel__link:hover .ps-kachel__media::after,
.ps-kachel__link:focus-visible .ps-kachel__media::after {
	background: rgba(var(--ps-k-dunkel), .32);
}

.ps-kachel__link:hover .ps-kachel__arrow,
.ps-kachel__link:focus-visible .ps-kachel__arrow {
	background: var(--ps-k-accent);
	color: #fff;
	transform: translateX(3px);
}

.ps-kacheln .ps-kachel__link:focus-visible {
	outline: 2px solid var(--ps-k-accent);
	outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
	.ps-kachel__img,
	.ps-kachel__media::after,
	.ps-kachel__arrow {
		transition: none;
	}
}

/* Desktop: gleiche Inhaltskante wie Hero und Footer (innerer Container mit 10 px). */
@media (min-width: 1025px) {
	.ps-kacheln {
		padding-inline: 10px;
	}
}

/* ---------- Kleiner Desktop: Kacheln schmaler, etwas mehr Höhe ---------- */

@media (max-width: 1279px) {
	.ps-kacheln {
		--ps-k-row: 290px;
	}

	.ps-kachel__body {
		padding: 46px 18px 18px;
	}

	.ps-kachel__title {
		font-size: 17px;
	}

	.ps-kachel__text {
		font-size: 14px;
	}

	.ps-kachel--xl .ps-kachel__title {
		font-size: 26px;
	}

	.ps-kachel--wide .ps-kachel__title {
		font-size: 20px;
	}
}

/* ---------- Tablet: 2 Spalten ---------- */

@media (max-width: 1024px) {
	.ps-kacheln {
		--ps-k-row: 250px;
		--ps-k-gap: 14px;
	}

	.ps-kacheln .ps-kacheln__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.ps-kachel__body {
		padding: 46px 20px 20px;
	}
}

@media (max-width: 767px) {
	.ps-kacheln {
		--ps-k-row: 270px;
	}
}

/* ---------- Handy: eine Spalte, Vorschaubild links ---------- */

@media (max-width: 600px) {
	.ps-kacheln {
		--ps-k-gap: 10px;
	}

	.ps-kacheln .ps-kacheln__grid {
		grid-template-columns: minmax(0, 1fr);
		grid-auto-rows: auto;
	}

	.ps-kachel--xl,
	.ps-kachel--wide,
	.ps-kachel--tall {
		grid-column: auto;
		grid-row: auto;
	}

	.ps-kacheln .ps-kachel__link {
		display: grid;
		grid-template-columns: 112px minmax(0, 1fr);
		align-items: center;
		min-height: 112px;
		background: #f5f3f1;
		color: #111;
	}

	.ps-kachel__media {
		position: relative;
		inset: auto;
		z-index: auto;
		align-self: stretch;
		overflow: hidden;
	}

	.ps-kachel__media::after {
		content: none;
	}

	.ps-kacheln .ps-kachel__img {
		position: absolute;
		inset: 0;
	}

	.ps-kachel__body,
	.ps-kachel--xl .ps-kachel__body {
		padding: 14px 16px;
		background: none;
	}

	.ps-kachel__eyebrow {
		margin-bottom: 4px;
		color: #4f5960;
		font-size: 10px;
	}

	.ps-kachel__title,
	.ps-kachel--xl .ps-kachel__title,
	.ps-kachel--wide .ps-kachel__title {
		color: #111;
		font-size: 16px;
	}

	.ps-kachel__text,
	.ps-kachel--xl .ps-kachel__text {
		display: block;
		overflow: visible;
		-webkit-line-clamp: none;
		margin-top: 4px;
		color: #3d4650;
		font-size: 14px;
		line-height: 1.4;
	}

	.ps-kachel__arrow {
		display: none;
	}

	.ps-kachel__link:hover .ps-kachel__img,
	.ps-kachel__link:focus-visible .ps-kachel__img {
		transform: none;
	}
}
