/*
 * 5.7 Leistungen #leistungen: Feed aus Kacheln und Leistungsfenster.
 * Werte „Handy · Desktop“ aus DESIGN.md 5.7.
 */

.hk-leistungen {
	padding: 56px 16px 0;
	background-color: var(--wp--preset--color--paper);
}

.hk-leistungen > :is(h1, h2) {
	margin-bottom: 8px;
	font-size: 32px;
	line-height: 1.18;
}

.hk-leistungen > :is(h1, h2) + p {
	margin-bottom: 24px;
	font-size: 17px;
}

/* ---------- Feed ---------- */

.hk-feed {
	position: relative;
	margin-inline: -16px; /* randlos */
}

.hk-feed-raster {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 3px;
}

.hk-kachel {
	position: relative;
	aspect-ratio: 3 / 4;
	overflow: hidden;
	border-radius: var(--wp--custom--radius--feed);
	color: var(--wp--preset--color--white);
}

/* Helle Grundfarben: Icon in cobalt. */
.hk-kachel:is(.has-creme-background-color, .has-paper-background-color, .has-blush-background-color, .has-white-background-color, .has-hairline-background-color) {
	color: var(--wp--preset--color--cobalt);
}

/* Bild deckt die Kachel. */
.hk-kachel > .wp-block-image {
	position: absolute;
	inset: 0;
}

.hk-kachel > .wp-block-image :is(a, img) {
	display: block;
	width: 100%;
	height: 100%;
}

.hk-kachel > .wp-block-image img {
	object-fit: cover;
}

/* Fokusring innen (−4 px). */
.hk-kachel a:focus-visible,
.hk-leistung:focus-visible {
	outline: 3px solid var(--wp--preset--color--cobalt);
	outline-offset: -4px;
}

/* Hover-Lift für Kacheln. */
.hk-kachel:has(> .wp-block-image a),
.hk-js .hk-leistung {
	cursor: pointer;
	transition: transform var(--wp--custom--dauer--lift) ease-out;
}

.hk-kachel:has(> .wp-block-image a):hover,
.hk-js .hk-leistung:hover {
	transform: translateY(-2px);
}

/* Eck-Icon rechts oben: Mehrfachbild bei Leistungen, Reel und Pin als Block-Stil. */
.hk-leistung::after,
.hk-kachel.is-style-kachel-reel::after,
.hk-kachel.is-style-kachel-pin::after {
	content: "";
	position: absolute;
	top: 9px;
	right: 9px;
	z-index: 1;
	width: 15px;
	height: 15px;
	background-color: currentColor;
	-webkit-mask: url("../icons/icon_mehrfachbild.svg") center / contain no-repeat;
	mask: url("../icons/icon_mehrfachbild.svg") center / contain no-repeat;
	pointer-events: none;
}

.hk-kachel.is-style-kachel-reel::after {
	-webkit-mask-image: url("../icons/icon_reel.svg");
	mask-image: url("../icons/icon_reel.svg");
}

.hk-kachel.is-style-kachel-pin::after {
	width: 16px;
	height: 16px;
	-webkit-mask-image: url("../icons/icon_pin.svg");
	mask-image: url("../icons/icon_pin.svg");
	transform: rotate(40deg);
}

/* Mit JavaScript: Kachel zeigt nur das Bild, der Name bleibt für Screenreader. */
.hk-js .hk-leistung > :is(h1, h2, h3, h4, h5, h6) {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

.hk-js .hk-leistung > p {
	display: none;
}

/* Ohne JavaScript: Kacheln als Raster, darunter alle Leistungen untereinander. */
html:not(.hk-js) .hk-kachel {
	display: contents;
}

html:not(.hk-js) .hk-kachel::after {
	display: none;
}

html:not(.hk-js) .hk-kachel > .wp-block-image {
	position: relative;
	aspect-ratio: 3 / 4;
	overflow: hidden;
	border-radius: var(--wp--custom--radius--feed);
}

html:not(.hk-js) .hk-kachel > :not(.wp-block-image) {
	order: 1;
	grid-column: 1 / -1;
	padding-inline: 16px;
	color: var(--wp--preset--color--ink);
}

html:not(.hk-js) .hk-leistung > :is(h1, h2, h3, h4, h5, h6) {
	padding-top: 24px;
	font-size: 22px;
	line-height: 1.25;
	color: var(--wp--preset--color--cobalt);
}

html:not(.hk-js) .hk-leistung > p:first-of-type {
	padding-top: 4px;
	font-size: 17px;
	line-height: 1.55;
	font-weight: 600;
}

html:not(.hk-js) .hk-leistung > p + p {
	padding-top: 8px;
	font-size: 16px;
	line-height: 1.65;
}

/* ---------- Leistungsfenster ---------- */

.hk-fenster[hidden] {
	display: none !important;
}

.hk-fenster {
	position: absolute;
	top: 0;
	right: 0;
	left: 0;
	z-index: 10;
	box-sizing: border-box;
	min-height: 100%;
	padding: 10px;
	background-color: var(--wp--custom--overlay);
}

.hk-fenster-box {
	scroll-margin-top: 10px;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border-radius: var(--wp--custom--radius--karte);
	background-color: var(--wp--preset--color--paper);
	color: var(--wp--preset--color--ink);
}

/* Handy: Kopfzeile oben, dann Farbkopf, Text, Fußzeile. */
.hk-fenster-inhalt {
	display: contents;
}

.hk-fenster-kopfzeile {
	order: -1;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 6px 6px 6px 14px;
	border-bottom: 1px solid var(--wp--preset--color--hairline);
}

.hk-fenster-kopfzeile .hk-mit-avatar {
	--hk-avatar: 30px;
	font-size: 14px;
}

.hk-fenster-kopfzeile .wp-block-buttons,
.hk-fenster-fuss .wp-block-buttons {
	margin: 0;
	gap: 0;
}

.hk-fenster-schliessen {
	--hk-maske: url("../icons/icon_schliessen.svg");
	--hk-icon: 20px;
}

.hk-fenster-schliessen .wp-block-button__link.wp-element-button {
	color: var(--wp--preset--color--ink);
}

.hk-fenster-farbkopf {
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	box-sizing: border-box;
	height: 190px;
	padding: 18px;
	color: var(--wp--preset--color--white);
}

.hk-fenster-farbkopf:is(.has-creme-background-color, .has-paper-background-color, .has-blush-background-color, .has-white-background-color, .has-hairline-background-color) {
	color: var(--wp--preset--color--cobalt);
}

.hk-fenster-name {
	font-size: 30px;
	line-height: 1.2;
	color: inherit;
}

.hk-fenster-text {
	padding: 16px 18px 8px;
}

.hk-fenster-einzeiler {
	margin-bottom: 8px;
	font-size: 17px;
	line-height: 1.55;
	font-weight: 600;
}

.hk-fenster-detail,
.hk-fenster-detail p {
	font-size: 16px;
	line-height: 1.65;
}

.hk-fenster-fuss {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 4px 6px 8px;
}

.hk-fenster-zurueck {
	--hk-maske: url("../icons/icon_pfeil-zurueck.svg");
	--hk-icon: 22px;
}

.hk-fenster-weiter {
	--hk-maske: url("../icons/icon_pfeil-weiter.svg");
	--hk-icon: 22px;
}

.hk-fenster-zaehler {
	font-size: 13px;
	font-weight: 900;
	letter-spacing: 0.08em;
	text-align: center;
}

/* ---------- Desktop ab 700 px ---------- */

@media (min-width: 700px) {
	.hk-leistungen {
		padding: 96px 24px 112px;
	}

	.hk-leistungen > * {
		max-width: 880px;
		margin-inline: auto;
	}

	.hk-leistungen > :is(h1, h2) {
		margin-bottom: 10px;
		font-size: 48px;
	}

	.hk-leistungen > :is(h1, h2) + p {
		margin-bottom: 36px;
		font-size: 19px;
	}

	.hk-feed {
		margin-inline: auto;
	}

	.hk-feed-raster {
		gap: 4px;
	}

	.hk-leistung::after,
	.hk-kachel.is-style-kachel-reel::after {
		top: 16px;
		right: 16px;
		width: 22px;
		height: 22px;
	}

	.hk-kachel.is-style-kachel-pin::after {
		top: 16px;
		right: 16px;
		width: 22px;
		height: 22px;
	}

	html:not(.hk-js) .hk-kachel > :not(.wp-block-image) {
		padding-inline: 0;
	}

	.hk-fenster {
		inset: 0;
		padding: 40px 24px;
		border-radius: var(--wp--custom--radius--feed);
	}

	.hk-fenster-box {
		position: sticky;
		top: 32px;
		flex-direction: row;
		flex-wrap: wrap;
		max-width: 760px;
		margin-inline: auto;
	}

	.hk-fenster-farbkopf {
		flex: 1 1 280px;
		height: auto;
		min-height: 360px;
		padding: 28px;
	}

	.hk-fenster-name {
		font-size: 36px;
	}

	.hk-fenster-inhalt {
		display: flex;
		flex: 1 1 320px;
		flex-direction: column;
	}

	.hk-fenster-kopfzeile {
		padding: 8px 8px 8px 20px;
	}

	.hk-fenster-kopfzeile .hk-mit-avatar {
		--hk-avatar: 36px;
		font-size: 15px;
	}

	.hk-fenster-text {
		padding: 22px 24px 10px;
	}

	.hk-fenster-einzeiler {
		margin-bottom: 12px;
		font-size: 19px;
	}

	.hk-fenster-detail,
	.hk-fenster-detail p {
		font-size: 17px;
		line-height: 1.7;
	}

	.hk-fenster-fuss {
		margin-top: auto;
		padding: 6px 8px 10px;
		border-top: 1px solid var(--wp--preset--color--hairline);
	}
}

@media (prefers-reduced-motion: reduce) {
	.hk-kachel:has(> .wp-block-image a):hover,
	.hk-js .hk-leistung:hover {
		transform: none;
	}
}
