:root,
.editor-styles-wrapper,
body.login {
	--asca-form-font-family: var(--wp--preset--font-family--titillium-web, "Titillium Web", sans-serif);
	--asca-form-font-size: var(--wp--preset--font-size--body-sans, 1rem);
	--asca-form-line-height: 1.5;
	--asca-form-text: var(--wp--preset--color--black, #1d2327);
	--asca-form-background: var(--wp--preset--color--white, #ffffff);
	--asca-form-background-muted: #f6f7f7;
	--asca-form-border: color-mix(in srgb, var(--asca-form-text) 14%, white);
	--asca-form-border-strong: color-mix(in srgb, var(--asca-form-text) 30%, white);
	--asca-form-accent: var(--wp--preset--color--primary-main, #3169b1);
	--asca-form-accent-strong: var(--wp--preset--color--primary-dark-1, #244d81);
	--asca-form-placeholder: color-mix(in srgb, var(--asca-form-text) 55%, white);
	--asca-form-shadow: 0 0 0 0.1875rem color-mix(in srgb, var(--asca-form-accent) 18%, transparent);
	--asca-form-focus-outline: transparent;
	--asca-form-focus-offset: 0;
	--asca-form-radius: var(--wp--custom--border--radius--small, 3px);
	--asca-form-padding: 0.4rem;
	--asca-form-error: var(--wp--preset--color--porpora-main, #892a32);
	--asca-form-gap: 0.75rem;
	--asca-form-control-height: 3rem;
}

:where(.wp-site-blocks, .editor-styles-wrapper, body.block-editor-iframe__body, body.login) form {
	display: grid;
	gap: var(--asca-form-gap);
	font-family: var(--asca-form-font-family);
	font-size: var(--asca-form-font-size);
	line-height: var(--asca-form-line-height);
	color: var(--asca-form-text);
}

:where(.wp-site-blocks, .editor-styles-wrapper, body.block-editor-iframe__body, body.login) fieldset {
	margin: 0;
	padding: 1rem;
	border: 1px solid var(--asca-form-border);
	border-radius: var(--asca-form-radius);
}

:where(.wp-site-blocks, .editor-styles-wrapper, body.block-editor-iframe__body, body.login) legend,
:where(.wp-site-blocks, .editor-styles-wrapper, body.block-editor-iframe__body, body.login) label {
	font-family: var(--asca-form-font-family);
	font-size: var(--wp--preset--font-size--label, 1rem);
	font-weight: 600;
	line-height: 1.4;
	color: var(--asca-form-text);
}

:where(.wp-site-blocks, .editor-styles-wrapper, body.block-editor-iframe__body, body.login) legend {
	padding-inline: 0.25rem;
}

/* One specificity for every text control; include ASCA modals moved under body.
 * Keep native checkbox/radio/file/color/range/hidden controls outside this skin.
 * The login-only branch preserves precedence over WordPress core login CSS. */
.login #login :is(input:not(:where([type="checkbox"], [type="radio"], [type="submit"], [type="button"], [type="reset"], [type="file"], [type="color"], [type="range"], [type="hidden"])), textarea, select),
:is(.wp-site-blocks, .editor-styles-wrapper, .block-editor-iframe__body, .login, .asca-contacts-modal, .asca-contacts-form-block)
:is(input:not(:where([type="checkbox"], [type="radio"], [type="submit"], [type="button"], [type="reset"], [type="file"], [type="color"], [type="range"], [type="hidden"])), textarea, select) {
	box-sizing: border-box;
	inline-size: 100%;
	min-block-size: var(--asca-form-control-height);
	padding: var(--asca-form-padding);
	margin: 0 0 6px 0;
	border: 1px solid var(--asca-form-border);
	border-radius: var(--asca-form-radius);
	background: var(--asca-form-background);
	box-shadow: none;
	font-family: var(--asca-form-font-family);
	font-size: var(--asca-form-font-size);
	font-weight: 400;
	line-height: var(--asca-form-line-height);
	color: var(--asca-form-text);
	transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.login #login :is(input:not(:where([type="checkbox"], [type="radio"], [type="submit"], [type="button"], [type="reset"], [type="file"], [type="color"], [type="range"], [type="hidden"])), select:not([multiple])),
:is(.wp-site-blocks, .editor-styles-wrapper, .block-editor-iframe__body, .login, .asca-contacts-modal, .asca-contacts-form-block)
:is(input:not(:where([type="checkbox"], [type="radio"], [type="submit"], [type="button"], [type="reset"], [type="file"], [type="color"], [type="range"], [type="hidden"])), select:not([multiple])) {
	block-size: var(--asca-form-control-height);
}

:where(.wp-site-blocks, .editor-styles-wrapper, body.block-editor-iframe__body, body.login) :where(button[type="submit"], input[type="submit"]) {
	box-sizing: border-box;
	block-size: var(--asca-form-control-height);
	min-block-size: var(--asca-form-control-height);
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

:is(.wp-site-blocks, .editor-styles-wrapper, .block-editor-iframe__body, .login, .asca-contacts-modal, .asca-contacts-form-block) textarea {
	min-block-size: 8rem;
	resize: vertical;
}

:is(.wp-site-blocks, .editor-styles-wrapper, .block-editor-iframe__body, .login, .asca-contacts-modal, .asca-contacts-form-block) select {
	padding-right: 2.75rem;
	background-color: var(--asca-form-background);
}

:is(.wp-site-blocks, .editor-styles-wrapper, .block-editor-iframe__body, .login, .asca-contacts-modal, .asca-contacts-form-block) :is(input, textarea)::placeholder {
	color: var(--asca-form-placeholder);
	opacity: 1;
}

.login #login :is(input:not(:where([type="checkbox"], [type="radio"], [type="submit"], [type="button"], [type="reset"], [type="file"], [type="color"], [type="range"], [type="hidden"])), textarea, select):hover:not(:where(:disabled)),
:is(.wp-site-blocks, .editor-styles-wrapper, .block-editor-iframe__body, .login, .asca-contacts-modal, .asca-contacts-form-block)
:is(input:not(:where([type="checkbox"], [type="radio"], [type="submit"], [type="button"], [type="reset"], [type="file"], [type="color"], [type="range"], [type="hidden"])), textarea, select):hover:not(:where(:disabled)) {
	border-color: var(--asca-form-border-strong);
}

.login #login :is(input:not(:where([type="checkbox"], [type="radio"], [type="submit"], [type="button"], [type="reset"], [type="file"], [type="color"], [type="range"], [type="hidden"])), textarea, select):is(:focus, :focus-visible):not(:where(:disabled)),
:is(.wp-site-blocks, .editor-styles-wrapper, .block-editor-iframe__body, .login, .asca-contacts-modal, .asca-contacts-form-block)
:is(input:not(:where([type="checkbox"], [type="radio"], [type="submit"], [type="button"], [type="reset"], [type="file"], [type="color"], [type="range"], [type="hidden"])), textarea, select):is(:focus, :focus-visible):not(:where(:disabled)) {
	border-color: var(--asca-form-accent);
	/* One soft ring, not an outline stacked on top of the halo.
	 * Keep a real outline ready for high-contrast/forced-colors modes. */
	outline: 2px solid var(--asca-form-focus-outline);
	outline-offset: var(--asca-form-focus-offset);
	box-shadow: var(--asca-form-shadow);
}

.login #login :is(input:not(:where([type="checkbox"], [type="radio"], [type="submit"], [type="button"], [type="reset"], [type="file"], [type="color"], [type="range"], [type="hidden"])), textarea, select):is([aria-invalid="true"], :user-invalid):not(:where(:disabled)),
:is(.wp-site-blocks, .editor-styles-wrapper, .block-editor-iframe__body, .login, .asca-contacts-modal, .asca-contacts-form-block)
:is(input:not(:where([type="checkbox"], [type="radio"], [type="submit"], [type="button"], [type="reset"], [type="file"], [type="color"], [type="range"], [type="hidden"])), textarea, select):is([aria-invalid="true"], :user-invalid):not(:where(:disabled)) {
	border-color: var(--asca-form-error);
}

.login #login :is(input:not(:where([type="checkbox"], [type="radio"], [type="submit"], [type="button"], [type="reset"], [type="file"], [type="color"], [type="range"], [type="hidden"])), textarea, select):disabled,
:is(.wp-site-blocks, .editor-styles-wrapper, .block-editor-iframe__body, .login, .asca-contacts-modal, .asca-contacts-form-block)
:is(input:not(:where([type="checkbox"], [type="radio"], [type="submit"], [type="button"], [type="reset"], [type="file"], [type="color"], [type="range"], [type="hidden"])), textarea, select):disabled {
	background: var(--asca-form-background-muted);
	color: color-mix(in srgb, var(--asca-form-text) 70%, white);
	box-shadow: none;
	cursor: not-allowed;
}

:where(.wp-site-blocks, .editor-styles-wrapper, body.block-editor-iframe__body, body.login) input[type="checkbox"],
:where(.wp-site-blocks, .editor-styles-wrapper, body.block-editor-iframe__body, body.login) input[type="radio"] {
	inline-size: 1rem;
	block-size: 1rem;
	margin: 0.125rem 0.5rem 0 0;
	accent-color: var(--asca-form-accent);
}

:where(.wp-site-blocks, .editor-styles-wrapper, body.block-editor-iframe__body, body.login) input[type="checkbox"]:focus,
:where(.wp-site-blocks, .editor-styles-wrapper, body.block-editor-iframe__body, body.login) input[type="checkbox"]:focus-visible,
:where(.wp-site-blocks, .editor-styles-wrapper, body.block-editor-iframe__body, body.login) input[type="radio"]:focus,
:where(.wp-site-blocks, .editor-styles-wrapper, body.block-editor-iframe__body, body.login) input[type="radio"]:focus-visible {
	outline: 2px solid var(--asca-form-accent);
	outline-offset: 0.125rem;
	box-shadow: none !important;
}

:where(.wp-site-blocks, .editor-styles-wrapper, body.block-editor-iframe__body, body.login) .is-checkbox,
:where(.wp-site-blocks, .editor-styles-wrapper, body.block-editor-iframe__body, body.login) .is-radio,
:where(.wp-site-blocks, .editor-styles-wrapper, body.block-editor-iframe__body, body.login) .checkbox-group,
:where(.wp-site-blocks, .editor-styles-wrapper, body.block-editor-iframe__body, body.login) .radio-group {
	display: flex;
	align-items: flex-start;
	gap: 0.5rem;
}

:where(.wp-site-blocks, .editor-styles-wrapper, body.block-editor-iframe__body, body.login) .description,
:where(.wp-site-blocks, .editor-styles-wrapper, body.block-editor-iframe__body, body.login) .form-help,
:where(.wp-site-blocks, .editor-styles-wrapper, body.block-editor-iframe__body, body.login) .screen-reader-text + .description {
	margin: 0;
	font-size: var(--wp--preset--font-size--caption, 0.875rem);
	line-height: 1.45;
	color: color-mix(in srgb, var(--asca-form-text) 72%, white);
}

/* Accessibility preferences replace the translucent halo with a solid outline. */
html.asca-a11y-contrast,
html.asca-a11y-contrast :is(.editor-styles-wrapper, body.login) {
	--asca-form-focus-outline: #000;
	--asca-form-focus-offset: 3px;
	--asca-form-shadow: none;
}

@media (prefers-contrast: more) {
	:root, .editor-styles-wrapper, body.login {
		--asca-form-focus-outline: var(--asca-form-accent);
		--asca-form-focus-offset: 2px;
		--asca-form-shadow: none;
	}
}

@media (forced-colors: active) {
	:root, .editor-styles-wrapper, body.login {
		--asca-form-focus-outline: Highlight;
		--asca-form-focus-offset: 2px;
		--asca-form-shadow: none;
	}
}

@media (min-width: 48rem) {
	:where(.wp-site-blocks, .editor-styles-wrapper, body.block-editor-iframe__body, body.login) form {
		gap: 1rem;
	}
}
