/**
 * Gravity Forms styles
 */

.gform-theme.gform-theme--orbital {
	/* Global */
	--gf-ctrl-border-color: var(--wp--preset--color--gray-lighter) !important;
	--gf-ctrl-border-color-focus: var(--wp--preset--color--primary);
	--gf-ctrl-border-width: 1px;
	--gf-ctrl-font-size: 16px;
	--gf-ctrl-outline-width: 0px;
	--gf-ctrl-outline-offset: 0px;
	--gf-ctrl-shadow: none;
	--gf-ctrl-transition: all var(--wp--custom--transition--hover);

	/* Buttons */
	--gf-ctrl-btn-bg-color-primary: var(--wp--preset--color--primary);
	--gf-ctrl-btn-bg-color-hover-primary: var(--wp--preset--color--contrast);
	--gf-ctrl-btn-padding-y: calc(var(--wp--preset--spacing--20) - 1px);
	--gf-ctrl-btn-padding-x: calc(var(--wp--preset--spacing--30) - 1px);
	--gf-ctrl-btn-font-size: 16px !important;
	--gf-ctrl-btn-font-weight: 700;
	--gf-ctrl-btn-icon-gap: 10px;
	--gf-ctrl-btn-letter-spacing: 0;
	--gf-ctrl-btn-line-height: 1;
	--gf-ctrl-btn-radius: var(--wp--preset--border-radius--small);

	/* Labels */
	--gf-ctrl-label-color-primary: var(--wp--preset--color--contrast);
	--gf-ctrl-label-font-size-primary: var(--wp--custom--kicker--default--font-size);
	--gf-ctrl-label-font-weight-primary: var(--wp--custom--kicker--default--font-weight);
	--gf-ctrl-label-letter-spacing-primary: var(--wp--custom--kicker--default--letter-spacing);
	--gf-ctrl-label-line-height-primary: 1;
	--gf-ctrl-label-color-tertiary: var(--wp--preset--color--contrast);
	--gf-ctrl-label-font-size-tertiary: var(--wp--custom--kicker--default--font-size);
	--gf-ctrl-label-font-weight-tertiary: var(--wp--custom--kicker--default--font-weight);
	--gf-ctrl-label-letter-spacing-tertiary: var(--wp--custom--kicker--default--letter-spacing);
	--gf-ctrl-label-line-height-tertiary: 1;
	--gf-ctrl-label-color-req: var(--wp--preset--color--contrast);
	--gf-ctrl-label-line-height-req: 1;
	--gf-label-req-gap: 1px;

	/* Field */
	--gf-field-gap-x: var(--wp--preset--spacing--20);
	--gf-field-gap-y: var(--wp--preset--spacing--20);

	/* Form */
	--gf-form-footer-margin-y-start: var(--wp--preset--spacing--30);
	--gf-form-gap-x: var(--wp--preset--spacing--20);
	--gf-form-gap-y: var(--wp--preset--spacing--20);
	--gf-form-spinner-fg-color: var(--wp--preset--color--primary);

	/* Text inputs */
	:is(input[type='email'], input[type='phone'], input[type='text'],
input[type='url'], input[type='tel'], input[type='number'], select, textarea) {
		--gf-local-font-size: 16px;
		--gf-local-line-height: 1;
		--gf-local-height: auto;
		--gf-local-padding-y: var(--wp--preset--spacing--15);
		--gf-local-padding-x: var(--wp--preset--spacing--20);
		--gf-local-radius: var(--wp--preset--border-radius--small);
		--gf-local-transition: none;
	}

	/* Adjusts input borders on focus */
	:is(input[type='email'], input[type='phone'], input[type='text'],
input[type='url'], input[type='tel'], input[type='number'], select, textarea):focus-visible {
		--gf-local-transition: none;
		/* stylelint-disable-next-line declaration-block-no-duplicate-properties */
		outline: 2px auto Highlight;
		outline: 2px auto -webkit-focus-ring-color;
	}

	/* --- Checkbox and radio inputs --- */
	:is(.gfield_radio, .gfield_checkbox) {
		.gform-field-label--type-inline {
			--gf-local-font-size: 18px;
		}
	}

	:is(input[type='checkbox'], input[type='radio']) {
		--gf-ctrl-choice-check-color: var(--wp--preset--color--base);
		--gf-ctrl-choice-size: 24px;
		--gf-local-radius: var(--wp--preset--border-radius--small);
		--gf-local-transition: none;

		align-items: center;
	}

	:is(input[type='checkbox'], input[type='radio']):checked {
		background-color: var(--wp--preset--color--primary);
	}


	/* Inline Variant for Checkboxes and Radio Buttons */
	.gfield--type-choice--inline.gfield--type-choice :is(.gfield_radio, .gfield_checkbox) {
		--gf-field-choice-gap: var(--wp--preset--spacing--40);

		flex-direction: row;
	}

	/* Checkbox */
	.gfield_checkbox {
		input[type='checkbox'] {
			--gf-local-radius: 0;
		}
	}

	/* Radio */
	input[type='radio'] {
		--gf-ctrl-radio-check-size: calc(var(--gf-ctrl-choice-size) * 0.25);
	}

	/* Consent checkbox */
	.ginput_container.ginput_container_consent {
		display: flex;
		gap: var(--wp--preset--spacing--10);
	}

	.gfield.gfield--type-consent.gfield--input-type-consent {
		margin-block: var(--wp--preset--spacing--10) 0;
	}


	/* Labels */
	.gfield_label.gform-field-label, .gform-field-label--type-sub {
		text-transform: uppercase;
	}

	.gfield:not(.field_sublabel_above) {
		& .gform-field-label--type-sub {
			font-size: 14px;
			text-transform: revert;
		}
	}

	/* Legend - Hide "required" text note */
	.gform_required_legend {
		font-size: 0;
	}

	/* Change "required to an asterisk */
	.gfield_required {
		.gfield_required_text {
			font-size: 0;
		}

		.gfield_required_text::before {
			font-size: 16px;
			content: '*';
		}
	}

	.ginput_container {
		position: relative;
	}

	/* Max character counters */
	.gfield_description.ginput_counter {
		position: absolute;
		block-size: 1px;
		inline-size: 1px;
		margin: -1px;
		padding: 0;
		border: 0;
		overflow: hidden;
		clip-path: inset(50%);
		overflow-wrap: normal !important;
		word-break: normal !important;
	}

	:where(input, textarea):has(+ .gfield_description.ginput_counter):focus {
		border-end-end-radius: 0;
	}

	:where(input, textarea):focus + .gfield_description.ginput_counter,
	.gfield_description.ginput_counter:focus {
		display: block;
		inset-block-start: 100%;
		inset-inline-end: 2px;
		block-size: auto;
		inline-size: auto;
		padding: 0.5em;
		background-color: var(--wp--preset--color--primary);
		border-radius: 0 0 4px 4px;
		color: var(--wp--preset--color--base);
		font-size: 10px;
		font-weight: 700;
		line-height: 1;
		text-decoration: none;
		text-transform: uppercase;
		z-index: 100000;
		clip-path: none;
	}

	/* Errors */
	.gform_submission_error:last-child {
		margin-block-end: 0;
	}

	/* Spinner style */
	.gform_ajax_spinner {
		block-size: auto !important;
		inline-size: 32px !important;
	}

	/* If Turnstile field is last-child of body, pull next sibling up */
	.gform-body:has(> .gform_fields > .gfield--type-turnstile:last-child) {
		margin-block-end: calc(var(--wp--preset--spacing--10) * -2);
	}
}
