/// @access private
/// @param {Boolean} $error-summary Whether to output inverse error summary styling
/// @param {Boolean} $radio Whether to output inverse radio input styling
/// @param {Boolean} $file Whether to output inverse file input styling
/// @output styles for inverse toggle based on a checkbox input
@mixin _oFormsInverse($error-summary: null, $radio: null, $file: null) {
	.o-forms-field--inverse {
		color: oPrivateFoundationGet('o3-color-use-case-body-inverse-text');

		.o-forms-title {
			.o-forms-title__main:after,
			.o-forms-title__prompt {
				color: rgba(_oFormsGet('toggle-inverse'), 0.7);
			}
		}

		.o-forms-input__label:before {
			background-color: _oFormsGet('toggle-inverse');
		}

		.o-forms-input__label:after {
			@include oPrivateIconsContent(
				'cross',
				$size: null,
				$color: _oFormsGet('toggle-inverse'),
				$include-base-styles: false
			);
			border-color: _oFormsGet('toggle-inverse');
			background-color: _oFormsGet('toggle-inverse-knob');
		}

		input {
			@include oPrivateNormaliseFocusApply() {
				@include oPrivateNormaliseFocusContentInverse();
			}
		}

		input[type='checkbox'] {
			&:focus {
				@include oPrivateNormaliseFocusUnsetContent();
				& + .o-forms-input__label:before {
					@include oPrivateNormaliseFocusContentInverse();
				}
			}

			// Unset :focus styles where :focus-visible is supported.
			// Ideally we would set `:focus-visible` by default and use
			// `@supports not selector(:focus-visible)` to provide a
			// `:focus` fallback, however some of our supported browsers
			// do not understand `@supports: selector()`.
			@supports selector(:focus-visible) {
				&:focus + .o-forms-input__label:before {
					@include oPrivateNormaliseFocusUnsetContent();
				}

				&:focus-visible {
					& + .o-forms-input__label:before {
						@include oPrivateNormaliseFocusContentInverse();
					}
				}
			}
		}

		input[type='checkbox']:checked {
			+ .o-forms-input__label:before {
				background-color: _oFormsGet('toggle-inverse-selected');
			}

			+ .o-forms-input__label:after {
				@include oPrivateIconsContent(
					'tick',
					$size: null,
					$color: _oFormsGet('toggle-inverse-selected'),
					$include-base-styles: false
				);
				border-color: _oFormsGet('toggle-inverse-selected');
			}
		}

		.o-forms-input--invalid {
			*:invalid:not(:disabled),
			input:not(:disabled),
			textarea:not(:disabled),
			select:not(:disabled) {
				color: _oFormsGet('invalid-base-color-inverse');
				border-color: _oFormsGet('invalid-base-border-inverse');

				+ .o-forms-input__label:before,
				+ .o-forms-input__label:after {
					border-color: _oFormsGet('invalid-base-border-inverse');
				}
			}

			.o-forms-input__error {
				color: _oFormsGet('invalid-base-inverse');
			}
		}

		@if $radio {
			.o-forms-input--radio-box {
				&.o-forms-input--invalid .o-forms-input--radio-box__container {
					border-color: _oFormsGet('invalid-base-border-inverse');
				}
			}
			.o-forms-input--radio-box__container {
				background-color: oPrivateFoundationGet('o3-color-palette-white');
			}

			.o-forms-input--radio-box input[type='radio'] {
				&:focus {
					@include oPrivateNormaliseFocusUnsetContent();
					& + .o-forms-input__label {
						@include oPrivateNormaliseFocusContentInverse();
					}
				}

				// Unset :focus styles where :focus-visible is supported.
				// Ideally we would set `:focus-visible` by default and use
				// `@supports not selector(:focus-visible)` to provide a
				// `:focus` fallback, however some of our supported browsers
				// do not understand `@supports: selector()`.
				@supports selector(:focus-visible) {
					&:focus + .o-forms-input__label {
						@include oPrivateNormaliseFocusUnsetContent();
					}

					&:focus-visible {
						& + .o-forms-input__label {
							@include oPrivateNormaliseFocusContentInverse();
						}
					}
				}
			}
		}

		@if $file {
			.o-forms-input--file ::file-selector-button {
				@include oPrivateButtonsContent(
					(
						'type': 'primary',
						'theme': 'inverse',
					)
				);
			}
		}
	}

	@if $error-summary {
		.o-forms__error-summary--inverse {
			background-color: _oFormsGet('error-summary-background-inverse');
			border-color: _oFormsGet('error-summary-border-inverse');
			border-width: 1px;
			border-style: solid;

			.o-forms__error-summary__heading {
				color: oPrivateFoundationGet('o3-color-palette-white');
			}

			.o-forms__error-summary__list {
				color: oPrivateFoundationGet('o3-color-palette-white');

				a {
					color: oPrivateFoundationGet('o3-color-palette-white');
					border-bottom: 1px solid _oFormsGet('invalid-base-inverse');
				}

				a:focus,
				a:focus-visible {
					outline-color: inherit;
				}
			}
		}
	}
}
