/* ==========================================================================
   Karten (Bild mit Markern, Textboxen, Linien). Alle Größen in cqw,
   also relativ zur Breite der Karte: sie skaliert mit dem Container.
   ========================================================================== */

.rjst-karte {
	margin: 1.5em 0;
}

.rjst-map {
	--ar: 1.7778;
	position: relative;
	width: 100%;
	aspect-ratio: var(--ar);
	overflow: hidden;
	container-type: inline-size;
	background: #243f5a;
	line-height: 1.25;
	text-align: left;
	font-weight: 400;
	text-transform: none;
	letter-spacing: normal;
	box-sizing: border-box;
}

.rjst-map *,
.rjst-map *::before,
.rjst-map *::after {
	box-sizing: border-box;
}

/* Hintergrundbild: Themes stylen img gern mit Rahmen und Schatten */
.rjst-map img.rjst-bg {
	position: absolute;
	left: 0;
	top: 0;
	width: 100%;
	height: auto;
	max-width: none;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	background: none;
}

.rjst-map .rjst-lines {
	position: absolute;
	left: 0;
	top: 0;
	width: 100%;
	height: 100%;
	overflow: visible;
	pointer-events: none;
}

.rjst-map .rjst-lines line {
	stroke-width: 2;
	stroke-linecap: round;
	vector-effect: non-scaling-stroke;
}

/* Freie Linien (Typ "line"): skalieren mit der Karte, anders als die Verbindungslinien */
.rjst-map .rjst-lines .rjst-ln {
	vector-effect: none;
}

/* Gemeinsam: Position ist der Mittelpunkt des Elements */
.rjst-map .rjst-it {
	position: absolute;
	margin: 0;
	transform: translate(-50%, -50%);
}

.rjst-map .rjst-marker {
	display: flex;
	align-items: center;
	justify-content: center;
	width: calc(var(--sz, 2.6) * 1cqw);
	height: calc(var(--sz, 2.6) * 1cqw);
	border-radius: 50%;
	font-size: calc(var(--sz, 2.6) * 0.5cqw);
	font-weight: 700;
	line-height: 1;
	box-shadow: 0 0.1cqw 0.3cqw rgba(0, 0, 0, 0.45);
}

.rjst-map .rjst-circle {
	box-sizing: border-box;
	width: calc(var(--sz, 8) * 1cqw);
	height: calc(var(--sz, 8) * 1cqw);
	border: calc(var(--lw, 0.4) * 1cqw) solid var(--bc, #ff0000);
	border-radius: 50%;
}

.rjst-map .rjst-circle.rjst-dash {
	border-style: dashed;
}

.rjst-map .rjst-circle::before {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: 50%;
	background: var(--fc, #ffff00);
	opacity: var(--fo, 0);
}

.rjst-map .rjst-box {
	width: max-content;
	padding: 0.45cqw 0.8cqw;
	border: 0.2cqw solid;
	font-size: calc(var(--fs, 1.2) * 1cqw);
	font-weight: 700;
	line-height: 1.25;
	text-align: center;
	white-space: pre;
}

.rjst-map .rjst-label {
	width: max-content;
	font-size: calc(var(--fs, 2.4) * 1cqw);
	line-height: 1.2;
	text-align: center;
	white-space: pre;
}

.rjst-map .rjst-al-l {
	text-align: left;
}

.rjst-map .rjst-al-r {
	text-align: right;
}

.rjst-map .rjst-label.rjst-b {
	font-weight: 700;
}

.rjst-map .rjst-label.rjst-u {
	text-decoration: underline;
}

.rjst-map img.rjst-img {
	width: calc(var(--sz, 10) * 1cqw);
	height: auto;
	max-width: none;
	padding: 0;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	background: none;
}

/* Knopf unter der Karte: print="true" */
.rjst-karte .rjst-karte-tools {
	margin: 0.5em 0 0;
	text-align: right;
}

.rjst-karte .rjst-print-btn {
	padding: 0.4em 0.9em;
	border: 1px solid currentColor;
	border-radius: 4px;
	background: transparent;
	color: inherit;
	font: inherit;
	font-size: 0.9em;
	cursor: pointer;
}

/* Vergrößern per Klick ([revealjs_karte]) */
.rjst-karte[data-zoom] .rjst-map {
	cursor: zoom-in;
}

.rjst-karte[data-zoom] .rjst-map:focus-visible {
	outline: 3px solid #2271b1;
	outline-offset: 2px;
}

html.rjst-lb-open {
	overflow: hidden;
}

.rjst-lb {
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 999999;
	overflow: hidden;
	background: rgba(0, 0, 0, 0.88);
	cursor: default;
	touch-action: none;
	user-select: none;
	-webkit-user-select: none;
}

.rjst-lb.rjst-lb-zoomed .rjst-map {
	cursor: grab;
}

.rjst-lb.rjst-lb-drag,
.rjst-lb.rjst-lb-drag .rjst-map {
	cursor: grabbing;
}

/* Position und Zoom setzt lightbox.js per transform; die Basisgröße passt in das Fenster */
.rjst-lb img {
	-webkit-user-drag: none;
}

.rjst-lb .rjst-map {
	position: absolute;
	top: 0;
	left: 0;
	transform-origin: 0 0;
	width: min(96vw, calc(94vh * var(--ar, 1.7778)));
	max-width: none;
	margin: 0;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}

.rjst-lb .rjst-lb-bar {
	position: absolute;
	bottom: 14px;
	left: 50%;
	transform: translateX(-50%);
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 6px 10px;
	border-radius: 999px;
	background: rgba(20, 20, 30, 0.82);
	color: #fff;
	font: 14px/1 system-ui, sans-serif;
}

.rjst-lb .rjst-lb-btn {
	min-width: 40px;
	height: 40px;
	padding: 0 10px;
	border: 0;
	border-radius: 20px;
	background: rgba(255, 255, 255, 0.15);
	color: #fff;
	font: 22px/40px system-ui, sans-serif;
	cursor: pointer;
}

.rjst-lb .rjst-lb-btn.rjst-lb-reset,
.rjst-lb .rjst-lb-btn.rjst-lb-print {
	font-size: 15px;
}

.rjst-lb .rjst-lb-btn:hover:not(:disabled),
.rjst-lb .rjst-lb-btn:focus-visible {
	background: rgba(255, 255, 255, 0.3);
	outline: 2px solid #fff;
}

.rjst-lb .rjst-lb-btn:disabled {
	opacity: 0.35;
	cursor: default;
}

.rjst-lb .rjst-lb-zoom {
	min-width: 52px;
	text-align: center;
}

.rjst-lb.rjst-lb-zoomed .rjst-lb-hint {
	display: none;
}

.rjst-lb .rjst-lb-hint {
	position: absolute;
	top: 14px;
	left: 16px;
	max-width: calc(100% - 100px);
	margin: 0;
	padding: 6px 12px;
	border-radius: 8px;
	background: rgba(20, 20, 30, 0.72);
	color: #e8e8f0;
	font: 13px/1.3 system-ui, sans-serif;
	pointer-events: none;
}

.rjst-lb .rjst-lb-close {
	position: absolute;
	top: 12px;
	right: 16px;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.15);
	color: #fff;
	font: 32px/44px system-ui, sans-serif;
	text-align: center;
	cursor: pointer;
}

.rjst-lb .rjst-lb-close:hover,
.rjst-lb .rjst-lb-close:focus-visible {
	background: rgba(255, 255, 255, 0.3);
	outline: 2px solid #fff;
}

/* In einer Präsentation: nicht höher als die Folie */
.reveal .rjst-map {
	max-width: calc(var(--rjst-h, 540) * 0.96px * var(--ar));
	margin-left: auto;
	margin-right: auto;
}

/* ==========================================================================
   Editor (nur im Admin)
   ========================================================================== */

.rjst-editor {
	max-width: 100%;
}

.rjst-ed-bar {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 8px;
	align-items: center;
	margin-bottom: 12px;
}

.rjst-ed-bar .rjst-sep {
	width: 1px;
	height: 24px;
	background: #c3c4c7;
	margin: 0 4px;
}

.rjst-ed-bar label {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-size: 13px;
}

.rjst-ed-bar input[type="number"] {
	width: 70px;
}

.rjst-ed-main {
	display: flex;
	gap: 16px;
	align-items: flex-start;
}

.rjst-ed-stagewrap {
	flex: 1 1 auto;
	min-width: 0;
	background: #f0f0f1;
	border: 1px solid #c3c4c7;
	padding: 8px;
}

.rjst-ed-inspector {
	flex: 0 0 270px;
	padding: 10px 12px;
	background: #fff;
	border: 1px solid #c3c4c7;
	font-size: 13px;
}

.rjst-ed-inspector h4 {
	margin: 0 0 10px;
	font-size: 13px;
}

.rjst-ed-inspector .rjst-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	margin-bottom: 8px;
}

.rjst-ed-inspector .rjst-row.rjst-col {
	display: block;
}

.rjst-ed-inspector .rjst-row.rjst-col > label {
	display: block;
	margin-bottom: 3px;
}

.rjst-ed-inspector input[type="text"],
.rjst-ed-inspector textarea {
	width: 100%;
}

.rjst-ed-inspector input[type="number"] {
	width: 80px;
}

.rjst-ed-inspector input[type="color"] {
	width: 44px;
	height: 28px;
	padding: 0;
}

.rjst-ed-inspector .rjst-hint {
	margin: 8px 0 0;
	color: #646970;
	font-size: 12px;
}

.rjst-ed-inspector .rjst-btns {
	display: flex;
	gap: 6px;
	margin-top: 12px;
}

.rjst-map.rjst-edit {
	outline: none;
	margin: 0 auto;
}

.rjst-map.rjst-edit .rjst-it {
	cursor: move;
	touch-action: none;
	user-select: none;
	-webkit-user-select: none;
}

.rjst-map.rjst-edit .rjst-it.rjst-sel {
	outline: 2px dashed #2271b1;
	outline-offset: 3px;
}

.rjst-map.rjst-edit .rjst-handle {
	position: absolute;
	z-index: 5;
	width: 16px;
	height: 16px;
	margin: -8px 0 0 -8px;
	border: 2px solid #fff;
	border-radius: 50%;
	background: #2271b1;
	box-shadow: 0 0 0 1px #2271b1;
	cursor: crosshair;
	touch-action: none;
}

.rjst-map.rjst-edit .rjst-empty {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	color: rgba(255, 255, 255, 0.75);
	font: 14px/1.4 system-ui, sans-serif;
	pointer-events: none;
}

/* Editor: Startpunkt einer freien Linie und breite Trefferfläche zum Anklicken */
.rjst-map.rjst-edit .rjst-it.rjst-line {
	width: 14px;
	height: 14px;
	border: 2px solid #fff;
	border-radius: 50%;
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6);
}

.rjst-map.rjst-edit .rjst-lines .rjst-hit {
	stroke: transparent;
	stroke-width: 16;
	vector-effect: non-scaling-stroke;
	pointer-events: stroke;
	cursor: move;
}

/* Farbwahl: 16 Standardfarben oder freier Farbwähler */
.rjst-ed-bar .rjst-barfield {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-size: 13px;
}

.rjst-color {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.rjst-swatches {
	display: grid;
	grid-template-columns: repeat(8, 16px);
	gap: 3px;
}

.rjst-swatches .rjst-swatch {
	box-sizing: border-box;
	width: 16px;
	height: 16px;
	padding: 0;
	border: 1px solid #8c8f94;
	border-radius: 2px;
	cursor: pointer;
}

.rjst-swatches .rjst-swatch.rjst-on {
	outline: 2px solid #2271b1;
	outline-offset: 1px;
}

.rjst-swatches .rjst-swatch:focus-visible {
	outline: 2px solid #2271b1;
	outline-offset: 1px;
}

.rjst-color .rjst-colormode {
	padding: 0;
	border: 0;
	background: none;
	color: #2271b1;
	font-size: 12px;
	text-decoration: underline;
	cursor: pointer;
}

.rjst-ed-bar .rjst-swatches {
	display: flex;
	flex-wrap: nowrap;
	gap: 2px;
}

.rjst-ed-bar .rjst-swatches .rjst-swatch {
	width: 15px;
	height: 15px;
}

.rjst-ed-inspector .rjst-colorrow {
	align-items: flex-start;
}

@media (max-width: 1100px) {
	.rjst-ed-main {
		flex-direction: column;
	}

	.rjst-ed-inspector {
		flex-basis: auto;
		width: 100%;
	}
}

/* ==========================================================================
   Drucken: nur die Karte (und ihr Titel), farbgetreu auf einer Seite
   ========================================================================== */

.rjst-print-root {
	display: none;
}

@media print {
	html.rjst-printing body > *:not(.rjst-print-root) {
		display: none !important;
	}

	html.rjst-printing,
	html.rjst-printing body {
		margin: 0 !important;
		padding: 0 !important;
		background: #fff !important;
		overflow: visible !important;
	}

	html.rjst-printing .rjst-print-root {
		display: block !important;
		position: static !important;
	}

	html.rjst-printing .rjst-print-title {
		margin: 0 0 3mm;
		color: #000;
		font: 700 14pt/1.2 system-ui, Arial, sans-serif;
	}

	html.rjst-printing .rjst-print-root .rjst-map {
		margin: 0;
		box-shadow: none;
		-webkit-print-color-adjust: exact;
		print-color-adjust: exact;
		break-inside: avoid;
	}
}
