/*
 * Wer zu uns passt – Styles.
 *
 * Aufbau aus dem Design-Handoff vom 29.09.2026 (fit-section.html), Maße
 * nach dem Design-System des Themes. Der Entwurf aus Claude Design setzte
 * eigene Größen (H2 64 px, 112/120 px Rand, große Karten) und war mit
 * 1425 px bei 1440 px Breite doppelt so hoch wie die Nachbar-Sections.
 * Wunsch Elias (29.09.2026): kleiner, Design-System einhalten, ruhigere
 * Animation. Deshalb:
 * - Rand, Innenbreite und Titel-Treppe wie alle Sections: Abstand
 *   `section`, `content-size`, H2 `title` 700, 32 px, Einleitung `lg`;
 * - Kicker nach der Label-Norm (sm, 600, Versalien, 0.06em – wie cta-card);
 * - Karten-Schrift nach der Kartenbreite, wie im Theme üblich: breite Karten
 *   (hier ~610 px) Titel lg / Text base wie die FAQ-Antworten darunter,
 *   Innenabstand wie die Problem-Karten; am Handy, wo die Karten schmal sind,
 *   Titel base / Text sm wie die Kundenstimmen. (Kundenstimmen-Schrift auch
 *   am Desktop war zu klein: 14 px in 610 px breiten Karten, 29.09.2026.);
 * - Hervorhebung im Titel accent, nicht kursiv (wie die dunkle Team-Section);
 * - Einblenden nur Kopf und die zwei Spalten, 12 px, ohne Unschärfe.
 *
 * Über 900 px Gegenüberstellung mit Mittelachse (Subgrid: Punkt n links und
 * rechts gleich hoch), darunter zwei gestapelte Karten.
 *
 * Weitere Abweichungen vom Handoff (Theme-Regeln): keine Hex-Fallbacks, kein
 * !important, keine Inline-Styles. Einblenden als Animation statt
 * Transition – in der Referenz überschrieb .is-in den Hover. Hover nur über
 * 900 px, darunter haben die Punkte keine eigene Kartenfläche.
 */

.ns-fit {
	--g: var(--wp--preset--color--primary);
	--a: var(--wp--preset--color--accent);
	--bg: var(--wp--preset--color--base-dark);
	--fg: var(--wp--preset--color--contrast-light);
	--mute: var(--wp--preset--color--neutral-light);
	--neg: var(--wp--preset--color--negative);
	--r: var(--wp--custom--radius--md);
	--achse: calc(2 * var(--wp--preset--spacing--lg)); /* Mittelspalte 64 px */
	--kreis: var(--wp--preset--spacing--xl); /* Nummernkreis und Icon 40 px */
	--ease: cubic-bezier(0.2, 0.7, 0.2, 1);
	position: relative;
	overflow: hidden;
	background: var(--bg);
	color: var(--fg);
	padding: var(--wp--preset--spacing--section) var(--wp--preset--spacing--gutter);
}

/* Deko-Schein oben mittig */
.ns-fit__glow {
	position: absolute;
	left: 50%;
	top: -200px;
	width: 760px;
	height: 400px;
	transform: translateX(-50%);
	border-radius: 50%;
	background: radial-gradient(closest-side, color-mix(in srgb, var(--g) 18%, transparent), transparent);
	pointer-events: none;
}

.ns-fit__inner {
	position: relative;
	max-width: var(--wp--style--global--content-size);
	margin-inline: auto;
}

/* Kopf: Kicker, H2, Einleitung – Titel-Treppe wie alle Sections */
.ns-fit__head {
	text-align: center;
	margin: 0 0 var(--wp--preset--spacing--section);
}

.ns-fit__kicker {
	font-size: var(--wp--preset--font-size--sm);
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.06em; /* Label-Norm (Review-2 M6) */
	color: var(--a);
	margin: 0 0 var(--wp--preset--spacing--sm);
}

.ns-fit__title {
	font-size: var(--wp--preset--font-size--title);
	font-weight: 700;
	line-height: var(--wp--custom--line-height--tight);
	letter-spacing: var(--wp--custom--letter-spacing--title);
	color: var(--fg);
	margin: 0 0 2rem; /* 32 px wie alle Sections (Review M9) */
}

.ns-fit__title em {
	font-style: normal;
	color: var(--a);
}

.ns-fit__lead {
	font-size: var(--wp--preset--font-size--lg);
	line-height: var(--wp--custom--line-height--snug);
	color: var(--mute);
	max-width: 64rem;
	margin: 0 auto;
	text-wrap: balance;
}

/* Desktop: Gegenüberstellung */
.ns-fit__grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr) var(--achse) minmax(0, 1fr);
	grid-template-rows: auto repeat(4, auto);
	row-gap: var(--wp--preset--spacing--sm);
}

/* Mittelachse über den vier Punkt-Zeilen, oben und unten ausgeblendet */
.ns-fit__grid::before {
	content: "";
	grid-column: 2;
	grid-row: 2 / 6;
	justify-self: center;
	width: 1px;
	background: linear-gradient(
		180deg,
		transparent,
		color-mix(in srgb, var(--fg) 18%, transparent) 15%,
		color-mix(in srgb, var(--fg) 18%, transparent) 85%,
		transparent
	);
}

.ns-fit__col {
	grid-row: 1 / 6;
	display: grid;
	grid-template-rows: subgrid;
}

.ns-fit__col--yes {
	grid-column: 1;
}

.ns-fit__col--no {
	grid-column: 3;
}

.ns-fit__list {
	display: contents;
	list-style: none;
	margin: 0;
	padding: 0;
}

.ns-fit__colhead {
	display: flex;
	align-items: center;
	gap: var(--wp--preset--spacing--sm);
}

.ns-fit__coltitle {
	font-size: var(--wp--preset--font-size--heading);
	font-weight: 600;
	line-height: var(--wp--custom--line-height--tight);
	color: var(--fg);
	margin: 0;
}

.ns-fit__colsub {
	font-size: var(--wp--preset--font-size--sm);
	line-height: var(--wp--custom--line-height--normal);
	color: var(--mute);
	margin: 0;
}

.ns-fit__icon {
	flex: none;
	width: var(--kreis);
	height: var(--kreis);
	border-radius: var(--wp--custom--radius--xs);
	display: flex;
	align-items: center;
	justify-content: center;
}

.ns-fit__icon svg {
	width: 45%;
	height: auto;
}

.ns-fit__icon--yes {
	background: var(--wp--preset--gradient--button);
	color: var(--wp--preset--color--contrast);
	box-shadow: 0 0 16px color-mix(in srgb, var(--g) 55%, transparent);
}

.ns-fit__icon--no {
	border: 1px solid color-mix(in srgb, var(--neg) 35%, transparent);
	background: color-mix(in srgb, var(--neg) 10%, transparent);
	color: var(--neg);
}

.ns-fit__icon--no svg {
	width: 40%;
}

/* Punkte: Innenabstand wie die Problem-Karten, Schrift wie die FAQ-Antworten */
.ns-fit__item {
	position: relative;
	display: flex;
	padding: 1rem 1.75rem; /* 16 × 28 px wie die Problem-Karten */
	border-radius: var(--r);
}

.ns-fit__item > div {
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--xxs);
}

.ns-fit__item strong {
	font-size: var(--wp--preset--font-size--lg);
	font-weight: 600;
	line-height: var(--wp--custom--line-height--snug);
	color: var(--fg);
}

.ns-fit__item span:not(.ns-fit__num) {
	font-size: var(--wp--preset--font-size--base);
	line-height: var(--wp--custom--line-height--normal);
	color: var(--mute);
	text-wrap: pretty;
}

.ns-fit__col--yes .ns-fit__item {
	border: 1px solid color-mix(in srgb, var(--g) 28%, transparent);
	background: linear-gradient(135deg, color-mix(in srgb, var(--g) 12%, transparent), color-mix(in srgb, var(--g) 2%, transparent));
}

.ns-fit__col--no .ns-fit__item {
	border: 1px solid color-mix(in srgb, var(--fg) 9%, transparent);
	background: color-mix(in srgb, var(--fg) 2.5%, transparent);
}

/* Nummern: am Desktop mittig auf der Achse (sitzen in der linken Karte,
   1 px = deren Rand), die der rechten Spalte sind ausgeblendet. */
.ns-fit__num {
	position: absolute;
	top: 50%;
	right: calc(var(--achse) / -2 - var(--kreis) / 2 - 1px);
	transform: translateY(-50%);
	box-sizing: border-box;
	width: var(--kreis);
	height: var(--kreis);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--bg);
	border: 1px solid color-mix(in srgb, var(--fg) 18%, transparent);
	font-size: var(--wp--preset--font-size--sm);
	font-weight: 600;
	color: var(--a);
	font-variant-numeric: tabular-nums;
}

.ns-fit__col--no .ns-fit__num {
	display: none;
}

.ns-fit__cta {
	display: flex;
	justify-content: center;
	margin-top: var(--wp--preset--spacing--xl); /* 40 px wie in der Ablauf-Section */
}

/* Hover nur am Desktop: ✓ rückt nach links, ✗ nach rechts. */
@media (hover: hover) and (min-width: 901px) {
	.ns-fit__col--yes .ns-fit__item:hover {
		border-color: color-mix(in srgb, var(--a) 60%, transparent);
		box-shadow:
			0 0 0 4px color-mix(in srgb, var(--g) 10%, transparent),
			0 20px 60px -20px color-mix(in srgb, var(--g) 50%, transparent);
		transform: translateX(-4px);
	}

	/* Die Nummer gleicht die Bewegung aus und bleibt auf der Achse. */
	.ns-fit__col--yes .ns-fit__item:hover .ns-fit__num {
		transform: translate(4px, -50%);
	}

	.ns-fit__col--no .ns-fit__item:hover {
		border-color: color-mix(in srgb, var(--neg) 40%, transparent);
		transform: translateX(4px);
	}
}

/* Handy und Tablet bis 900 px: zwei gestapelte Karten */
@media (max-width: 900px) {
	.ns-fit {
		--kreis: 2rem; /* Icons 32 px */
	}

	.ns-fit__grid {
		display: flex;
		flex-direction: column;
		gap: var(--wp--preset--spacing--md);
	}

	.ns-fit__grid::before {
		display: none;
	}

	.ns-fit__col {
		display: flex;
		flex-direction: column;
		gap: var(--wp--preset--spacing--sm);
		padding: var(--wp--preset--spacing--md) var(--wp--preset--spacing--gutter);
		border-radius: var(--r);
	}

	.ns-fit__col--yes {
		border: 1px solid color-mix(in srgb, var(--g) 32%, transparent);
		background: linear-gradient(160deg, color-mix(in srgb, var(--g) 13%, transparent), color-mix(in srgb, var(--g) 2%, transparent) 60%);
		box-shadow: 0 24px 60px -30px color-mix(in srgb, var(--g) 50%, transparent);
	}

	.ns-fit__col--no {
		border: 1px solid color-mix(in srgb, var(--fg) 10%, transparent);
		background: color-mix(in srgb, var(--fg) 2.5%, transparent);
	}

	.ns-fit__colhead {
		align-items: flex-start;
		padding-bottom: var(--wp--preset--spacing--sm);
		border-bottom: 1px solid color-mix(in srgb, var(--fg) 10%, transparent);
	}

	.ns-fit__list {
		display: flex;
		flex-direction: column;
		gap: var(--wp--preset--spacing--sm);
	}

	/* Punkte ohne eigene Box; die Nummer steht auf der Grundlinie des Titels */
	.ns-fit__col--yes .ns-fit__item,
	.ns-fit__col--no .ns-fit__item {
		align-items: baseline;
		gap: var(--wp--preset--spacing--xs);
		padding: 0;
		border: 0;
		background: none;
	}

	.ns-fit__num,
	.ns-fit__col--no .ns-fit__num {
		display: block;
		position: static;
		transform: none;
		flex: none;
		width: 1.5rem;
		height: auto;
		border: 0;
		border-radius: 0;
		background: none;
		font-size: var(--wp--preset--font-size--xs);
	}

	.ns-fit__col--no .ns-fit__num {
		color: var(--mute);
	}

	.ns-fit__cta .wp-element-button {
		width: 100%;
		justify-content: center;
		text-align: center;
	}
}

/* Handy (< 768 px): Karten so schmal wie die Kundenstimmen, also deren Schrift */
@media (max-width: 767px) {
	.ns-fit__item strong {
		font-size: var(--wp--preset--font-size--base);
	}

	.ns-fit__item span:not(.ns-fit__num) {
		font-size: var(--wp--preset--font-size--sm);
	}
}

/*
 * Bewegung: nur wer sie nicht abgeschaltet hat (prefers-reduced-motion).
 *
 * Einblenden greift NUR, wenn view.js die Klasse .ns-fit--anim setzt – ohne
 * JavaScript ist alles sichtbar. Dezent: nur Kopf und die zwei Spalten,
 * 12 px Weg, 0,6 s, die rechte Spalte einen Wimpernschlag später. Animiert
 * werden nur opacity und transform, nichts verschiebt das Layout.
 * fill-mode backwards: in der Wartezeit gilt der Startzustand, danach
 * greifen wieder die normalen Regeln (auch der Hover).
 */
@media (prefers-reduced-motion: no-preference) {
	.ns-fit__item,
	.ns-fit__num {
		transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
	}

	.ns-fit--anim [data-reveal] {
		opacity: 0;
	}

	.ns-fit--anim [data-reveal].is-in {
		opacity: 1;
		animation: ns-fit-in 0.6s var(--ease) var(--d, 0ms) backwards;
	}

	.ns-fit__col--yes {
		--d: 80ms;
	}

	.ns-fit__col--no {
		--d: 160ms;
	}
}

@keyframes ns-fit-in {
	from {
		opacity: 0;
		transform: translateY(12px);
	}
}
