/* Zeitstrahl – Theme-agnostisch. Farben/Abstände über Custom Properties
   im Theme überschreibbar, z. B.:
   .zs-zeitstrahl { --zs-akzent: #0a6e5c; } */

.zs-zeitstrahl {
	--zs-akzent: currentColor;
	--zs-linie: color-mix(in srgb, currentColor 25%, transparent);
	--zs-karte-bg: color-mix(in srgb, currentColor 5%, transparent);
	--zs-abstand: 3rem;
	--zs-marker: 0.875rem;

	margin: 0 auto;
	width: 80%;
	max-width: none;
}

/* Auf schmaleren Containern volle Breite nutzen */
@media (max-width: 1024px) {
	.zs-zeitstrahl {
		width: 100%;
	}
}

.zs-timeline {
	list-style: none;
	margin: 0;
	padding: 0;
	position: relative;
}

/* Mittellinie */
.zs-timeline::before {
	content: "";
	position: absolute;
	top: 0;
	bottom: 0;
	left: 50%;
	width: 2px;
	transform: translateX(-50%);
	background: var(--zs-linie);
}

.zs-item {
	position: relative;
	width: 50%;
	padding: 0 var(--zs-abstand) var(--zs-abstand) 0;
	box-sizing: border-box;
}

.zs-item:nth-child(even) {
	margin-left: 50%;
	padding: 0 0 var(--zs-abstand) var(--zs-abstand);
}

.zs-item:last-child {
	padding-bottom: 0;
}

/* Punkt-Marker auf der Linie */
.zs-marker {
	position: absolute;
	top: 0.4rem;
	width: var(--zs-marker);
	height: var(--zs-marker);
	border-radius: 50%;
	background: var(--zs-akzent);
	box-shadow: 0 0 0 4px color-mix(in srgb, var(--zs-akzent) 20%, transparent);
}

.zs-item:nth-child(odd) .zs-marker {
	right: calc(var(--zs-marker) / -2);
}

.zs-item:nth-child(even) .zs-marker {
	left: calc(var(--zs-marker) / -2);
}

.zs-card {
	background: var(--zs-karte-bg);
	border-radius: 0.5rem;
	padding: 1.25rem 1.5rem;
}

.zs-item:nth-child(odd) .zs-card {
	text-align: right;
}

/* Jahreszahl neben dem Marker, auf der gegenüberliegenden Seite der Linie */
.zs-date {
	position: absolute;
	top: 0.25rem;
	font-size: 0.875em;
	font-weight: 700;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: var(--zs-akzent);
	white-space: nowrap;
}

.zs-item:nth-child(odd) .zs-date {
	left: calc(100% + var(--zs-marker) + 0.75rem);
}

.zs-item:nth-child(even) .zs-date {
	right: calc(100% + var(--zs-marker) + 0.75rem);
}

.zs-title {
	margin: 0 0 0.5rem;
	font-size: 1.25em;
	line-height: 1.3;
}

.zs-figure {
	margin: 0 0 0.75rem;
}

.zs-image {
	width: 100%;
	height: auto;
	border-radius: 0.375rem;
	display: block;
}

.zs-text > :last-child {
	margin-bottom: 0;
}

/* Einblend-Animation (JS setzt .zs-visible) */
@media (prefers-reduced-motion: no-preference) {
	.zs-item {
		opacity: 0;
		transform: translateY(2rem);
		transition: opacity 0.7s ease-out, transform 0.7s ease-out;
	}

	.zs-item.zs-visible {
		opacity: 1;
		transform: none;
	}
}

/* Mobil: einspaltig, Linie links */
@media (max-width: 700px) {
	.zs-timeline::before {
		left: 0.5rem;
		transform: none;
	}

	.zs-item,
	.zs-item:nth-child(even) {
		width: 100%;
		margin-left: 0;
		padding: 0 0 var(--zs-abstand) 2.25rem;
	}

	.zs-item:last-child {
		padding-bottom: 0;
	}

	.zs-item:nth-child(odd) .zs-marker,
	.zs-item:nth-child(even) .zs-marker {
		left: calc(0.5rem - var(--zs-marker) / 2);
		right: auto;
	}

	.zs-item:nth-child(odd) .zs-card {
		text-align: left;
	}

	/* Jahreszahl rechts neben dem Marker, Karte rückt darunter */
	.zs-item:nth-child(odd) .zs-date,
	.zs-item:nth-child(even) .zs-date {
		position: static;
		display: block;
		margin-bottom: 0.375rem;
	}
}

/* =========================================================
   Horizontal: [zeitstrahl ausrichtung="horizontal"]
   Wischbare Leiste mit Scroll-Snap. Jahreszahl über dem Punkt,
   Karte darunter. Steht bewusst am Dateiende, damit die
   Regeln oben (inkl. Mobil-Query) sicher überschrieben werden.
   ========================================================= */

.zs-zeitstrahl--horizontal {
	--zs-h-breite: clamp(15rem, 85%, 24rem); /* Breite je Eintrag */
	--zs-h-datum: 2rem;                      /* Höhe der Datumszeile */
}

.zs-timeline--horizontal {
	display: flex;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-padding-inline: 0.375rem;
	overscroll-behavior-x: contain;
	scrollbar-width: thin;
	/* Innenabstand links, damit der Marker-Ring nicht abgeschnitten wird */
	padding: 0 0 1rem 0.375rem;
}

.zs-timeline--horizontal::before {
	display: none;
}

.zs-timeline--horizontal .zs-item,
.zs-timeline--horizontal .zs-item:nth-child(even) {
	flex: 0 0 var(--zs-h-breite);
	width: auto;
	margin-left: 0;
	padding: calc(var(--zs-h-datum) + var(--zs-marker) + 1.25rem) 2rem 0 0;
	scroll-snap-align: start;
}

/* Linienstück je Eintrag – aneinandergereiht ergibt das die durchgehende Linie */
.zs-timeline--horizontal .zs-item::before {
	content: "";
	position: absolute;
	top: calc(var(--zs-h-datum) + var(--zs-marker) / 2 - 1px);
	left: 0;
	right: 0;
	height: 2px;
	background: var(--zs-linie);
}

.zs-timeline--horizontal .zs-item:nth-child(odd) .zs-marker,
.zs-timeline--horizontal .zs-item:nth-child(even) .zs-marker {
	top: var(--zs-h-datum);
	left: 0;
	right: auto;
}

.zs-timeline--horizontal .zs-item:nth-child(odd) .zs-date,
.zs-timeline--horizontal .zs-item:nth-child(even) .zs-date {
	position: absolute;
	top: 0;
	left: 0;
	right: 2rem;
	display: block;
	margin: 0;
	line-height: 1.5;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* Einträge oben ausrichten – Karten behalten ihre Inhaltshöhe */
.zs-timeline--horizontal {
	align-items: flex-start;
}

.zs-timeline--horizontal .zs-item:nth-child(odd) .zs-card {
	text-align: left;
}

.zs-timeline--horizontal:focus-visible {
	outline: 2px solid var(--zs-akzent);
	outline-offset: 4px;
	border-radius: 0.25rem;
}

/* Vor/Zurück-Pfeile – Spezifität erhöht, damit Theme-Button-Styles nicht durchschlagen */
.zs-zeitstrahl .zs-nav {
	display: flex;
	justify-content: flex-end;
	gap: 0.5rem;
	margin: 0 0 1rem;
}

.zs-zeitstrahl .zs-nav[hidden] {
	display: none;
}

.zs-zeitstrahl .zs-nav-btn {
	display: inline-grid;
	place-items: center;
	width: 2.75rem;
	height: 2.75rem;
	min-width: 0;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 2px solid var(--zs-akzent);
	border-radius: 50%;
	background: transparent;
	box-shadow: none;
	color: var(--zs-akzent);
	text-transform: none;
	line-height: 1;
	cursor: pointer;
	transition: background-color 0.2s ease, opacity 0.2s ease;
}

.zs-zeitstrahl .zs-nav-btn svg {
	pointer-events: none;
}

.zs-zeitstrahl .zs-nav-btn:hover:not(:disabled) {
	background: color-mix(in srgb, var(--zs-akzent) 10%, transparent);
}

.zs-zeitstrahl .zs-nav-btn:focus-visible {
	outline: 2px solid var(--zs-akzent);
	outline-offset: 3px;
}

.zs-zeitstrahl .zs-nav-btn:disabled {
	opacity: 0.3;
	cursor: default;
}
