/*
 * Fluent Forms and Yoast breadcrumbs, restyled to the design inputs. Presets
 * only.
 */

/*
 * ---- Fluent Forms. Scoped to .gm-form so a form elsewhere keeps its own
 * look.
 */
.gm-form .fluentform {
	--fluentform-danger: var(--wp--preset--color--clay);
	color: var(--wp--preset--color--soil);
	font-family: var(--wp--preset--font-family--inter);
}

.gm-form .fluentform .ff-el-group {
	margin-bottom: var(--wp--preset--spacing--30);
}

.gm-form .fluentform .ff-el-input--label label {
	margin-bottom: 8px;
	color: var(--wp--preset--color--soil);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 500;
}

.gm-form .fluentform .ff-el-input--label.asterisk-right label::after {
	color: var(--wp--preset--color--clay);
}

.gm-form .fluentform .ff-el-form-control {
	box-sizing: border-box;
	min-height: 44px;
	margin-bottom: 0;
	padding: 9px 14px;
	border: 1px solid var(--wp--preset--color--field);
	border-radius: var(--wp--custom--radius--button);
	background: var(--wp--preset--color--surface);
	box-shadow: none;
	color: var(--wp--preset--color--soil);
	font-family: inherit;
	font-size: var(--wp--preset--font-size--medium);
	line-height: 1.5;
}

.gm-form .fluentform textarea.ff-el-form-control {
	min-height: 140px;
	resize: vertical;
}

.gm-form .fluentform .ff-el-form-control::placeholder {
	color: var(--wp--preset--color--muted);
	opacity: 1;
}

.gm-form .fluentform .ff-el-form-control:focus {
	border-color: var(--wp--preset--color--moss);
	box-shadow: 0 0 0 1px var(--wp--preset--color--moss);
	outline: 2px solid transparent;
	background: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--soil);
}

/* Select: keep the native arrow but give it room. */
.gm-form .fluentform select.ff-el-form-control {
	padding-inline-end: 40px;
}

/*
 * Radios: the input itself is a 44px target, drawn as a 20px ring so it looks
 * like the design.
 */
.gm-form .fluentform .ff-el-form-check {
	margin: 0;
}

.gm-form .fluentform .ff-el-form-check-label {
	display: flex;
	align-items: center;
	gap: 0;
	min-height: 44px;
	margin: 0;
	color: var(--wp--preset--color--soil);
	font-size: var(--wp--preset--font-size--medium);
	font-weight: 400;
}

.gm-form .fluentform .ff-el-form-check-input.ff-el-form-check-radio {
	flex: none;
	appearance: none;
	width: 44px;
	height: 44px;
	margin: 0 0 0 -12px;
	border: 0;
	border-radius: 50%;
	background: radial-gradient(circle, var(--wp--preset--color--surface) 0 9px, var(--wp--preset--color--field) 9px 10px, transparent 10px) center / 44px 44px no-repeat;
	cursor: pointer;
}

.gm-form .fluentform .ff-el-form-check-input.ff-el-form-check-radio:checked {
	background: radial-gradient(circle, var(--wp--preset--color--moss) 0 5px, var(--wp--preset--color--surface) 5px 9px, var(--wp--preset--color--moss) 9px 10px, transparent 10px) center / 44px 44px no-repeat;
}

.gm-form .fluentform .ff-el-form-check-input.ff-el-form-check-radio:focus-visible {
	outline: 2px solid var(--wp--preset--color--moss);
	outline-offset: -4px;
}

.gm-form .fluentform .ff-el-form-check-radio > span {
	margin-inline-start: 0;
}

/* Checkboxes: the 44px label row is the target; the box is native. */
.gm-form .fluentform .ff-el-form-check-input.ff-el-form-check-checkbox {
	flex: none;
	width: 20px;
	height: 20px;
	margin: 0 12px 0 0;
	accent-color: var(--wp--preset--color--moss);
	cursor: pointer;
}

.gm-form .fluentform .ff-el-form-check-input.ff-el-form-check-checkbox:focus-visible {
	outline: 2px solid var(--wp--preset--color--moss);
	outline-offset: 2px;
}

.gm-form .fluentform .ff-el-form-check-checkbox > span {
	margin-inline-start: 0;
}

/*
 * Errors: inline, Clay text and border. Text is never the only cue, the field
 * border changes too.
 */
.gm-form .fluentform .ff-el-is-error .ff-el-form-control {
	border-color: var(--wp--preset--color--clay);
}

.gm-form .fluentform .ff-el-is-error .ff-el-form-control:focus {
	box-shadow: 0 0 0 1px var(--wp--preset--color--clay);
}

.gm-form .fluentform .text-danger,
.gm-form .fluentform .error.text-danger {
	margin-top: 6px;
	color: var(--wp--preset--color--clay);
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.45;
}

.gm-form .fluentform .ff-errors-in-stack {
	margin-top: var(--wp--preset--spacing--20);
}

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

.gm-form .fluentform .ff-errors-in-stack .error {
	color: var(--wp--preset--color--clay);
	font-size: var(--wp--preset--font-size--small);
}

/* Success: Moss tint panel, text stays Soil for contrast. */
.gm-form .fluentform .ff-message-success {
	margin: 0;
	padding: var(--wp--preset--spacing--30);
	border: 1px solid var(--wp--preset--color--moss);
	border-radius: var(--wp--custom--radius--button);
	background: var(--wp--preset--color--moss-tint);
	box-shadow: none;
	color: var(--wp--preset--color--soil);
	font-size: var(--wp--preset--font-size--medium);
}

.gm-form .fluentform .ff-message-success p {
	margin: 0;
}

/*
 * Submit: the primary button. Selectors are doubled to beat Fluent Forms' per-
 * form inline colours.
 */
.gm-form .fluentform .ff-btn-submit.ff-btn-submit {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	padding: 0 24px;
	border: 0;
	border-radius: var(--wp--custom--radius--button);
	background: var(--wp--preset--color--moss);
	box-shadow: none;
	color: var(--wp--preset--color--on-moss);
	cursor: pointer;
	font-family: inherit;
	font-size: var(--wp--preset--font-size--medium);
	font-weight: 500;
	line-height: 1;
	transition: background-color 0.2s ease;
}

.gm-form .fluentform .ff-btn-submit.ff-btn-submit:hover,
.gm-form .fluentform .ff-btn-submit.ff-btn-submit:focus {
	background: var(--wp--preset--color--moss-deep);
	color: var(--wp--preset--color--on-moss);
	opacity: 1;
}

.gm-form .fluentform .ff-btn-submit.ff-btn-submit:focus-visible {
	outline: 2px solid var(--wp--preset--color--moss);
	outline-offset: 2px;
}

.gm-form .fluentform .ff-btn-submit.ff-btn-submit[disabled] {
	cursor: default;
	opacity: 0.6;
}

.gm-form .fluentform .ff_submit_btn_wrapper {
	margin-bottom: 0;
}

/*
 * On the Moss-tint band the field colour is 2.8:1 against the band, so use
 * Muted for the field border.
 */
.has-moss-tint-background-color .gm-form .fluentform .ff-el-form-control {
	border-color: var(--wp--preset--color--muted);
}

.has-moss-tint-background-color .gm-form .fluentform .ff-el-form-control:focus {
	border-color: var(--wp--preset--color--moss);
}

/*
 * Signup forms (notify me): tighter rhythm, the label stays visible.
 */
.gm-form--notify .fluentform .ff-el-group {
	margin-bottom: var(--wp--preset--spacing--20);
}

@media (prefers-reduced-motion: reduce) {

	.gm-form .fluentform .ff-btn-submit.ff-btn-submit {
		transition: none;
	}
}

/*
 * ---- Yoast breadcrumbs: 14px muted links, chevron separators, current page
 * in Soil, 44px targets.
 */
.yoast-breadcrumbs {
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.4;
}

.yoast-breadcrumbs > span {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
}

.yoast-breadcrumbs > span > span {
	display: inline-flex;
	align-items: center;
}

.yoast-breadcrumbs > span > span + span::before {
	content: "";
	flex: none;
	width: 6px;
	height: 6px;
	margin-inline: 10px;
	border-top: 1.5px solid var(--wp--preset--color--muted);
	border-inline-end: 1.5px solid var(--wp--preset--color--muted);
	transform: rotate(45deg);
}

.yoast-breadcrumbs a {
	display: inline-flex;
	align-items: center;
	min-width: 44px;
	min-height: 44px;
	color: var(--wp--preset--color--muted);
	text-decoration: none;
}

.yoast-breadcrumbs a:hover {
	color: var(--wp--preset--color--soil);
	text-decoration: underline;
}

.yoast-breadcrumbs .breadcrumb_last {
	color: var(--wp--preset--color--soil);
}

[dir="rtl"] .yoast-breadcrumbs > span > span + span::before {
	transform: rotate(-135deg);
}
