/*
 * Ze-One Wohnungsangebote - frontend styles
 * Copyright (c) 2026 Ze-One IT Dienstleistung, Stephan Ramsteiner <s.ramsteiner@ze-one.de>
 */

.zewo {
	--zewo-primary: #003a8c;
	--zewo-line: rgba(0, 0, 0, 0.15);
	--zewo-soft: rgba(0, 0, 0, 0.04);
	--zewo-radius: 4px;
	box-sizing: border-box;
}

.zewo *,
.zewo *::before,
.zewo *::after {
	box-sizing: inherit;
}

.zewo .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* buttons */

.zewo .zewo-button {
	display: inline-block;
	padding: 0.6em 1.2em;
	border: 2px solid var(--zewo-primary);
	border-radius: var(--zewo-radius);
	background: var(--zewo-primary);
	color: #fff;
	font: inherit;
	font-weight: 600;
	line-height: 1.3;
	text-decoration: none;
	cursor: pointer;
}

/* themes style buttons with long selectors, a real button needs more weight to keep the plugin colours */
.zewo button.zewo-button[type][class] {
	border: 2px solid var(--zewo-primary);
	border-radius: var(--zewo-radius);
	background: var(--zewo-primary);
	color: #fff;
}

.zewo button.zewo-button[type][class]:disabled {
	opacity: 0.6;
	cursor: progress;
}

.zewo .zewo-button:hover,
.zewo .zewo-button:focus {
	filter: brightness(1.15);
	color: #fff;
	text-decoration: none;
}

.zewo .zewo-button-hell {
	background: transparent;
	color: var(--zewo-primary);
}

.zewo .zewo-button-hell:hover,
.zewo .zewo-button-hell:focus {
	background: var(--zewo-primary);
	color: #fff;
	filter: none;
}

.zewo .zewo-button:focus-visible,
.zewo a:focus-visible,
.zewo input:focus-visible,
.zewo select:focus-visible {
	outline: 3px solid var(--zewo-primary);
	outline-offset: 2px;
}

/* filter */

.zewo-filter {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	gap: 1.25rem 2rem;
	margin: 0 0 2rem;
	padding: 1.25rem 1.5rem;
	border: 1px solid var(--zewo-line);
	border-radius: var(--zewo-radius);
	background: var(--zewo-soft);
}

.zewo-filter .zewo-filter-gruppe {
	min-width: 0;
	margin: 0;
	padding: 0;
	border: 0;
}

.zewo-filter legend,
.zewo-filter .zewo-filter-sortierung label {
	display: block;
	margin: 0 0 0.4rem;
	padding: 0;
	font-weight: 600;
}

.zewo-filter .zewo-check {
	display: flex;
	align-items: baseline;
	gap: 0.5em;
	margin: 0 0 0.2rem;
	font-weight: normal;
	cursor: pointer;
}

.zewo-filter .zewo-check input {
	flex: none;
	margin: 0;
}

.zewo-filter .zewo-bereich {
	display: flex;
	gap: 0.5rem;
}

.zewo-filter .zewo-bereich label {
	flex: 1 1 0;
	min-width: 0;
	margin: 0;
}

.zewo-filter input[type="number"],
.zewo-filter select {
	width: 100%;
	max-width: 100%;
	min-height: 2.6em;
	margin: 0;
	padding: 0.4em 0.6em;
	border: 1px solid var(--zewo-line);
	border-radius: var(--zewo-radius);
	background: #fff;
	color: inherit;
	font: inherit;
}

.zewo-filter .zewo-filter-aktionen {
	grid-column: 1 / -1;
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
}

/* with JavaScript the list follows every change, the submit button is not needed */
.zewo-js .zewo-filter .zewo-filter-senden {
	display: none;
}

.zewo-ergebnisse.zewo-laedt {
	opacity: 0.45;
	transition: opacity 0.15s;
}

/* list: tiles or rows */

.zewo-anzahl {
	margin: 0 0 1rem;
	font-weight: 600;
}

.zewo-liste {
	display: grid;
	gap: 1.5rem;
}

/* as many tiles per row as fit, never more than --zewo-cols */
.zewo-layout-kacheln {
	grid-template-columns: repeat(auto-fill, minmax(max(230px, calc((100% - (var(--zewo-cols, 3) - 1) * 1.5rem) / var(--zewo-cols, 3))), 1fr));
}

.zewo-layout-kacheln .zewo-objekt {
	display: flex;
	flex-direction: column;
	min-width: 0;
	overflow: hidden;
	border: 1px solid var(--zewo-line);
	border-radius: var(--zewo-radius);
}

.zewo-layout-kacheln .zewo-objekt-text {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	padding: 1rem 1.1rem 1.2rem;
}

.zewo-layout-kacheln .zewo-objekt-text > .zewo-button {
	align-self: flex-start;
	margin-top: auto;
}

.zewo-layout-kacheln .zewo-objekt-bild a {
	border-radius: 0;
}

.zewo .zewo-layout-kacheln .zewo-eckdaten {
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 0.75rem 1rem;
}

.zewo-layout-liste .zewo-objekt {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: 1.5rem;
	padding: 0 0 1.5rem;
	border-bottom: 1px solid var(--zewo-line);
}

.zewo-layout-liste .zewo-objekt-text {
	flex: 2 1 320px;
	min-width: 0;
}

.zewo-layout-liste .zewo-objekt-bild {
	flex: 1 1 200px;
}

.zewo-objekt-bild {
	position: relative;
}

.zewo-objekt-bild a {
	display: block;
	aspect-ratio: 4 / 3;
	overflow: hidden;
	border-radius: var(--zewo-radius);
	background: var(--zewo-soft);
}

.zewo-objekt-bild img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* badges */

.zewo-badges {
	position: absolute;
	top: 0.6rem;
	right: 0.6rem;
	left: 0.6rem;
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem;
	pointer-events: none;
}

.zewo .zewo-badge {
	display: inline-flex;
	align-items: center;
	gap: 0.4em;
	padding: 0.3em 0.7em;
	border-radius: 999px;
	background: var(--zewo-badge, var(--zewo-primary));
	color: var(--zewo-badge-text, #fff);
	font-size: 0.8rem;
	font-weight: 700;
	line-height: 1.25;
}

.zewo-badges .zewo-badge {
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.zewo .zewo-icon {
	flex: none;
	width: 1.2em;
	height: 1.2em;
	margin: 0;
	border: 0;
	border-radius: 0;
	box-shadow: none;
}

.zewo .zewo-merkmale,
.zewo .zewo-kennzeichen {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	margin: 0 0 1rem;
}

.zewo .zewo-merkmal {
	display: inline-flex;
	align-items: center;
	gap: 0.35em;
	padding: 0.2em 0.6em;
	border: 1px solid var(--zewo-line);
	border-radius: 999px;
	font-size: 0.8rem;
	line-height: 1.25;
}

.zewo .zewo-objekt-titel {
	margin: 0 0 0.25rem;
}

.zewo .zewo-objekt-titel a {
	color: var(--zewo-primary);
	text-decoration: none;
}

.zewo .zewo-objekt-titel a:hover {
	text-decoration: underline;
}

.zewo .zewo-objekt-untertitel,
.zewo .zewo-untertitel {
	margin: 0 0 1rem;
	opacity: 0.8;
}

.zewo .zewo-eckdaten {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
	gap: 0.75rem 1.5rem;
	margin: 0 0 1.25rem;
	padding: 0;
}

.zewo .zewo-eckdaten dt {
	margin: 0;
	padding: 0;
	font-size: 0.85em;
	font-weight: normal;
	opacity: 0.8;
}

.zewo .zewo-eckdaten dd {
	margin: 0;
	padding: 0;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

.zewo-leer {
	padding: 1.5rem;
	border: 1px solid var(--zewo-line);
	border-radius: var(--zewo-radius);
	background: var(--zewo-soft);
}

.zewo-leer > :last-child {
	margin-bottom: 0;
}

/* pages */

.zewo .zewo-seiten ul {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.4rem;
	margin: 2rem 0 0;
	padding: 0;
	list-style: none;
}

.zewo .zewo-seiten li {
	margin: 0;
	padding: 0;
	list-style: none;
}

.zewo-seiten li .page-numbers {
	display: block;
	min-width: 2.6em;
	padding: 0.45em 0.8em;
	border: 1px solid var(--zewo-line);
	border-radius: var(--zewo-radius);
	color: var(--zewo-primary);
	text-align: center;
	text-decoration: none;
}

.zewo-seiten li a.page-numbers:hover,
.zewo-seiten li .page-numbers.current {
	border-color: var(--zewo-primary);
	background: var(--zewo-primary);
	color: #fff;
}

.zewo-seiten li .page-numbers.dots {
	border-color: transparent;
}

/* detail */

.zewo-spalten {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
	gap: 2rem;
}

.zewo-spalte {
	min-width: 0;
}

.zewo-detail h2 {
	margin: 0 0 0.75rem;
	color: var(--zewo-primary);
}

.zewo-abschnitt {
	margin-top: 2rem;
	padding-top: 2rem;
	border-top: 1px solid var(--zewo-line);
}

.zewo .zewo-daten {
	display: grid;
	grid-template-columns: fit-content(45%) minmax(0, 1fr);
	margin: 0;
	padding: 0;
}

/* label and value of all rows share the two columns, long labels wrap between words only */
.zewo .zewo-daten > div {
	display: contents;
}

.zewo .zewo-daten dt,
.zewo .zewo-daten dd {
	margin: 0;
	padding: 0.35rem 0;
	border-bottom: 1px solid var(--zewo-line);
}

.zewo .zewo-daten dt {
	padding-right: 1rem;
	font-weight: normal;
	hyphens: auto;
}

.zewo .zewo-daten dd {
	font-weight: 600;
	overflow-wrap: break-word;
}

.zewo .zewo-kosten dd {
	text-align: right;
	font-variant-numeric: tabular-nums;
}

.zewo .zewo-daten .zewo-summe dt,
.zewo .zewo-daten .zewo-summe dd {
	color: var(--zewo-primary);
	font-size: 1.1em;
	font-weight: 700;
	opacity: 1;
}

.zewo .zewo-aktionen {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	margin: 1.5rem 0 0;
}

/* gallery */

.zewo-galerie-gross {
	display: block;
	aspect-ratio: 4 / 3;
	overflow: hidden;
	border-radius: var(--zewo-radius);
	background: var(--zewo-soft);
}

.zewo-galerie-gross img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.zewo .zewo-galerie-liste {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
	gap: 0.5rem;
	margin: 0.5rem 0 0;
	padding: 0;
	list-style: none;
}

.zewo .zewo-galerie-liste li {
	margin: 0;
	padding: 0;
}

.zewo-galerie-liste a {
	display: block;
	aspect-ratio: 1;
	overflow: hidden;
	border: 2px solid transparent;
	border-radius: var(--zewo-radius);
}

.zewo-galerie-liste a.zewo-aktiv {
	border-color: var(--zewo-primary);
}

.zewo-galerie-liste img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

@media (max-width: 700px) {
	.zewo-filter {
		padding: 1rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.zewo-ergebnisse.zewo-laedt {
		transition: none;
	}
}

/* category switch above the filter */

.zewo-filter .zewo-umschalter {
	grid-column: 1 / -1;
}

.zewo-umschalter-liste {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.zewo-filter .zewo-pille {
	position: relative;
	margin: 0;
	cursor: pointer;
}

.zewo-filter .zewo-pille input {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: 0;
	opacity: 0;
}

.zewo-filter .zewo-pille > span {
	display: inline-flex;
	align-items: center;
	gap: 0.45em;
	padding: 0.45em 1em;
	border: 2px solid var(--zewo-badge, var(--zewo-primary));
	border-radius: 999px;
	background: #fff;
	color: #1d1d1d;
	font-weight: 600;
	line-height: 1.3;
}

.zewo-filter .zewo-pille-icon {
	display: inline-flex;
	margin: -0.15em 0 -0.15em -0.45em;
	padding: 0.3em;
	border-radius: 50%;
	background: var(--zewo-badge, var(--zewo-primary));
	color: var(--zewo-badge-text, #fff);
}

.zewo-filter .zewo-pille input:checked + span {
	background: var(--zewo-badge, var(--zewo-primary));
	color: var(--zewo-badge-text, #fff);
}

.zewo-filter .zewo-pille input:focus-visible + span {
	outline: 3px solid var(--zewo-primary);
	outline-offset: 2px;
}

.zewo-teaser-link {
	justify-content: center;
}

/* inquiry form */

.zewo-felder {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
	gap: 1rem 1.5rem;
}

.zewo .zewo-feld {
	margin: 0;
}

.zewo .zewo-feld-breit {
	grid-column: 1 / -1;
}

.zewo-feld label {
	display: block;
	margin: 0 0 0.3rem;
	font-weight: 600;
}

.zewo-formular input[type="text"],
.zewo-formular input[type="email"],
.zewo-formular input[type="tel"],
.zewo-formular textarea {
	display: block;
	width: 100%;
	max-width: 100%;
	margin: 0;
	padding: 0.55em 0.7em;
	border: 1px solid var(--zewo-line);
	border-radius: var(--zewo-radius);
	background: #fff;
	color: #1d1d1d;
	font: inherit;
}

.zewo .zewo-einwilligung {
	margin: 1.25rem 0 0;
}

.zewo-einwilligung label {
	display: flex;
	align-items: baseline;
	gap: 0.6em;
	font-weight: normal;
	cursor: pointer;
}

.zewo-einwilligung input {
	flex: none;
	margin: 0;
}

.zewo altcha-widget {
	display: block;
	margin: 1.25rem 0 0;
	--altcha-color-primary: var(--zewo-primary);
	--altcha-border-radius: var(--zewo-radius);
}

.zewo .zewo-meldung {
	margin: 1.25rem 0 0;
	padding: 0.8em 1em;
	border: 1px solid var(--zewo-line);
	border-radius: var(--zewo-radius);
	background: var(--zewo-soft);
}

.zewo .zewo-meldung.zewo-fehler {
	border-color: #b32d2e;
	background: #fcf0f1;
	color: #8a1f1f;
}

.zewo .zewo-meldung.zewo-erfolg {
	border-color: #1a7f37;
	background: #edfaef;
	color: #0f5323;
}

.zewo-formular [aria-invalid="true"] {
	border-color: #b32d2e;
}

/* lightbox, attached to the body */

.zewo-lightbox {
	width: 100vw;
	max-width: 100vw;
	height: 100vh;
	max-height: 100vh;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	overflow: hidden;
}

.zewo-lightbox::backdrop {
	background: rgba(0, 0, 0, 0.9);
}

.zewo-lightbox figure {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.6rem;
	box-sizing: border-box;
	height: 100%;
	margin: 0;
	padding: 3.5rem 4rem 1.5rem;
}

.zewo-lightbox img {
	display: block;
	max-width: 100%;
	max-height: calc(100vh - 7.5rem);
	object-fit: contain;
}

.zewo-lightbox figcaption {
	color: #fff;
	font-size: 0.9rem;
}

.zewo-lightbox button {
	position: fixed;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 3rem;
	height: 3rem;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.16);
	color: #fff;
	font-size: 1.8rem;
	line-height: 1;
	cursor: pointer;
}

.zewo-lightbox button:hover,
.zewo-lightbox button:focus-visible {
	background: rgba(255, 255, 255, 0.34);
	outline: 2px solid #fff;
	outline-offset: 2px;
}

.zewo-lightbox .zewo-lightbox-zu {
	top: 0.75rem;
	right: 0.75rem;
}

.zewo-lightbox .zewo-lightbox-zurueck {
	top: calc(50% - 1.5rem);
	left: 0.5rem;
}

.zewo-lightbox .zewo-lightbox-weiter {
	top: calc(50% - 1.5rem);
	right: 0.5rem;
}

.zewo-galerie[data-zewo-lightbox] .zewo-galerie-gross {
	cursor: zoom-in;
}

@media (max-width: 600px) {
	.zewo-lightbox figure {
		padding: 3.5rem 0.5rem 1.5rem;
	}
}
