/* =========================================================
   DMG Leistungen: dynamische Farbzuordnung

   Die semantischen Variablen greifen zuerst auf bereits ausgegebene
   SCF-/Markenfarben zurück. Falls eine Variable nicht vorhanden ist,
   bleiben sichere Standardwerte aktiv.
   ========================================================= */
/* Die Variablen verwenden exakt die Slugs aus markenfarben.php. */
:root {
    --dmg-leistung-primaer: var(--wp--preset--color--ti-accent, #005A8C);
    --dmg-leistung-primaer-hover: var(--wp--preset--color--ti-accent-secondary, #003B5C);
    --dmg-leistung-akzent: var(--wp--preset--color--ti-highlight, #E8A000);
    --dmg-leistung-text: var(--wp--preset--color--ti-fg, #1D252C);
    --dmg-leistung-text-sekundaer: var(--wp--preset--color--ti-fg, #1D252C);
    --dmg-leistung-hintergrund: var(--wp--preset--color--ti-bg, #FFFFFF);
    --dmg-leistung-flaeche: var(--wp--preset--color--ti-bg, #FFFFFF);
    --dmg-leistung-flaeche-sanft: var(--wp--preset--color--ti-bg-alt, #F2F4F5);
    --dmg-leistung-flaeche-bild: var(--wp--preset--color--ti-bg-alt, #F2F4F5);
    --dmg-leistung-rahmen: var(--wp--preset--color--ti-border, #D8DDE1);
    --dmg-leistung-auf-primaer: var(--wp--preset--color--ti-fg-alt, #FFFFFF);
}

.dmg-leistungsuebersicht::before {
	content: "";
	position: absolute;
	z-index: -1;
	top: 0;
	bottom: 0;
	left: 50%;
	width: 100vw;
	transform: translateX(-50%);
	background-color: var(--dmg-leistung-flaeche-sanft);
	background-repeat: no-repeat;
	background-position: center center;
	background-size: cover;
	pointer-events: none;
}

.dmg-leistungsuebersicht--beratung::before {
	background-image:
		linear-gradient(
			rgba(255, 255, 255, 0.58),
			rgba(255, 255, 255, 0.58)
		),
		url("./backgrounds/beratung.webp");
}

.dmg-leistungsuebersicht--abrechnung::before {
	background-image:
		linear-gradient(
			rgba(255, 255, 255, 0.58),
			rgba(255, 255, 255, 0.58)
		),
		url("./backgrounds/abrechnung.webp");
}

.dmg-leistungsuebersicht--miete::before {
	background-image:
		linear-gradient(
			rgba(255,255,255,0.58),
			rgba(255,255,255,0.58)
		),
		url("./backgrounds/geraete.webp");
}

.dmg-leistungsuebersicht--rauchwarnmelder::before {
	background-image:
		linear-gradient(
			rgba(255, 255, 255, 0.58),
			rgba(255, 255, 255, 0.58)
		),
		url("./backgrounds/rauchwarnmelder.webp");
}

.dmg-leistungsuebersicht--sonstiges::before {
	background-image:
		linear-gradient(
			rgba(255, 255, 255, 0.58),
			rgba(255, 255, 255, 0.58)
		),
		url("./backgrounds/sonstiges.webp");
}

/* =========================================================
   Hintergrundbilder auf Leistungsdetailseiten
   ========================================================= */

/*
 * Der Cover-Block erhält auf allen Leistungsdetailseiten
 * dieselbe neutrale Klasse.
 */
.dmg-leistung-hintergrund {
	position: relative;
	width: 100vw;
	max-width: none;
	margin-left: calc(50% - 50vw);
	margin-right: calc(50% - 50vw);
	background-color: var(--dmg-leistung-flaeche-sanft);
	background-repeat: no-repeat;
	background-position: center center;
	background-size: cover;
}

/*
 * Beratung und Planung
 */
body.dmg-leistungsgruppe--beratung
.dmg-leistung-hintergrund {
	background-image: url("./backgrounds/beratung.webp");
}

/*
 * Abrechnung
 */
body.dmg-leistungsgruppe--abrechnung
.dmg-leistung-hintergrund {
	background-image: url("./backgrounds/abrechnung.webp");
}

/*
 * Finanzierung und Gerätemiete
 */
body.dmg-leistungsgruppe--miete
.dmg-leistung-hintergrund {
	background-image: url("./backgrounds/geraete.webp");
}

body.dmg-leistungsgruppe--sonstiges
.dmg-leistung-hintergrund {
    background-image: url("./backgrounds/sonstiges.webp");
}


.dmg-leistung-image {
	display: block;
	width: 100%;
	max-width: 100%;
	min-width: 0;
	margin: 0;
	padding: 0;
	border-radius: 20px;
	overflow: hidden;
}

.dmg-leistung-image .dmg-leistungsbild {
	display: block;
	width: 100% !important;
	max-width: 100% !important;
	height: auto !important;
	margin: 0;
	padding: 0;
	border-radius: inherit;
	object-fit: cover;
}

.dmg-leistung-textbereich {
	color: var(--dmg-leistung-text);
}

.dmg-leistung-textbereich p,
.dmg-leistung-textbereich li,
.dmg-leistung-textbereich h1,
.dmg-leistung-textbereich h2,
.dmg-leistung-textbereich h3,
.dmg-leistung-textbereich h4,
.dmg-leistung-textbereich a {
	color: inherit;
}

.dmg-leistungsuebersicht {
	display: grid !important;
	grid-template-columns: repeat(3, minmax(0, 340px));
	justify-content: center;
	align-items: stretch;
	gap: 32px;
	position: relative;
	z-index: 0;
	isolation: isolate;
	box-sizing: border-box;
	width: 100%;
	max-width: 1100px;
	margin: 0 auto;
	padding: 48px 8px;
	background: none;
	border: 0;
	border-radius: 0;
	overflow: visible;
}

.wp-block-post-content > p:has(.dmg-leistungsuebersicht),
p:has(> .dmg-leistungsuebersicht) {
	display: block;
	width: 100%;
	max-width: none;
	margin: 0 !important;
	padding: 0 !important;
}

.dmg-leistungskarte {
	display: flex;
	flex-direction: column;
	box-sizing: border-box;
	width: 100%;
	min-width: 0;
	max-width: 340px;
	height: 100%;
	min-height: 470px;
	margin: 0;
	padding: 16px;
	overflow: hidden;
	border: 2px solid color-mix(in srgb, var(--dmg-leistung-primaer) 55%, transparent);
	border-radius: 16px;
	background-color: color-mix(in srgb, var(--dmg-leistung-flaeche) 78%, transparent);
	-webkit-backdrop-filter: blur(5px);
	backdrop-filter: blur(5px);
	box-shadow:
		0 10px 24px color-mix(in srgb, var(--dmg-leistung-text) 14%, transparent),
		0 18px 42px color-mix(in srgb, var(--dmg-leistung-text) 12%, transparent);
	transition:
		transform 0.25s ease,
		box-shadow 0.25s ease,
		border-color 0.25s ease;
}

.dmg-leistungskarte:hover {
	transform: translateY(-5px);
	border-color: color-mix(in srgb, var(--dmg-leistung-primaer) 85%, transparent);
	box-shadow:
		0 14px 30px color-mix(in srgb, var(--dmg-leistung-text) 17%, transparent),
		0 24px 50px color-mix(in srgb, var(--dmg-leistung-text) 15%, transparent);
}

.dmg-leistungskarte__bildlink {
	display: block;
	box-sizing: border-box;
	width: 100%;
	height: 190px;
	flex: 0 0 190px;
	margin: 0;
	padding: 0;
	overflow: hidden;
	border-radius: 12px;
	background-color: var(--dmg-leistung-flaeche-bild);
	text-decoration: none;
}

.dmg-leistungskarte__bilddatei {
	display: block !important;
	width: 100% !important;
	max-width: none !important;
	height: 100% !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0;
	border-radius: 0;
	object-fit: cover !important;
	object-position: center center;
	transition: transform 0.35s ease;
}

.dmg-leistungskarte:hover .dmg-leistungskarte__bilddatei {
	transform: scale(1.035);
}

.dmg-leistungskarte__inhalt {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	align-items: stretch;
	box-sizing: border-box;
	min-width: 0;
	width: 100%;
	padding: 22px 4px 2px;
	text-align: center;
}

.dmg-leistungskarte__titel {
	margin: 0 0 16px;
	padding: 0;
	color: var(--dmg-leistung-text);
	font-size: clamp(1.2rem, 1.5vw, 1.4rem);
	font-weight: 700;
	line-height: 1.3;
	text-align: center;
	text-decoration-line: underline;
	text-decoration-color: var(--dmg-leistung-akzent);
	text-decoration-thickness: 2px;
	text-underline-offset: 5px;
}

.dmg-leistungskarte__text {
	flex: 0 1 auto;
	margin: 0;
	padding: 0;
	color: var(--dmg-leistung-text-sekundaer);
	font-size: 1rem;
	line-height: 1.6;
	text-align: center;
}

.dmg-leistungskarte__aktion {
	display: flex;
	align-items: flex-end;
	justify-content: center;
	width: 100%;
	margin-top: auto;
	padding-top: 22px;
}

.dmg-leistungskarte__button,
.dmg-leistungskarte__button.wp-element-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	width: 100%;
	min-height: 48px;
	margin: 0;
	padding: 12px 20px;
	border: 0;
	border-radius: 999px;
	background-color: var(--dmg-leistung-primaer);
	color: var(--dmg-leistung-auf-primaer);
	font-size: 0.95rem;
	font-weight: 700;
	line-height: 1.25;
	text-align: center;
	text-decoration: none;
	transition:
		background-color 0.2s ease,
		transform 0.2s ease;
}

.dmg-leistungskarte__button:hover,
.dmg-leistungskarte__button:focus,
.dmg-leistungskarte__button.wp-element-button:hover,
.dmg-leistungskarte__button.wp-element-button:focus {
	background-color: var(--dmg-leistung-primaer-hover);
	color: var(--dmg-leistung-auf-primaer);
	text-decoration: none;
	transform: translateY(-2px);
}

.dmg-leistungskarte__button:focus-visible {
	outline: 3px solid var(--dmg-leistung-akzent);
	outline-offset: 3px;
}

.dmg-leistungsuebersicht__hinweis {
	grid-column: 1 / -1;
	box-sizing: border-box;
	width: 100%;
	margin: 0;
	padding: 18px 20px;
	border-left: 4px solid var(--dmg-leistung-primaer);
	border-radius: 10px;
	background-color: var(--dmg-leistung-auf-primaer);
	color: var(--dmg-leistung-text);
}

@media (max-width: 1100px) {
	.dmg-leistungsuebersicht {
		grid-template-columns: repeat(2, minmax(0, 340px));
		width: 100%;
		max-width: 732px;
		gap: 28px;
		padding: 64px 8px;
	}
}

@media (max-width: 740px) {
	.dmg-leistungsuebersicht {
		grid-template-columns: minmax(0, 1fr);
		width: 100%;
		max-width: 420px;
		margin: 0 auto;
		padding: 36px 18px;
		gap: 24px;
	}

	.dmg-leistungsuebersicht::before {
		background-position: center center;
	}

	.dmg-leistungskarte {
		max-width: 100%;
		min-height: 0;
	}

	.dmg-leistungskarte__bildlink {
		height: 200px;
		flex-basis: 200px;
	}

	.dmg-leistungskarte__inhalt {
		padding-top: 20px;
	}

	.dmg-leistungskarte__titel {
		font-size: 1.25rem;
	}

	.dmg-leistungskarte:hover {
		transform: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.dmg-leistungskarte,
	.dmg-leistungskarte__bilddatei,
	.dmg-leistungskarte__button {
		transition: none;
	}

	.dmg-leistungskarte:hover,
	.dmg-leistungskarte:hover .dmg-leistungskarte__bilddatei,
	.dmg-leistungskarte__button:hover {
		transform: none;
	}
}
/* =========================================================
   Wiederverwendbares Kategorien-Modul [dmg_leistungskategorien]
   Bildpfade relativ zur zentralen leistungen.css.
   ========================================================= */
.dmg-leistungskategorien {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: stretch;
    gap: 28px;
    box-sizing: border-box;
    width: 100%;
    max-width: 1100px !important;
    margin: 32px auto !important;
    padding: 16px;
}
.dmg-leistungskategorien .dmg-kategoriekarte {
    display: flex;
    flex-direction: column;
    flex: 0 1 calc((100% - 56px) / 3);
    min-width: 0;
    box-sizing: border-box;
    overflow: hidden;
    border: 1px solid var(--dmg-leistung-rahmen);
    border-radius: 18px;
    background: var(--dmg-leistung-flaeche);
    color: var(--dmg-leistung-text);
    text-decoration: none;
    box-shadow: 0 8px 24px color-mix(in srgb, var(--dmg-leistung-text) 8%, transparent);
    transition: transform .2s ease, box-shadow .2s ease;
}
.dmg-leistungskategorien .dmg-kategoriekarte:hover {
    color: var(--dmg-leistung-text);
    text-decoration: none;
    transform: translateY(-4px);
    box-shadow: 0 12px 28px color-mix(in srgb, var(--dmg-leistung-text) 14%, transparent);
}
.dmg-leistungskategorien .dmg-kategoriekarte:focus-visible {
    outline: 3px solid var(--dmg-leistung-akzent);
    outline-offset: 4px;
}
.dmg-kategoriekarte__bild {
    display: block;
    flex: 0 0 auto;
    width: 100%;
    aspect-ratio: 16 / 10;
    background-color: var(--dmg-leistung-flaeche-bild);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}
.dmg-kategoriekarte--beratung .dmg-kategoriekarte__bild { background-image: url("./backgrounds/beratung.webp"); }
.dmg-kategoriekarte--abrechnung .dmg-kategoriekarte__bild { background-image: url("./backgrounds/abrechnung.webp"); }
.dmg-kategoriekarte--miete .dmg-kategoriekarte__bild { background-image: url("./backgrounds/geraete.webp"); }
.dmg-kategoriekarte--rauchwarnmelder .dmg-kategoriekarte__bild { background-image: url("./backgrounds/rauchwarnmelder.webp"); }
.dmg-kategoriekarte--sonstiges .dmg-kategoriekarte__bild {
    background-image: url("./backgrounds/sonstiges.webp");
}
.dmg-kategoriekarte__inhalt {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 24px;
    text-align: center;
}
.dmg-leistungskategorien .dmg-kategoriekarte__titel {
    margin: 0 0 14px;
    color: inherit;
    font-size: 1.4rem;
    line-height: 1.3;
    overflow-wrap: anywhere;
}
.dmg-leistungskategorien .dmg-kategoriekarte__text {
    margin: 0 0 24px;
    color: var(--dmg-leistung-text-sekundaer);
    font-size: 1rem;
    line-height: 1.65;
}
.dmg-kategoriekarte__button {
    display: block;
    margin-top: auto;
    padding: 13px 16px;
    border-radius: 999px;
    background: var(--dmg-leistung-primaer);
    color: var(--dmg-leistung-auf-primaer);
    font-weight: 700;
    line-height: 1.4;
}
.dmg-kategoriekarte:hover .dmg-kategoriekarte__button { background: var(--dmg-leistung-primaer-hover); }
.dmg-leistungskategorien__hinweis {
    box-sizing: border-box;
    max-width: 1100px;
    margin: 24px auto;
    padding: 18px;
    border-left: 4px solid var(--dmg-leistung-primaer);
    background: var(--dmg-leistung-flaeche-sanft);
    color: var(--dmg-leistung-text);
}
@media (max-width: 1000px) {
    .dmg-leistungskategorien .dmg-kategoriekarte { flex-basis: calc((100% - 28px) / 2); }
}
@media (max-width: 640px) {
    .dmg-leistungskategorien { gap: 24px; padding: 12px; }
    .dmg-leistungskategorien .dmg-kategoriekarte { flex-basis: 100%; max-width: 420px; }
    .dmg-kategoriekarte__inhalt { padding: 22px; }
    .dmg-leistungskategorien .dmg-kategoriekarte:hover { transform: none; }
}
@media (prefers-reduced-motion: reduce) {
    .dmg-leistungskategorien .dmg-kategoriekarte { transition: none; }
    .dmg-leistungskategorien .dmg-kategoriekarte:hover { transform: none; }
}


.dmg-leistungskategorien {
    position: relative;
    isolation: isolate;

    /* Kein Außenabstand außerhalb des Hintergrundbildes */
    margin: 0 auto !important;

    /* Abstand der Boxen innerhalb des Hintergrundbildes */
    padding: 48px 16px !important;
}

@media (max-width: 640px) {
    .dmg-leistungskategorien {
        padding: 36px 12px !important;
    }
}

/* Hintergrund über die Bildschirmbreite */
.dmg-leistungskategorien::before {
    content: "";
    position: absolute;
    z-index: -1;
    pointer-events: none;

    inset: 0 auto 0 50%;
    width: 100vw;
    transform: translateX(-50%);

    background-color: var(--dmg-leistung-flaeche-sanft);
    background-image:
        linear-gradient(
            rgba(255, 255, 255, 0.35),
            rgba(255, 255, 255, 0.35)
        ),
        url("./backgrounds/leistungen.webp");

    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
}

/* =========================================================
   DMG Leistungen: Unterlinien in lokaler Markenfarbe
   ========================================================= */

/* Überschriften innerhalb der Leistungskacheln */
.dmg-leistungskarte__titel,
.dmg-leistungskarte__titel a,
.dmg-leistungskarte h2,
.dmg-leistungskarte h2 a,
.dmg-leistungskarte h3,
.dmg-leistungskarte h3 a,
.dmg-kategoriekarte__titel,
.dmg-kategoriekarte__titel a {
    text-decoration-color: var(
        --dmg-leistung-primaer,
        var(--wp--preset--color--ti-accent, #005a8c)
    ) !important;

    text-decoration-thickness: 2px;
    text-underline-offset: 4px;
}
