/*
 * Form controls. design/DESIGN-SYSTEM.md §4.13, grid from §3.4.
 *
 * Field chrome is quoted exactly: #111 ground, 1px rgba(255,255,255,0.16)
 * border, 14px padding, 15px text, radius 0. The focus state is the replacement
 * §4.13 asks for (the prototype sets `outline:none` and stops); it already lives
 * in base.css, so nothing is repeated here.
 *
 * The prototype has no error state -- it has no server. Errors therefore reuse
 * the design's single accent: the field border turns red and the message is set
 * in the helper-text size, so nothing new enters the palette.
 */

/* ---------------------------------------------------------------- layout */

.sp-form__grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
	gap: var(--sp-5);
}

.sp-field {
	display: flex;
	flex-direction: column;
	gap: var(--sp-2);
}

.sp-field--full {
	grid-column: 1 / -1;
}

/* --------------------------------------------------------------- control */

.sp-field__label {
	display: block;
}

.sp-input {
	width: 100%;
	padding: var(--sp-4);
	background: var(--sp-bg-deep);
	border: var(--sp-border-field);
	border-radius: var(--sp-radius);
	color: var(--sp-text);
	font-family: var(--sp-font-body);
	font-size: var(--sp-fs-base);
	line-height: var(--sp-lh-body);
	transition:
		border-color var(--sp-dur-fast) var(--sp-ease),
		box-shadow var(--sp-dur-fast) var(--sp-ease);
}

.sp-input::placeholder {
	color: var(--sp-text-45);
	opacity: 1;
}

/* Height comes from rows="5" in the markup, as §4.13 specifies. */
.sp-textarea {
	resize: vertical;
}

/* ----------------------------------------------------------------- error */

.sp-field--error .sp-input {
	border-color: var(--sp-red);
}

.sp-field__error {
	margin: 0;
	font-size: var(--sp-fs-xs);
	line-height: var(--sp-lh-body);
	color: var(--sp-red);
}

/* --------------------------------------------------------------- actions */

.sp-form__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--sp-5);
	margin-top: var(--sp-7);
}

/* §4.1, contact submit row: 17px label, 16px 34px box. */
.sp-form__submit {
	padding: var(--sp-5) var(--sp-12);
}

.sp-form__consent {
	font-size: var(--sp-fs-xs);
	color: var(--sp-text-45);
}

/* ------------------------------------------------------------- honeypot */

/*
 * Not `display:none`: a headless browser reads computed styles and skips what is
 * not rendered. This is rendered, it is simply nowhere a person can reach --
 * off the canvas, out of the tab order (tabindex="-1" in the markup) and out of
 * the autofill pool (autocomplete="off").
 */
.sp-form__hp {
	position: absolute;
	left: -9999px;
	top: auto;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* ---------------------------------------------- notice panel (§4.13 success) */

.sp-form__notice {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--sp-5);
	margin-top: var(--sp-9);
	padding: var(--sp-10);
	border: 1px solid var(--sp-line-hover-sub);
	background: var(--sp-tint-red-8);
}

.sp-form__notice-icon {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 46px;
	height: 46px;
	border: var(--sp-border-accent);
	border-radius: var(--sp-radius-circle);
	font-size: var(--sp-fs-xl);
	line-height: 1;
	color: var(--sp-red);
}

.sp-form__notice-title {
	font-family: var(--sp-font-display);
	font-style: italic;
	font-weight: 800;
	font-size: var(--sp-fs-20);
	line-height: var(--sp-lh-tight);
	text-transform: uppercase;
	color: var(--sp-text);
}

.sp-form__notice-sub {
	margin-top: 2px;
	font-size: var(--sp-fs-sm);
	color: var(--sp-text-60);
}

/* The error panel is the same panel; only the glyph changes. */
.sp-form__notice--error .sp-form__notice-icon {
	font-weight: 800;
}
