/* Floating labels (see js/float-labels.js).
   Everything is scoped to html.fl-js, so forms look exactly as before when
   JavaScript is unavailable. Kept outside style.scss so Prepros builds don't
   overwrite it. */

html.fl-js .fl-field {
	position: relative;
}
/* Gravity Forms wraps name/address parts in inline <span>s. */
html.fl-js span.fl-field {
	display: block;
}

/* The label sits over the field like a placeholder… */
html.fl-js .fl-field > label.fl-label {
	position: absolute !important;
	top: 0.95rem !important;
	left: 0.8rem !important;
	right: auto !important;
	display: block !important;
	max-width: calc(100% - 1.6rem);
	margin: 0 !important;
	padding: 0 !important;
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
	font-size: 1rem !important;
	font-weight: 400 !important;
	line-height: 1.25 !important;
	letter-spacing: normal;
	text-transform: none;
	color: #6b6b6b !important;
	pointer-events: none;
	transform-origin: left top;
	transition: transform 0.15s ease, color 0.15s ease;
	z-index: 2;
}

/* …and floats up when the field is focused or has a value. */
html.fl-js .fl-field.is-focused > label.fl-label,
html.fl-js .fl-field.is-filled > label.fl-label {
	transform: translateY(-0.6rem) scale(0.75);
}
html.fl-js .fl-field.is-focused > label.fl-label {
	color: rgb(149, 27, 129) !important;
}

/* Room at the top of the field for the floated label. */
html.fl-js .fl-field > input[data-fl],
html.fl-js .fl-field > select[data-fl] {
	box-sizing: border-box;
	width: 100%;
	height: auto !important;
	min-height: 3.25rem;
	padding: 1.45rem 0.8rem 0.45rem !important;
	line-height: 1.3 !important;
	font-size: 1rem;
}
html.fl-js .fl-field > select[data-fl] {
	padding-right: 2rem !important;
}

/* Field-specific placeholders (not just a copy of the label) appear only once focused. */
html.fl-js .fl-field > [data-fl]::placeholder {
	opacity: 0;
	transition: opacity 0.15s ease;
}
html.fl-js .fl-field.is-focused > [data-fl]::placeholder {
	opacity: 0.6;
}

/* Required markers keep their colour. */
html.fl-js .fl-field > label.fl-label .gfield_required,
html.fl-js .fl-field > label.fl-label .req,
html.fl-js .fl-field > label.fl-label .required {
	color: #b32d2e;
}

/* Errors. */
html.fl-js .gfield_error .fl-field > label.fl-label {
	color: #b32d2e !important;
}

/* WP-Members hides its labels in favour of placeholders; floating labels replace that. */
html.fl-js #wpmem_login form .fl-field > label.fl-label,
html.fl-js #wpmem_reg form .fl-field > label.fl-label {
	display: block !important;
}

/* Gravity Forms: sub-labels (First / Last name etc.) float inside their own field. */
html.fl-js .gform_wrapper .fl-field > label.fl-label.gform-field-label--type-sub {
	font-size: 1rem !important;
}

/* Let browsers' autofill be detected (js listens for this animation). */
@keyframes fl-autofill {
	from { opacity: 1; }
	to { opacity: 1; }
}
html.fl-js .fl-field > input:-webkit-autofill {
	animation-name: fl-autofill;
	animation-duration: 0.01s;
}

@media (prefers-reduced-motion: reduce) {
	html.fl-js .fl-field > label.fl-label {
		transition: none;
	}
}
