/*
 * Form controls (Figma «Поле» 12:883, «Згода» 12:914): label, 52 px field, hint,
 * Default / Error states, checkbox. The order form block (bti-core) styles itself
 * with the same tokens; these rules cover every other form on the site.
 */

label,
.bti-label {
	color: var(--c-graphite);
	font-size: var(--fs-label);
	line-height: var(--lh-label);
	font-weight: 500;
}

input:not([type="checkbox"], [type="radio"], [type="submit"], [type="button"], [type="hidden"], [type="file"], [type="range"], [type="color"]),
select,
textarea {
	display: block;
	width: 100%;
	min-height: var(--field-h);
	margin: 0;
	padding: 12px 14px;
	border: var(--border);
	border-radius: var(--radius);
	background-color: var(--c-sheet);
	color: var(--c-graphite);
	font-family: var(--font-sans);
	font-size: 17px; /* Mobile/Body on every width; 16 px+ keeps iOS from zooming. */
	line-height: 26px;
	appearance: none;
}

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

select {
	padding-right: 44px;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='none' stroke='%2326323D' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 12px center;
}

::placeholder {
	color: var(--c-graphite-soft);
	opacity: 1;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
	outline: var(--focus-ring);
	outline-offset: 0;
	border-color: var(--c-ink);
}

/* Error state */
[aria-invalid="true"],
.is-error input,
.is-error select,
.is-error textarea {
	border: 1.5px solid var(--c-change);
}

/* Checkbox: 20 px square, graphite when checked. */
input[type="checkbox"] {
	flex: none;
	width: 20px;
	height: 20px;
	margin: 1px 0 0;
	border: 1.5px solid var(--c-graphite);
	border-radius: var(--radius);
	background: var(--c-sheet) center / 16px 16px no-repeat;
	appearance: none;
	cursor: pointer;
}

input[type="checkbox"]:checked {
	background-color: var(--c-graphite);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5 10 17l9-10'/%3E%3C/svg%3E");
}

input[type="checkbox"][aria-invalid="true"] {
	border-color: var(--c-change);
}

/* Field wrapper: label, control, hint/error, 6 px apart. */
.bti-field {
	display: grid;
	gap: 6px;
}

.bti-field__hint {
	margin: 0;
	color: var(--c-graphite-soft);
	font-size: var(--fs-small);
	line-height: var(--lh-small);
}

.bti-field__error {
	margin: 0;
	color: var(--c-change-text);
	font-size: var(--fs-small);
	line-height: var(--lh-small);
}

.bti-field__error:empty {
	display: none;
}

.bti-field--check {
	grid-template-columns: auto 1fr;
	align-items: start;
	column-gap: 10px;
}

.bti-field--check label {
	color: var(--c-graphite-soft);
	font-size: var(--fs-small);
	line-height: var(--lh-small);
	font-weight: 400;
}

.bti-field--check .bti-field__error {
	grid-column: 1 / -1;
}
