/*
 * Ladeanzeige — shown while the next page is on its way (main.js, November
 * 2026): a bar across the top of the window, and a ring in the middle.
 *
 * Both show only if the page is slow: main.js waits 300ms after a click before
 * adding .is-ladend, and a page that is there by then never shows either. That
 * delay is what makes the ring acceptable. A spinner on every click would say
 * "wait" where there is no wait; this one appears only when there is.
 *
 * The ring was added on 17 November 2026. On an iPhone the bar is easy to miss:
 * all Mike saw while a slow page loaded in Safari was the page fading to
 * white. He asked for something in the middle, in the logo's colours.
 *
 * The bar runs to 85% and slows as it goes, because the real progress is not
 * known — it stops short of the end rather than arrive at a page that has not.
 * The new page replaces both. Teal and yellow, the logo's two colours.
 */
.ladeanzeige {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: calc(var(--z-skip) + 1);
	height: 3px;
	pointer-events: none;
	opacity: 0;
	transition: opacity 0.2s ease;
}

.admin-bar .ladeanzeige {
	top: 32px;
}

@media screen and (max-width: 782px) {
	.admin-bar .ladeanzeige {
		top: 46px;
	}
}

.ladeanzeige::before {
	content: '';
	display: block;
	width: 100%;
	height: 100%;
	background: linear-gradient(to right, var(--brand-teal), var(--brand-yellow));
	box-shadow: 0 0 8px color-mix(in srgb, var(--brand-teal) 60%, transparent);
	transform: scaleX(0);
	transform-origin: left center;
}

.ladeanzeige.is-ladend {
	opacity: 1;
}

.ladeanzeige.is-ladend::before {
	animation: ladeanzeige-lauf 8s cubic-bezier(0.1, 0.7, 0.2, 1) forwards;
}

@keyframes ladeanzeige-lauf {
	0%   { transform: scaleX(0.08); }
	100% { transform: scaleX(0.85); }
}

/*
 * The ring: two arcs, teal and yellow, turning on a faint track, on a white
 * disc so that it reads over a photo as well as over text. Fixed to the
 * middle of the window, not of the page.
 */
.ladeanzeige-kreis {
	position: fixed;
	top: 50%;
	left: 50%;
	z-index: calc(var(--z-skip) + 1);
	width: 64px;
	height: 64px;
	margin: -32px 0 0 -32px;
	border-radius: 50%;
	background-color: #fff;
	box-shadow: 0 4px 18px rgba(0, 0, 0, 0.14);
	pointer-events: none;
	opacity: 0;
	transform: scale(0.85);
	transition: opacity 0.2s ease, transform 0.2s ease;
}

.ladeanzeige-kreis::before {
	content: '';
	position: absolute;
	inset: 13px;
	border-radius: 50%;
	border: 4px solid color-mix(in srgb, var(--brand-teal) 14%, transparent);
	border-top-color: var(--brand-teal);
	border-bottom-color: var(--brand-yellow);
}

.ladeanzeige-kreis.is-ladend {
	opacity: 1;
	transform: scale(1);
}

.ladeanzeige-kreis.is-ladend::before {
	animation: ladeanzeige-dreh 0.9s linear infinite;
}

@keyframes ladeanzeige-dreh {
	to { transform: rotate(360deg); }
}

/* Without motion: the bar stands at half width, the ring stands still, and
   both breathe, so they still say that something is happening. */
@media (prefers-reduced-motion: reduce) {
	.ladeanzeige.is-ladend::before {
		transform: scaleX(0.5);
		animation: ladeanzeige-ruhig 1.6s ease-in-out infinite alternate;
	}

	.ladeanzeige-kreis {
		transition: opacity 0.2s ease;
		transform: none;
	}

	.ladeanzeige-kreis.is-ladend::before {
		animation: ladeanzeige-ruhig 1.6s ease-in-out infinite alternate;
	}

	@keyframes ladeanzeige-ruhig {
		from { opacity: 0.45; }
		to   { opacity: 1; }
	}
}
