/**
 * Wizard styles.
 *
 * Scoped under .wrbp so nothing leaks into the client's theme, and written with
 * no theme assumptions in the other direction either — this form has to survive
 * being dropped into a site built by someone else.
 *
 * The register is that of a financing document rather than a marketing page:
 * deep navy, quiet neutral surfaces, generous but not airy spacing, and the
 * client's orange kept back for the few marks that must catch the eye. Someone
 * is typing their social security number and their salary into this form; it has
 * to look like it belongs to a bank, not like a contact form.
 */

.wrbp {
	--wrbp-navy: #12324F;
	--wrbp-navy-deep: #0B2338;
	--wrbp-navy-soft: #E8EDF3;

	/* The client's orange, held back to the marks that must be found at a
	   glance: the current step, a required field, a validation focus. */
	--wrbp-accent: #E4670A;
	--wrbp-accent-ink: #A8480B;
	--wrbp-accent-soft: #FDF0E5;

	--wrbp-ink: #16202B;
	--wrbp-muted: #5A6675;
	--wrbp-line: #DCE3EA;
	--wrbp-line-strong: #C3CCD7;
	--wrbp-band: #EFF3F7;
	--wrbp-card: #FFFFFF;
	--wrbp-surface: #F6F8FA;
	--wrbp-danger: #B3261E;
	--wrbp-danger-soft: #FCEDEC;

	--wrbp-radius: 10px;
	--wrbp-shell: 1120px;

	color: var(--wrbp-ink);
	font-size: 16px;
	line-height: 1.55;
	box-sizing: border-box;

	/* The full-bleed band. `alignfull` on the element does the structural part in
	   a block theme; this doubled selector is the fallback for themes that do not
	   know the class. It outranks `.is-layout-constrained > :where(…)` (0,1,0),
	   which otherwise wins on source order and pins the form to the content
	   width — that is what squeezed 157 fields into one narrow column. */
	background: var(--wrbp-band);
	padding: clamp(20px, 4vw, 48px) 0 clamp(28px, 5vw, 64px);

	/* The page title is suppressed on this page (see Wizard::suppress_page_title),
	   which leaves the space the theme had reserved for it. Reclaim it, bounded
	   so a theme with unusual spacing cannot pull the form over its own header,
	   and inert on themes that do not define the variable. */
	margin-top: clamp(-72px, calc(-1 * var(--wp--preset--spacing--50, 0px)), 0px);
}

.wrbp.wrbp {
	max-width: none;
}

.wrbp *,
.wrbp *::before,
.wrbp *::after {
	box-sizing: inherit;
}

.wrbp-shell {
	max-width: var(--wrbp-shell);
	margin-inline: auto;
	padding-inline: clamp(16px, 4vw, 32px);
}

.wrbp-card {
	padding: clamp(20px, 3.5vw, 44px);
	border: 1px solid var(--wrbp-line);
	border-radius: var(--wrbp-radius);
	background: var(--wrbp-card);
	box-shadow: 0 1px 2px rgba(11, 35, 56, .04), 0 12px 32px -12px rgba(11, 35, 56, .10);
}

/* --- progress ---------------------------------------------------------- */

.wrbp-progress {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: 1fr;
	list-style: none;
	margin: 0 0 22px;
	padding: 0;
	font-size: 12.5px;
}

.wrbp-progress__item {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	padding-top: 26px;
	color: var(--wrbp-muted);
	text-align: center;
	line-height: 1.3;
}

/* The rail. Drawn per item so the first and last halves can be trimmed. */
.wrbp-progress__item::before {
	content: "";
	position: absolute;
	top: 10px;
	left: -50%;
	width: 100%;
	height: 2px;
	background: var(--wrbp-line-strong);
}

.wrbp-progress__item:first-child::before {
	display: none;
}

.wrbp-progress__item.is-done::before,
.wrbp-progress__item.is-current::before {
	background: var(--wrbp-navy);
}

.wrbp-progress__num {
	position: absolute;
	top: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: var(--wrbp-card);
	box-shadow: inset 0 0 0 2px var(--wrbp-line-strong);
	color: var(--wrbp-muted);
	font-size: 11.5px;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

.wrbp-progress__item.is-done .wrbp-progress__num {
	background: var(--wrbp-navy);
	box-shadow: inset 0 0 0 2px var(--wrbp-navy);
	color: #fff;
}

.wrbp-progress__item.is-current {
	color: var(--wrbp-ink);
	font-weight: 650;
}

.wrbp-progress__item.is-current .wrbp-progress__num {
	background: var(--wrbp-accent);
	box-shadow: inset 0 0 0 2px var(--wrbp-accent), 0 0 0 4px var(--wrbp-accent-soft);
	color: #fff;
}

/* The phone stand-in for the rail — eight labels never fit across a phone, and
   the attempt is what produced four wrapped lines of circles. */
.wrbp-progress__compact {
	display: none;
	margin: 0 0 18px;
}

.wrbp-progress__compact-text {
	display: block;
	margin-bottom: 7px;
	color: var(--wrbp-muted);
	font-size: 13px;
	font-weight: 600;
}

.wrbp-progress__track {
	display: block;
	height: 4px;
	border-radius: 4px;
	background: var(--wrbp-line-strong);
	overflow: hidden;
}

.wrbp-progress__bar {
	display: block;
	height: 100%;
	width: 0;
	border-radius: 4px;
	background: var(--wrbp-accent);
	transition: width .25s ease;
}

/* --- steps ------------------------------------------------------------- */

.wrbp-step__head {
	margin-bottom: 26px;
	padding-bottom: 18px;
	border-bottom: 2px solid var(--wrbp-navy);
}

.wrbp-step__title {
	margin: 0;
	font-size: clamp(20px, 2.4vw, 26px);
	line-height: 1.2;
	font-weight: 700;
	letter-spacing: -.015em;
	color: var(--wrbp-navy);
}

.wrbp-step__intro {
	margin: 7px 0 0;
	max-width: 62ch;
	color: var(--wrbp-muted);
	font-size: 14.5px;
}

/* --- groups ------------------------------------------------------------ */

.wrbp-group + .wrbp-group {
	margin-top: 34px;
}

.wrbp-group__title {
	margin: 0 0 14px;
	padding-bottom: 7px;
	border-bottom: 1px solid var(--wrbp-line);
	font-size: 12px;
	font-weight: 700;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var(--wrbp-navy);
}

/* --- the borrower table ------------------------------------------------ */

.wrbp-table {
	--wrbp-caption: minmax(180px, 1.05fr);
}

.wrbp-table__head,
.wrbp-row {
	display: grid;
	grid-template-columns: var(--wrbp-caption) 1fr 1fr;
	gap: 10px 20px;
	align-items: start;
}

.wrbp-table__head {
	position: sticky;
	top: 0;
	z-index: 1;
	margin-bottom: 6px;
	padding: 8px 0;
	background: var(--wrbp-card);
	border-bottom: 1px solid var(--wrbp-line);
	font-size: 11.5px;
	font-weight: 700;
	letter-spacing: .06em;
	text-transform: uppercase;
	color: var(--wrbp-muted);
}

.wrbp-row {
	padding: 7px 0;
}

.wrbp-row + .wrbp-row {
	border-top: 1px solid var(--wrbp-surface);
}

.wrbp-row__caption {
	margin: 0;
	padding-top: 9px;
	font-size: 14px;
	font-weight: 600;
	color: var(--wrbp-ink);
	hyphens: auto;
}

.wrbp-row__cell {
	min-width: 0;
}

/* Where a row exists for only one borrower, an empty column reads as something
   missing. A dash says it is meant to be empty. */
.wrbp-row__cell:empty::after {
	content: "—";
	display: block;
	padding-top: 10px;
	color: var(--wrbp-line-strong);
	font-size: 15px;
}

.wrbp-row__extra,
.wrbp-row--wide {
	grid-column: 1 / -1;
}

/* On a wide screen the caption column and the column headings say what each
   input is, so the per-input label is redundant *to the eye only*. It stays in
   the document, complete and associated, for assistive technology — and comes
   back into view on a phone, where the headings are gone. */
.wrbp-label--cell,
.wrbp-check--cell .wrbp-check__text {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

/* Named only where the column headings are not on screen. */
.wrbp-cell__who {
	display: none;
}

/* A tick box in a cell keeps only its box; the caption column says what it is. */
.wrbp-check--cell {
	min-height: 44px;
	padding: 0;
	align-items: center;
}

/* --- fields ------------------------------------------------------------ */

.wrbp-fields {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
	gap: 16px 22px;
}

.wrbp-field--textarea,
.wrbp-field--checkbox {
	grid-column: 1 / -1;
}

/* One row of a table — an existing credit and its seven columns. Set off so the
   entries do not run into one another, and denser than a free-standing grid. */
.wrbp-fields--entry {
	grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
	gap: 12px 16px;
	padding: 14px 16px;
	border: 1px solid var(--wrbp-line);
	border-radius: 8px;
	background: var(--wrbp-surface);
}

.wrbp-fields--entry + .wrbp-fields--entry {
	margin-top: 12px;
}

.wrbp-fields + .wrbp-fields--entry,
.wrbp-fields--entry + .wrbp-fields {
	margin-top: 16px;
}

.wrbp-fields--entry .wrbp-field--checkbox {
	grid-column: auto;
}

.wrbp-field + .wrbp-field {
	margin-top: 0;
}

.wrbp-row__cell .wrbp-field + .wrbp-field {
	margin-top: 10px;
}

.wrbp-label {
	display: block;
	margin-bottom: 5px;
	font-size: 13px;
	font-weight: 600;
	color: var(--wrbp-ink);
}

.wrbp-req {
	color: var(--wrbp-accent-ink);
	margin-left: 2px;
}

.wrbp input[type="text"],
.wrbp input[type="email"],
.wrbp input[type="tel"],
.wrbp textarea {
	width: 100%;
	min-height: 44px;
	padding: 10px 12px;
	border: 1px solid var(--wrbp-line-strong);
	border-radius: 7px;
	background: #fff;
	color: var(--wrbp-ink);
	font: inherit;
	/* 16px is the threshold below which iOS Safari zooms on focus, which then
	   strands the rest of the form off-screen. */
	font-size: 16px;
	transition: border-color .12s ease, box-shadow .12s ease;
}

.wrbp textarea {
	min-height: 88px;
	resize: vertical;
}

.wrbp input:hover:not([readonly]),
.wrbp textarea:hover {
	border-color: var(--wrbp-navy);
}

.wrbp input:focus,
.wrbp textarea:focus {
	outline: none;
	border-color: var(--wrbp-navy);
	box-shadow: 0 0 0 3px rgba(18, 50, 79, .16);
}

/* A required field is marked on the control itself, so the mark survives the
   wide layout where the label is not on screen. Tick boxes are excluded: the
   bar lands inside the box and reads as a half-filled state, and every consent
   is a required tick box. */
.wrbp input[data-required]:not([type="checkbox"]),
.wrbp textarea[data-required] {
	box-shadow: inset 3px 0 0 var(--wrbp-accent);
}

.wrbp input[data-required]:not([type="checkbox"]):focus,
.wrbp textarea[data-required]:focus {
	box-shadow: inset 3px 0 0 var(--wrbp-accent), 0 0 0 3px rgba(18, 50, 79, .16);
}

/* Scoped through `.wrbp` on purpose: the base rule above is
   `.wrbp input[type="text"]`, and an attribute selector weighs the same as a
   class, so a bare `.wrbp-field--computed input` would lose the tie. */
.wrbp .wrbp-field--computed input {
	background: var(--wrbp-surface);
	border-color: var(--wrbp-line);
	border-style: dashed;
	color: var(--wrbp-navy);
	font-weight: 700;
}

.wrbp-field--currency input,
.wrbp-field--percent input,
.wrbp-field--number input,
.wrbp-field--date-text input {
	text-align: right;
	font-variant-numeric: tabular-nums;
	letter-spacing: .01em;
}

.wrbp-check {
	display: flex;
	align-items: flex-start;
	gap: 11px;
	min-height: 44px;
	padding: 9px 0;
	cursor: pointer;
	font-size: 15px;
}

.wrbp-check input {
	width: 20px;
	height: 20px;
	margin: 2px 0 0;
	accent-color: var(--wrbp-navy);
	flex: none;
}

.wrbp-error {
	margin: 5px 0 0;
	color: var(--wrbp-danger);
	font-size: 12.5px;
	font-weight: 600;
}

.wrbp .has-error input,
.wrbp .has-error textarea {
	border-color: var(--wrbp-danger);
	background: var(--wrbp-danger-soft);
}

.wrbp .has-error input:focus,
.wrbp .has-error textarea:focus {
	box-shadow: 0 0 0 3px rgba(179, 38, 30, .18);
}

/* --- consents ---------------------------------------------------------- */

.wrbp-consents {
	display: grid;
	gap: 12px;
	margin-bottom: 8px;
}

.wrbp-consent {
	padding: 15px 17px;
	border: 1px solid var(--wrbp-line);
	border-left: 3px solid var(--wrbp-navy);
	border-radius: 8px;
	background: #fff;
}

.wrbp-consent--optional {
	border-left-color: var(--wrbp-line-strong);
	background: var(--wrbp-surface);
}

.wrbp-consent .wrbp-check {
	min-height: 0;
	padding: 0;
}

.wrbp-optional {
	display: inline-block;
	margin-left: 8px;
	padding: 1px 8px;
	border-radius: 20px;
	background: var(--wrbp-navy-soft);
	color: var(--wrbp-navy);
	font-size: 11px;
	font-style: normal;
	font-weight: 700;
	letter-spacing: .04em;
	text-transform: uppercase;
	vertical-align: 1px;
}

.wrbp-consent__text {
	margin-top: 9px;
	font-size: 13.5px;
	color: var(--wrbp-muted);
}

.wrbp-consent__text summary {
	cursor: pointer;
	color: var(--wrbp-navy);
	font-size: 12.5px;
	font-weight: 600;
}

.wrbp-consent__text p {
	margin: 9px 0 0;
	padding-left: 12px;
	border-left: 2px solid var(--wrbp-line);
}

/* --- signature --------------------------------------------------------- */

.wrbp-subhead {
	margin: 34px 0 5px;
	font-size: 16px;
	font-weight: 700;
	color: var(--wrbp-navy);
}

.wrbp-hint {
	margin: 0 0 18px;
	max-width: 62ch;
	color: var(--wrbp-muted);
	font-size: 13.5px;
}

.wrbp-signature {
	margin-bottom: 18px;
	padding: 14px 16px 16px;
	border: 1px solid var(--wrbp-line);
	border-radius: 8px;
	background: var(--wrbp-surface);
}

.wrbp-signature__head {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 12px;
	margin-bottom: 8px;
	font-size: 13.5px;
	font-weight: 600;
}

.wrbp-signature__pad {
	display: block;
	width: 100%;
	height: 180px;
	border: 1px solid var(--wrbp-line-strong);
	border-radius: 7px;
	background:
		linear-gradient(#fff, #fff) padding-box,
		repeating-linear-gradient(0deg, transparent 0 148px, var(--wrbp-line-strong) 148px 149px) padding-box;
	cursor: crosshair;
	/* Without this the browser claims the gesture and scrolls the page instead
	   of drawing — the pad is unusable on a touch screen. */
	touch-action: none;
}

.wrbp-link {
	border: 0;
	background: none;
	padding: 4px 0;
	color: var(--wrbp-navy);
	font: inherit;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	text-decoration: underline;
}

.wrbp-link:hover {
	color: var(--wrbp-accent-ink);
}

/* --- navigation -------------------------------------------------------- */

.wrbp-nav {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-top: 34px;
	padding-top: 20px;
	border-top: 1px solid var(--wrbp-line);
}

.wrbp-status {
	flex: 1;
	font-size: 13px;
	color: var(--wrbp-muted);
}

.wrbp-status.is-error {
	color: var(--wrbp-danger);
	font-weight: 600;
}

.wrbp-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 46px;
	padding: 11px 24px;
	border: 1px solid transparent;
	border-radius: 7px;
	background: var(--wrbp-navy);
	color: #fff;
	font: inherit;
	font-size: 15px;
	font-weight: 650;
	text-decoration: none;
	cursor: pointer;
	transition: background .12s ease, border-color .12s ease;
}

.wrbp-btn:hover,
.wrbp-btn:focus {
	background: var(--wrbp-navy-deep);
	color: #fff;
}

.wrbp-btn:focus-visible {
	outline: 3px solid var(--wrbp-accent);
	outline-offset: 2px;
}

.wrbp-btn[disabled] {
	opacity: .55;
	cursor: progress;
}

.wrbp-btn--submit {
	background: var(--wrbp-accent);
}

.wrbp-btn--submit:hover,
.wrbp-btn--submit:focus {
	background: var(--wrbp-accent-ink);
}

.wrbp-btn--ghost {
	background: transparent;
	color: var(--wrbp-navy);
	border-color: var(--wrbp-line-strong);
}

.wrbp-btn--ghost:hover,
.wrbp-btn--ghost:focus {
	background: var(--wrbp-surface);
	color: var(--wrbp-navy);
	border-color: var(--wrbp-navy);
}

/* --- terminal states --------------------------------------------------- */

.wrbp-done,
.wrbp-notice {
	padding: clamp(28px, 5vw, 52px);
	border: 1px solid var(--wrbp-line);
	border-top: 3px solid var(--wrbp-navy);
	border-radius: var(--wrbp-radius);
	background: var(--wrbp-card);
	text-align: center;
	box-shadow: 0 1px 2px rgba(11, 35, 56, .04), 0 12px 32px -12px rgba(11, 35, 56, .10);
}

.wrbp-done {
	border: 0;
	box-shadow: none;
	padding: clamp(12px, 3vw, 28px) 0;
}

.wrbp-done h2,
.wrbp-notice h2 {
	margin: 0 0 10px;
	font-size: 22px;
	color: var(--wrbp-navy);
}

.wrbp-done p,
.wrbp-notice p {
	margin: 0 0 12px;
	color: var(--wrbp-muted);
}

/* --- narrow screens ---------------------------------------------------- */

/* The form is filled in on a phone more often than not. Below this width the
   borrower table stops being a table: each field stands on its own and gets its
   own label back, because "Straße, Hausnummer" twice in a row with nothing to
   tell the two apart is worse than the suffix ever was. */
@media (max-width: 860px) {
	.wrbp-progress {
		display: none;
	}

	.wrbp-progress__compact {
		display: block;
	}

	.wrbp-table__head {
		display: none;
	}

	.wrbp-row {
		display: block;
		padding: 0;
	}

	.wrbp-row + .wrbp-row {
		margin-top: 16px;
		padding-top: 16px;
		border-top: 1px solid var(--wrbp-line);
	}

	.wrbp-row__caption {
		display: none;
	}

	.wrbp-row__cell + .wrbp-row__cell {
		margin-top: 12px;
	}

	/* Stacked, an absent column is simply absent — no placeholder needed. */
	.wrbp-row__cell:empty {
		display: none;
	}

	.wrbp-label--cell,
	.wrbp-check--cell .wrbp-check__text {
		position: static;
		width: auto;
		height: auto;
		margin: 0 0 5px;
		overflow: visible;
		clip: auto;
		clip-path: none;
		white-space: normal;
	}

	.wrbp-check--cell .wrbp-check__text {
		margin: 0;
	}

	.wrbp-cell__who {
		display: block;
		margin: 0 0 8px;
		font-size: 11.5px;
		font-weight: 700;
		letter-spacing: .06em;
		text-transform: uppercase;
		color: var(--wrbp-navy);
	}

	.wrbp-nav {
		flex-wrap: wrap;
	}

	.wrbp-status {
		order: 3;
		flex-basis: 100%;
	}

	.wrbp-btn {
		flex: 1 1 auto;
	}
}

@media (max-width: 480px) {
	.wrbp-card {
		border-radius: 8px;
	}

	.wrbp-signature__pad {
		height: 160px;
	}
}

/* --- dark ------------------------------------------------------------- */

/**
 * Deliberately opt-in, not automatic.
 *
 * The form now paints a full-width band, and the theme around it does not
 * follow the system preference — twentytwentyfive stays white either way. Left
 * on `prefers-color-scheme`, a visitor whose phone is in dark mode got a black
 * band sitting inside a white page, which reads as a broken embed rather than
 * as a courtesy. Whether the surrounding site is dark is a fact about the
 * site, and CSS cannot ask.
 *
 * So: everything below applies only when the site says so, by putting
 * `wrbp-dark` on the form's container (or any ancestor). Re-enabling the
 * automatic behaviour is one line — change the selector to
 * `@media (prefers-color-scheme: dark)` — and worth doing the day the client's
 * own site has a dark mode.
 */
.wrbp-dark .wrbp,
.wrbp.wrbp-dark {
	color-scheme: dark;
}

.wrbp-dark .wrbp,
.wrbp.wrbp-dark {
	--wrbp-navy: #7FA9CE;
	--wrbp-navy-deep: #A6C4DF;
	--wrbp-navy-soft: #1E2B38;
	--wrbp-accent: #F0812E;
	--wrbp-accent-ink: #F5A45F;
	--wrbp-accent-soft: #2C1F14;
	--wrbp-ink: #E8EDF2;
	--wrbp-muted: #9AA6B4;
	--wrbp-line: #2B3644;
	--wrbp-line-strong: #3C4A5B;
	--wrbp-band: #0D141C;
	--wrbp-card: #141C26;
	--wrbp-surface: #1A232E;
	--wrbp-danger: #F0857D;
	--wrbp-danger-soft: #2A1715;
}

.wrbp-dark .wrbp input[type="text"],
.wrbp-dark .wrbp input[type="email"],
.wrbp-dark .wrbp input[type="tel"],
.wrbp-dark .wrbp textarea,
.wrbp-dark .wrbp-consent,
.wrbp.wrbp-dark input[type="text"],
.wrbp.wrbp-dark input[type="email"],
.wrbp.wrbp-dark input[type="tel"],
.wrbp.wrbp-dark textarea,
.wrbp.wrbp-dark .wrbp-consent {
	background: #0F1720;
	color: var(--wrbp-ink);
}

.wrbp-dark .wrbp-btn,
.wrbp.wrbp-dark .wrbp-btn,
.wrbp-dark .wrbp-btn:hover,
.wrbp.wrbp-dark .wrbp-btn:hover,
.wrbp-dark .wrbp-btn:focus,
.wrbp.wrbp-dark .wrbp-btn:focus {
	color: #0B1219;
}

.wrbp-dark .wrbp-btn--ghost,
.wrbp.wrbp-dark .wrbp-btn--ghost {
	color: var(--wrbp-navy);
}

/* The signature is written in ink on paper whatever the theme — it is exported
   as an image and stamped into a white PDF. */
.wrbp-dark .wrbp-signature__pad,
.wrbp.wrbp-dark .wrbp-signature__pad {
	background:
		linear-gradient(#fff, #fff) padding-box,
		repeating-linear-gradient(0deg, transparent 0 148px, #C3CCD7 148px 149px) padding-box;
}

@media (prefers-reduced-motion: reduce) {
	.wrbp * {
		transition: none !important;
	}
}
