/*
 * Holiday House Lights forms.
 *
 * Colours come from CSS custom properties so the theme controls the look.
 * Fallbacks use system colours, which adapt to light and dark pages.
 */

.hhl-form-wrap {
	--hhl-form-gap: 1.25rem;
	max-width: 40rem;
	font-size: var(--hhl-form-font-size, 1.125rem);
	line-height: 1.5;
}

.hhl-form {
	display: grid;
	gap: var(--hhl-form-gap);
}

.hhl-form__group {
	display: grid;
	gap: var(--hhl-form-gap);
	margin: 0;
	padding: 0;
	border: 0;
}

.hhl-form__legend {
	margin-bottom: 0.25rem;
	padding: 0;
	font-family: var(--hhl-heading-font, inherit);
	font-size: 1.35em;
	font-weight: 700;
}

.hhl-form__field {
	display: grid;
	gap: 0.35rem;
	margin: 0;
	padding: 0;
	border: 0;
}

.hhl-form__field > label,
.hhl-form__field > legend,
.hhl-listing-picker label {
	font-weight: 700;
}

/* Checkbox and radio labels read as normal text. */
.hhl-form__field > .hhl-form__choice {
	font-weight: 400;
}

.hhl-form__help,
.hhl-form__required-note,
.hhl-form__count {
	margin: 0;
	color: var(--hhl-muted, inherit);
	font-size: 0.9em;
	opacity: var(--hhl-muted-opacity, 0.85);
}

.hhl-form input[type="text"],
.hhl-form input[type="email"],
.hhl-form input[type="tel"],
.hhl-form input[type="search"],
.hhl-form input[type="file"],
.hhl-form textarea {
	box-sizing: border-box;
	width: 100%;
	min-height: 3rem;
	padding: 0.65rem 0.85rem;
	border: 2px solid var(--hhl-input-border, GrayText);
	border-radius: var(--hhl-radius, 0.6rem);
	background: var(--hhl-input-bg, Field);
	color: var(--hhl-input-text, FieldText);
	font: inherit;
}

.hhl-form input[type="file"] {
	padding: 0.5rem;
	cursor: pointer;
}

.hhl-form textarea {
	min-height: 7rem;
	resize: vertical;
}

.hhl-form input:focus-visible,
.hhl-form textarea:focus-visible,
.hhl-form button:focus-visible,
.hhl-form a:focus-visible,
.hhl-form__status:focus-visible {
	outline: 3px solid var(--hhl-focus, Highlight);
	outline-offset: 2px;
}

.hhl-form [aria-invalid="true"] {
	border-color: var(--hhl-error, #c62828);
}

.hhl-form__choices {
	gap: 0.5rem;
}

.hhl-form__choice {
	display: flex;
	gap: 0.75rem;
	align-items: flex-start;
	min-height: 3rem;
	padding: 0.5rem 0;
	font-weight: 400;
	cursor: pointer;
}

.hhl-form__choice input {
	flex: none;
	width: 1.5rem;
	height: 1.5rem;
	margin: 0.1rem 0 0;
	accent-color: var(--hhl-primary, #0b9444);
}

.hhl-form__error {
	margin: 0;
	color: var(--hhl-error, #c62828);
	font-weight: 700;
}

.hhl-form__error::before {
	content: "⚠ ";
}

.hhl-form__status {
	margin-bottom: var(--hhl-form-gap);
	padding: 1rem 1.25rem;
	border-left: 6px solid currentColor;
	border-radius: var(--hhl-radius, 0.6rem);
	background: var(--hhl-surface, rgba(127, 127, 127, 0.12));
	font-weight: 700;
}

.hhl-form__status--success {
	border-left-color: var(--hhl-primary, #0b9444);
	font-size: 1.15em;
}

.hhl-form__status--error {
	border-left-color: var(--hhl-error, #c62828);
}

.hhl-form__actions {
	display: grid;
	gap: 0.5rem;
}

.hhl-form__submit,
.hhl-form__secondary {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 3.25rem;
	padding: 0.75rem 1.5rem;
	border: 0;
	border-radius: var(--hhl-radius, 0.6rem);
	font: inherit;
	font-size: 1.2rem;
	font-weight: 700;
	cursor: pointer;
}

.hhl-form__submit {
	width: 100%;
	background: var(--hhl-primary, #0b9444);
	color: var(--hhl-on-primary, #fff);
}

.hhl-form__submit:hover {
	filter: brightness(1.08);
}

.hhl-form__submit[disabled] {
	cursor: progress;
	opacity: 0.7;
}

.hhl-form__secondary {
	min-height: 3rem;
	border: 2px solid currentColor;
	background: transparent;
	color: inherit;
	font-size: 1rem;
}

.hhl-form__progress {
	margin: 0;
	font-weight: 700;
	text-align: center;
}

.hhl-form__captcha {
	min-height: 65px;
}

/* Trap field: off-screen for people, still in the markup for bots. */
.hhl-form__trap {
	position: absolute !important;
	left: -10000px !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* Listing picker (report form). */
.hhl-listing-picker__results {
	display: grid;
	gap: 0.5rem;
	margin: 0.5rem 0 0;
	padding: 0;
	list-style: none;
}

.hhl-listing-picker__results button {
	display: grid;
	gap: 0.15rem;
	width: 100%;
	min-height: 3rem;
	padding: 0.65rem 0.85rem;
	border: 2px solid var(--hhl-input-border, GrayText);
	border-radius: var(--hhl-radius, 0.6rem);
	background: var(--hhl-surface, transparent);
	color: inherit;
	font: inherit;
	text-align: left;
	cursor: pointer;
}

.hhl-listing-picker__results button:hover,
.hhl-listing-picker__results button:focus-visible {
	border-color: var(--hhl-primary, #0b9444);
}

.hhl-listing-picker__results small {
	opacity: 0.8;
}

.hhl-listing-picker__selected {
	padding: 0.75rem 1rem;
	border-radius: var(--hhl-radius, 0.6rem);
	background: var(--hhl-surface, rgba(127, 127, 127, 0.12));
}

.hhl-listing-picker__selected p {
	margin: 0 0 0.5rem;
}

.hhl-form [hidden],
.hhl-form-wrap [hidden] {
	display: none !important;
}

@media (prefers-reduced-motion: no-preference) {
	.hhl-form__submit {
		transition: filter 0.15s ease;
	}
}

/* "Already on the map" notice on the Submit form. */
.hhl-form__dupe {
	display: grid;
	gap: 0.6rem;
	margin-top: 0.75rem;
	padding: 0.9rem 1rem;
	border-left: 4px solid var(--hhl-focus, #ffcb08);
	border-radius: var(--hhl-radius, 0.6rem);
	background: color-mix(in srgb, var(--hhl-focus, #ffcb08) 12%, transparent);
}

.hhl-form__dupe[hidden] {
	display: none;
}

.hhl-form__dupe-text {
	margin: 0;
}
