/* Zweieck Kachel-Grid – Frontend */

.zg-wrap {
	container-type: inline-size;
	container-name: zg;
	box-sizing: border-box;
	width: 100%;
	padding-left: var(--zg-pad, 12px);
	padding-right: var(--zg-pad, 12px);
}

.zg-svg-defs {
	position: absolute;
	width: 0;
	height: 0;
	overflow: hidden;
}

.zg-grid {
	--zg-cols: 5;
	--zg-gap: 6px;
	/* Breite einer Zelle – Zeilen sind genauso hoch, dadurch quadratische Kacheln */
	--zg-cell: calc((100cqi - (var(--zg-cols) - 1) * var(--zg-gap)) / var(--zg-cols));
	display: grid;
	grid-template-columns: repeat(var(--zg-cols), minmax(0, 1fr));
	grid-auto-rows: var(--zg-cell);
	grid-auto-flow: row dense; /* füllt Lücken mit nachfolgenden kleinen Kacheln */
	gap: var(--zg-gap);
	position: relative;
	margin: 0;
	padding: 0;
}

.zg-grid .zg-w2 { grid-column: span 2; }
.zg-grid .zg-h2 { grid-row: span 2; }

/* ---------- Kachel ---------- */

.zg-grid .zg-tile {
	position: relative;
	display: block;
	overflow: hidden;
	min-width: 0;
	margin: 0;
	background: var(--zg-bg, #000);
	color: var(--zg-accent);
	text-decoration: none !important;
	isolation: isolate;
}

/* Keine Link-Unterstreichung, keine Theme-Linkfarben */
.zg-grid a.zg-tile,
.zg-grid a.zg-tile:hover,
.zg-grid a.zg-tile:focus,
.zg-grid a.zg-tile:visited,
.zg-grid a.zg-tile * {
	color: var(--zg-accent);
	text-decoration: none !important;
	box-shadow: none;
}

.zg-grid a.zg-tile:focus-visible {
	outline: 4px solid var(--zg-accent);
	outline-offset: -4px;
}

.zg-grid .zg-img {
	position: absolute;
	inset: 0;
	width: 100% !important;
	height: 100% !important;
	max-width: none !important;
	margin: 0 !important;
	object-fit: cover;
	z-index: 0;
	transition: transform .6s ease;
}

.zg-grid .zg-overlay {
	position: absolute;
	inset: 0;
	background: #000;
	opacity: var(--zg-overlay, 0);
	z-index: 1;
	pointer-events: none;
}

.zg-grid a.zg-tile:hover .zg-img {
	transform: scale(1.04);
}

@media (prefers-reduced-motion: reduce) {
	.zg-grid .zg-img { transition: none; }
	.zg-grid a.zg-tile:hover .zg-img { transform: none; }
}

/* ---------- Inhalt ---------- */

.zg-grid .zg-content {
	position: absolute;
	inset: 0;
	z-index: 2;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	padding: calc(var(--zg-cell) * .05);
	box-sizing: border-box;
}

.zg-grid .zg-pos-oben .zg-content { justify-content: flex-start; }
.zg-grid .zg-pos-mitte .zg-content { justify-content: center; }
.zg-grid .zg-pos-verteilt .zg-content { justify-content: space-between; }

.zg-grid .zg-part {
	display: flex;
	flex-direction: column;
	gap: calc(var(--zg-cell) * .02);
	min-width: 0;
}

.zg-grid .zg-content p {
	margin: 0 !important;
	padding: 0;
	text-align: left;
	text-transform: uppercase;
	text-indent: 0;
	color: inherit;
}

.zg-grid .zg-title {
	font-size: calc(var(--zg-cell) * var(--zg-ts, .13));
	font-weight: 900;
	line-height: 1;
	letter-spacing: -.01em;
	overflow-wrap: normal;
	word-break: normal;
	hyphens: manual;
}

.zg-grid .zg-kicker,
.zg-grid .zg-text,
.zg-grid .zg-marker {
	font-size: max(10px, calc(var(--zg-cell) * .042));
	font-weight: 800;
	line-height: 1.3;
}

.zg-grid .zg-mark {
	background: var(--zg-mark-bg);
	color: var(--zg-mark-color) !important;
	padding: .05em .25em;
	-webkit-box-decoration-break: clone;
	box-decoration-break: clone;
}

/* Balken unter Oberzeile und Marker-Zeile */
.zg-grid .zg-bars .zg-kicker::after,
.zg-grid .zg-bars .zg-marker::after {
	content: "";
	display: block;
	height: max(5px, calc(var(--zg-cell) * .04));
	margin-top: calc(var(--zg-cell) * .012);
	background: var(--zg-accent);
}

/* ---------- Platzhalter ---------- */

.zg-grid .zg-ph {
	display: block;
	min-width: 0;
	pointer-events: none;
}

.zg-empty {
	padding: 1em;
	border: 2px dashed currentColor;
}
