/* forms — underline fields, no boxes, no shadows.
 *
 * Contact form: name, phone/WhatsApp, make and model, year, reason (the six
 * services plus "cotizar un repuesto") and free text.
 *
 * Errors are red, which is also the brand colour. That is fine here: an error
 * message is a single line of text, not an area of colour.
 */

.tci-form {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 32px 40px;
}

.tci-form__field {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.tci-form__field--full {
	grid-column: 1 / -1;
}

/* Formulario de cita: seis columnas, y cada campo dice cuántas ocupa. El
 * diseño pide dos filas distintas — nombre y teléfono al 50 %, luego marca y
 * año en 2:1 — y con una retícula de dos columnas la segunda no se puede
 * expresar sin trampas. */
.tci-form--appointment {
	grid-template-columns: repeat(6, 1fr);
	gap: 26px;
}

.tci-form__field--half   { grid-column: span 3; }
.tci-form__field--wide   { grid-column: span 4; }
.tci-form__field--narrow { grid-column: span 2; }

/* La nota y el botón comparten fila: la nota explica para qué se usan los
 * datos y tiene que leerse antes de enviar, no después. */
.tci-form__footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 32px;
	margin-top: 8px;
}

.tci-form__footer p {
	max-width: 420px;
	margin: 0;
}

.tci-form__footer .tci-button {
	flex: none;
	white-space: nowrap;
}

.tci-form label,
.tci-form legend {
	font-family: var(--wp--preset--font-family--plex-mono);
	font-size: var(--wp--preset--font-size--mono-sm, 11px);
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--wp--preset--color--text-muted);
}

.tci-form input[type="text"],
.tci-form input[type="tel"],
.tci-form input[type="email"],
.tci-form input[type="number"],
.tci-form select,
.tci-form textarea,
.woocommerce form .form-row input.input-text,
.woocommerce form .form-row select,
.woocommerce form .form-row textarea {
	appearance: none;
	width: 100%;
	background: transparent;
	border: 0;
	border-bottom: var(--tci-hairline) solid var(--wp--preset--color--border);
	padding: 10px 0;
	font-family: var(--wp--preset--font-family--space-grotesk);
	font-size: var(--wp--preset--font-size--lg, 16px);
	color: var(--wp--preset--color--graphite);
	transition: border-color 140ms linear;
}

.tci-form textarea {
	min-height: 120px;
	resize: vertical;
}

.tci-form :is(input, select, textarea):focus {
	outline: 0;
	border-bottom-color: var(--wp--preset--color--red);
	border-bottom-width: var(--tci-rule);
}

.tci-form ::placeholder {
	color: var(--wp--preset--color--text-muted);
}

/* Native select arrow drawn in graphite so no browser blue creeps in. */
.tci-form select {
	background-image: linear-gradient(45deg, transparent 50%, var(--wp--preset--color--graphite) 50%),
	                  linear-gradient(135deg, var(--wp--preset--color--graphite) 50%, transparent 50%);
	background-position: calc(100% - 12px) center, calc(100% - 6px) center;
	background-size: 6px 6px, 6px 6px;
	background-repeat: no-repeat;
	padding-right: 28px;
}

/* On graphite grounds. */
.is-style-tci-block-graphite .tci-form :is(input, select, textarea) {
	border-bottom-color: var(--tci-hairline-dark);
	color: var(--wp--preset--color--bone);
}

/* Validation. */
.tci-form__error,
.woocommerce-error {
	font-size: var(--wp--preset--font-size--xs, 13px);
	color: var(--wp--preset--color--red);
	list-style: none;
	margin: 0;
	padding: 0;
}

.tci-form :is(input, select, textarea)[aria-invalid="true"] {
	border-bottom-color: var(--wp--preset--color--red);
}

/* Success notices: graphite, never green. */
.tci-form__success,
.woocommerce-message,
.woocommerce-info {
	background: var(--wp--preset--color--graphite);
	color: var(--wp--preset--color--bone);
	padding: 18px 24px;
	font-size: var(--wp--preset--font-size--md, 15px);
	border: 0;
	list-style: none;
	margin: 0 0 24px;
}

.woocommerce-message a,
.woocommerce-info a {
	color: var(--wp--preset--color--brass);
}

/* Honeypot for the contact form. */
.tci-form__trap {
	position: absolute;
	left: -9999px;
}

/* El aviso de enviado va arriba del todo y a lo ancho: aparece tras recargar
 * la página y tiene que verse sin buscarlo. */
.tci-form__success,
.tci-form__error {
	grid-column: 1 / -1;
}

@media (max-width: 640px) {
	.tci-form {
		grid-template-columns: 1fr;
	}

	/* Un campo por fila. Los `span` de arriba seguirían mandando sobre una sola
	   columna y dejarían huecos. */
	.tci-form--appointment {
		grid-template-columns: 1fr;
		gap: 22px;
	}

	.tci-form--appointment .tci-form__field {
		grid-column: 1 / -1;
	}

	.tci-form__footer {
		flex-direction: column;
		align-items: stretch;
		gap: 20px;
	}

	.tci-form__footer .tci-button {
		width: 100%;
	}
}
