/*
 * Design: iOS-Schalter — clean iOS system look: white surface, rounded inputs,
 * a segmented control for radios and a green toggle for checkbox/consent.
 * Background not overridable (the light system surface is the identity).
 */
.mf-design--ios-schalter {
	--mf-accent: #0068ec;
	--mf-bg: #ffffff;
	--mf-ink: #1c1c1e;
	--mf-line: #d1d1d6;
	/* Field outline: 3.5:1 against the ground (WCAG 1.4.11, tom.wiesseckel/divb-hq#206). */
	--mf-field-line: #89888d;
	--mf-track: #e9e9eb;
	--mf-on: #34c759;

	padding: 22px;
	background: var( --mf-bg );
	color: var( --mf-ink );
	font-family: -apple-system, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
}

.mf-design--ios-schalter .mf-form__label {
	font-size: 12px;
	color: #6b6b70;
}

.mf-design--ios-schalter .mf-form__input,
.mf-design--ios-schalter select.mf-form__input,
.mf-design--ios-schalter textarea.mf-form__input {
	border: 1px solid var( --mf-field-line );
	border-radius: 10px;
	padding: 9px 12px;
	background: #fff;
	color: var( --mf-ink );
}

.mf-design--ios-schalter .mf-form__input:focus {
	outline: none;
	border-color: var( --mf-accent );
	box-shadow: 0 0 0 3px color-mix( in srgb, var( --mf-accent ) 20%, transparent );
	/* Kept on focus: host themes recolour a focused field (divb-hq#336). */
	color: var( --mf-ink );
}

/* Segmented control: a grey track with a white pill that slides to the choice. */
.mf-design--ios-schalter .mf-form__group {
	padding: 0;
	border: none;
}

.mf-design--ios-schalter .mf-form__group > legend {
	margin-bottom: 6px;
	font-size: 12px;
	color: #6b6b70;
}

.mf-design--ios-schalter .mf-form__options {
	position: relative;
	flex-direction: row;
	gap: 0;
	padding: 2px;
	border-radius: 9px;
	background: var( --mf-track );
}

/* The sliding white pill. Its width matches one segment (per option count); it
 * translates by whole segment-widths to the selected option. */
.mf-design--ios-schalter .mf-form__options::before {
	content: "";
	position: absolute;
	top: 2px;
	bottom: 2px;
	left: 2px;
	z-index: 0;
	width: calc( 50% - 2px );
	border-radius: 7px;
	background: #fff;
	box-shadow: 0 1px 3px rgba( 0, 0, 0, 0.2 );
	transition: transform 0.25s cubic-bezier( 0.4, 0, 0.2, 1 );
}

.mf-design--ios-schalter .mf-form__options:has( .mf-form__radio:nth-of-type(3):last-of-type )::before {
	width: calc( 33.333% - 1.34px );
}

.mf-design--ios-schalter .mf-form__options:has( .mf-form__radio:nth-of-type(4):last-of-type )::before {
	width: calc( 25% - 1px );
}

.mf-design--ios-schalter .mf-form__options:has( .mf-form__radio:nth-of-type(2) input:checked )::before {
	transform: translateX( 100% );
}

.mf-design--ios-schalter .mf-form__options:has( .mf-form__radio:nth-of-type(3) input:checked )::before {
	transform: translateX( 200% );
}

.mf-design--ios-schalter .mf-form__options:has( .mf-form__radio:nth-of-type(4) input:checked )::before {
	transform: translateX( 300% );
}

.mf-design--ios-schalter .mf-form__radio {
	flex: 1 1 0;
	position: relative;
	z-index: 1;
	padding: 7px 12px;
	text-align: center;
	font-size: 12px;
	font-weight: 600;
	color: #6b6b70;
	cursor: pointer;
	transition: color 0.2s ease;
}

.mf-design--ios-schalter .mf-form__radio input {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
}

.mf-design--ios-schalter .mf-form__radio:has( input:checked ) {
	color: var( --mf-ink );
}

/* Toggle (checkbox + consent) — green iOS switch with a sliding thumb. */
.mf-design--ios-schalter .mf-form__checkbox,
.mf-design--ios-schalter .mf-form__consent {
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 13px;
}

.mf-design--ios-schalter .mf-form__checkbox input,
.mf-design--ios-schalter .mf-form__consent input {
	appearance: none;
	flex: 0 0 auto;
	width: 47px;
	height: 27px;
	margin: 0;
	border-radius: 999px;
	background-color: var( --mf-track );
	background-image: radial-gradient( circle, #fff 0 46%, transparent 48% );
	background-repeat: no-repeat;
	background-size: 23px 23px;
	background-position: 2px center;
	cursor: pointer;
	transition: background-color 0.2s ease, background-position 0.2s ease;
	filter: drop-shadow( 0 1px 2px rgba( 0, 0, 0, 0.2 ) );
}

.mf-design--ios-schalter .mf-form__checkbox input:checked,
.mf-design--ios-schalter .mf-form__consent input:checked {
	background-color: var( --mf-on );
	background-position: calc( 100% - 2px ) center;
}

.mf-design--ios-schalter .mf-form__submit {
	margin-top: 1rem;
	padding: 11px 20px;
	border: none;
	border-radius: 10px;
	--mf-btn-fill: var( --mf-accent );
	--mf-btn-ink: #fff;
	font-weight: 600;
	cursor: pointer;
}

/*
 * Chosen background (tom.wiesseckel/divb-hq#199): text follows the ink the
 * editor resolved for it. Scoped to .mf-form--bg, which the renderer sets
 * only when the embed picks a background.
 */
.mf-design--ios-schalter.mf-form--bg .mf-form__label,
.mf-design--ios-schalter.mf-form--bg .mf-form__consent,
.mf-design--ios-schalter.mf-form--bg .mf-form__help {
	color: color-mix( in srgb, var( --mf-ink ) 80%, transparent );
}

.mf-design--ios-schalter.mf-form--bg .mf-form__fineprint {
	color: var( --mf-ink );
}

/*
 * Chosen accent (tom.wiesseckel/divb-hq#206): the button text must read on
 * whatever accent the embed picks. Scoped to .mf-form--accent, so the default
 * look above stays exactly as designed.
 */
.mf-design--ios-schalter.mf-form--accent .mf-form__submit {
	/* Black or white, whichever reads on the accent fill. */
	--mf-btn-ink: oklch( from var( --mf-accent ) clamp( 0, ( 0.62 - l ) * 1000, 1 ) 0 0 );
}

/*
 * Fields with their own fill keep the design's ink inside them: a chosen
 * background changes the ink for the form ground, not for a white (or dark)
 * input box (tom.wiesseckel/divb-hq#206).
 */
.mf-design--ios-schalter.mf-form--bg .mf-form__input {
	--mf-ink: #1c1c1e;
}
