/*
 * HiveMail signup form (release 1.0, slice 31). Hand-written, shipped as it is.
 *
 * The form takes the look of the site it is on: the font, the text colour and the size come from the page. The one thing it
 * brings is an accent (the button and the focus ring). To change it, set --hivemail-form-accent on the form or on a parent:
 *
 *   .hivemail-form-wrap { --hivemail-form-accent: #0a7d3c; }
 */
.hivemail-form-wrap {
	--hivemail-form-accent: #5539fb;
	--hivemail-form-on-accent: #fff;
	--hivemail-form-danger: #b42318;
	--hivemail-form-danger-text: var(--hivemail-form-danger);
	--hivemail-form-success: #157f3b;
	--hivemail-form-line: #8c8f94;
	--hivemail-form-gap: 1em;
	box-sizing: border-box;
	width: 100%;
	max-width: 34em;
	margin: 0 0 1.5em;
	font: inherit;
	color: inherit;
	line-height: 1.5;
	text-align: left;
}

.hivemail-form-wrap *,
.hivemail-form-wrap *::before,
.hivemail-form-wrap *::after {
	box-sizing: inherit;
}

.hivemail-form {
	margin: 0;
	padding: 0;
	border: 0;
}

.hivemail-form-field {
	margin: 0 0 var(--hivemail-form-gap);
}

.hivemail-form-field label {
	display: block;
	margin: 0 0 0.35em;
	font: inherit;
	font-weight: 600;
}

.hivemail-form-req {
	color: var(--hivemail-form-danger-text);
}

.hivemail-form-field input[type="text"],
.hivemail-form-field input[type="email"] {
	display: block;
	width: 100%;
	min-height: 2.75em;
	margin: 0;
	padding: 0.55em 0.8em;
	font: inherit;
	/* 16px keeps phones from zooming in when the field is touched. */
	font-size: max(16px, 1em);
	color: inherit;
	background: transparent;
	border: 1px solid var(--hivemail-form-line);
	border-radius: 0.4em;
	box-shadow: none;
}

@supports (color: color-mix(in srgb, red, blue)) {
	.hivemail-form-wrap {
		--hivemail-form-line: color-mix(in srgb, currentColor 45%, transparent);
		/* Red text that stays readable on a light and on a dark page: it leans toward the page's own text colour. */
		--hivemail-form-danger-text: color-mix(in srgb, var(--hivemail-form-danger) 62%, currentColor);
	}
}

.hivemail-form-field input::placeholder {
	color: inherit;
	opacity: 0.55;
}

.hivemail-form-field input[type="text"]:hover,
.hivemail-form-field input[type="email"]:hover {
	border-color: currentColor;
}

.hivemail-form-field input:focus-visible,
.hivemail-form-consent input:focus-visible,
.hivemail-form-button:focus-visible {
	outline: 2px solid var(--hivemail-form-accent);
	outline-offset: 2px;
}

.hivemail-form-field input[type="text"]:focus,
.hivemail-form-field input[type="email"]:focus {
	border-color: var(--hivemail-form-accent);
}

.hivemail-form-consent {
	margin: 0 0 var(--hivemail-form-gap);
	font-size: 0.9em;
}

.hivemail-form-consent label {
	display: flex;
	align-items: flex-start;
	gap: 0.6em;
	margin: 0;
	font: inherit;
	font-size: inherit;
	cursor: pointer;
}

.hivemail-form-consent input[type="checkbox"] {
	flex: 0 0 auto;
	width: 1.15em;
	height: 1.15em;
	margin: 0.2em 0 0;
	accent-color: var(--hivemail-form-accent);
}

.hivemail-form-actions {
	margin: 0;
}

.hivemail-form-button {
	display: inline-block;
	min-height: 2.75em;
	margin: 0;
	padding: 0.55em 1.6em;
	font: inherit;
	font-weight: 600;
	line-height: 1.3;
	color: var(--hivemail-form-on-accent);
	background: var(--hivemail-form-accent);
	border: 1px solid var(--hivemail-form-accent);
	border-radius: 0.4em;
	box-shadow: none;
	text-decoration: none;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}

.hivemail-form-button:hover {
	filter: brightness(0.92);
}

.hivemail-form-button[disabled],
.hivemail-form-button[aria-disabled="true"] {
	opacity: 0.65;
	cursor: not-allowed;
	filter: none;
}

/* The CAPTCHA service draws its check in this box (nothing at all for the invisible kind). */
.hivemail-form-captcha {
	margin: 0 0 var(--hivemail-form-gap);
	max-width: 100%;
}

.hivemail-form-captcha[data-invisible="1"] {
	margin: 0;
}

.hivemail-form-captcha iframe {
	max-width: 100%;
}

/* In the editor's preview: a picture of where the check goes. */
.hivemail-form-captcha.is-placeholder {
	padding: 0.8em 1em;
	font-size: 0.9em;
	border: 1px dashed var(--hivemail-form-line);
	border-radius: 0.4em;
	opacity: 0.85;
}

/* A form with a CAPTCHA cannot be sent without JavaScript. */
.hivemail-form-noscript {
	margin: 0 0 var(--hivemail-form-gap);
	padding: 0.7em 1em;
	font-size: 0.9em;
	border: 1px solid var(--hivemail-form-danger);
	border-left-width: 0.35em;
	border-radius: 0.4em;
}

/* The honeypot: out of sight for people and screen readers, there for robots. */
.hivemail-form-hp {
	position: absolute !important;
	left: -10000px !important;
	top: auto !important;
	width: 1px !important;
	height: 1px !important;
	overflow: hidden !important;
}

.hivemail-form-status {
	margin: 0.9em 0 0;
}

.hivemail-form-status:empty {
	display: none;
}

.hivemail-form-status.is-error {
	color: var(--hivemail-form-danger-text);
	font-weight: 600;
}

.hivemail-form-message {
	margin: 0 0 var(--hivemail-form-gap);
	padding: 0.8em 1em;
	font: inherit;
	border: 1px solid currentColor;
	border-radius: 0.4em;
	color: inherit;
}

.hivemail-form-message--ok {
	border-color: var(--hivemail-form-success);
	border-left-width: 0.35em;
}

.hivemail-form-message--error {
	border-color: var(--hivemail-form-danger);
	border-left-width: 0.35em;
}

.hivemail-form-message:focus {
	outline: 2px solid var(--hivemail-form-accent);
	outline-offset: 2px;
}

/* A note for the people who manage HiveMail, when a form is off or gone. */
.hivemail-form-note {
	margin: 0 0 1em;
	padding: 0.7em 1em;
	font-size: 0.9em;
	border: 1px dashed currentColor;
	border-radius: 0.4em;
	opacity: 0.8;
}

/* In the editors and the admin preview the form is a picture: nothing is sent from there. */
.hivemail-form-wrap.is-preview {
	margin-bottom: 0;
}

@media (prefers-reduced-motion: no-preference) {
	.hivemail-form-button {
		transition: filter 0.12s ease;
	}
}
