.visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.form-modal {
	position: fixed;
	inset: 0;
	display: flex;
	padding: 24px 20px;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;

	&[hidden] {
		display: none;
	}

	& .form-modal__backdrop {
		position: absolute;
		inset: 0;
		background: rgba(28, 30, 40, 0.48);
		backdrop-filter: blur(4px);
	}

	& .form-modal__dialog {
		position: relative;
		display: flex;
		width: min(100%, 1100px);
		max-height: min(92vh, 900px);
		flex-direction: column;
		outline: none;
	}

	& .form-modal__content {
		position: relative;
		overflow: auto;
		width: 100%;
		max-height: min(92vh, 900px);
		background: rgba(230, 231, 237, 0.96);
		box-shadow: 0 32px 100px rgba(36, 38, 53, 0.2);
	}

	& .form-modal__body {
		display: flex;
		padding: 70px 56px 56px;
		flex-direction: column;
		gap: 32px;
	}

	& .form-modal__close {
		position: absolute;
		top: 20px;
		right: 20px;
		z-index: 2;
		display: inline-flex;
		width: 40px;
		height: 40px;
		padding: 0;
		align-items: center;
		justify-content: center;
		border: none;
		background: transparent;
		color: #5a5b6c;
		cursor: pointer;
		transition: opacity 0.2s ease-out;

		& svg {
			display: block;
		}

		&:focus-visible {
			outline: 2px solid #868bab;
			outline-offset: 2px;
		}
	}

	& .form-modal__header {
		display: flex;
		max-width: 720px;
		margin: 0 auto;
		flex-direction: column;
		gap: 12px;
		align-items: center;
		text-align: center;
	}

	& .form-modal__title {
		margin: 0;
		font-size: 46px;
		font-style: normal;
		font-weight: 400;
		line-height: 1.1;
		color: #5a5b6c;
	}

	& .form-modal__description {
		color: #5a5b6c;
		font-size: 16px;
		font-weight: 300;
		line-height: 1.45;

		& > *:first-child {
			margin-top: 0;
		}

		& > *:last-child {
			margin-bottom: 0;
		}
	}

	& .form-modal__status,
	& .form-modal__success {
		display: flex;
		padding: 24px;
		flex-direction: column;
		gap: 12px;
		border: 1px solid rgba(134, 139, 171, 0.28);
		background: rgba(255, 255, 255, 0.55);
		color: #5a5b6c;
	}

	& .form-modal__status {
		color: #aa2d2d;
	}

	& .form-modal__success-title {
		margin: 0;
		font-size: 28px;
		font-weight: 400;
		line-height: 1.2;
		color: #5a5b6c;
	}

	& .form-modal__success-text {
		color: #5a5b6c;
		line-height: 1.5;

		& > *:first-child {
			margin-top: 0;
		}

		& > *:last-child {
			margin-bottom: 0;
		}
	}

	& .form-modal__actions {
		display: flex;
		justify-content: center;
	}

	& .form-modal__actions--center {
		margin-top: 8px;
	}

	& .form-modal__submit.btn,
	& .form-modal__success .btn,
	& button.form-modal__submit {
		display: inline-flex;
		min-height: 44px;
		padding: 12px 84px;
		align-items: center;
		justify-content: center;
		border: none;
		border-radius: 999px;
		background: rgba(255, 255, 255, 0.9);
		color: #5a5b6c;
		font-size: 14px;
		font-weight: 400;
		line-height: 20px;
		cursor: pointer;
		transition: background 0.2s ease-out, opacity 0.2s ease-out;
	}
}

.form-modal-form {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 28px;

	& .form-modal-form__form {
		display: flex;
		flex-direction: column;
		gap: 28px;
		margin: 0;
	}

	& .form-modal-form__loading {
		position: absolute;
		inset: 0;
		z-index: 3;
		display: flex;
		padding: 24px;
		align-items: center;
		justify-content: center;
		background: rgba(230, 231, 237, 0.75);
		backdrop-filter: blur(3px);
	}

	& .form-modal-form__loading[hidden] {
		display: none;
	}

	& .form-modal-form__loading-text {
		display: inline-flex;
		align-items: center;
		gap: 12px;
		color: #5a5b6c;
		font-size: 15px;
		line-height: 1.4;

		&::before {
			content: "";
			width: 18px;
			height: 18px;
			border: 2px solid rgba(134, 139, 171, 0.35);
			border-top-color: #5a5b6c;
			border-radius: 50%;
			animation: form-modal-spin 0.8s linear infinite;
		}
	}

	& .form-modal-form__grid {
		display: flex;
		flex-wrap: wrap;
		gap: 24px 20px;
	}

	& .form-modal-form__field {
		position: relative;
		display: flex;
		flex: 1 1 calc(50% - 10px);
		min-width: min(360px, 100%);
		flex-direction: column;
		gap: 10px;
	}

	& .form-modal-form__field--wide {
		flex-basis: 100%;
	}

	& .form-modal-form__field--option {
		gap: 8px;
	}

	& .form-modal-form__field--error .form-modal-form__control,
	& .form-modal-form__field--error textarea,
	& .form-modal-form__field--error select {
		border-bottom-color: #aa2d2d;
	}

	& .form-modal-form__label {
		font-size: 14px;
		line-height: 1.3;
		color: #868bab;
	}

	& .form-modal-form__required {
		color: #aa2d2d;
	}

	& .form-modal-form__field-error,
	& .form-modal-form__policy-error {
		font-size: 13px;
		line-height: 1.4;
		color: #aa2d2d;
	}

	& .form-modal-form__control-wrap {
		width: 100%;
	}

	& .form-modal-form__control,
	& .form-modal-form__control-wrap input[type="text"],
	& .form-modal-form__control-wrap input[type="email"],
	& .form-modal-form__control-wrap input[type="tel"],
	& .form-modal-form__control-wrap input[type="file"],
	& .form-modal-form__control-wrap textarea,
	& .form-modal-form__control-wrap select {
		box-sizing: border-box;
		width: 100%;
		padding: 10px 0 11px;
		border: none;
		border-bottom: 1px solid #868bab;
		border-radius: 0;
		background: transparent;
		font-family: inherit;
		font-size: 16px;
		font-weight: 400;
		line-height: 22px;
		color: #5a5b6c;
		outline: none;
		transition: box-shadow 0.15s ease-out, border-color 0.15s ease-out;

		&::placeholder {
			color: rgba(90, 91, 108, 0.55);
		}

		&:focus {
			border-bottom-color: #5a5b6c;
			box-shadow: 0 1px 0 0 #5a5b6c;
		}
	}

	& .form-modal-form__control-wrap textarea {
		min-height: 120px;
		resize: vertical;
	}

	& .form-modal-form__control-wrap select {
		padding-right: 24px;
		cursor: pointer;
	}

	& .form-modal-form__control-wrap label {
		display: inline-flex;
		align-items: flex-start;
		gap: 10px;
		color: #5a5b6c;
		line-height: 1.45;
		cursor: pointer;
	}

	& .form-modal-form__checkbox,
	& .form-modal-form__control-wrap input[type="checkbox"] {
		appearance: none;
		flex-shrink: 0;
		width: 20px;
		height: 20px;
		margin: 2px 0 0;
		border: 1px solid rgba(90, 91, 108, 0.7);
		border-radius: 0;
		background: transparent;
		cursor: pointer;
		transition: background 0.15s ease-out, box-shadow 0.15s ease-out;

		&:checked {
			background: #5a5b6c;
			box-shadow: inset 0 0 0 2px #e6e7ed;
		}

		&:focus-visible {
			outline: 2px solid #868bab;
			outline-offset: 2px;
		}
	}

	& .form-modal-form__control-wrap input[type="radio"] {
		accent-color: #5a5b6c;
	}

	& .form-modal-form__captcha-title {
		font-size: 14px;
		line-height: 1.3;
		color: #868bab;
	}

	& .form-modal-form__captcha-image img {
		display: block;
		max-width: 180px;
		height: auto;
	}

	& .form-modal-form__policy {
		margin: 0;
		padding: 0;
		border: none;
	}

	& .form-modal-form__policy-row {
		display: flex;
		align-items: flex-start;
		gap: 10px;
	}

	& .form-modal-form__policy-label {
		color: #868bab;
		font-size: 14px;
		line-height: 1.45;
		cursor: pointer;

		& a {
			color: inherit;
			text-decoration: underline;
			text-underline-offset: 2px;
		}
	}

	& .form-modal-form__required-note {
		color: #868bab;
		font-size: 13px;
		line-height: 1.4;
	}

	& .starrequired {
		display: none;
	}

	& input[type="submit"][name="web_form_apply"],
	& input[type="reset"] {
		display: none !important;
	}
}

.form-modal[data-form-modal-loading="Y"] {
	& .form-modal__close,
	& .form-modal__backdrop {
		pointer-events: none;
	}

	& .form-modal-form__loading {
		display: flex;
	}

	& .form-modal__submit.btn,
	& button.form-modal__submit,
	& input[data-form-modal-submit] {
		opacity: 0.75;
		cursor: wait;
		pointer-events: none;
	}
}

@keyframes form-modal-spin {
	from {
		transform: rotate(0deg);
	}

	to {
		transform: rotate(360deg);
	}
}

@media (hover: hover) {
	.form-modal {
		& .form-modal__close:hover {
			opacity: 0.7;
		}

		& .form-modal__submit.btn:hover,
		& .form-modal__success .btn:hover,
		& button.form-modal__submit:hover {
			background: #ffffff;
		}
	}
}

@media (max-width: 900px) {
	.form-modal {
		& .form-modal__body {
			padding: 60px 28px 32px;
		}

		& .form-modal__title {
			font-size: 34px;
		}

		& .form-modal__submit.btn,
		& .form-modal__success .btn,
		& button.form-modal__submit {
			padding: 12px 32px;
		}
	}

	.form-modal-form {
		& .form-modal-form__field {
			flex-basis: 100%;
			min-width: 0;
		}
	}
}

@media (max-width: 600px) {
	.form-modal {
		padding: 12px;

		& .form-modal__body {
			padding: 56px 20px 24px;
			gap: 24px;
		}

		& .form-modal__title {
			font-size: 26px;
		}

		& .form-modal__submit.btn,
		& .form-modal__success .btn,
		& button.form-modal__submit {
			width: 100%;
		}
	}
}