/* ==========================================================================
   Formidable forms in the theme's look (pass 3, 27 Nov 2026). Loaded wherever a [formidable]
   shortcode renders (inc/content.php, do_shortcode_tag) and on the calculator pages (page.php).
   Scoped to .frm_forms. Formidable's own stylesheet drives its fields with CSS variables on
   .with_frm_style, so most of the look is set by overriding those variables (selector with one
   more class than Formidable's per-style rule); a few hard-coded !important rules of its default
   style (submit button colour/font/padding) need an !important override.
   Never touched: the honeypot container (hidden by Formidable's inline script), the hidden-label
   containers (.frm_hidden_container), calculation fields and their scripts.
   ========================================================================== */

.frm_forms.with_frm_style[class*="frm_style_"] {
	--form-width: 100%;
	--font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif; /* the theme stack (a var(--font) self-reference would be invalid) */
	--font-size: var(--fs-sm);
	--label-color: var(--c-ink);
	--weight: 700;
	--label-padding: 0 0 6px 0;
	--required-color: var(--c-warn);
	--required-weight: 700;
	--description-font-size: var(--fs-sm);
	--description-color: var(--c-muted);
	--field-font-size: 1rem;          /* 16px: no iOS zoom on focus */
	--field-height: var(--tap);       /* 44px targets */
	--line-height: 1.4;
	--field-pad: 10px 12px;
	--field-margin: var(--sp-4);
	--text-color: var(--c-text);
	--border-color: var(--c-field-border); /* 3.4:1 field outline (WCAG 1.4.11) */
	--field-border-width: 1px;
	--bg-color: #fff;
	--bg-color-active: #fff;
	--border-color-active: var(--c-ink);
	--border-color-error: var(--c-warn);
	--text-color-error: var(--c-text);
	--bg-color-error: #fff;
	--border-radius: var(--radius-sm);
	--check-font-size: 1rem;
	--check-label-color: var(--c-text);
	--section-color: var(--c-ink);
	--section-border-color: var(--c-line);
	--section-border-width: 1px;
	--submit-bg-color: var(--c-red);
	--submit-border-color: var(--c-red);
	--submit-text-color: #fff;
	--submit-hover-bg-color: var(--c-red-dark);
	--submit-hover-border-color: var(--c-red-dark);
	--submit-hover-color: #fff;
	--submit-active-bg-color: var(--c-red-dark);
	--submit-active-border-color: var(--c-red-dark);
	--submit-active-color: #fff;
	--submit-border-radius: var(--btn-radius, var(--radius));
	--error-bg: var(--c-warn-bg);
	--error-border: var(--c-warn);
	--error-text: var(--c-warn);
	--error-font-size: var(--fs-sm);
	--success-bg-color: var(--c-green-bg);
	--success-border-color: var(--c-green);
	--success-text-color: var(--c-green);
	--success-font-size: var(--fs-base);
	--base-font-size: 1rem;
	max-width: 100%;
	margin: 0 0 var(--sp-5);
	font-family: var(--font);
	color: var(--c-text);
}

/* Fields */
.frm_forms .frm_fields_container { row-gap: 0; }
.frm_forms .frm_form_field { margin-bottom: var(--sp-4); min-width: 0; }
.frm_forms .frm_primary_label { display: block; line-height: 1.35; }
.frm_forms .frm_required { margin-left: 2px; }
.frm_forms.with_frm_style[class*="frm_style_"] :is(input[type=text], input[type=email], input[type=number], input[type=url], input[type=tel], input[type=password], input[type=search], input[type=date], select, textarea) {
	width: 100% !important;
	max-width: 100%;
	font-family: var(--font) !important;
	box-shadow: none;
	transition: border-color .15s, box-shadow .15s;
}
.frm_forms.with_frm_style[class*="frm_style_"] textarea { min-height: 8rem; line-height: 1.5 !important; }
.frm_forms.with_frm_style[class*="frm_style_"] select { padding-right: 36px !important; }
.frm_forms.with_frm_style[class*="frm_style_"] :is(input, select, textarea):focus-visible,
.frm_forms.with_frm_style[class*="frm_style_"] :is(input, select, textarea):focus {
	border-color: var(--c-ink) !important;
	box-shadow: 0 0 0 3px rgba(17, 17, 17, .14) !important;
}
.frm_forms.with_frm_style[class*="frm_style_"] :is(input, select, textarea)[readonly] { background-color: var(--c-bg-soft) !important; }
/* Field descriptions ("Hours", "Minutes per km"): theme font. Formidable's own
   '.frm_style_formidable-style.with_frm_style div.frm_description' (0,3,1 + !important) loads after
   this file, so these selectors carry more weight (html body … = 0,3,3 / 0,4,3). */
.frm_forms .frm_description, .with_frm_style .frm_form_field .frm_description, .frm_forms.with_frm_style div.description,
html body .with_frm_style .frm_form_field div.frm_description, html body .frm_forms.with_frm_style .frm_form_field div.frm_description { margin-top: 4px !important; font-family: var(--font) !important; color: var(--c-muted) !important; font-size: var(--fs-sm) !important; line-height: 1.35 !important; letter-spacing: 0 !important; }

/* Invalid fields: Formidable paints every ':invalid' control red from the first keystroke, including
   a step mismatch (9.5 in a step=1 number field, which is a valid distance). The red only shows once
   main.js has flagged the field (.jrl-invalid: after blur / a submit attempt, and never for a step
   mismatch alone); validation itself is unchanged. */
.frm_forms.with_frm_style[class*="frm_style_"] .frm_form_field :invalid:not(.jrl-invalid) {
	--text-color-error: var(--c-text);
	--bg-color-error: #fff;
	--border-color-error: var(--c-field-border);
	--border-width-error: 1px;
	--border-style-error: solid;
}
.frm_forms.with_frm_style[class*="frm_style_"] .frm_form_field :is(input, select, textarea).jrl-invalid { border-color: var(--c-warn) !important; }

/* Checkboxes + radios: each option a 44px row, real controls 20px. */
.frm_forms .frm_opt_container { display: grid; gap: 2px; }
.frm_forms :is(.frm_checkbox, .frm_radio) { margin: 0; }
.frm_forms :is(.frm_checkbox, .frm_radio) label { display: flex !important; align-items: center; gap: var(--sp-2); min-height: var(--tap); margin: 0; padding: 4px 0; font-family: var(--font) !important; font-weight: 400; line-height: 1.35; cursor: pointer; }
.frm_forms :is(.frm_checkbox, .frm_radio) input { flex: none; width: 20px; height: 20px; margin: 0 !important; accent-color: var(--c-ink); }
.frm_forms :is(.frm_checkbox, .frm_radio) input:focus-visible { outline: 3px solid var(--c-focus); outline-offset: 2px; }
.frm_forms .horizontal_radio .frm_opt_container { display: flex; flex-wrap: wrap; gap: 0 var(--sp-4); }

/* File upload (Formidable Pro dropzone + plain input). */
.frm_forms .frm_dropzone { border: 1px dashed var(--c-line-strong) !important; border-radius: var(--radius) !important; background: var(--c-bg-soft) !important; }
.frm_forms .frm_dropzone .dz-message { min-height: var(--tap); padding: var(--sp-4); }
.frm_forms input[type=file] { max-width: 100%; min-height: var(--tap); padding: 8px 0; font: inherit; }
.frm_forms input[type=file]::file-selector-button { min-height: 36px; margin-right: var(--sp-3); padding: 6px 14px; border: 1px solid var(--c-line-strong); border-radius: var(--radius-sm); background: #fff; color: var(--c-ink); font: inherit; font-weight: 600; cursor: pointer; }

/* Section headings / page breaks inside a form. */
.frm_forms .frm_section_heading h3, .frm_forms h3.frm_pos_top { margin: var(--sp-5) 0 var(--sp-3); padding: 0 0 var(--sp-2); border: 0 !important; border-bottom: 1px solid var(--c-line) !important; font-family: var(--font) !important; font-size: var(--fs-lg) !important; color: var(--c-ink) !important; }

/* Submit: brand red CTA, 44px, full width on phones. */
.frm_forms.with_frm_style[class*="frm_style_"] .frm_submit :is(input[type=submit], input[type=button], button),
.frm_forms.with_frm_style[class*="frm_style_"] input[type=submit].frm_final_submit {
	min-height: var(--tap);
	padding: 10px 24px !important;
	border: 1px solid var(--c-red) !important;
	border-radius: var(--btn-radius, var(--radius)) !important;
	background: var(--c-red) !important;
	color: #fff !important;
	font-family: var(--font) !important;
	font-size: var(--fs-base) !important;
	font-weight: 700 !important;
	line-height: 1.2 !important;
	box-shadow: none !important;
	cursor: pointer;
}
.frm_forms.with_frm_style[class*="frm_style_"] .frm_submit :is(input[type=submit], input[type=button], button):hover { background: var(--c-red-dark) !important; border-color: var(--c-red-dark) !important; }
.frm_forms.with_frm_style[class*="frm_style_"] .frm_submit :is(input[type=submit], input[type=button], button):focus-visible { outline: 3px solid var(--c-focus) !important; outline-offset: 2px; }
.frm_forms .frm_submit { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); margin-top: var(--sp-2); }
@media (max-width: 599px) {
	.frm_forms.with_frm_style[class*="frm_style_"] .frm_submit :is(input[type=submit], button) { width: 100% !important; }
}
.frm_forms .frm_ajax_loading { width: 24px; height: 24px; }

/* Errors + success */
.frm_forms .frm_error { margin-top: 4px; font-family: var(--font) !important; font-size: var(--fs-sm) !important; font-weight: 600 !important; color: var(--c-warn) !important; }
.frm_forms .frm_blank_field :is(input, select, textarea) { border-color: var(--c-warn) !important; }
.frm_forms .frm_error_style, .frm_error_style {
	margin: 0 0 var(--sp-4) !important;
	padding: var(--sp-3) var(--sp-4) !important;
	border: 1px solid var(--c-warn) !important;
	border-radius: var(--radius) !important;
	background: var(--c-warn-bg) !important;
	color: var(--c-warn) !important;
	font-size: var(--fs-sm) !important;
}
.frm_forms .frm_message, .frm_message {
	margin: 0 0 var(--sp-4);
	padding: var(--sp-4) var(--sp-5);
	border: 1px solid var(--c-green);
	border-radius: var(--radius);
	background: var(--c-green-bg);
	color: var(--c-green);
	font-weight: 600;
}
.frm_message p:last-child { margin-bottom: 0; }

/* reCAPTCHA never wider than the screen (304px widget). */
.frm_forms .g-recaptcha { max-width: 100%; overflow: hidden; }
@media (max-width: 359px) { .frm_forms .g-recaptcha { transform: scale(.9); transform-origin: 0 0; } }

/* Calculators: one-line row labels ("Your pace should be:", "Target timing") on the first third run
   over the empty label space of the hidden-label thirds next to them, so all three inputs of the row
   stay level (the label no longer wraps onto a second line on phones). */
.content-page--tool .frm_form_field.frm_first_third > .frm_primary_label { white-space: nowrap; overflow: visible; }
.content-page--tool .frm_fields_container > :is(.frm_third, .frm_first_third, .frm_last_third) { align-self: start; }
/* Calculators: hours / minutes / seconds stay three in a row on phones too. */
@media (max-width: 600px) {
	.content-page--tool .frm_fields_container > :is(.frm_third, .frm_first_third, .frm_last_third) { grid-column: span 4 / span 4 !important; }
}

@media (prefers-reduced-motion: reduce) { .frm_forms :is(input, select, textarea) { transition: none !important; } }
