/*
 * Native forms — front-end base styles.
 * [2026-10-22 · Claude · native-forms] Phase 1. Deliberately light: design
 * systems style the `.nad-form` wrapper and its elements, so this file only
 * owns what a design system does not — layout scaffolding, the honeypot, error
 * and status states. Everything is scoped under .ppd-form.
 */

/*
 * Layout grid. The form is a wrapping flex row so fields can sit side by side by
 * width (full / half / third / quarter), backed by a notional 12-column grid.
 * A field with no width class is full, so a form built before widths looks
 * exactly as it did (one field per row). Non-field children (captcha, status,
 * actions, consent) always span the full width. The `gap` replaces the old
 * per-field margin, so spacing stays even in both axes.
 */
.ppd-form__form {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: 1rem;
}
.ppd-form__form > * { flex: 0 0 100%; min-width: 0; }

.ppd-form__field {
	flex: 0 1 100%;
	min-width: 0;
}

/* Width modifiers. The subtractions account for the row gap so two halves (or
 * three thirds) fill the row exactly instead of wrapping. */
.ppd-form__field--w-full    { flex-basis: 100%; }
.ppd-form__field--w-half    { flex-basis: calc(50% - (1rem / 2)); }
.ppd-form__field--w-third   { flex-basis: calc((100% - 2rem) / 3); }
.ppd-form__field--w-quarter { flex-basis: calc((100% - 3rem) / 4); }

/* On a phone every field is full width, as Gravity Forms and JetFormBuilder both
 * collapse their grids. */
@media (max-width: 600px) {
	.ppd-form__field { flex-basis: 100% !important; }
}

.ppd-form__label {
	display: block;
	margin-bottom: .35rem;
	font-weight: 600;
}

.ppd-form__req { color: currentColor; }

.ppd-form .ppd-form__form input,
.ppd-form .ppd-form__form select,
.ppd-form .ppd-form__form textarea {
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
}

.ppd-form__field--consent .ppd-form__consent {
	display: flex;
	align-items: flex-start;
	gap: .5rem;
	font-weight: 400;
}
.ppd-form__field--consent input { width: auto; }

/* Honeypot: hidden belt-and-braces (the markup also hides it inline). */
.ppd-form input[name="ppd_hp_url"] { display: none !important; }

/* Errors. */
.ppd-form__error {
	margin: .3rem 0 0;
	font-size: .875em;
	color: #b3261e;
}
.ppd-form [aria-invalid="true"] {
	outline: 2px solid #b3261e;
	outline-offset: 1px;
}

/* Status + success.
 * [2026-11-11 · Claude · native-forms] The success confirmation REPLACES the
 * whole form, so it has to be legible on any section background by itself.
 * It used border + text in currentColor, which on a dark section inherited the
 * page's dark body colour and rendered dark-on-dark (invisible — seen live on a
 * dark CTA panel). It now carries an opaque success palette that reads on light
 * or dark backgrounds; a design system can still override .ppd-form__success to
 * match its own look. Same reasoning for the error status box. */
.ppd-form__status { margin: .5rem 0 0; }
.ppd-form__status.is-error {
	padding: .75rem 1rem;
	border: 1px solid #e0a3a3;
	border-radius: .5rem;
	background: #fdeceb;
	color: #8a1c13;
}
.ppd-form__status:empty { margin: 0; }

.ppd-form__success {
	padding: 1rem 1.25rem;
	border: 1px solid #a3cfbb;
	border-radius: .5rem;
	background: #e7f5ee;
	color: #0b3d2e;
}

.ppd-form__submit[aria-busy="true"] { opacity: .7; cursor: progress; }

.ppd-form__notice {
	padding: .5rem .75rem;
	border: 1px dashed currentColor;
	font-size: .9em;
	opacity: .8;
}

/* International phone (intl-tel-input): let the widget fill the field width so it
   lines up with the other controls. The library ships its own flag-dropdown CSS. */
.ppd-form__field--tel .iti { width: 100%; }

/* File upload: a small muted hint under the control. */
.ppd-form__filehint { display: block; margin-top: 4px; font-size: .85em; opacity: .75; }

/* Help text: a small muted hint shown under the label, above the control. */
.ppd-form__help { display: block; margin: 0 0 .35rem; font-size: .85em; opacity: .75; }
