/* Fluent Forms — themed once, for every form on every site (Design §5).
 *
 * A form dropped onto any page, by the Contact block or a shortcode or a
 * pattern, arrives on brand with nothing to configure. This used to live in the
 * Contact block's stylesheet scoped to .zerodigital-contact__form, which made
 * the contact form the only styled form on a site, and anything else needed a
 * copy pasted into Fluent Forms' per-form Custom CSS box — two sources for one
 * set of rules, and every new form starting off-brand until somebody remembered.
 *
 * LOADED CONDITIONALLY, which is why this is its own file rather than a section
 * of style.css. Block stylesheets are enqueued only on pages that render the
 * block — measured: the home page loads hero-home, services-grid and
 * footer-columns, and not contact/style.css — so folding these rules into the
 * always-loaded style.css would have put 13KB of render-blocking CSS onto every
 * page WITHOUT a form in order to fix the ones with. zerodigital_page_has_
 * fluent_form() in functions.php decides, and this is enqueued between the
 * parent stylesheet and the child's, so a child rule at matching specificity
 * still wins.
 *
 * Real Fluent Forms DOM, read off a live form rather than assumed:
 *   div.fluentform.ff-default.fluentform_wrapper_<id>      wrapper
 *     form.frm-fluent-form.fluent_form_<id>                the form
 *       .ff-el-group                                       one field
 *         .ff-el-input--label > label
 *         .ff-el-input--content > input | textarea | select
 *       .ff-t-container > .ff-t-cell                       multi-column row
 *       .ff-step-container .ff-el-progress                 paged forms
 *       .step-nav > .ff-btn-prev, .ff-btn-next
 *       .ff-btn-submit
 *
 * SPECIFICITY IS THE WHOLE GAME HERE, so the numbers are stated rather than
 * felt. Fluent Forms prints an inline <style> per form carrying rules like
 *     form.fluent_form_1 .wpf_has_custom_css.ff-btn-submit      0,3,1
 * and its default sheet styles step buttons with
 *     .ff-default .ff-btn-secondary:not(.ff_btn_no_style)       0,3,0
 * A three-class rule therefore loses in place, silently, and only on forms
 * whose button was styled in the builder — the worst kind of failure to spot.
 * Every rule below is scoped `.fluentform .frm-fluent-form` and lands at 0,4,0
 * or better, so it wins on specificity rather than load order and needs no
 * !important. Keep it that way when editing.
 *
 * The plugin's own opt-out is honoured throughout: a button carrying
 * `ff_btn_no_style` is left entirely alone, which is the escape hatch for a
 * form that genuinely wants the builder's colours instead of the site's.
 *
 * BUTTONS DO NOT INHERIT font-family. Inputs do, via `font: inherit` below.
 * That asymmetry is why a form could look almost right — every field in the
 * site typeface, every button in the browser's default Arial — and it is worth
 * knowing because nothing about the rendering suggests a missing declaration.
 * ------------------------------------------------------------------------ */

/* 1. Retoken Fluent Forms' own design variables. This is the cleanest lever
 * available: everything the plugin drives from them recolours in one place.
 * Danger stays red — an error should not wear the brand accent, which in most
 * style variations is not red. */
.fluentform .frm-fluent-form {
	--fluentform-primary: var(--wp--preset--color--primary, #0e4b52);
	--fluentform-secondary: var(--wp--preset--color--muted, #565b62);
	--fluentform-border-color: var(--wp--preset--color--border, #e4e6e9);
	--fluentform-border-radius: var(--wp--custom--radius--sm, 0.375rem);
}

/* 2. Vertical rhythm between fields, and an even gutter on multi-column rows
 * (First / Last name and the like). */
.fluentform .frm-fluent-form .ff-el-group {
	margin-bottom: var(--wp--preset--spacing--md, 1.5rem);
}

.fluentform .frm-fluent-form .ff-t-container {
	gap: var(--wp--preset--spacing--sm, 1rem);
}

.fluentform .frm-fluent-form .ff-t-cell {
	padding-right: 0;
	padding-left: 0;
}

/* 3. Labels, and the required asterisk as a cue in the accent rather than an
 * error in red. */
.fluentform .frm-fluent-form .ff-el-input--label label {
	display: inline-block;
	margin-bottom: var(--wp--preset--spacing--2-xs, 0.5rem);
	font-weight: 600;
	font-size: 0.9rem;
	color: var(--wp--preset--color--foreground, #16181b);
}

.fluentform .frm-fluent-form .ff-el-input--label.asterisk-right label::after,
.fluentform .frm-fluent-form .ff-el-is-required .ff-el-input--label label::after {
	color: var(--zd-accent, var(--wp--preset--color--accent, #c4263c));
}

/* 4. Text inputs, textareas, selects. `font: inherit` is what puts fields in
 * the site typeface — and is exactly what buttons cannot do. */
.fluentform .frm-fluent-form input:not([type="submit"]):not([type="checkbox"]):not([type="radio"]),
.fluentform .frm-fluent-form textarea,
.fluentform .frm-fluent-form select,
.fluentform .frm-fluent-form .ff-el-form-control {
	width: 100%;
	padding: 0.7rem 0.85rem;
	font: inherit;
	line-height: 1.5;
	color: var(--wp--preset--color--foreground, #16181b);
	background: var(--wp--preset--color--background, #fff);
	border: 1px solid var(--wp--preset--color--border, #e4e6e9);
	border-radius: var(--zd-input-radius, var(--wp--custom--radius--md, 0.5rem));
	box-shadow: none;
	transition: border-color var(--zd-ease, 180ms ease), box-shadow var(--zd-ease, 180ms ease);
}

.fluentform .frm-fluent-form ::placeholder {
	color: var(--wp--preset--color--muted, #565b62);
	opacity: 0.7;
}

.fluentform .frm-fluent-form input:not([type="submit"]):focus,
.fluentform .frm-fluent-form textarea:focus,
.fluentform .frm-fluent-form select:focus,
.fluentform .frm-fluent-form .ff-el-form-control:focus {
	outline: none;
	border-color: var(--wp--preset--color--primary, #0e4b52);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--wp--preset--color--primary, #0e4b52) 18%, transparent);
}

/* A pill input is right on a single-line field and wrong on a textarea, where
 * 999px resolves to half the box height and turns the message box into a
 * stadium. min() caps it: sharp skins pass their own value straight through,
 * the pill skin lands on a generous-but-sane 1rem. */
.fluentform .frm-fluent-form textarea,
.fluentform .frm-fluent-form textarea.ff-el-form-control {
	border-radius: min(var(--zd-input-radius, 0.5rem), 1rem);
}

/* The focus rule above drops the outline for the "active field" look, which is
 * fine for a pointer but leaves a keyboard user with a border-colour change and
 * an 18% halo — thin against WCAG 1.4.11's 3:1. Keyboard focus gets the same
 * accent ring as every other control on the site; pointer focus keeps the
 * quieter treatment. */
.fluentform .frm-fluent-form input:not([type="submit"]):focus-visible,
.fluentform .frm-fluent-form textarea:focus-visible,
.fluentform .frm-fluent-form select:focus-visible,
.fluentform .frm-fluent-form .ff-el-form-control:focus-visible {
	outline: 2px solid var(--zd-accent, var(--wp--preset--color--accent, #c4263c));
	outline-offset: 2px;
}

.fluentform .frm-fluent-form input[type="checkbox"],
.fluentform .frm-fluent-form input[type="radio"] {
	accent-color: var(--zd-accent, var(--wp--preset--color--accent, #c4263c));
}

/* 5. Every button, including the upload control — which is a <span>, hence the
 * cursor. `font-family: inherit` is the declaration this whole section exists
 * for; without it a button is Arial on a Montserrat page. */
.fluentform .frm-fluent-form .ff-btn,
.fluentform .frm-fluent-form .ff_upload_btn {
	font-family: inherit;
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
	transition: background-color var(--zd-ease, 180ms ease), border-color var(--zd-ease, 180ms ease), color var(--zd-ease, 180ms ease), transform var(--zd-ease, 180ms ease), box-shadow var(--zd-ease, 180ms ease);
}

/* Focus ring. These buttons sit outside the theme's own control selectors, and
 * a long paged form is one a keyboard user will tab all the way down. */
.fluentform .frm-fluent-form .ff-btn:focus-visible,
.fluentform .frm-fluent-form .ff_upload_btn:focus-visible {
	outline: 2px solid var(--zd-accent, var(--wp--preset--color--accent, #c4263c));
	outline-offset: 2px;
}

/* 6. Submit — the site's primary button. This deliberately overrides the
 * colour set on the button in the form builder, whose default is Fluent Forms
 * blue and therefore off-brand on every site we build. A form that wants the
 * builder's colours back sets `ff_btn_no_style` on the button. */
.fluentform .frm-fluent-form .ff-btn-submit:not(.ff_btn_no_style) {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: var(--zd-btn-min-h, 2.875rem);
	padding: 0.85rem 1.9rem;
	font-size: 1rem;
	color: var(--wp--preset--color--background, #fff);
	background: var(--wp--preset--color--primary, #0e4b52);
	border: 0;
	border-radius: var(--zd-btn-radius, var(--wp--custom--radius--md, 0.5rem));
	box-shadow: var(--zd-shadow-sm, 0 1px 3px rgba(16, 24, 40, 0.1));
}

.fluentform .frm-fluent-form .ff-btn-submit:not(.ff_btn_no_style):hover {
	background: var(--wp--preset--color--secondary, #0a3339);
	color: var(--wp--preset--color--background, #fff);
	transform: translateY(-1px);
	box-shadow: var(--zd-shadow-md, 0 4px 8px -2px rgba(16, 24, 40, 0.1));
}

/* 7. Step navigation on a paged form. Fluent Forms' one rule for these sets
 * background-color, border-color and color and nothing else, so the browser's
 * own button defaults show through as a 2px outset border and 1px 6px of
 * padding. Geometry first, then the two roles. */
.fluentform .frm-fluent-form .ff-btn-next:not(.ff_btn_no_style),
.fluentform .frm-fluent-form .ff-btn-prev:not(.ff_btn_no_style) {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: var(--zd-btn-min-h, 2.875rem);
	padding: 0.75rem 1.75rem;
	font-size: 1rem;
	border: 1px solid transparent;
	border-radius: var(--zd-btn-radius, var(--wp--custom--radius--md, 0.5rem));
}

/* Next is the primary action. */
.fluentform .frm-fluent-form .ff-btn-next:not(.ff_btn_no_style) {
	background-color: var(--wp--preset--color--primary, #0e4b52);
	border-color: var(--wp--preset--color--primary, #0e4b52);
	color: var(--wp--preset--color--background, #fff);
}

.fluentform .frm-fluent-form .ff-btn-next:not(.ff_btn_no_style):hover {
	background-color: var(--wp--preset--color--secondary, #0a3339);
	border-color: var(--wp--preset--color--secondary, #0a3339);
	color: var(--wp--preset--color--background, #fff);
}

/* Back is secondary, so it does not compete with Next for the same glance. */
.fluentform .frm-fluent-form .ff-btn-prev:not(.ff_btn_no_style) {
	background-color: transparent;
	border-color: var(--wp--preset--color--border, #e4e6e9);
	color: var(--wp--preset--color--foreground, #16181b);
}

.fluentform .frm-fluent-form .ff-btn-prev:not(.ff_btn_no_style):hover {
	background-color: transparent;
	border-color: var(--wp--preset--color--foreground, #16181b);
	color: var(--wp--preset--color--foreground, #16181b);
}

/* The nav row. The plugin floats Next right, which leaves the row with no
 * height of its own and lands it tight against the last field. Flex gives it a
 * real box, keeps Back and Next on one line, and stacks them on a narrow
 * screen with Next on top — the action you reach for first. */
.fluentform .frm-fluent-form .step-nav {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	align-items: center;
	margin-top: var(--wp--preset--spacing--md, 1.5rem);
}

.fluentform .frm-fluent-form .step-nav .ff-float-right {
	float: none;
	margin-left: auto;
}

@media (max-width: 480px) {
	.fluentform .frm-fluent-form .step-nav .ff-btn {
		flex: 1 1 100%;
	}

	.fluentform .frm-fluent-form .step-nav .ff-float-right {
		margin-left: 0;
		order: -1;
	}
}

/* 8. File upload control — a ghost button, so it reads as secondary to
 * whatever submits the form. */
.fluentform .frm-fluent-form .ff_upload_btn:not(.ff_btn_no_style) {
	display: inline-flex;
	align-items: center;
	min-height: var(--zd-btn-min-h, 2.875rem);
	padding: 0.625rem 1.25rem;
	font-size: 0.95rem;
	background-color: transparent;
	color: var(--wp--preset--color--foreground, #16181b);
	border: 1px solid var(--wp--preset--color--border, #e4e6e9);
	border-radius: var(--zd-btn-radius, var(--wp--custom--radius--md, 0.5rem));
}

.fluentform .frm-fluent-form .ff_upload_btn:not(.ff_btn_no_style):hover {
	background-color: transparent;
	border-color: var(--wp--preset--color--primary, #0e4b52);
	color: var(--wp--preset--color--primary, #0e4b52);
}

/* 9. Validation and success. Errors keep Fluent Forms' danger red; the success
 * message picks up the theme primary. */
.fluentform .frm-fluent-form .ff-el-is-error .ff-el-form-control,
.fluentform .frm-fluent-form .ff-el-form-control.error {
	border-color: var(--fluentform-danger, #f56c6c);
}

.fluentform .frm-fluent-form .ff-el-is-error .error,
.fluentform .frm-fluent-form .text-danger {
	margin-top: var(--wp--preset--spacing--2-xs, 0.5rem);
	font-size: 0.85rem;
	color: var(--fluentform-danger, #f56c6c);
}

.fluentform .frm-fluent-form .ff-message-success {
	padding: var(--wp--preset--spacing--md, 1.5rem);
	border-radius: var(--zd-card-radius, var(--wp--custom--radius--lg, 0.75rem));
	background: color-mix(in srgb, var(--wp--preset--color--primary, #0e4b52) 8%, transparent);
	border: 1px solid color-mix(in srgb, var(--wp--preset--color--primary, #0e4b52) 30%, transparent);
	color: var(--wp--preset--color--foreground, #16181b);
}

/* No rule for the progress bar on a paged form, deliberately. Fluent Forms
 * already styles it `background-color: var(--fluentform-primary)`, so §1 above
 * has recoloured it — checked on a live 14-step form before writing a rule that
 * would have been a second source saying the same thing. */
