/**
 * Aufmacher „Foto + Schnellzugriff“  (T54)
 * ---------------------------------------------------------------------------
 * Gilt für jeden Elementor-Abschnitt mit der CSS-Klasse „hac-aufmacher“
 * (Startseite, Leistungsseiten, Elektro Laimer). Geladen von inc/aufmacher.php.
 *
 * Aufbau in Elementor (bleibt dort pflegbar):
 *   Abschnitt .hac-aufmacher  → Foto = Hintergrundbild des Abschnitts
 *     Titel-Baustein          → H1, Dachzeile („Subtitle“), Unterzeile („Text“)
 *     Social-Icons            → Desktop oben rechts im Foto, Handy unten in der Karte
 *     Knöpfe                  → der ERSTE ist der Hauptknopf, alle weiteren
 *                               stehen als Felder in der weißen Leiste
 *
 * Update-fest:
 * - Keine Element-IDs (d7746da …), nur stabile Elementor-Klassen und eigene Klassen.
 * - Unabhängig von .elementor-widget-container („Optimized Markup“).
 * - Klassische Abschnitte UND Flexbox-Container (.e-con).
 * - Fehlt die Klasse oder lädt diese Datei nicht, sieht der Aufmacher aus wie
 *   vorher – alle Einstellungen bleiben in Elementor gespeichert.
 *
 * Warum „:not(#hac-aufmacher)“? Elementor schreibt für jeden Abschnitt eigene
 * Regeln mit vier Klassen (Polster, Overlay, Knopffarben). Das :not(#…) zählt
 * wie eine ID und schlägt diese Regeln sicher, ohne !important.
 */

/* ─── Farben je Bereich ─────────────────────────────────────────────────── */

:is(.elementor-section, .e-con).hac-aufmacher:not(#hac-aufmacher) {
	--hac-auf-akzent: #BAC6AE;      /* fest: Hof: Salbeigrün */
	--hac-auf-auf-akzent: #1A1A1A;  /* fest: Schrift auf Grün */
	--hac-auf-akzent-tief: var(--hac-schrift-gruen, #4D5F3B); /* Grün als Schrift/Symbol */
	--hac-auf-linie: var(--hac-linie, #E4E7E0);
	--hac-auf-hell: var(--hac-flaeche, #F4F6F2);
	--hac-foto-h: clamp(420px, 56vh, 540px);
}

body.hac-elektro :is(.elementor-section, .e-con).hac-aufmacher:not(#hac-aufmacher) {
	--hac-auf-akzent: #1D89F6;      /* fest: Elektro: Blau */
	--hac-auf-auf-akzent: #FFFFFF;  /* fest: bewusst Weiß auf Blau (AGENTS 7) */
	--hac-auf-akzent-tief: var(--hac-schrift-blau, #0363C3);
}

/* ─── Foto: liegt am Abschnitt (Elementor), wird nur hinter dem Titel gezeigt ─ */

:is(.elementor-section, .e-con).hac-aufmacher:not(#hac-aufmacher) {
	position: relative;
	padding: 0;
	background-size: 0 0;
	background-color: transparent;
	overflow: visible;
}

/* Das Foto zeigt der Titel-Baustein. Bild und Bildausschnitt reicht jede Ebene
   dazwischen nur weiter (unsichtbar) – auch das kleinere Handy-Bild aus
   hac-performance.php (T37). So wächst das Foto mit, wenn ein langer Titel
   mehr Platz braucht. */
:is(.elementor-section, .e-con).hac-aufmacher:not(#hac-aufmacher) :is(.elementor-container, .elementor-column, .elementor-widget-wrap, .e-con-inner) {
	background-image: inherit;
	background-position: inherit;
	background-size: 0 0;
	background-repeat: no-repeat;
}

:is(.elementor-section, .e-con).hac-aufmacher:not(#hac-aufmacher) > .elementor-background-overlay {
	display: none;
}

:is(.elementor-section, .e-con).hac-aufmacher:not(#hac-aufmacher) :is(.elementor-widget-wrap, .e-con-inner) {
	justify-content: center;
	align-items: stretch;
	gap: 0;
	padding: 0;
}

:is(.elementor-section, .e-con).hac-aufmacher:not(#hac-aufmacher) :is(.elementor-widget-wrap, .e-con-inner) > .elementor-element {
	margin: 0;
}

/* ─── Titel-Baustein: H1 bleibt im Code zuerst, die Dachzeile (<p>) steht nur optisch darüber ─ */

:is(.elementor-section, .e-con).hac-aufmacher:not(#hac-aufmacher) .elementor-widget-eltdf_section_title {
	position: relative;
	width: 100%;
	min-height: var(--hac-foto-h);
	margin: 0;
	padding: 64px 32px 104px;
	border-radius: 8px;
	overflow: hidden;
	background-image: inherit;
	background-position: inherit;
	background-size: cover;
	background-repeat: no-repeat;
	display: flex;
	align-items: center;
	justify-content: center;
}

/* Weicher Schatten nur hinter der Schrift, damit das Foto hell bleibt */
:is(.elementor-section, .e-con).hac-aufmacher:not(#hac-aufmacher) .elementor-widget-eltdf_section_title::before {
	content: "";
	position: absolute;
	inset: 0;
	background:
		radial-gradient(ellipse 60% 70% at 50% 45%, rgba(12, 16, 12, .58) 0%, rgba(12, 16, 12, .22) 78%),
		radial-gradient(circle 260px at 100% 0, rgba(12, 16, 12, .38), rgba(12, 16, 12, 0)),
		linear-gradient(to bottom, rgba(12, 16, 12, 0) 55%, rgba(12, 16, 12, .4) 100%);
}

:is(.elementor-section, .e-con).hac-aufmacher:not(#hac-aufmacher) .elementor-widget-eltdf_section_title > * {
	position: relative;
	width: 100%;
	max-width: 840px;
	text-shadow: 0 2px 18px rgba(0, 0, 0, .3);
}

:is(.elementor-section, .e-con).hac-aufmacher:not(#hac-aufmacher) .eltdf-st-inner {
	display: flex;
	flex-direction: column;
}

:is(.elementor-section, .e-con).hac-aufmacher:not(#hac-aufmacher) .eltdf-st-subtitle {
	order: -1;
	margin: 0 0 12px;
	font-size: 13px;
	line-height: 1.3;
	font-weight: 700;
	letter-spacing: .16em;
	text-transform: uppercase;
	color: #FFFFFF; /* fest: auf Foto */
}

:is(.elementor-section, .e-con).hac-aufmacher:not(#hac-aufmacher) .eltdf-st-title {
	margin: 0;
	text-transform: none;
	font-size: clamp(38px, 4.2vw, 62px);
	line-height: 1.06;
	letter-spacing: -.01em;
	font-weight: 700;
	color: #FFFFFF; /* fest: auf Foto */
	-webkit-hyphens: auto;
	hyphens: auto;
	overflow-wrap: break-word;
	text-wrap: balance;
}

:is(.elementor-section, .e-con).hac-aufmacher:not(#hac-aufmacher) .eltdf-st-text {
	margin: 14px auto 0;
	max-width: 36em;
	font-size: clamp(16px, 1.3vw, 19px);
	line-height: 1.5;
	color: #FFFFFF; /* fest: auf Foto */
	text-wrap: balance;
}

/* ─── Knöpfe: der erste ist der Hauptknopf ─────────────────────────────── */

:is(.elementor-section, .e-con).hac-aufmacher:not(#hac-aufmacher) .elementor-widget-button .elementor-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 48px;
	padding: 12px 22px;
	border: 1px solid transparent;
	border-radius: 8px;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: normal;
	text-transform: none;
	text-decoration: none;
	transition: background-color .2s, box-shadow .2s, transform .2s;
}

:is(.elementor-section, .e-con).hac-aufmacher:not(#hac-aufmacher) .elementor-widget-button .elementor-button-content-wrapper {
	gap: 10px;
}

:is(.elementor-section, .e-con).hac-aufmacher:not(#hac-aufmacher) .elementor-button-icon svg {
	width: 18px;
	height: 18px;
	fill: currentColor;
}

:is(.elementor-section, .e-con).hac-aufmacher:not(#hac-aufmacher) .elementor-button-icon i {
	font-size: 18px;
}

:is(.elementor-section, .e-con).hac-aufmacher:not(#hac-aufmacher) .elementor-widget-button:not(.elementor-widget-button ~ .elementor-widget-button) .elementor-button {
	background: var(--hac-auf-akzent);
	color: var(--hac-auf-auf-akzent);
	box-shadow: 0 8px 20px -10px rgba(0, 0, 0, .55);
}

:is(.elementor-section, .e-con).hac-aufmacher:not(#hac-aufmacher) .elementor-widget-button:not(.elementor-widget-button ~ .elementor-widget-button) .elementor-button:hover {
	background: var(--hac-auf-akzent);
	color: var(--hac-auf-auf-akzent);
	transform: translateY(-1px);
	box-shadow: 0 12px 24px -10px rgba(0, 0, 0, .55);
}

:is(.elementor-section, .e-con).hac-aufmacher:not(#hac-aufmacher) a:focus-visible {
	outline: 3px solid #FFFFFF; /* fest: Fokus auf Foto */
	outline-offset: 3px;
	box-shadow: 0 0 0 6px #1A1A1A;
}

/* ─── Schnellzugriff-Leiste: nur Knöpfe, jeder Knopf ist ein Feld ──────── */

:is(.elementor-section, .e-con).hac-aufmacher:not(#hac-aufmacher) :is(.elementor-widget-wrap, .e-con-inner) > .elementor-widget-button {
	position: relative;
	z-index: 1;
	width: auto;
	margin-top: -48px;
	padding: 18px 10px;
	display: flex;
	align-items: center;
	background: var(--hac-flaeche-erhoeht, #FFFFFF);
	box-shadow: 0 14px 28px rgba(20, 30, 20, .14);
}

:is(.elementor-section, .e-con).hac-aufmacher:not(#hac-aufmacher) .elementor-widget-button:not(.elementor-widget-button ~ .elementor-widget-button) {
	padding-left: 18px;
	border-radius: 8px 0 0 8px;
}

:is(.elementor-section, .e-con).hac-aufmacher:not(#hac-aufmacher) :is(.elementor-widget-wrap, .e-con-inner) > .elementor-widget-button:last-child {
	padding-right: 18px;
	border-top-right-radius: 8px;
	border-bottom-right-radius: 8px;
}

/* Trennstrich vor jedem weiteren Knopf */
:is(.elementor-section, .e-con).hac-aufmacher:not(#hac-aufmacher) .elementor-widget-button ~ .elementor-widget-button::before {
	content: "";
	position: absolute;
	left: 0;
	top: 24px;
	bottom: 24px;
	width: 1px;
	background: var(--hac-auf-linie);
}

:is(.elementor-section, .e-con).hac-aufmacher:not(#hac-aufmacher) .elementor-widget-button ~ .elementor-widget-button .elementor-button {
	padding: 12px 16px;
	background: transparent;
	color: var(--hac-schrift-stark, #1A1A1A);
	box-shadow: none;
}

:is(.elementor-section, .e-con).hac-aufmacher:not(#hac-aufmacher) .elementor-widget-button ~ .elementor-widget-button .elementor-button-icon {
	color: var(--hac-auf-akzent-tief);
}

:is(.elementor-section, .e-con).hac-aufmacher:not(#hac-aufmacher) .elementor-widget-button ~ .elementor-widget-button .elementor-button:hover {
	background: var(--hac-auf-hell);
	color: var(--hac-schrift-stark, #1A1A1A);
}

:is(.elementor-section, .e-con).hac-aufmacher:not(#hac-aufmacher) .elementor-widget-button ~ .elementor-widget-button a:focus-visible {
	outline-color: var(--hac-auf-akzent-tief);
	box-shadow: none;
}

/* ─── Social-Icons am Desktop: klein oben rechts im Foto ───────────────── */

:is(.elementor-section, .e-con).hac-aufmacher:not(#hac-aufmacher) .elementor-widget-social-icons {
	position: absolute;
	top: 20px;
	right: 20px;
	z-index: 2;
	width: auto;
}

:is(.elementor-section, .e-con).hac-aufmacher:not(#hac-aufmacher) .elementor-social-icons-wrapper {
	display: flex;
	flex-wrap: nowrap;
	gap: 8px;
}

:is(.elementor-section, .e-con).hac-aufmacher:not(#hac-aufmacher) .elementor-social-icon {
	width: 44px;
	height: 44px;
	padding: 0;
	border: 1px solid rgba(255, 255, 255, .55);
	border-radius: 50%;
	background: rgba(255, 255, 255, .14);
	color: #FFFFFF; /* fest: auf Foto */
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
	transition: background-color .2s;
}

:is(.elementor-section, .e-con).hac-aufmacher:not(#hac-aufmacher) .elementor-social-icon svg {
	width: 19px;
	height: 19px;
	fill: currentColor;
}

:is(.elementor-section, .e-con).hac-aufmacher:not(#hac-aufmacher) .elementor-social-icon i {
	font-size: 19px;
	color: currentColor;
}

:is(.elementor-section, .e-con).hac-aufmacher:not(#hac-aufmacher) .elementor-social-icon:hover {
	background: rgba(255, 255, 255, .3);
}

@media (prefers-reduced-motion: reduce) {
	:is(.elementor-section, .e-con).hac-aufmacher:not(#hac-aufmacher) * {
		transition: none;
		transform: none;
	}
}

/* ─── Handy: Foto oben, darunter eine Karte mit Hauptknopf, Liste und Social-Icons ─ */

@media (max-width: 767px) {
	:is(.elementor-section, .e-con).hac-aufmacher:not(#hac-aufmacher) {
		--hac-foto-h: 330px;
	}

	:is(.elementor-section, .e-con).hac-aufmacher:not(#hac-aufmacher) .elementor-widget-eltdf_section_title {
		border-radius: 0;
		padding: 40px 16px 76px;
	}

	:is(.elementor-section, .e-con).hac-aufmacher:not(#hac-aufmacher) .elementor-widget-eltdf_section_title::before {
		background:
			radial-gradient(ellipse 80% 70% at 50% 45%, rgba(12, 16, 12, .58) 0%, rgba(12, 16, 12, .25) 80%),
			linear-gradient(to bottom, rgba(12, 16, 12, 0) 55%, rgba(12, 16, 12, .4) 100%);
	}

	:is(.elementor-section, .e-con).hac-aufmacher:not(#hac-aufmacher) .eltdf-st-title {
		font-size: 36px;
	}

	:is(.elementor-section, .e-con).hac-aufmacher:not(#hac-aufmacher) .eltdf-st-subtitle {
		font-size: 12px;
		letter-spacing: .1em;
	}

	:is(.elementor-section, .e-con).hac-aufmacher:not(#hac-aufmacher) :is(.elementor-widget-wrap, .e-con-inner) > :is(.elementor-widget-button, .elementor-widget-social-icons) {
		width: calc(100% - 32px);
		margin: 0 16px;
		background: var(--hac-flaeche-erhoeht, #FFFFFF);
		box-shadow: 0 16px 28px -22px rgba(20, 30, 20, .5);
	}

	:is(.elementor-section, .e-con).hac-aufmacher:not(#hac-aufmacher) :is(.elementor-widget-wrap, .e-con-inner) > .elementor-widget-button {
		display: block;
	}

	:is(.elementor-section, .e-con).hac-aufmacher:not(#hac-aufmacher) .elementor-widget-button:not(.elementor-widget-button ~ .elementor-widget-button) {
		margin-top: -48px;
		padding: 16px 16px 10px;
		border-radius: 8px 8px 0 0;
	}

	:is(.elementor-section, .e-con).hac-aufmacher:not(#hac-aufmacher) .elementor-widget-button:not(.elementor-widget-button ~ .elementor-widget-button) .elementor-button {
		width: 100%;
	}

	:is(.elementor-section, .e-con).hac-aufmacher:not(#hac-aufmacher) :is(.elementor-widget-wrap, .e-con-inner) > .elementor-widget-button:last-child {
		border-radius: 0;
		padding-right: 16px;
	}

	:is(.elementor-section, .e-con).hac-aufmacher:not(#hac-aufmacher) .elementor-widget-button ~ .elementor-widget-button {
		padding: 0 16px;
	}

	:is(.elementor-section, .e-con).hac-aufmacher:not(#hac-aufmacher) .elementor-widget-button ~ .elementor-widget-button::before {
		display: none;
	}

	:is(.elementor-section, .e-con).hac-aufmacher:not(#hac-aufmacher) .elementor-widget-button ~ .elementor-widget-button .elementor-button {
		width: 100%;
		min-height: 52px;
		justify-content: space-between;
		padding: 14px 4px;
		border-top: 1px solid var(--hac-auf-linie);
		border-radius: 0;
	}

	/* Pfeil rechts in jeder Zeile der Liste */
	:is(.elementor-section, .e-con).hac-aufmacher:not(#hac-aufmacher) .elementor-widget-button ~ .elementor-widget-button .elementor-button::after {
		content: "";
		width: 8px;
		height: 8px;
		margin-right: 6px;
		border-right: 2px solid currentColor;
		border-bottom: 2px solid currentColor;
		transform: rotate(-45deg);
	}

	:is(.elementor-section, .e-con).hac-aufmacher:not(#hac-aufmacher) .elementor-widget-social-icons {
		position: relative;
		top: auto;
		right: auto;
		z-index: 1;
		order: 5;
		display: flex;
		justify-content: center;
		padding: 6px 16px 14px;
		border-top: 1px solid var(--hac-auf-linie);
		border-radius: 0 0 8px 8px;
	}

	:is(.elementor-section, .e-con).hac-aufmacher:not(#hac-aufmacher) .elementor-social-icons-wrapper {
		justify-content: center;
		gap: 2px;
	}

	:is(.elementor-section, .e-con).hac-aufmacher:not(#hac-aufmacher) .elementor-social-icon {
		border: 0;
		background: transparent;
		color: var(--hac-schrift-leise, #6B6B6B);
		-webkit-backdrop-filter: none;
		backdrop-filter: none;
	}

	:is(.elementor-section, .e-con).hac-aufmacher:not(#hac-aufmacher) .elementor-social-icon:hover {
		background: var(--hac-auf-hell);
		color: var(--hac-auf-akzent-tief);
	}
}
