/* FFP Forms: front end. Everything inherits the theme's fonts and colours; override the custom properties to restyle. */
.ffpf-wrapper {
	--ffpf-gap: 1.25rem;
	--ffpf-border: #8b93a1;
	--ffpf-radius: 6px;
	--ffpf-focus: currentColor;
	--ffpf-error: #b42318;
	--ffpf-error-bg: #fef3f2;
	--ffpf-ok-bg: #ecfdf3;
	--ffpf-ok-color: #054f31;
	--ffpf-ok-border: #12b76a;
	--ffpf-error-color: #7a271a;
	--ffpf-input-bg: #fff;
	--ffpf-input-color: #1a1a1a;
	--ffpf-label-width: 30%;
	margin: 0 0 1.5rem;
}
.ffpf-wrapper *, .ffpf-wrapper *::before, .ffpf-wrapper *::after { box-sizing: border-box; }
.ffpf-title { margin: 0 0 .25rem; }
.ffpf-form-description { margin: 0 0 var(--ffpf-gap); opacity: .85; }
/* Two-column grid: fields span the row; add the class ffpf-half to a field to put two side by side. */
.ffpf-body { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--ffpf-gap) 1.25rem; }
.ffpf-body > .ffpf-field { grid-column: 1 / -1; }
.ffpf-body > .ffpf-half { grid-column: span 1; }
.ffpf-half .ffpf-input { max-width: none !important; }
@media (max-width: 640px) { .ffpf-body > .ffpf-half { grid-column: 1 / -1; } }
.ffpf-sr-only { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.ffpf-field { margin: 0; min-width: 0; }
.ffpf-label { display: block; font-weight: 600; margin-bottom: .35rem; }
.ffpf-required { color: inherit; font-weight: 700; }
.ffpf-required--text { font-size: .85em; opacity: .8; color: inherit; }
.ffpf-description { font-size: .875em; opacity: .8; margin: .35rem 0; }
.ffpf-desc--above .ffpf-description { margin-top: 0; }
.ffpf-hint { font-size: .8em; opacity: .75; display: block; margin-top: .25rem; }

.ffpf-input input[type="text"], .ffpf-input input[type="email"], .ffpf-input input[type="url"], .ffpf-input input[type="tel"],
.ffpf-input input[type="date"], .ffpf-input input[type="time"], .ffpf-input input[type="number"], .ffpf-input input[type="file"],
.ffpf-input select, .ffpf-input textarea {
	width: 100%;
	max-width: 100%;
	padding: .65rem .8rem;
	font: inherit;
	color: var(--ffpf-input-color);
	background: var(--ffpf-input-bg);
	border: 1px solid var(--ffpf-border);
	border-radius: var(--ffpf-radius);
	min-height: 44px;
}
.ffpf-input textarea { min-height: 7rem; resize: vertical; }
.ffpf-input input:focus-visible, .ffpf-input select:focus-visible, .ffpf-input textarea:focus-visible, .ffpf-button:focus-visible {
	outline: 2px solid var(--ffpf-focus);
	outline-offset: 2px;
}

/* Field sizes */
.ffpf-size--small .ffpf-input { max-width: 14rem; }
.ffpf-size--medium .ffpf-input { max-width: 28rem; }
.ffpf-size--large .ffpf-input { max-width: 100%; }
.ffpf-field--checkbox .ffpf-input, .ffpf-field--radio .ffpf-input { max-width: none; }

/* Choices */
.ffpf-choices { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .4rem; }
.ffpf-choice { display: flex; align-items: flex-start; gap: .5rem; margin: 0; }
.ffpf-choice input { margin-top: .3em; flex: none; width: 1.1em; height: 1.1em; }
.ffpf-choice label { font-weight: 400; }

/* Name / address */
.ffpf-composite { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.ffpf-sub { display: flex; flex-direction: column; }
.ffpf-sub--street, .ffpf-sub--street2, .ffpf-sub--country { grid-column: 1 / -1; }
.ffpf-sublabel { font-size: .8em; opacity: .8; margin: .25rem 0 0; }
.ffpf-sublabel--above .ffpf-sub { flex-direction: column; }
.ffpf-composite .ffpf-sub input { width: 100%; }
.ffpf-size--small .ffpf-composite, .ffpf-size--medium .ffpf-composite { max-width: 28rem; }

/* Section / html */
.ffpf-section-title { margin: .75rem 0 .25rem; padding-bottom: .35rem; border-bottom: 1px solid currentColor; }
.ffpf-section-description { margin: 0; opacity: .8; }

/* Label placement: left / right */
@media (min-width: 640px) {
	.ffpf-label--left .ffpf-field:not(.ffpf-field--section):not(.ffpf-field--html):not(.ffpf-field--hidden),
	.ffpf-label--right .ffpf-field:not(.ffpf-field--section):not(.ffpf-field--html):not(.ffpf-field--hidden) {
		display: grid;
		grid-template-columns: var(--ffpf-label-width) minmax(0, 1fr);
		column-gap: 1rem;
		align-items: start;
	}
	.ffpf-label--left .ffpf-field > .ffpf-label, .ffpf-label--right .ffpf-field > .ffpf-label { grid-column: 1; padding-top: .65rem; margin: 0; }
	.ffpf-label--right .ffpf-field > .ffpf-label { text-align: right; }
	.ffpf-label--left .ffpf-field > :not(.ffpf-label), .ffpf-label--right .ffpf-field > :not(.ffpf-label) { grid-column: 2; }
	.ffpf-label--left .ffpf-field > [role="group"], .ffpf-label--right .ffpf-field > [role="group"] { display: contents; }
}

/* Hidden by logic or visibility */
.ffpf-logic-hidden, .ffpf-field--hidden { display: none !important; }

/* Honeypot: off-screen, still reachable by bots */
.ffpf-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }

/* Validation */
/* Own background + text colour, so contrast holds on light and dark themes alike. */
.ffpf-validation { display: inline-block; background: var(--ffpf-error-bg); color: var(--ffpf-error-color); border-left: 3px solid var(--ffpf-error); font-size: .875em; font-weight: 600; margin-top: .4rem; padding: .25rem .6rem; border-radius: 3px; }
.ffpf-validation:empty { display: none; }
.ffpf-has-error .ffpf-input input, .ffpf-has-error .ffpf-input select, .ffpf-has-error .ffpf-input textarea { border-color: var(--ffpf-error); }
.ffpf-error-banner { background: var(--ffpf-error-bg); color: var(--ffpf-error-color); border: 1px solid var(--ffpf-error); border-radius: var(--ffpf-radius); padding: .75rem 1rem; margin-bottom: var(--ffpf-gap); }
.ffpf-error-banner p { margin: 0; }
.ffpf-error-banner ul { margin: .5rem 0 0 1.25rem; padding: 0; }
.ffpf-error-banner a { color: inherit; }
.ffpf-messages:empty { display: none; }

/* Footer + button */
.ffpf-footer { margin-top: var(--ffpf-gap); }
.ffpf-footer--top { margin: 0 0 var(--ffpf-gap); }
.ffpf-button { cursor: pointer; }
.ffpf-button[disabled] { opacity: .65; cursor: progress; }
.ffpf-button--full .ffpf-button { width: 100%; }

/* Confirmation */
.ffpf-confirmation__message { background: var(--ffpf-ok-bg); color: var(--ffpf-ok-color); border: 1px solid var(--ffpf-ok-border); border-radius: var(--ffpf-radius); padding: 1rem 1.25rem; }
.ffpf-confirmation__message a { color: inherit; text-decoration: underline; }
.ffpf-confirmation__message > :first-child { margin-top: 0; }
.ffpf-confirmation__message > :last-child { margin-bottom: 0; }
.ffpf-confirmation__message:focus { outline: none; }
.ffpf-unavailable { padding: 1rem 1.25rem; border: 1px solid currentColor; border-radius: var(--ffpf-radius); }
.ffpf-admin-note { padding: .5rem .75rem; color: #1d2327; background: #fff8e5; border-left: 4px solid #dba617; font-size: .875em; }

@media (max-width: 520px) {
	.ffpf-composite { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: no-preference) {
	.ffpf-input input, .ffpf-input select, .ffpf-input textarea { transition: border-color .15s ease; }
}

/* intl-tel-input (phone fields). On small screens the library moves the country list out of the form (to the page or
   the open dialog), so these rules must not depend on the .ffpf-* ancestors, and must carry their own colours. */
.ffpf-input .iti { display: block; width: 100%; }
.ffpf-has-error .iti input { border-color: var(--ffpf-error); }
.iti__country-selector {
	--iti-country-selector-bg: #fff;
	--iti-hover-color: #f0f1f3;
	z-index: 30;
	color: #1a1a1a;
	font-family: inherit;
	font-size: 1rem;
	line-height: 1.4;
	text-align: left;
	box-shadow: 0 8px 28px rgba(15, 34, 56, 0.28);
}
.iti__country-selector .iti__country-name,
.iti__country-selector .iti__country { color: #1a1a1a; }
.iti__country-selector .iti__dial-code { color: #5a6470; margin-left: 0.35em; }
.iti__country-selector .iti__country { padding-top: 0.6rem; padding-bottom: 0.6rem; }
.iti__country-selector .iti__country-list { max-height: min(17rem, 45vh); overscroll-behavior: contain; }
/* Search box: undo the form-input look (fixed height, borders, padding from theme/plugin rules). The doubled
   classes outrank those rules; padding-left leaves room for the search icon. */
.iti__country-selector.iti__country-selector .iti__search-input.iti__search-input {
	box-sizing: border-box;
	width: 100%;
	height: auto;
	min-height: 0;
	margin: 0;
	padding: 0.6rem 0.75rem 0.6rem 2.4rem;
	font: inherit;
	font-size: 1rem;
	color: #1a1a1a;
	background: transparent;
	border: 0;
	border-radius: 0;
	box-shadow: none;
}
.iti__country-selector .iti__search-input:focus-visible { outline: 2px solid var(--ffpf-focus, #b8891f); outline-offset: -2px; }
.iti__country-selector .iti__search-icon-svg { width: 16px; height: 16px; }
