/*
 * ZumEcho Ferienwohnungen – Übersicht, Galerie und Lightbox.
 * Die Spaltenzahl kommt als CSS-Variable aus dem Shortcode.
 */

.zefw-grid {
	--zefw-cols: 3;
	--zefw-cols-tablet: 2;
	--zefw-cols-mobile: 1;
	--zefw-gap: 20px;
	--zefw-radius: 8px;
	--zefw-ratio: 4/3;

	display: grid;
	grid-template-columns: repeat(var(--zefw-cols), minmax(0, 1fr));
	gap: var(--zefw-gap);
	margin: 0;
	padding: 0;
	list-style: none;
}

/* Tablet */
@media (max-width: 980px) {
	.zefw-grid {
		grid-template-columns: repeat(var(--zefw-cols-tablet), minmax(0, 1fr));
	}
}

/* Handy */
@media (max-width: 640px) {
	.zefw-grid {
		grid-template-columns: repeat(var(--zefw-cols-mobile), minmax(0, 1fr));
	}
}

/* ---------- Übersicht ---------- */

.zefw-card {
	display: block;
	overflow: hidden;
	border-radius: var(--zefw-radius);
	background: rgba(0, 0, 0, 0.04);
	color: inherit;
	text-decoration: none;
	transition: transform 0.25s ease, box-shadow 0.25s ease;
}

a.zefw-card:hover,
a.zefw-card:focus-visible {
	transform: translateY(-4px);
	box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
	text-decoration: none;
}

.zefw-card-media {
	position: relative;
	aspect-ratio: var(--zefw-ratio);
	overflow: hidden;
	background: rgba(0, 0, 0, 0.06);
}

.zefw-card-img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.4s ease;
}

a.zefw-card:hover .zefw-card-img {
	transform: scale(1.04);
}

.zefw-card-empty,
.zefw-item-empty {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 14px;
	opacity: 0.6;
}

.zefw-card-body {
	padding: 12px 14px 14px;
}

.zefw-card-title {
	display: block;
	font-weight: 600;
	line-height: 1.3;
}

/* ---------- Galerie ---------- */

.zefw-item {
	display: block;
	position: relative;
	width: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: var(--zefw-radius);
	overflow: hidden;
	background: rgba(0, 0, 0, 0.06);
	aspect-ratio: var(--zefw-ratio);
	cursor: zoom-in;
	appearance: none;
}

.zefw-grid:not(.has-lightbox) .zefw-item {
	cursor: default;
}

.zefw-item-img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.4s ease, opacity 0.25s ease;
}

.zefw-item:hover .zefw-item-img,
.zefw-item:focus-visible .zefw-item-img {
	transform: scale(1.05);
	opacity: 0.92;
}

.zefw-item:focus-visible {
	outline: 3px solid currentColor;
	outline-offset: 3px;
}

.zefw-notice {
	padding: 12px 16px;
	border: 1px dashed rgba(0, 0, 0, 0.3);
	border-radius: 6px;
	font-size: 14px;
	opacity: 0.85;
}

/* ---------- Lightbox ---------- */

.zefw-lightbox {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.92);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.25s ease, visibility 0.25s ease;
	touch-action: pan-y;
}

.zefw-lightbox.is-open {
	opacity: 1;
	visibility: visible;
}

.zefw-lightbox-stage {
	position: relative;
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 56px 72px;
	box-sizing: border-box;
}

.zefw-lightbox-img {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
	border-radius: 4px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
	transition: opacity 0.2s ease;
}

.zefw-lightbox.is-loading .zefw-lightbox-img {
	opacity: 0.3;
}

.zefw-lightbox button {
	position: absolute;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.12);
	color: #fff;
	cursor: pointer;
	line-height: 1;
	transition: background 0.2s ease, transform 0.2s ease;
	appearance: none;
}

.zefw-lightbox button:hover,
.zefw-lightbox button:focus-visible {
	background: rgba(255, 255, 255, 0.28);
}

.zefw-lightbox-close {
	top: 14px;
	right: 14px;
	width: 44px;
	height: 44px;
	font-size: 26px;
}

.zefw-lightbox-prev,
.zefw-lightbox-next {
	top: 50%;
	width: 52px;
	height: 52px;
	margin-top: -26px;
	font-size: 26px;
}

.zefw-lightbox-prev {
	left: 14px;
}

.zefw-lightbox-next {
	right: 14px;
}

.zefw-lightbox-count {
	position: absolute;
	bottom: 16px;
	left: 50%;
	transform: translateX(-50%);
	color: rgba(255, 255, 255, 0.85);
	font-size: 14px;
	letter-spacing: 0.03em;
}

.zefw-lightbox.is-single .zefw-lightbox-prev,
.zefw-lightbox.is-single .zefw-lightbox-next,
.zefw-lightbox.is-single .zefw-lightbox-count {
	display: none;
}

@media (max-width: 640px) {
	.zefw-lightbox-stage {
		padding: 60px 12px 72px;
	}

	.zefw-lightbox-prev,
	.zefw-lightbox-next {
		top: auto;
		bottom: 14px;
		margin-top: 0;
		width: 46px;
		height: 46px;
	}

	.zefw-lightbox-prev {
		left: 20%;
	}

	.zefw-lightbox-next {
		right: 20%;
	}

	.zefw-lightbox-count {
		bottom: 72px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.zefw-card,
	.zefw-card-img,
	.zefw-item-img,
	.zefw-lightbox,
	.zefw-lightbox button {
		transition: none;
	}
}

/* Divi setzt bei Buttons eigene Vorgaben – die hier wieder abschalten. */
.zefw-item::after,
.zefw-lightbox button::after {
	display: none !important;
}
