/*
 * RMHN forms (Prompt 10). Fluent Forms markup, Blocksy's form styling underneath; this file adds only
 * what the boards need: labels above fields, 52/56px controls, choice "cards", the error summary,
 * inline errors in #8F4700 with the alert icon, and the confirmation. Loaded only on form pages.
 */

/* ---------------------------------------------------------------- card */
.rmhn-form {
	background: var(--rmhn-white);
	border-radius: 18px;
	padding: 20px;
}

@media (min-width: 690px) {
	.rmhn-form {
		border-radius: 24px;
		padding: 40px;
	}
}

.rmhn-form .ff-el-group {
	margin-bottom: 20px;
}

@media (min-width: 690px) {
	.rmhn-form .ff-el-group {
		margin-bottom: 26px;
	}
}

/* ---------------------------------------------------------------- labels */
.rmhn-form .ff-el-input--label {
	display: block;
	margin-bottom: 8px;
}

.rmhn-form .ff-el-input--label label {
	font: 600 16px/1.4 var(--rmhn-font-body);
	color: var(--rmhn-ink);
}

@media (min-width: 690px) {
	.rmhn-form .ff-el-input--label label {
		font-size: 17px;
	}
}

.rmhn-form .rmhn-optional {
	font-weight: 400;
	color: var(--rmhn-muted);
}

.rmhn-form .ff-el-help-message {
	margin-top: 6px;
	font: 400 15px/1.5 var(--rmhn-font-body);
	color: var(--rmhn-muted);
}

/* ---------------------------------------------------------------- text controls */
.rmhn-form .ff-el-form-control {
	width: 100%;
	min-height: 52px;
	padding: 0 14px;
	border: 1px solid var(--rmhn-border);
	border-radius: var(--rmhn-radius-field);
	background-color: var(--rmhn-white); /* not the shorthand: Blocksy draws the select arrow as a background image */
	font: 400 18px/1.4 var(--rmhn-font-body);
	color: var(--rmhn-ink);
}

.rmhn-form textarea.ff-el-form-control {
	min-height: 132px;
	padding: 12px 14px;
}

@media (min-width: 690px) {
	.rmhn-form .ff-el-form-control {
		min-height: 56px;
		padding-inline: 16px;
	}
}

.rmhn-form .ff-el-form-control:focus {
	border-color: var(--rmhn-ink);
}

/* ---------------------------------------------------------------- choice cards (radio / checkbox) */
.rmhn-form .ff-el-input--content[role="radiogroup"],
.rmhn-form .ff-el-input--content[role="group"] {
	display: grid;
	gap: 10px;
}

@media (min-width: 480px) {
	.rmhn-form .ff-el-input--content[role="radiogroup"],
	.rmhn-form .ff-el-input--content[role="group"] {
		grid-template-columns: 1fr 1fr;
	}
}

.rmhn-form .ff-el-form-check {
	margin: 0;
}

.rmhn-form .ff-el-form-check-label {
	display: flex;
	align-items: center;
	gap: 12px;
	min-height: 52px;
	margin: 0;
	padding: 8px 14px;
	border: 1px solid var(--rmhn-border);
	border-radius: 10px;
	background: var(--rmhn-white);
	font: 400 17px/1.4 var(--rmhn-font-body);
	color: var(--rmhn-ink);
	cursor: pointer;
}

@media (min-width: 690px) {
	.rmhn-form .ff-el-form-check-label {
		padding-inline: 16px;
		font-size: 18px;
	}
}

.rmhn-form .ff-el-form-check-label:has(input:checked) {
	padding: 7px 13px;
	border: 2px solid var(--rmhn-red);
	background: var(--rmhn-blush);
}

@media (min-width: 690px) {
	.rmhn-form .ff-el-form-check-label:has(input:checked) {
		padding-inline: 15px;
	}
}

.rmhn-form .ff-el-form-check-label:has(input:focus-visible) {
	outline: 3px solid var(--rmhn-ink);
	outline-offset: 2px;
}

.rmhn-form .ff-el-form-check-input {
	appearance: none;
	flex: none;
	width: 24px;
	height: 24px;
	margin: 0;
	border: 2px solid var(--rmhn-muted);
	background: var(--rmhn-white) no-repeat center / 16px;
	vertical-align: middle;
}

.rmhn-form .ff-el-form-check-input:focus-visible {
	outline: none; /* the card shows the focus ring */
}

.rmhn-form .ff-el-form-check-radio {
	border-radius: 50%;
}

.rmhn-form .ff-el-form-check-radio:checked {
	border-color: var(--rmhn-red);
	background: radial-gradient(circle, var(--rmhn-red) 0 5px, var(--rmhn-white) 6px);
}

.rmhn-form input[type="checkbox"].ff-el-form-check-input {
	border-radius: 6px;
}

.rmhn-form input[type="checkbox"].ff-el-form-check-input:checked {
	border-color: var(--rmhn-red);
	background-color: var(--rmhn-red);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* Consent: a plain checkbox + sentence, not a card. */
/* FF's own rule is .fluentform .ff-el-tc label.ff_tc_label { display: table-row } */
.rmhn-form .ff-el-tc label.ff_tc_label {
	display: flex;
	align-items: flex-start;
	min-height: 44px;
	padding: 0;
	border: 0;
	background: none;
}

.rmhn-form .ff-el-tc .ff-el-form-check-label:has(input:checked) {
	padding: 0;
	border: 0;
	background: none;
}

.rmhn-form .ff-el-tc .ff-el-form-check-label:has(input:focus-visible) {
	outline: none;
}

.rmhn-form .ff-el-tc label.ff_tc_label > .ff_tc_checkbox,
.rmhn-form .ff-el-tc label.ff_tc_label > .ff_t_c {
	display: block;
	padding: 0;
}

.rmhn-form .ff-el-tc label.ff_tc_label > .ff_tc_checkbox {
	flex: none;
	width: auto;
	padding-top: 0 !important; /* overrides Fluent Forms' own !important */
	line-height: 0;
}

.rmhn-form .ff-el-tc .ff-el-form-check-input {
	margin-top: 2px;
}

.rmhn-form .ff-el-tc .ff-el-form-check-input:focus-visible {
	outline: 3px solid var(--rmhn-ink);
	outline-offset: 2px;
}

.rmhn-form .ff_t_c {
	font: 400 17px/1.55 var(--rmhn-font-body);
}

.rmhn-form .ff_t_c a {
	color: var(--rmhn-red);
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* ---------------------------------------------------------------- submit */
.rmhn-form .ff_submit_btn_wrapper {
	margin: 8px 0 0;
}

.rmhn-form .fluentform .ff_submit_btn_wrapper button.ff-btn-submit {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 56px;
	padding: 0 26px;
	border: 0;
	border-radius: var(--rmhn-radius-button);
	background: var(--rmhn-red);
	color: var(--rmhn-white);
	font: 600 19px/1 var(--rmhn-font-body);
	cursor: pointer;
}

@media (min-width: 690px) {
	.rmhn-form .fluentform .ff_submit_btn_wrapper button.ff-btn-submit {
		min-height: 60px;
		font-size: 20px;
	}
}

.rmhn-form .fluentform .ff_submit_btn_wrapper button.ff-btn-submit:hover {
	background: var(--rmhn-red-hover);
}

.rmhn-form .fluentform .ff_submit_btn_wrapper button.ff-btn-submit:disabled {
	opacity: 0.7;
}

/* ---------------------------------------------------------------- errors */
.rmhn-form .ff-el-is-error .ff-el-input--label label {
	color: var(--rmhn-error);
}

.rmhn-form .ff-el-is-error .ff-el-form-control,
.rmhn-form .ff-el-is-error .ff_input-group {
	border: 2px solid var(--rmhn-error);
}

.rmhn-form .ff-el-is-error .ff_input-group .ff-el-form-control {
	border: 0;
}

.rmhn-form .ff-el-is-error .ff-el-form-check-input {
	border-color: var(--rmhn-error);
}

.rmhn-form .ff-el-is-error .error,
.rmhn-form .text-danger {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	margin-top: 8px;
	font: 400 15px/1.5 var(--rmhn-font-body);
	color: var(--rmhn-error);
}

/* Alert icon: an error is never colour alone (R7). */
.rmhn-form .ff-el-is-error .error::before {
	content: "";
	flex: none;
	width: 20px;
	height: 20px;
	margin-top: 1px;
	background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='9' fill='none' stroke='%238F4700' stroke-width='2'/%3E%3Cpath d='M12 7.4v6' fill='none' stroke='%238F4700' stroke-width='2' stroke-linecap='round'/%3E%3Ccircle cx='12' cy='16.6' r='1.2' fill='%238F4700'/%3E%3C/svg%3E") no-repeat center / contain;
}

.rmhn-form .ff-errors-in-stack:empty {
	display: none;
}

/* Summary above the form card, linking to each field. */
.rmhn-error-summary {
	margin-bottom: 16px;
	padding: 18px;
	border: 2px solid var(--rmhn-error);
	border-radius: 14px;
	background: var(--rmhn-white);
	color: var(--rmhn-error);
}

.rmhn-error-summary:focus {
	outline: 3px solid var(--rmhn-ink);
	outline-offset: 2px;
}

.rmhn-error-summary__title {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0 0 8px;
	font: 600 18px/1.4 var(--rmhn-font-body);
}

.rmhn-error-summary ul {
	margin: 0;
	padding: 0;
	list-style: none;
}

.rmhn-error-summary li + li {
	margin-top: 6px;
}

.rmhn-error-summary a {
	font: 400 17px/1.6 var(--rmhn-font-body);
	color: var(--rmhn-error);
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* ---------------------------------------------------------------- confirmation */
.rmhn-form .ff-message-success {
	margin: 0;
	padding: 0;
	border: 0;
	box-shadow: none;
}

.rmhn-form .ff-message-success h2 {
	margin: 0 0 12px;
	font: 700 26px/1.25 var(--rmhn-font-heading);
}

.rmhn-form-done {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 18px;
	padding: 12px 4px;
	text-align: center;
}

.rmhn-form-done__icon {
	width: 88px;
	height: 88px;
	border-radius: 50%;
	background: var(--rmhn-blush) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='9' fill='none' stroke='%23A81916' stroke-width='2'/%3E%3Cpath d='m8 12.4 2.8 2.8L16 9.6' fill='none' stroke='%23A81916' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center / 44px;
}

.rmhn-form .rmhn-form-done__title {
	margin: 0;
}

.rmhn-form-done__text {
	margin: 0;
	font: 400 18px/1.6 var(--rmhn-font-body);
}

.rmhn-form-done__note {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 16px;
	border-radius: 14px;
	background: var(--rmhn-sand);
	font: 400 16px/1.55 var(--rmhn-font-body);
	text-align: left;
}

.rmhn-form-done__note::before {
	content: "";
	flex: none;
	width: 22px;
	height: 22px;
	background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='9' fill='none' stroke='%235C5550' stroke-width='2'/%3E%3Cpath d='M12 11v5.6' fill='none' stroke='%235C5550' stroke-width='2' stroke-linecap='round'/%3E%3Ccircle cx='12' cy='7.6' r='1.2' fill='%235C5550'/%3E%3C/svg%3E") no-repeat center / contain;
}

.rmhn-form-done .rmhn-btn {
	width: 100%;
	max-width: 360px;
	min-height: 52px;
}

/* Turnstile ("interaction-only") takes no space until Cloudflare needs to show something. */
.rmhn-form .ff-el-turnstile:empty {
	display: none;
}

/* ---------------------------------------------------------------- two-column rows */
/* Fields marked "rmhn-half" (name and email) share a row on a computer, as on the boards. So do the
   country code and the phone number. On a phone each takes its own row. */
@media (min-width: 690px) {
	.rmhn-form .frm-fluent-form fieldset {
		display: grid;
		grid-template-columns: 1fr 1fr;
		column-gap: 20px;
	}

	.rmhn-form .frm-fluent-form fieldset > * {
		grid-column: 1 / -1;
		min-width: 0;
	}

	.rmhn-form .frm-fluent-form fieldset > .rmhn-half,
	.rmhn-form .frm-fluent-form fieldset > .rmhn-phone-code,
	.rmhn-form .frm-fluent-form fieldset > .rmhn-phone-number {
		grid-column: auto;
	}
}
