/*
 * Frelim Care form fields (frelim/form block). Loaded only on pages with a form.
 * Focus comes from base.css; borders meet 3:1 and text 4.5:1 against white.
 */

.fc-form {
	display: grid;
	gap: var(--fc-space-40);
	max-width: 40rem;
}

.fc-form__instructions {
	margin: 0;
	color: var(--fc-muted);
}

/* ---------- Error summary (an .fc-alert--error) ---------- */

.fc-form__summary {
	flex-direction: column;
	gap: var(--fc-space-10);
}

.fc-form__summary:focus {
	/* Always visible: it receives focus from script, not only from the keyboard. */
	outline: 3px solid var(--fc-focus-ring);
	outline-offset: 2px;
	box-shadow: 0 0 0 2px var(--fc-focus-gap), 0 0 0 11px var(--fc-focus-halo);
}

.fc-form__summary h2 {
	font-size: var(--wp--preset--font-size--large);
	color: var(--fc-ink);
}

.fc-form__summary ul {
	margin: 0;
	padding-left: 1.25em;
}

.fc-form__summary li + li {
	margin-top: var(--fc-space-10);
}

.fc-form__summary a {
	color: var(--fc-error);
	font-weight: 600;
	text-decoration-line: underline;
	text-decoration-thickness: 2px;
	text-underline-offset: 0.15em;
}

/* ---------- Fieldsets and fields ---------- */

.fc-fieldset {
	display: grid;
	gap: var(--fc-space-30);
	min-width: 0;
	margin: 0;
	padding: 0;
	border: 0;
}

.fc-fieldset__legend {
	margin-bottom: var(--fc-space-20);
	padding: 0;
	font-size: var(--wp--preset--font-size--large);
	font-weight: 600;
	color: var(--fc-indigo-deep);
}

.fc-field {
	display: grid;
	gap: var(--fc-space-10);
	min-width: 0;
	margin: 0;
	padding: 0;
	border: 0;
}

.fc-field__label {
	padding: 0;
	font-weight: 600;
	color: var(--fc-ink);
}

.fc-field__hint,
.fc-field__error,
.fc-field__context {
	margin: 0;
}

.fc-field__hint {
	color: var(--fc-muted);
}

.fc-field__error {
	display: flex;
	align-items: flex-start;
	gap: 0.4em;
	font-weight: 600;
	color: var(--fc-error);
}

.fc-field__error::before {
	content: "";
	flex: none;
	width: 1.2em;
	height: 1.2em;
	margin-top: 0.15em;
	background-color: currentColor;
	mask: url(../svg/icons/warning-circle.svg) center / contain no-repeat;
}

.fc-field__context {
	justify-self: start;
	padding: var(--fc-space-10) var(--fc-space-20);
	border-radius: var(--fc-radius-card);
	background-color: var(--fc-cream-soft);
	border: 1px solid var(--fc-line);
	font-weight: 600;
	color: var(--fc-indigo-deep);
}

/* ---------- Controls ---------- */

.fc-input {
	width: 100%;
	min-height: 48px;
	padding: 10px 14px;
	font: inherit;
	color: var(--fc-ink);
	background-color: var(--fc-white);
	border: 2px solid var(--fc-muted);
	border-radius: 8px;
}

.fc-input--textarea {
	min-height: 10rem;
	resize: vertical;
}

/* File inputs: the browser's button styled like a secondary button; the file names beside it. */
.fc-input--file {
	padding: 8px;
	cursor: pointer;
}

.fc-input--file::file-selector-button {
	min-height: 40px;
	margin-inline-end: var(--fc-space-20);
	padding: 6px 18px;
	font: inherit;
	font-weight: 600;
	color: var(--fc-indigo-deep);
	background-color: var(--fc-cream-soft);
	border: 2px solid var(--fc-indigo);
	border-radius: var(--fc-radius-pill);
	cursor: pointer;
}

.fc-input--file:hover::file-selector-button {
	background-color: var(--fc-cream);
}

.fc-field--error .fc-input {
	border-color: var(--fc-error);
	border-width: 3px;
}

/* Radios and checkboxes: the whole row is the hit area (the label), at least 48px tall. */
.fc-choices {
	display: grid;
	gap: var(--fc-space-10);
}

/* Yes / No side by side: two short answers read as one question. */
.fc-choices--inline {
	grid-template-columns: repeat(auto-fit, minmax(6rem, max-content));
	column-gap: var(--fc-space-40);
}

.fc-choice {
	display: flex;
	align-items: flex-start;
	gap: var(--fc-space-20);
}

.fc-choice__input {
	flex: none;
	width: 1.5rem;
	height: 1.5rem;
	margin: 12px 0 0;
	accent-color: var(--fc-indigo);
	cursor: pointer;
}

.fc-choice__label {
	flex: 1;
	min-height: 48px;
	padding-block: 10px;
	cursor: pointer;
}

.fc-field--error .fc-choice__input {
	outline: 2px solid var(--fc-error);
	outline-offset: 1px;
}

.fc-field--error .fc-choice__input:focus-visible {
	outline: 3px solid var(--fc-focus-ring);
	outline-offset: 2px;
}

/* ---------- Follow-up questions (shown if an earlier answer applies) ---------- */

/* Set apart as part of the question above it. */
.fc-field--conditional {
	padding: var(--fc-space-20) var(--fc-space-30);
	background-color: var(--fc-cream-soft);
	border: 1px solid var(--fc-line);
	border-radius: var(--fc-radius-card);
}

/* forms.js hides a follow-up until it applies; display: grid would otherwise win over [hidden]. */
.fc-field[hidden],
.fc-field__condition[hidden] {
	display: none;
}

.fc-form__submit {
	justify-self: start;
	cursor: pointer;
}

/* ---------- Thank-you message ---------- */

.fc-form-thanks__message {
	font-size: var(--wp--preset--font-size--large);
}

.fc-form-thanks strong {
	font-variant-numeric: tabular-nums;
	letter-spacing: 0.04em;
	white-space: nowrap;
}
