/*
 * Moritz Händlersuche, Gestaltung v1.2 (mobil überarbeitet in 1.2.4)
 * Akzent: Moritz-Blau aus dem Logo (#0c2e6a). Text: Dunkelbraun der Website.
 * Buttons wie auf der Startseite (Avada-Standard): Dunkelbraun, Versalien, 2px Radius.
 * Formen: Suchleiste und Schalter mit 4px bzw. 2px Radius, Liste ohne Rahmen.
 * Website ist nur hell, daher kein Dark Mode.
 */
.moritz-hs {
	--hs-text: #38231a;
	--hs-leise: #6b6455;
	--hs-blau: #0c2e6a;
	--hs-blau-hell: #e6ebf3;
	--hs-linie: rgba(56, 35, 26, 0.14);
	--hs-linie-stark: rgba(56, 35, 26, 0.55);
	--hs-fehler: #a3201c;
	--hs-ease: cubic-bezier(0.16, 1, 0.3, 1);
	max-width: 1040px;
	margin: 0 auto;
	color: var(--hs-text);
	text-align: left;
}

.moritz-hs *,
.moritz-hs *::before,
.moritz-hs *::after {
	box-sizing: border-box;
}

.moritz-hs fieldset {
	min-width: 0;
	margin: 0;
	padding: 0;
	border: 0;
}

.moritz-hs legend,
.moritz-hs__plz label {
	display: block;
	margin: 0 0 10px;
	padding: 0;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.3;
	color: var(--hs-leise);
}

/* ---------- Suche ---------- */
.moritz-hs__suche {
	margin: 0;
	padding: 0;
}

/* Suchleiste: PLZ, Umkreis und Button in einer weißen Pille über die volle Breite */
.moritz-hs__eingabe {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto auto;
	gap: 10px;
	align-items: center;
	padding: 6px 6px 6px 24px;
	background: #fff;
	border: 1px solid #d2ad6e; /* Linkfarbe Gold der Website */
	border-radius: 4px;
	transition: box-shadow 0.2s;
}

.moritz-hs__eingabe:has(input[name="plz"]:focus) {
	box-shadow: 0 0 0 3px rgba(12, 46, 106, 0.45);
}

.moritz-hs__eingabe:has(input[aria-invalid="true"]) {
	box-shadow: 0 0 0 3px rgba(163, 32, 28, 0.55);
}

.moritz-hs .moritz-hs__plz label {
	margin: 0 0 1px;
	font-size: 12px;
	letter-spacing: 0.01em;
}

.moritz-hs__plz input {
	display: block;
	width: 100%;
	max-width: 260px;
	height: 30px;
	margin: 0;
	padding: 0;
	font: inherit;
	font-size: 22px;
	font-weight: 600;
	line-height: 30px;
	letter-spacing: 0.05em;
	font-variant-numeric: tabular-nums;
	color: var(--hs-text);
	background: transparent;
	border: 0;
	border-radius: 0;
	box-shadow: none;
}

.moritz-hs__plz input::placeholder {
	color: rgba(56, 35, 26, 0.4);
	font-weight: 400;
	letter-spacing: 0;
	opacity: 1;
}

.moritz-hs__plz input:focus {
	outline: none;
}

/* Umkreis-Beschriftung nur für Screenreader, die Schalter sprechen für sich */
.moritz-hs .moritz-hs__umkreis legend {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

/* Umkreis */
.moritz-hs__segmente {
	display: inline-flex;
	gap: 4px;
	padding: 3px;
	background: rgba(56, 35, 26, 0.06);
	border-radius: 2px;
}

.moritz-hs__segmente label {
	position: relative;
	margin: 0;
	cursor: pointer;
}

.moritz-hs__segmente input,
.moritz-hs__oel input {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	opacity: 0;
	cursor: pointer;
}

.moritz-hs__segmente span {
	display: flex;
	align-items: center;
	height: 37px;
	padding: 0 16px;
	font-size: 14px;
	font-weight: 600;
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
	border-radius: 2px;
	transition: background-color 0.2s, color 0.2s;
}

/* Hover nur bei Maus, sonst bleibt der Effekt auf dem Handy nach dem Tippen hängen */
@media (hover: hover) {
	.moritz-hs__segmente label:hover span {
		background: rgba(255, 255, 255, 0.7);
	}
}

.moritz-hs__segmente input:checked + span {
	color: #fff;
	background: var(--hs-text);
}

/* Buttons wie auf der Startseite (.fusion-button.button-default) */
.moritz-hs__button,
.moritz-hs__mehr,
.moritz-hs__route {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin: 0;
	padding: 13px 29px;
	font: inherit;
	font-size: 14px;
	font-weight: 400;
	line-height: 17px;
	letter-spacing: normal;
	text-transform: uppercase;
	text-decoration: none;
	white-space: nowrap;
	color: #fff;
	background: var(--hs-text);
	border: 0;
	border-radius: 2px;
	cursor: pointer;
	transition: opacity 0.2s, transform 0.15s var(--hs-ease);
}

.moritz-hs__button:hover,
.moritz-hs__mehr:hover,
.moritz-hs__route:hover,
.moritz-hs__route:focus-visible {
	color: #fff;
	background: var(--hs-text);
	text-decoration: none;
	opacity: 0.88;
}

.moritz-hs__button:active,
.moritz-hs__mehr:active,
.moritz-hs__route:active {
	transform: translateY(1px);
}

.moritz-hs__fehler {
	margin: 12px 0 0;
	font-size: 15px;
	font-weight: 600;
	color: var(--hs-fehler);
}

/* ---------- Ölauswahl: Flaschen stehen frei in einer Reihe ---------- */
.moritz-hs .moritz-hs__oele {
	margin-top: 44px;
}

.moritz-hs__regal {
	display: grid;
	grid-template-columns: repeat(5, minmax(0, 1fr));
	align-items: end;
	gap: 8px;
	border-bottom: 2px solid var(--hs-linie);
}

/* „Alle Öle“: vier Flaschen leicht überlappend */
.moritz-hs__oel--alle .moritz-hs__flaschen img {
	height: 86%;
}

.moritz-hs__oel--alle .moritz-hs__flaschen img + img {
	margin-left: -10px;
}

.moritz-hs__oel {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 14px;
	margin: 0;
	padding: 0 4px 14px;
	cursor: pointer;
}

.moritz-hs__flaschen {
	display: flex;
	align-items: flex-end;
	justify-content: center;
	height: 150px;
}

.moritz-hs__flaschen img {
	display: block;
	width: auto;
	height: 100%;
	max-width: none;
	transition: opacity 0.3s, filter 0.3s, transform 0.35s var(--hs-ease);
}

.moritz-hs__oelname {
	display: flex;
	align-items: flex-start;
	justify-content: center;
	min-height: 2.6em; /* zwei Zeilen, damit alle Flaschen auf einer Linie stehen */
	font-size: 14px;
	font-weight: 600;
	line-height: 1.3;
	text-align: center;
	transition: color 0.2s;
}

/* Ist ein Öl gewählt, treten die anderen zurück */
.moritz-hs__regal:has(.moritz-hs__oel:not(.moritz-hs__oel--alle) input:checked) .moritz-hs__oel:not(:has(input:checked)) img {
	opacity: 0.35;
	filter: grayscale(1);
}

.moritz-hs__regal:has(.moritz-hs__oel:not(.moritz-hs__oel--alle) input:checked) .moritz-hs__oel:not(:has(input:checked)) .moritz-hs__oelname {
	color: var(--hs-leise);
	font-weight: 400;
}

@media (hover: hover) {
	.moritz-hs__oel:hover img {
		opacity: 1;
		filter: none;
	}
}

.moritz-hs__kurz {
	display: none;
}

.moritz-hs__oel:has(input:checked) .moritz-hs__oelname {
	color: var(--hs-blau);
}

/* ---------- Ergebnis ---------- */
.moritz-hs__ergebnis {
	margin-top: 48px;
}

.moritz-hs__status {
	margin: 0 0 18px;
	font-size: 18px;
	line-height: 1.4;
}

.moritz-hs__status:empty {
	display: none;
}

.moritz-hs__anzahl {
	margin-right: 2px;
	font-size: 40px;
	font-weight: 700;
	line-height: 1;
	letter-spacing: -0.02em;
	font-variant-numeric: tabular-nums;
	color: var(--hs-blau);
	vertical-align: -4px;
}

.moritz-hs__hinweis {
	display: block;
	margin-top: 6px;
	font-size: 14px;
	color: var(--hs-leise);
}

.moritz-hs__liste {
	margin: 0;
	padding: 0;
	list-style: none;
	border-top: 2px solid var(--hs-text);
}

.moritz-hs__liste[hidden],
.moritz-hs__mehr[hidden],
.moritz-hs__grenze[hidden],
.moritz-hs__fehler[hidden] {
	display: none;
}

.moritz-hs__markt {
	display: grid;
	grid-template-columns: 112px minmax(0, 1fr) auto 128px;
	grid-template-areas: "km wer regal route";
	align-items: center;
	gap: 24px;
	margin: 0;
	padding: 12px 8px;
	min-height: 92px;
	border-bottom: 1px solid var(--hs-linie);
	transition: background-color 0.2s;
}

.moritz-hs__markt::before {
	content: none;
}

@media (hover: hover) {
	.moritz-hs__markt:hover {
		background: rgba(255, 255, 255, 0.6);
	}

	.moritz-hs__markt:hover .moritz-hs__name {
		color: var(--hs-blau);
	}
}

.moritz-hs__km {
	grid-area: km;
	font-size: 14px;
	font-weight: 600;
	white-space: nowrap;
	color: var(--hs-leise);
}

.moritz-hs__kmzahl {
	font-size: 30px;
	font-weight: 700;
	letter-spacing: -0.02em;
	font-variant-numeric: tabular-nums;
	color: var(--hs-blau);
}

.moritz-hs__wer {
	grid-area: wer;
	min-width: 0;
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
	font-size: 16px;
	line-height: 1.4;
}

.moritz-hs__name {
	font-size: 18px;
	font-weight: 700;
	transition: color 0.2s;
}

.moritz-hs__adresse {
	margin-left: 14px;
	color: var(--hs-leise);
}

.moritz-hs__regalzeile {
	grid-area: regal;
	display: grid;
	grid-template-columns: repeat(4, 22px);
	gap: 10px;
	align-items: end;
	height: 74px;
}

.moritz-hs__fach {
	display: flex;
	align-items: flex-end;
	justify-content: center;
	height: 74px;
}

.moritz-hs .moritz-hs__fach img {
	display: block;
	width: 20px;
	height: 74px;
	max-width: none;
	object-fit: contain;
}

.moritz-hs__route {
	grid-area: route;
	justify-self: end;
	padding: 10px 18px;
	font-size: 13px;
}

.moritz-hs__mehr {
	display: flex;
	margin: 32px auto 0;
}

.moritz-hs__mehr:disabled {
	opacity: 0.6;
	cursor: wait;
}

.moritz-hs__grenze {
	margin: 20px 0 0;
	font-size: 15px;
	color: var(--hs-leise);
}

/* Platzhalter beim Laden */
.moritz-hs__markt.is-platzhalter span {
	display: block;
	height: 14px;
	border-radius: 2px;
	background: rgba(56, 35, 26, 0.08);
}

.moritz-hs__markt.is-platzhalter span:nth-child(1) { grid-area: km; width: 60px; height: 26px; }
.moritz-hs__markt.is-platzhalter span:nth-child(2) { grid-area: wer; width: 60%; }
.moritz-hs__markt.is-platzhalter span:nth-child(3) { grid-area: regal; width: 118px; height: 56px; border-radius: 4px; }

.moritz-hs__sr {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

/* ---------- Fokus (BFSG) ---------- */
.moritz-hs button:focus-visible,
.moritz-hs a:focus-visible,
.moritz-hs [tabindex="-1"]:focus {
	outline: 3px solid var(--hs-blau);
	outline-offset: 3px;
}

.moritz-hs__segmente label:has(input:focus-visible) span {
	outline: 3px solid var(--hs-blau);
	outline-offset: 2px;
}

.moritz-hs__oel:has(input:focus-visible) .moritz-hs__oelname {
	outline: 3px solid var(--hs-blau);
	outline-offset: 4px;
	border-radius: 2px;
}

.moritz-hs input:focus-visible {
	outline: none;
}

.moritz-hs [tabindex="-1"]:focus:not(:focus-visible) {
	outline: none;
}

/* ---------- Bewegung: nur als Rückmeldung, abschaltbar ---------- */
@media (prefers-reduced-motion: no-preference) {
	.moritz-hs__oel:has(input:checked) img {
		transform: translateY(-8px);
	}

	@media (hover: hover) {
		.moritz-hs__oel:hover img {
			transform: translateY(-4px);
		}
	}

	.moritz-hs__markt:not(.is-platzhalter) {
		animation: moritz-hs-ein 0.45s var(--hs-ease) both;
		animation-delay: calc(var(--i, 0) * 35ms);
	}

	.moritz-hs__markt.is-platzhalter span {
		animation: moritz-hs-puls 1.2s ease-in-out infinite;
	}
}

@media (prefers-reduced-motion: reduce) {
	.moritz-hs * {
		transition: none !important;
	}
}

@keyframes moritz-hs-ein {
	from { opacity: 0; transform: translateY(10px); }
	to { opacity: 1; transform: none; }
}

@keyframes moritz-hs-puls {
	50% { opacity: 0.4; }
}

/* ---------- Tablet ---------- */
@media (max-width: 960px) {
	.moritz-hs__markt {
		grid-template-columns: 96px minmax(0, 1fr) auto;
		grid-template-areas:
			"km wer regal"
			"km route regal";
		gap: 6px 20px;
	}

	.moritz-hs__wer {
		white-space: normal;
		overflow-wrap: anywhere; /* lange Marktnamen umbrechen statt abschneiden */
		hyphens: auto;
	}

	.moritz-hs__name,
	.moritz-hs__adresse {
		display: block;
		margin: 0;
	}

	.moritz-hs__route {
		justify-self: start;
	}
}

/* ---------- Mobil ---------- */
@media (max-width: 760px) {
	/* Avada-Spalte und Sektion um das Modul herum schmaler polstern, sonst bleiben
	   auf dem Handy nur gut 200 px Breite (Seite 1879: 50 px + 30 px je Seite). */
	.fusion-fullwidth:has(.moritz-hs) {
		padding-left: 12px !important;
		padding-right: 12px !important;
	}

	.fusion-layout-column:has(.moritz-hs) > .fusion-column-wrapper {
		padding-left: 14px !important;
		padding-right: 14px !important;
	}

	.moritz-hs__eingabe {
		grid-template-columns: minmax(0, 1fr);
		gap: 12px;
		padding: 12px;
		border-radius: 4px;
	}

	.moritz-hs__plz {
		padding: 4px 10px 6px;
		border-bottom: 1px solid var(--hs-linie);
	}

	.moritz-hs__plz input {
		max-width: none;
		font-size: 24px;
	}

	/* Drei gleich breite Schalter, die immer in die Leiste passen */
	.moritz-hs__segmente {
		display: grid;
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	.moritz-hs__segmente span {
		justify-content: center;
		height: 44px;
		padding: 0 4px;
	}

	.moritz-hs__button {
		width: 100%;
	}

	.moritz-hs .moritz-hs__oele {
		margin-top: 36px;
	}

	/* Fünf Felder passen nicht nebeneinander: seitlich wischen */
	.moritz-hs__regal {
		grid-template-columns: none;
		grid-auto-flow: column;
		grid-auto-columns: 76px;
		gap: 6px;
		padding-right: 32px;
		overflow-x: auto;
		scroll-snap-type: x mandatory;
		scrollbar-width: none;
		/* Ausblenden am rechten Rand zeigt, dass die Reihe weitergeht */
		-webkit-mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent);
		mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent);
	}

	.moritz-hs__regal::-webkit-scrollbar {
		display: none;
	}

	.moritz-hs__oel {
		scroll-snap-align: start;
	}

	.moritz-hs__oel {
		padding: 0 0 12px;
		gap: 10px;
	}

	.moritz-hs__flaschen {
		height: 84px;
	}

	.moritz-hs__oel--alle .moritz-hs__flaschen img + img {
		margin-left: -9px;
	}

	.moritz-hs__oelname {
		font-size: 12px;
		hyphens: auto;
	}

	/* Auf dem Handy Kurznamen, die Flasche zeigt die Marke */
	.moritz-hs__lang {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(0 0 0 0);
	}

	.moritz-hs__kurz {
		display: block;
	}

	.moritz-hs__anzahl {
		font-size: 34px;
	}

	.moritz-hs__markt {
		grid-template-columns: minmax(0, 1fr) auto;
		grid-template-areas:
			"km regal"
			"wer regal"
			"route regal";
		gap: 4px 16px;
		padding: 16px 0;
	}

	.moritz-hs__kmzahl {
		font-size: 24px;
	}

	.moritz-hs__regalzeile {
		grid-template-columns: repeat(4, 16px);
		gap: 6px;
		height: 60px;
	}

	.moritz-hs__fach {
		height: 60px;
	}

	.moritz-hs .moritz-hs__fach img {
		width: 16px;
		height: 60px;
	}

	.moritz-hs__route {
		margin-top: 8px;
		min-height: 44px;
	}
}
