/* ============================================================
   FLIBBR — FORMS.CSS
   Fluent Forms skin override CSS.

   Loads conditionally from functions.php → flibbr_enqueue_assets()
   on Contact (page-template-page-contact.php) and any future
   form-bearing template. NOT loaded site-wide.

   Scope: every rule below targets .flibbr-form-wrap .fluentform...
   The .flibbr-form-wrap container is added by partials that embed
   forms (e.g. template-parts/contact/contact-validation.php).
   This namespace policy is deliberate:

   1. Fluent Forms ships its own widely-applied CSS. Bare overrides
      (.fluentform a) would bleed into every Fluent Forms instance
      (Subscription Form id=2, Contact Form Demo id=1) and into
      future Fluent Forms upgrades.

   2. Other Flibbr forms (e.g. the Validation Room §4 sample-report
      gate, when its Tier-1 page-validation-room.php template lands)
      may want a different visual treatment. The wrap-namespace
      keeps these styles opt-in per partial.

   Visual spec sourced VERBATIM from locked canonical
   `flibbr-design-mockup-final-flibbr-validation-room.html`
   §.validation-report-* (L2497-2660). The same input convention
   applies here under Fluent Forms class names.

   Mapping table (canonical → Fluent Forms):
     .validation-report-form    → .ff-el-group + .fluentform
     .validation-report-field   → .ff-el-group, .ff-el-input--label
     .validation-report-label   → .ff-el-input--label label
     .validation-report-input   → .ff-el-form-control,
                                   .ff_input_box,
                                   input[type=text/email/tel/url],
                                   textarea, select
     .validation-report-submit  → .ff-btn-submit
     .req                       → .ff-el-is-required-mark

   Order of rules below matches the canonical's ordering for
   reviewer ergonomics: container → fields → inputs → submit →
   states (error / success).

   @package Flibbr
   @since   0.5.26
   ============================================================ */


/* ──────────────────────────────────────────────────────────────
   Container — base reset, font inheritance, layout rhythm.
   ────────────────────────────────────────────────────────── */
.flibbr-form-wrap {
	margin-top: var(--s-7);
}

.flibbr-form-wrap .fluentform {
	font-family: var(--serif);
	color: var(--ink);
}

.flibbr-form-wrap .fluentform .ff-el-form-control,
.flibbr-form-wrap .fluentform .ff-el-group,
.flibbr-form-wrap .fluentform input,
.flibbr-form-wrap .fluentform select,
.flibbr-form-wrap .fluentform textarea,
.flibbr-form-wrap .fluentform button {
	box-sizing: border-box;
}

/* Field group rhythm — vertical stack, --s-4 gap between fields,
   matches canonical .validation-report-form gap: var(--s-4). */
.flibbr-form-wrap .fluentform .ff-el-group {
	display: flex;
	flex-direction: column;
	gap: var(--s-2);
	margin-bottom: var(--s-4);
}


/* ──────────────────────────────────────────────────────────────
   Labels — canonical .validation-report-label (L2535-2540).
   Sans 11px, 0.14em letterspaced, uppercase, --ink-quiet.
   ────────────────────────────────────────────────────────── */
.flibbr-form-wrap .fluentform .ff-el-input--label label,
.flibbr-form-wrap .fluentform label.ff-el-form-label {
	font-family: var(--sans);
	font-weight: 600;
	font-size: 11px;
	line-height: 1;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--ink-quiet);
	margin: 0;
}

/* Required asterisk — canonical .req (L2541-2545). */
.flibbr-form-wrap .fluentform .ff-el-is-required-mark,
.flibbr-form-wrap .fluentform label .ff_required {
	color: var(--accent);
	margin-left: 2px;
	font-weight: 600;
}


/* ──────────────────────────────────────────────────────────────
   Inputs (text, email, tel, url) — canonical
   .validation-report-input (L2546-2572). 1px --rule border,
   --s-3/--s-4 padding, serif 16px, ink on paper, focus to
   --accent border + 2px outline-offset.
   ────────────────────────────────────────────────────────── */
.flibbr-form-wrap .fluentform input[type="text"],
.flibbr-form-wrap .fluentform input[type="email"],
.flibbr-form-wrap .fluentform input[type="tel"],
.flibbr-form-wrap .fluentform input[type="url"],
.flibbr-form-wrap .fluentform input[type="search"],
.flibbr-form-wrap .fluentform input[type="number"],
.flibbr-form-wrap .fluentform input[type="password"],
.flibbr-form-wrap .fluentform textarea,
.flibbr-form-wrap .fluentform select {
	display: block;
	width: 100%;
	padding: var(--s-3) var(--s-4);
	font-family: var(--serif);
	font-weight: 400;
	font-size: 16px;
	line-height: 1.4;
	color: var(--ink);
	background: var(--paper);
	border: 1px solid var(--rule);
	border-radius: 0;
	box-shadow: none;
	transition: border-color var(--motion-duration-ui) var(--motion-ease-ui);
}

.flibbr-form-wrap .fluentform input::placeholder,
.flibbr-form-wrap .fluentform textarea::placeholder {
	color: var(--ink-quiet);
	opacity: 0.6;
}

.flibbr-form-wrap .fluentform input:focus,
.flibbr-form-wrap .fluentform textarea:focus,
.flibbr-form-wrap .fluentform select:focus {
	outline: none;
	border-color: var(--accent);
}

.flibbr-form-wrap .fluentform input:focus-visible,
.flibbr-form-wrap .fluentform textarea:focus-visible,
.flibbr-form-wrap .fluentform select:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}


/* Textarea — additional min-height for usable writing surface. */
.flibbr-form-wrap .fluentform textarea {
	min-height: 7em;
	line-height: 1.6;
	resize: vertical;
}


/* Select — replace native chevron with a SVG one in --ink-quiet,
   maintain ink-on-paper consistency with text inputs. The native
   appearance is removed for cross-browser visual parity. */
.flibbr-form-wrap .fluentform select {
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 8' fill='none' stroke='%236e6c66' stroke-width='1.5'><path d='M1 1l6 6 6-6'/></svg>");
	background-repeat: no-repeat;
	background-position: right var(--s-4) center;
	background-size: 12px 7px;
	padding-right: var(--s-7);
}


/* ──────────────────────────────────────────────────────────────
   Submit button — canonical .validation-report-submit
   (L2582-2605). Sans 13px, 0.08em letterspaced, uppercase, paper
   on --accent, hover → --ink. Op-learning #10 button-defaults
   reset baked in (border:0; font:inherit). align-self:flex-start
   so the button doesn't span the form width.
   ────────────────────────────────────────────────────────── */
/* Specificity note (v0.5.26.2, op-learning #16):
   Fluent Forms emits a per-form inline <style> rule
   `form.fluent_form_3 .ff-btn-submit:not(.ff_btn_no_style)
   { background-color: var(--fluentform-primary); }` — specificity
   (0,3,1). Our v0.5.26 selector tied at (0,3,1) and lost on source
   order (FF inline emits AFTER our forms.css link). The v0.5.26.1
   patch tried `form.fluentform` but failed: in FF 6.2.2's actual
   DOM, the `.fluentform` class is on the WRAPPER DIV, not on the
   FORM element (the FORM has `.frm-fluent-form`, `.fluent_form_3`,
   etc.). Selector did not match. v0.5.26.2 fix: keep `.fluentform`
   (which matches the wrapper div as before), add `:not(.ff_btn_no_style)`
   to bump specificity to (0,4,1) — beats FF inline's (0,3,1). Hover,
   focus, and focus-visible rules below remain at v0.5.26 selectors —
   they were already winning the cascade. Op-learning #50 should
   formally include: ALWAYS .matches()-test the patch selector against
   the live DOM BEFORE shipping; specificity arithmetic alone is not
   sufficient. */
.flibbr-form-wrap .fluentform button.ff-btn:not(.ff_btn_no_style),
.flibbr-form-wrap .fluentform button.ff-btn-submit:not(.ff_btn_no_style),
.flibbr-form-wrap .fluentform input[type="submit"]:not(.ff_btn_no_style) {
	display: inline-flex;
	align-items: center;
	gap: var(--s-2);
	align-self: flex-start;
	margin-top: var(--s-3);
	padding: var(--s-3) var(--s-5);
	border: 0;
	border-radius: 0;
	font: inherit;
	font-family: var(--sans);
	font-weight: 600;
	font-size: 13px;
	line-height: 1;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--paper);
	background: var(--accent);
	cursor: pointer;
	box-shadow: none;
	transition: background var(--motion-duration-ui) var(--motion-ease-ui);
}

.flibbr-form-wrap .fluentform button.ff-btn:hover,
.flibbr-form-wrap .fluentform button.ff-btn-submit:hover,
.flibbr-form-wrap .fluentform input[type="submit"]:hover {
	background: var(--ink);
}

.flibbr-form-wrap .fluentform button.ff-btn:focus-visible,
.flibbr-form-wrap .fluentform button.ff-btn-submit:focus-visible,
.flibbr-form-wrap .fluentform input[type="submit"]:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}


/* ──────────────────────────────────────────────────────────────
   Checkboxes & radios — minimal pass. Fluent Forms wraps these
   in .ff-el-input--content — keep the native control but align
   typography and spacing to the page register.
   ────────────────────────────────────────────────────────── */
.flibbr-form-wrap .fluentform .ff-el-input--content label {
	font-family: var(--serif);
	font-weight: 400;
	font-size: 15px;
	line-height: 1.5;
	color: var(--ink-soft);
	letter-spacing: 0;
	text-transform: none;
	display: inline-flex;
	align-items: baseline;
	gap: var(--s-2);
	margin: 0;
}

.flibbr-form-wrap .fluentform input[type="checkbox"],
.flibbr-form-wrap .fluentform input[type="radio"] {
	width: 1em;
	height: 1em;
	accent-color: var(--accent);
	margin: 0;
	flex-shrink: 0;
}


/* ──────────────────────────────────────────────────────────────
   Help / instructions text under fields — Fluent Forms uses
   .ff-el-help-message. Keep it quiet, sans, small.
   ────────────────────────────────────────────────────────── */
.flibbr-form-wrap .fluentform .ff-el-help-message,
.flibbr-form-wrap .fluentform .ff-help-text {
	font-family: var(--sans);
	font-weight: 400;
	font-size: 12px;
	line-height: 1.5;
	letter-spacing: 0.02em;
	color: var(--ink-quiet);
	margin-top: var(--s-1);
}


/* ──────────────────────────────────────────────────────────────
   Validation states — error border, error message.
   Fluent Forms sets .ff-el-is-error on the field group on
   client-side validation failure.
   ────────────────────────────────────────────────────────── */
.flibbr-form-wrap .fluentform .ff-el-is-error input,
.flibbr-form-wrap .fluentform .ff-el-is-error textarea,
.flibbr-form-wrap .fluentform .ff-el-is-error select {
	border-color: var(--accent);
}

.flibbr-form-wrap .fluentform .error,
.flibbr-form-wrap .fluentform .error_msg,
.flibbr-form-wrap .fluentform .ff-el-is-error .text-danger {
	font-family: var(--sans);
	font-weight: 400;
	font-size: 12px;
	line-height: 1.5;
	letter-spacing: 0.02em;
	color: var(--accent);
	margin-top: var(--s-1);
}


/* ──────────────────────────────────────────────────────────────
   Success state — Fluent Forms swaps in .ff-message-success
   after submission (or .ff_msg_temp variants). Render in the
   serif voice with a quiet paper-warm panel.
   ────────────────────────────────────────────────────────── */
.flibbr-form-wrap .fluentform .ff-message-success,
.flibbr-form-wrap .fluentform .ff_msg_temp.ff_msg_temp_success,
.flibbr-form-wrap .fluentform .ff-success-message {
	font-family: var(--serif);
	font-weight: 400;
	font-size: 16px;
	line-height: 1.6;
	color: var(--ink-soft);
	background: var(--paper-warm);
	border: 1px solid var(--rule-soft);
	padding: var(--s-5) var(--s-6);
	border-radius: 0;
	margin-top: var(--s-5);
}


/* ──────────────────────────────────────────────────────────────
   Reset Fluent Forms' default panel chrome we don't want.
   FF wraps each field in .ff-el-group with its own padding /
   margins; we already control those. Override colour-scheme
   defaults that cause focus-ring weirdness in Safari.
   ────────────────────────────────────────────────────────── */
.flibbr-form-wrap .fluentform .ff-el-group:last-child {
	margin-bottom: 0;
}

.flibbr-form-wrap .fluentform .ff-t-cell,
.flibbr-form-wrap .fluentform .ff-t-container,
.flibbr-form-wrap .fluentform .ff-t-row {
	background: transparent;
	box-shadow: none;
}


/* ──────────────────────────────────────────────────────────────
   path-detail-form — wrapper from contact-validation.php.
   Constrains form measure to readable width on wide viewports.
   ────────────────────────────────────────────────────────── */
.path-detail-form {
	max-width: 56ch;
}

/* G.3b — Fluent Forms submit button tap-target */
@media (max-width: 880px) {
  .ff-btn.ff-btn-submit.ff-btn-md {
    min-height: 44px;
  }
}
