/* Kalendrio 2027 – Startseiten-Modal */

html.kalendrio-open {
	overflow: hidden;
}

.kalendrio-modal {
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	margin: auto;
	padding: 0;
	border: 0;
	width: 100vw;
	max-width: 100vw;
	max-height: 100vh;
	max-height: 100dvh;
	background: #fff;
	color: #000;
	overflow: hidden;
}

.kalendrio-modal:not([open]) {
	display: none;
}

.kalendrio-modal::backdrop {
	background: rgba(0, 0, 0, 0.85);
}

/* Fallback für Browser ohne <dialog>-Unterstützung */
.kalendrio-modal.kalendrio-fallback[open] {
	display: block;
	z-index: 99999;
	box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.85);
}

.kalendrio-modal[open] {
	animation: kalendrio-in 0.25s ease-out;
}

@keyframes kalendrio-in {
	from { opacity: 0; transform: scale(0.97); }
	to   { opacity: 1; transform: none; }
}

/* Scrollbereich: Hochformat bleibt erhalten, gescrollt wird im Modal */
.kalendrio-scroll {
	max-height: 100vh;
	max-height: 100dvh;
	overflow: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
}

.kalendrio-figure {
	position: relative;
	width: 100%;
	cursor: zoom-in;
}

.kalendrio-figure img {
	display: block;
	width: 100%;
	max-width: none;
	height: auto;
	user-select: none;
	-webkit-user-select: none;
}

/* Vergrößert: doppelte Breite, in beide Richtungen verschiebbar */
.kalendrio-modal.is-zoomed .kalendrio-figure {
	width: 200%;
	cursor: zoom-out;
}

/* Unsichtbare Klickfläche über dem Mail-Absatz im Bild */
.kalendrio-mail {
	position: absolute;
	left: 35%;
	top: 87.5%;
	width: 63%;
	height: 10%;
	border-radius: 6px;
	cursor: pointer;
}

.kalendrio-mail:hover,
.kalendrio-mail:focus-visible {
	outline: 3px solid rgba(232, 31, 39, 0.8);
	outline-offset: 2px;
}

/* Buttons (Theme-Styles neutralisieren) */
.kalendrio-modal .kalendrio-btn {
	position: absolute;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.75);
	color: #fff;
	cursor: pointer;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
	transition: background 0.15s;
}

.kalendrio-modal .kalendrio-btn:hover {
	background: #000;
	text-decoration: none;
}

.kalendrio-modal .kalendrio-btn:focus {
	outline: none;
}

.kalendrio-modal .kalendrio-btn:focus-visible {
	outline: 3px solid #fff;
	outline-offset: 2px;
}

.kalendrio-close {
	top: max(10px, env(safe-area-inset-top));
	right: 10px;
}

.kalendrio-zoom {
	bottom: max(10px, env(safe-area-inset-bottom));
	right: 10px;
}

.kalendrio-icon-out,
.kalendrio-modal.is-zoomed .kalendrio-icon-in {
	display: none;
}

.kalendrio-modal.is-zoomed .kalendrio-icon-out {
	display: block;
}

/* Scroll-Hinweis, verschwindet nach dem ersten Scrollen */
.kalendrio-hint {
	position: absolute;
	left: 50%;
	bottom: max(14px, env(safe-area-inset-bottom));
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	margin-left: -18px;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.75);
	color: #fff;
	pointer-events: none;
	animation: kalendrio-bounce 1.6s ease-in-out infinite;
	transition: opacity 0.3s;
}

.kalendrio-modal.is-scrolled .kalendrio-hint {
	opacity: 0;
	animation: none;
}

@keyframes kalendrio-bounce {
	0%, 100% { transform: translateY(0); }
	50%      { transform: translateY(5px); }
}

/* Tablet / Desktop: mittig, max. Originalbreite, 92 % Höhe */
@media (min-width: 700px) {
	.kalendrio-modal {
		width: min(640px, 92vw);
		max-height: 92vh;
		max-height: 92dvh;
		border-radius: 8px;
		box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
	}

	.kalendrio-scroll {
		max-height: 92vh;
		max-height: 92dvh;
	}
}

@media (prefers-reduced-motion: reduce) {
	.kalendrio-modal[open],
	.kalendrio-hint {
		animation: none;
	}
}
