/**
 * WP Base — Startseite der App.
 *
 * Baut auf den Variablen aus base.css auf (Farben, Radien, Schrift) und
 * erbt damit auch den Dunkelmodus.
 *
 * Gedacht für die leere Seitenvorlage: Die Seite bringt ihren eigenen Rahmen
 * mit, weil kein Theme-Header da ist. Auf einer normalen Theme-Seite
 * funktioniert sie ebenfalls, dann eben innerhalb des Theme-Layouts.
 */

/* ──────────────────────────────────────────────
   Seitenaufbau

   Der Header liegt AUSSERHALB und bleibt weiß — wie auf allen
   Unterseiten. Darunter der Empfangsbereich: ein Grund mit Licht von
   oben, damit die Fläche Tiefe bekommt statt flach dazuliegen.
   ────────────────────────────────────────────── */

.wpb-page {
	position: relative;
	min-height: 78vh;
	padding: 0 20px 88px;
	/* Der Verlauf geht von fast weiß oben nach getönt unten. Das allein
	   nimmt der Seite schon das Flache — ein einzelner Grauton wirkt
	   immer wie eine unbedruckte Fläche. */
	background:
		linear-gradient(to bottom,
			#fbfbfd 0%,
			var(--wpb-page) 340px,
			var(--wpb-page) 100%);
	font-family: var(--wpb-font);
	color: var(--wpb-fg);
	box-sizing: border-box;
	overflow: hidden;
}

/* Lichtschein hinter der Überschrift. Sehr weit und sehr blass — man
   sieht ihn nicht bewusst, aber die Seite wirkt dadurch beleuchtet
   statt gleichmäßig ausgeleuchtet. */
.wpb-page::before {
	content: "";
	position: absolute;
	top: -180px;
	left: 50%;
	width: 900px;
	height: 520px;
	margin-left: -450px;
	background: radial-gradient(
		ellipse at center,
		rgba(10, 132, 255, 0.10) 0%,
		rgba(88, 86, 214, 0.05) 42%,
		transparent 70%
	);
	pointer-events: none;
	z-index: 0;
}

.wpb-page *,
.wpb-page *::before,
.wpb-page *::after {
	box-sizing: border-box;
}

.wpb-home {
	position: relative;
	z-index: 1;
	max-width: 940px;
	margin: 0 auto;
	padding: 0;
}

/* ── Einstieg ─────────────────────────────────
   Viel Luft über der Überschrift. Das ist der Unterschied zwischen
   "Inhalt fängt an" und "hier beginnt etwas". */

.wpb-home__lead {
	padding: 72px 4px 40px;
	text-align: center;
}

.wpb-home__headline {
	margin: 0;
	font-size: 38px;
	font-weight: 700;
	line-height: 1.1;
	letter-spacing: -0.028em;
	color: var(--wpb-fg);
}

.wpb-home__sub {
	margin: 12px 0 0;
	font-size: 17px;
	line-height: 1.5;
	color: var(--wpb-muted);
}

/* ── Hinweistext des Administrators ─────────── */

.wpb-home__intro {
	max-width: 62ch;
	margin: 0 auto 28px;
	padding: 0 4px;
	font-size: 15px;
	line-height: 1.6;
	text-align: center;
	color: var(--wpb-muted);
	background: none;
	box-shadow: none;
}

.wpb-home__intro p { margin: 0 0 8px; }
.wpb-home__intro p:last-child { margin-bottom: 0; }
.wpb-home__intro a { color: var(--wpb-fg); }

/* Login-Ansicht: Box mittig auf der Fläche, ohne Einstiegsbereich. */
.wpb-home--login {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 70vh;
	padding: 20px 0;
}

/* <main> trägt keine eigene Gestaltung — nur semantischer Rahmen. */

/* ── Dunkelmodus ──────────────────────────────
   Licht und Kanten müssen hier andere Werte haben: Ein weißer
   Innenschein auf dunklem Grund wirkt wie ein Fehler, und der
   Verlauf muss von dunkel nach dunkler laufen statt umgekehrt. */

@media (prefers-color-scheme: dark) {
	:root:not([data-wpb-theme="light"]) .wpb-page {
		background: linear-gradient(to bottom,
			#1a1a1d 0%,
			var(--wpb-page) 340px,
			var(--wpb-page) 100%);
	}

	:root:not([data-wpb-theme="light"]) .wpb-page::before {
		background: radial-gradient(
			ellipse at center,
			rgba(77, 163, 255, 0.10) 0%,
			rgba(132, 130, 232, 0.06) 42%,
			transparent 70%
		);
	}

	:root:not([data-wpb-theme="light"]) .wpb-tile {
		box-shadow:
			inset 0 1px 0 rgba(255, 255, 255, 0.06),
			0 0 0 1px rgba(255, 255, 255, 0.06),
			0 12px 28px -6px rgba(0, 0, 0, 0.5);
	}

	:root:not([data-wpb-theme="light"]) .wpb-tile:hover,
	:root:not([data-wpb-theme="light"]) .wpb-tile:focus-visible {
		box-shadow:
			inset 0 1px 0 rgba(255, 255, 255, 0.08),
			0 0 0 1px rgba(255, 255, 255, 0.09),
			0 24px 48px -12px rgba(0, 0, 0, 0.65);
	}

	:root:not([data-wpb-theme="light"]) .wpb-tile__icon {
		box-shadow:
			inset 0 1px 0 rgba(255, 255, 255, 0.07),
			0 1px 2px rgba(0, 0, 0, 0.3);
	}
}

/* ── Das Raster ───────────────────────────────
   Freistehende Kacheln mit Abstand dazwischen — nicht in einem
   gemeinsamen Feld. Man soll sie anfassen wollen, und dafür müssen
   sie einzeln auf der Fläche liegen. */

.wpb-home__panel {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
	gap: 24px;
}

/* ── Farbtöne ──────────────────────────────────
   Acht Töne, aus dem Seitentitel errechnet (WPB_Restrict::tone_for).
   Sie tragen das Symbolfeld und den Lichtschein, der beim Überfahren
   von oben in die Kachel fällt. */

.wpb-tile[data-tone="0"] { --tone: #0a84ff; --tone-bg: #e8f2ff; }
.wpb-tile[data-tone="1"] { --tone: #12a594; --tone-bg: #e0f4f1; }
.wpb-tile[data-tone="2"] { --tone: #5856d6; --tone-bg: #ecebfb; }
.wpb-tile[data-tone="3"] { --tone: #d97706; --tone-bg: #fdf0dd; }
.wpb-tile[data-tone="4"] { --tone: #d6336c; --tone-bg: #fce8ef; }
.wpb-tile[data-tone="5"] { --tone: #2b9348; --tone-bg: #e6f4ea; }
.wpb-tile[data-tone="6"] { --tone: #9c36b5; --tone-bg: #f6e9fa; }
.wpb-tile[data-tone="7"] { --tone: #4c6ef5; --tone-bg: #e9edfd; }

@media (prefers-color-scheme: dark) {
	:root:not([data-wpb-theme="light"]) .wpb-tile[data-tone="0"] { --tone: #4da3ff; --tone-bg: rgba(77, 163, 255, 0.16); }
	:root:not([data-wpb-theme="light"]) .wpb-tile[data-tone="1"] { --tone: #3ec9b6; --tone-bg: rgba(62, 201, 182, 0.16); }
	:root:not([data-wpb-theme="light"]) .wpb-tile[data-tone="2"] { --tone: #8482e8; --tone-bg: rgba(132, 130, 232, 0.18); }
	:root:not([data-wpb-theme="light"]) .wpb-tile[data-tone="3"] { --tone: #f0a944; --tone-bg: rgba(240, 169, 68, 0.16); }
	:root:not([data-wpb-theme="light"]) .wpb-tile[data-tone="4"] { --tone: #e8699a; --tone-bg: rgba(232, 105, 154, 0.16); }
	:root:not([data-wpb-theme="light"]) .wpb-tile[data-tone="5"] { --tone: #5cb877; --tone-bg: rgba(92, 184, 119, 0.16); }
	:root:not([data-wpb-theme="light"]) .wpb-tile[data-tone="6"] { --tone: #c46fd8; --tone-bg: rgba(196, 111, 216, 0.18); }
	:root:not([data-wpb-theme="light"]) .wpb-tile[data-tone="7"] { --tone: #7d95f8; --tone-bg: rgba(125, 149, 248, 0.18); }
}

/* ── Die Kachel ───────────────────────────────
   Symbol und Titel stehen NEBENEINANDER, nicht übereinander. Die
   frühere Anordnung ließ die Mitte leer, und diese Leere wirkte billig. */

.wpb-tile {
	position: relative;
	display: flex;
	flex-direction: column;
	padding: 30px 30px 26px;
	background: var(--wpb-bg);
	border-radius: 20px;
	text-decoration: none;
	color: var(--wpb-fg);
	/* Vier Lagen statt einer: eine helle Oberkante (Licht fällt von
	   oben), eine feine Außenkante, ein naher und ein weiter Schatten.
	   Genau das unterscheidet "hat einen Schatten" von "liegt auf". */
	box-shadow:
		inset 0 1px 0 rgba(255, 255, 255, 0.9),
		0 0 0 1px rgba(0, 0, 0, 0.035),
		0 2px 4px rgba(0, 0, 0, 0.03),
		0 12px 28px -6px rgba(16, 24, 40, 0.09);
	transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1),
	            box-shadow 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Lichtschein in der Akzentfarbe, der beim Überfahren von oben in die
   Kachel fällt. Sehr zurückhaltend — man sieht ihn kaum, aber er nimmt
   der Kachel die Härte. */
.wpb-tile::before {
	content: "";
	position: absolute;
	inset: 0 0 auto 0;
	height: 140px;
	border-radius: 20px 20px 0 0;
	background: linear-gradient(to bottom, var(--tone-bg), transparent);
	opacity: 0;
	transition: opacity 0.28s ease;
	pointer-events: none;
}

.wpb-tile:hover,
.wpb-tile:focus-visible {
	transform: translateY(-6px);
	box-shadow:
		inset 0 1px 0 rgba(255, 255, 255, 0.9),
		0 0 0 1px rgba(0, 0, 0, 0.04),
		0 4px 8px rgba(0, 0, 0, 0.04),
		0 24px 48px -12px rgba(16, 24, 40, 0.18);
	color: var(--wpb-fg);
}

.wpb-tile:hover::before,
.wpb-tile:focus-visible::before {
	opacity: 0.6;
}

.wpb-tile:active {
	transform: translateY(-2px);
	transition-duration: 0.1s;
}

.wpb-tile:focus-visible {
	outline: 2px solid var(--tone);
	outline-offset: 3px;
}

/* ── Kopfzeile der Kachel: Symbol + Titel nebeneinander ── */

.wpb-tile__top {
	display: flex;
	align-items: center;
	gap: 16px;
	margin-bottom: 18px;
	position: relative;
	z-index: 1;
}

.wpb-tile__icon {
	display: flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 56px;
	height: 56px;
	font-size: 28px;
	line-height: 1;
	background: var(--tone-bg);
	border-radius: 16px;
	/* Eigene feine Kante — das Symbolfeld soll ein Gegenstand auf der
	   Kachel sein, kein aufgemalter Fleck. */
	box-shadow:
		inset 0 1px 0 rgba(255, 255, 255, 0.5),
		0 1px 2px rgba(16, 24, 40, 0.06);
	transition: transform 0.28s cubic-bezier(0.34, 1.4, 0.64, 1),
	            box-shadow 0.28s ease;
}

.wpb-tile__icon--image {
	overflow: hidden;
	background: var(--tone-bg);
}

.wpb-tile__icon--image img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.wpb-tile:hover .wpb-tile__icon {
	transform: scale(1.08) rotate(-2deg);
	box-shadow:
		inset 0 1px 0 rgba(255, 255, 255, 0.6),
		0 4px 10px rgba(16, 24, 40, 0.12);
}

/* Ohne Symbol: der Anfangsbuchstabe in der Akzentfarbe. */
.wpb-tile__initial {
	font-size: 24px;
	font-weight: 600;
	color: var(--tone);
	text-transform: uppercase;
}

.wpb-tile__title {
	display: block;
	font-size: 19px;
	font-weight: 600;
	line-height: 1.25;
	letter-spacing: -0.016em;
	min-width: 0;
	overflow-wrap: anywhere;
}

/* ── Text ─────────────────────────────────────── */

.wpb-tile__body {
	display: block;
	flex: 1 1 auto;
	position: relative;
	z-index: 1;
}

.wpb-tile__text {
	display: block;
	font-size: 14.5px;
	line-height: 1.6;
	color: var(--wpb-muted);
}

/* ── Fußzeile mit Pfeil ───────────────────────── */

.wpb-tile__foot {
	display: flex;
	align-items: center;
	gap: 6px;
	margin-top: 22px;
	padding-top: 16px;
	border-top: 1px solid var(--wpb-border-soft);
	font-size: 13px;
	font-weight: 500;
	color: var(--wpb-muted);
	position: relative;
	z-index: 1;
	transition: color 0.18s ease;
}

.wpb-tile:hover .wpb-tile__foot,
.wpb-tile:focus-visible .wpb-tile__foot {
	color: var(--tone);
}

/* ── Pfeil ────────────────────────────────────
   Sitzt in der Fußzeile statt absolut — dadurch hat die Kachel unten
   eine klare Abschlusskante statt eines schwebenden Symbols. */

.wpb-tile__arrow {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 16px;
	height: 16px;
	transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.wpb-tile__arrow svg {
	width: 100%;
	height: 100%;
}

.wpb-tile:hover .wpb-tile__arrow,
.wpb-tile:focus-visible .wpb-tile__arrow {
	transform: translateX(4px);
}

@media (prefers-reduced-motion: reduce) {
	.wpb-tile,
	.wpb-tile::before,
	.wpb-tile__icon,
	.wpb-tile__arrow,
	.wpb-tile__foot {
		transition: none;
	}
	.wpb-tile:hover,
	.wpb-tile:focus-visible {
		transform: none;
	}
	.wpb-tile:hover .wpb-tile__icon {
		transform: none;
	}
	.wpb-tile:hover .wpb-tile__arrow {
		transform: none;
	}
}

/* ──────────────────────────────────────────────
   Nichts freigeschaltet
   ────────────────────────────────────────────── */

.wpb-home__empty {
	max-width: 60ch;
	margin: 0 auto;
	padding: 52px 36px;
	text-align: center;
	background: var(--wpb-bg);
	border-radius: 18px;
	box-shadow:
		0 1px 2px rgba(0, 0, 0, 0.04),
		0 8px 28px rgba(0, 0, 0, 0.06);
}

.wpb-home__empty-title {
	margin: 0 0 8px;
	font-size: 16px;
	font-weight: 600;
}

.wpb-home__empty-text {
	margin: 0;
	font-size: 14px;
	line-height: 1.6;
	color: var(--wpb-muted);
}

.wpb-home__admin-hint {
	margin: 24px 0 0;
	padding-top: 18px;
	border-top: 1px solid var(--wpb-border-soft);
	font-size: 13px;
	line-height: 1.6;
	color: var(--wpb-muted);
	text-align: left;
}

.wpb-home__admin-hint a {
	color: var(--wpb-fg);
}

/* ──────────────────────────────────────────────
   Schmale Bildschirme
   ────────────────────────────────────────────── */

/* ──────────────────────────────────────────────
   Header
   ──────────────────────────────────────────────
   Auf der Startseite steht er innerhalb des Inhalts (deshalb ohne eigenen
   Hintergrund), auf Unterseiten als durchgehende Leiste über dem Theme.
   Die Variante unterscheidet .wpb-header--sub.
   ────────────────────────────────────────────── */

.wpb-header {
	background: var(--wpb-bg);
	border-bottom: 1px solid var(--wpb-border-soft);
	font-family: var(--wpb-font);
	color: var(--wpb-fg);
	box-sizing: border-box;
}

.wpb-header *,
.wpb-header *::before,
.wpb-header *::after {
	box-sizing: border-box;
}

/**
 * Die Leiste muss auf Startseite und Unterseiten EXAKT gleich hoch sein —
 * sonst springt der Inhalt beim Wechsel, und das fällt sofort auf.
 *
 * Maßgeblich sind die Werte der Startseite: oben bündig mit dem Seitenrand,
 * unten 20px Abstand zur Trennlinie. Die Unterseiten dürfen davon nur die
 * seitliche Begrenzung und den Hintergrund abweichen lassen, nicht die
 * senkrechten Maße.
 */
.wpb-header__inner {
	display: flex;
	flex-wrap: wrap;
	gap: 12px 20px;
	align-items: center;
	justify-content: space-between;
	max-width: 880px;
	margin: 0 auto;
	padding: 16px 20px;
	border-bottom: none;
}

/* Auf Unterseiten steht unter der Leiste direkt der Inhalt — dort
   braucht es einen Abstand. Auf der Startseite übernimmt das der
   getönte Bereich. */
.wpb-header--sub {
	margin-bottom: 28px;
}

.wpb-header__brand {
	display: flex;
	align-items: center;
	min-width: 0;
}

.wpb-header__home {
	display: flex;
	align-items: center;
	text-decoration: none;
	color: inherit;
	border-radius: 6px;
}

.wpb-header__home:hover {
	opacity: 0.75;
	color: inherit;
}

.wpb-header__home:focus-visible {
	outline: 2px solid var(--wpb-fg);
	outline-offset: 3px;
}

.wpb-header__title {
	font-size: 19px;
	font-weight: 600;
	letter-spacing: -0.01em;
	line-height: 1.2;
}

/* Höhe kommt als Inline-Style aus den Einstellungen, Breite ergibt sich. */
.wpb-header__logo {
	display: block;
	width: auto;
	max-width: 260px;
	object-fit: contain;
}

.wpb-header__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 14px;
	align-items: center;
	font-size: 13px;
}

.wpb-header__back {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 5px 12px;
	font-size: 13px;
	font-weight: 500;
	color: var(--wpb-fg);
	background: var(--wpb-border-soft);
	border-radius: 999px;
	text-decoration: none;
	white-space: nowrap;
	transition: background 0.15s ease;
}

.wpb-header__back:hover {
	background: var(--wpb-border);
	color: var(--wpb-fg);
}

.wpb-header__arrow {
	font-size: 14px;
	line-height: 1;
}

.wpb-header__email {
	color: var(--wpb-muted);
	word-break: break-all;
}

.wpb-header__logout {
	color: var(--wpb-fg);
	text-decoration: underline;
	text-underline-offset: 2px;
	white-space: nowrap;
}

.wpb-header__logout:hover {
	opacity: 0.7;
	color: var(--wpb-fg);
}

@media (prefers-reduced-motion: reduce) {
	.wpb-header__back {
		transition: none;
	}
}

/* ──────────────────────────────────────────────
   Hinweistext des Administrators
   ────────────────────────────────────────────── */

@media (max-width: 600px) {
	.wpb-page {
		padding: 0 14px 48px;
	}

	.wpb-home__lead {
		padding: 44px 4px 28px;
	}

	.wpb-home__headline {
		font-size: 29px;
	}

	.wpb-home__sub {
		font-size: 15px;
	}

	.wpb-header__inner {
		padding: 14px 16px;
	}

	.wpb-header--sub {
		margin-bottom: 22px;
	}

	.wpb-header__actions {
		width: 100%;
		justify-content: space-between;
	}

	.wpb-header__email {
		order: 3;
		width: 100%;
		font-size: 12px;
	}

	.wpb-home__panel {
		grid-template-columns: 1fr;
		gap: 16px;
	}

	.wpb-tile {
		padding: 24px 22px 20px;
		border-radius: 18px;
	}

	.wpb-tile__icon {
		width: 50px;
		height: 50px;
		font-size: 25px;
		border-radius: 14px;
	}

	.wpb-tile__initial {
		font-size: 21px;
	}

	.wpb-tile__title {
		font-size: 17px;
	}

	.wpb-tile__foot {
		margin-top: 14px;
		padding-top: 12px;
	}

	.wpb-home__empty {
		padding: 36px 24px;
	}
}
