/* Page defaults are inherited by every form and confirmation notice. */
:root, .ohso-form-accent--default {
	--form-accent: var(--primary);
	--form-accent-dark: var(--primary-dark);
	--form-accent-light: var(--primary-light);
	--form-accent-surface: var(--secondary-ultra-light);
}
.ohso-form-accent--law {
	--form-accent: var(--law-accent);
	--form-accent-dark: var(--law-accent-semi-dark);
	--form-accent-light: var(--law-accent-light);
	--form-accent-surface: var(--law-accent-ultra-light);
}
.ohso-form-accent--barrister {
	--form-accent: var(--barrister-accent);
	--form-accent-dark: var(--barrister-accent-semi-dark);
	--form-accent-light: var(--barrister-accent-light);
	--form-accent-surface: var(--barrister-accent-ultra-light);
}
.ohso-form-accent--expert {
	--form-accent: var(--expert-accent);
	--form-accent-dark: var(--expert-accent-semi-dark);
	--form-accent-light: var(--expert-accent-light);
	--form-accent-surface: var(--expert-accent-utra-light);
}
.ohso-form-accent--family {
	--form-accent: var(--family-accent);
	--form-accent-dark: var(--family-accent-semi-dark);
	--form-accent-light: var(--family-accent-light);
	--form-accent-surface: var(--family-accent-ultra-light);
}

/* Override plugin theme colours without changing each form's layout. */
.gform_wrapper {
	--gf-color-primary: var(--form-accent) !important;
	--gf-color-primary-darker: var(--form-accent-dark) !important;
	--gf-color-primary-lighter: var(--form-accent-light) !important;
	--gf-color-in-ctrl-primary: var(--form-accent) !important;
	--gf-color-in-ctrl-primary-darker: var(--form-accent-dark) !important;
	--gf-color-in-ctrl-primary-lighter: var(--form-accent-light) !important;
}
.gform_wrapper :is(.gfield_label, .gform-field-label--type-sub, .gsection_title, .gform_title) { color: var(--form-accent-dark); }
.gform_wrapper .ginput_container :is(input:not([type='checkbox']):not([type='radio']):not([type='file']):not([type='hidden']):not([type='submit']):not([type='button']), select, textarea) { border-color: var(--form-accent-light); color: var(--form-accent-dark); }
.gform_wrapper :is(.gform_button, .gform_next_button, .gform_previous_button, .gform_button_select_files) { border-color: var(--form-accent); background-color: var(--form-accent); color: var(--white); }
.gform_wrapper :is(.gform_button, .gform_next_button, .gform_previous_button, .gform_button_select_files):hover { border-color: var(--form-accent-dark); background-color: var(--form-accent-dark); color: var(--white); }
.gform_wrapper .gchoice:has(:checked) { border-color: var(--form-accent); }
.gform_wrapper :is(input, select, textarea, button):focus-visible { outline: 2px solid var(--form-accent); outline-offset: 2px; }
.gform_wrapper .gfield_error .ginput_container :is(input, select, textarea) { border-color: var(--accent-semi-dark); }

/* Native forms share the palette while directory controls keep their own layout. */
form :is(input, select, textarea) { accent-color: var(--form-accent); }
form:not([id^='gform_']):not(.ohso-directory__filters) label { color: var(--form-accent-dark); }
form:not([id^='gform_']):not(.ohso-directory__filters) :is(input:not([type='hidden']):not([type='checkbox']):not([type='radio']):not([type='submit']):not([type='button']), select, textarea) { border-color: var(--form-accent-light); }
form:not([id^='gform_']):not(.ohso-directory__filters) :is(button[type='submit'], input[type='submit']) { border-color: var(--form-accent); background-color: var(--form-accent); color: var(--white); }
form:not([id^='gform_']):not(.ohso-directory__filters) :is(button[type='submit'], input[type='submit']):hover { border-color: var(--form-accent-dark); background-color: var(--form-accent-dark); }
form:not([id^='gform_']):not(.ohso-directory__filters) :is(input, select, textarea, button):focus-visible { outline: 2px solid var(--form-accent); outline-offset: 2px; }

/* Shared presentation applies to existing and future Gravity Forms. */
.gform_wrapper[id] {
	grid-column: 1 / -1;
	justify-self: center;
	width: 100%;
	max-width: 900px;
	margin: var(--space-m) auto;
	font-family: var(--font-body);
	font-size: var(--text-m);
	color: var(--neutral-dark);
}

.gform_wrapper[id] > form {
	padding: var(--space-s);
	border: 1px solid var(--form-accent-light);
	border-radius: var(--radius-l);
	background: var(--form-accent-surface);
}

.gform_wrapper[id] .gform_fields {
	row-gap: var(--space-s);
	column-gap: var(--space-xs);
}

.gform_wrapper[id] .gfield {
	min-width: 0;
}

.gform_wrapper[id] .gfield_label,
.gform_wrapper[id] .gform-field-label--type-sub {
	display: block;
	margin-bottom: var(--space-xxs);
	font-family: var(--font-body);
	font-size: var(--text-m);
	font-weight: 600;
	line-height: 1.4;
	color: var(--form-accent-dark);
}

.gform_wrapper[id] .gfield_required_text {
	font-size: 0;
}

.gform_wrapper[id] .gfield_required_text::after {
	content: '*';
	font-size: var(--text-s);
	color: var(--form-accent-dark);
}

.gform_wrapper[id] .ginput_container input:is([type='text'], [type='email'], [type='tel'], [type='number'], [type='url'], [type='search'], [type='password'], [type='date']),
.gform_wrapper[id] .ginput_container select,
.gform_wrapper[id] .ginput_container textarea {
	width: 100%;
	max-width: none;
	min-height: 60px;
	padding: var(--space-xs);
	border: 1px solid var(--form-accent-light);
	border-radius: var(--radius-s);
	background: var(--white);
	box-shadow: none;
	font-family: var(--font-body);
	font-size: var(--text-m);
	line-height: 1.5;
	color: var(--form-accent-dark);
}

.gform_wrapper[id] .ginput_container textarea {
	min-height: 160px;
	resize: vertical;
}

.gform_wrapper[id] .ginput_container input:focus-visible,
.gform_wrapper[id] .ginput_container select:focus-visible,
.gform_wrapper[id] .ginput_container textarea:focus-visible,
.gform_wrapper[id] .gchoice:focus-within,
.gform_wrapper[id] .gform_button:focus-visible {
	outline: 2px solid var(--form-accent);
	outline-offset: 2px;
}

.gform_wrapper[id] .gfield_radio,
.gform_wrapper[id] .gfield_checkbox {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--space-xxs);
}

.gform_wrapper[id] .gchoice {
	position: relative;
	display: flex;
	align-items: center;
	gap: var(--space-xxs);
	min-width: 0;
	min-height: 56px;
	padding: var(--space-xxs) var(--space-xs);
	border: 1px solid var(--form-accent-light);
	border-radius: var(--radius-s);
	background: var(--white);
	font-size: var(--text-m);
	line-height: 1.5;
	cursor: pointer;
}

.gform_wrapper[id] .gchoice:has(:checked) {
	border-color: var(--form-accent);
	background: var(--white);
}

.gform_wrapper[id] .gchoice input {
	flex: 0 0 auto;
	margin: 0;
	accent-color: var(--form-accent);
}

.gform_wrapper[id] .gchoice label {
	position: static;
	flex: 1;
	margin: 0;
	font-family: var(--font-body);
	font-size: var(--text-s);
	line-height: 1.4;
	color: var(--form-accent-dark);
	cursor: pointer;
}


/* Extend the native label action across the card, including its padding. */
.gform_wrapper[id] .gchoice > label::after {
	content: '';
	position: absolute;
	inset: 0;
	border-radius: inherit;
	cursor: pointer;
}
.gform_wrapper[id] .gchoice > :is(input, select, textarea, button),
.gform_wrapper[id] .gchoice label a {
	position: relative;
	z-index: 1;
}

/* International phone controls use the same height and palette as text inputs. */
.gform_wrapper[id] .gfield--type-phone .gform-phone .gform-phone__country-selector.gform-theme-button {
	box-sizing: border-box;
	min-block-size: 60px;
	block-size: 60px;
	inline-size: auto;
	padding-block: 0;
	padding-inline: var(--space-xs);
	border: 1px solid var(--form-accent-light);
	border-start-start-radius: var(--radius-s);
	border-end-start-radius: var(--radius-s);
	border-start-end-radius: 0;
	border-end-end-radius: 0;
	background: var(--white);
	box-shadow: none;
	font-family: var(--font-body);
	font-size: var(--text-m);
	line-height: 1.5;
	color: var(--form-accent-dark);
}
.gform_wrapper[id] .gfield--type-phone .gform-phone .gform-phone__country-selector.gform-theme-button:is(:hover, [aria-expanded="true"]) {
	background: var(--form-accent-surface);
	border-color: var(--form-accent);
	color: var(--form-accent-dark);
}
.gform_wrapper[id] .gform-phone input.gform-phone__input {
	border-start-start-radius: 0;
	border-end-start-radius: 0;
}
.gform_wrapper[id] .gform-phone .gform-phone__dial-code {
	font-size: inherit;
}
.gform_wrapper[id] .gform-phone .gform-phone__dropdown {
	border: 1px solid var(--form-accent-light);
	border-radius: var(--radius-s);
	background: var(--white);
	box-shadow: var(--box-shadow-s);
	font-family: var(--font-body);
	font-size: var(--text-s);
	color: var(--form-accent-dark);
}
.gform_wrapper[id] .gform-phone .gform-phone__search-wrapper {
	padding: var(--space-xs);
	background: var(--white);
}
.gform_wrapper[id] .gform-phone .gform-phone__search-wrapper input.gform-phone__search {
	min-height: 44px;
	padding-block: var(--space-xxs);
	padding-inline-start: 32px;
	font-size: var(--text-s);
}
.gform_wrapper[id] .gform-phone .gform-phone__country-list {
	font-family: var(--font-body);
	padding-block: var(--space-xxs);
}
.gform_wrapper[id] .gform-phone .gform-phone__country-item {
	min-height: 44px;
	padding: var(--space-xxs) var(--space-xs);
	font-size: var(--text-s);
	color: var(--form-accent-dark);
}
.gform_wrapper[id] .gform-phone .gform-phone__country-item:is(:hover, .gform-phone__country-item--focused, .gform-phone__country-item--active) {
	background: var(--form-accent-surface);
	box-shadow: inset 3px 0 0 var(--form-accent);
	color: var(--form-accent-dark);
}

.gform_wrapper[id] .gform_drop_area {
	padding: var(--space-s);
	border: 1px dashed var(--form-accent-light);
	border-radius: var(--radius-s);
	background: var(--white);
	color: var(--neutral-dark);
}

.gform_wrapper[id] .ginput_container input[type='file'] {
	width: 100%;
	padding: var(--space-xs);
	border: 1px dashed var(--form-accent-light);
	border-radius: var(--radius-s);
	background: var(--white);
	font-family: var(--font-body);
	font-size: var(--text-s);
	color: var(--neutral-dark);
}

.gform_wrapper[id] .ginput_container input[type='file']::file-selector-button {
	margin-right: var(--space-xs);
	padding: var(--space-xxs) var(--space-xs);
	border: 1px solid var(--form-accent);
	border-radius: var(--radius-m);
	background: var(--form-accent);
	font: inherit;
	font-weight: 700;
	color: var(--white);
	cursor: pointer;
	transition: background-color var(--transition), border-color var(--transition);
}

.gform_wrapper[id] .ginput_container input[type='file']::file-selector-button:hover {
	background: var(--form-accent-dark);
	border-color: var(--form-accent-dark);
}

.gform_wrapper[id] .gform_button_select_files,
.gform_wrapper[id] .gform_button {
	min-height: 56px;
	padding: var(--space-xs) var(--space-s);
	border: 1px solid var(--form-accent);
	border-radius: var(--radius-m);
	background: var(--form-accent);
	font-family: var(--font-body);
	font-size: var(--text-s);
	font-weight: 700;
	line-height: 1.5;
	color: var(--white);
	cursor: pointer;
	transition: background-color var(--transition), border-color var(--transition);
}

.gform_wrapper[id] .gform_button_select_files:hover,
.gform_wrapper[id] .gform_button:hover {
	border-color: var(--form-accent-dark);
	background: var(--form-accent-dark);
	color: var(--white);
}

.gform_wrapper[id] .gform_footer {
	margin-top: var(--space-s);
	padding: 0;
}

.gform_wrapper[id] .gfield_description,
.gform_wrapper[id] .gform_fileupload_rules {
	font-size: var(--text-s);
	line-height: 1.5;
	color: var(--neutral-dark);
}

.gform_wrapper[id] .gfield_error .ginput_container input,
.gform_wrapper[id] .gfield_error .ginput_container textarea,
.gform_wrapper[id] .gfield_error .gchoice {
	border-color: var(--accent-semi-dark);
}

.gform_wrapper[id] .gform_validation_errors,
.form-already-submitted {
	width: 100%;
	max-width: 900px;
	margin: var(--space-m) auto;
	padding: var(--space-s);
	border: 1px solid var(--form-accent-light);
	border-radius: var(--radius-l);
	background: var(--form-accent-surface);
	font-family: var(--font-body);
	font-size: var(--text-m);
	line-height: 1.5;
	color: var(--form-accent-dark);
}

.site-main > .form-already-submitted {
	grid-column: 1 / -1;
	justify-self: center;
}

.form-already-submitted p {
	margin: 0;
}

.form-already-submitted a {
	font-weight: 700;
	color: var(--form-accent);
}

/* Confirmation messages keep the form's space and palette after submission. */
.gform_confirmation_wrapper[id][class],
.gform_confirmation_message:not(.gform_confirmation_wrapper .gform_confirmation_message) {
	box-sizing: border-box;
	grid-column: 1 / -1;
	justify-self: center;
	width: 100%;
	max-width: 900px;
	margin: var(--space-m) auto;
	padding: var(--space-s);
	border: 1px solid var(--form-accent-light);
	border-radius: var(--radius-l);
	background: var(--form-accent-surface);
	box-shadow: none;
	font-family: var(--font-body);
	font-size: var(--text-m);
	line-height: 1.5;
	color: var(--form-accent-dark);
	overflow-wrap: anywhere;
}
.gform_confirmation_wrapper[id][class] .gform_confirmation_message {
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	font: inherit;
	color: inherit;
	max-inline-size: none;
	text-shadow: none;
}
.gform_confirmation_wrapper[id][class] :is(p, ul, ol) {
	font-size: inherit;
	line-height: inherit;
	color: inherit;
}
.gform_confirmation_wrapper[id][class] :is(h1, h2, h3, h4, h5, h6) {
	font-family: var(--font-heading);
	color: var(--form-accent-dark);
}
.gform_confirmation_wrapper[id][class] > :first-child,
.gform_confirmation_wrapper[id][class] .gform_confirmation_message > :first-child { margin-top: 0; }
.gform_confirmation_wrapper[id][class] > :last-child,
.gform_confirmation_wrapper[id][class] .gform_confirmation_message > :last-child { margin-bottom: 0; }
.gform_confirmation_wrapper[id][class] a:not(.wp-element-button):not(.wp-block-button__link) {
	color: var(--form-accent-dark);
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: .15em;
	transition: color var(--transition);
}
.gform_confirmation_wrapper[id][class] a:not(.wp-element-button):not(.wp-block-button__link):hover { color: var(--form-accent); }
.gform_confirmation_wrapper[id][class] a:focus-visible { outline: 2px solid var(--form-accent); outline-offset: 3px; }

.gform_confirmation_wrapper[id]:is(.gf_confirmation_yellow_gradient, .gf_confirmation_green_gradient)::before,
.gform_confirmation_wrapper[id]:is(.gf_confirmation_yellow_gradient, .gf_confirmation_green_gradient)::after { content: none; }

@media (max-width: 600px) {
	.gform_wrapper[id] .gfield_radio,
	.gform_wrapper[id] .gfield_checkbox {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* The content container supplies the space above embedded forms and their notices. */
.ohso-content-container :is(
	.gform_wrapper[id],
	.gform_confirmation_wrapper[id][class],
	.gform_confirmation_message:not(.gform_confirmation_wrapper .gform_confirmation_message),
	.form-already-submitted
) {
	margin-top: 0;
}
