.pk-vorm {
	--pk-line: var(--wp--preset--color--field-line, #85705e);
	--pk-card-line: var(--wp--preset--color--line, #e2d3be);
	--pk-sand: var(--wp--preset--color--sand, #f7f0e6);
	--pk-brand: var(--wp--preset--color--brand, #6a4127);
	--pk-danger: var(--wp--preset--color--danger, #a12a1f);
	--pk-ok: var(--wp--preset--color--ok, #2f6b3a);
	--pk-focus: var(--wp--preset--color--focus, #8a4a12);
	--pk-radius: var(--wp--custom--radius, 16px);
	--pk-radius-s: var(--wp--custom--radius-s, 10px);
	max-width: 46rem;
}

/* Card: two-column grid on desktop, one column on mobile. */
.pk-vorm__form {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 1.25rem;
	box-sizing: border-box;
	padding: 1.25rem;
	border: 1px solid var(--pk-card-line);
	border-radius: var(--pk-radius);
	background: #fff;
}

.pk-vorm__row {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 1.25rem;
}

@media (min-width: 640px) {
	.pk-vorm__form {
		padding: 2rem;
		gap: 1.5rem;
	}

	.pk-vorm__row {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.pk-vorm__row--3 {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

.pk-vorm__field {
	display: grid;
	gap: 0.375rem;
	align-content: start;
	min-width: 0;
}

.pk-vorm label {
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.4;
}

.pk-vorm__req {
	color: var(--pk-danger);
}

.pk-vorm input[type="text"],
.pk-vorm input[type="email"],
.pk-vorm input[type="tel"],
.pk-vorm input[type="date"],
.pk-vorm input[type="number"],
.pk-vorm select,
.pk-vorm textarea {
	box-sizing: border-box;
	display: block;
	width: 100%;
	min-width: 0;
	height: 48px;
	min-height: 48px;
	margin: 0;
	padding: 0 0.875rem;
	border: 1px solid var(--pk-line);
	border-radius: var(--pk-radius-s);
	background-color: #fff;
	color: inherit;
	font: inherit;
	line-height: 1.4;
	-webkit-appearance: none;
	appearance: none;
}

.pk-vorm input[type="date"] {
	text-align: left;
}

.pk-vorm input[type="date"]::-webkit-date-and-time-value {
	text-align: left;
	min-height: 1.4em;
}

.pk-vorm select {
	padding-right: 2.5rem;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%236a4127' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 0.95rem center;
}

.pk-vorm textarea {
	height: auto;
	min-height: 9rem;
	padding: 0.75rem 0.875rem;
	resize: vertical;
}

/* Focus = the field's own border turns brand (no second ring), like the checkout fields. */
.pk-vorm input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):focus,
.pk-vorm select:focus,
.pk-vorm textarea:focus {
	border-color: var(--wp--preset--color--brand, #6a4127);
	box-shadow: inset 0 0 0 1px var(--wp--preset--color--brand, #6a4127);
	outline: none;
}

.pk-vorm__submit:focus-visible,
.pk-vorm__status:focus-visible,
.pk-vorm__files button:focus-visible,
.pk-vorm__file:focus-visible + .pk-vorm__pick-btn {
	outline: 3px solid var(--pk-focus);
	outline-offset: 2px;
}

.pk-vorm__hint,
.pk-vorm__note {
	margin: 0;
	color: var(--wp--preset--color--muted, #5e4d40);
	font-size: 0.875rem;
	line-height: 1.45;
}

.pk-vorm__note {
	margin-bottom: -0.25rem;
}

/* Upload: a 48 px button like the other controls, status beside it, chosen images
   below. Without JS the native input is shown (same button look via
   ::file-selector-button); vormid.js adds .is-ready. */
.pk-vorm__upload {
	position: relative;
	/* The native input has a fixed intrinsic width; an auto column would grow past 320 px. */
	grid-template-columns: minmax(0, 1fr);
}

.pk-vorm__pick {
	position: relative;
	display: flex;
	align-items: center;
	gap: 0.75rem;
	min-height: 48px;
}

.pk-vorm .pk-vorm__file {
	box-sizing: border-box;
	width: 100%;
	min-width: 0;
	max-width: 100%;
	margin: 0;
	color: var(--wp--preset--color--muted, #5e4d40);
	font: inherit;
	font-size: 0.9375rem;
}

.pk-vorm .pk-vorm__pick-btn,
.pk-vorm .pk-vorm__file::file-selector-button {
	box-sizing: border-box;
	min-height: 48px;
	padding: 0 1rem;
	border: 1px solid var(--pk-line);
	border-radius: var(--pk-radius-s);
	background: #fff;
	color: var(--pk-brand);
	font: inherit;
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
}

.pk-vorm .pk-vorm__file::file-selector-button {
	margin-right: 0.75rem;
}

.pk-vorm .pk-vorm__pick-btn {
	display: inline-flex;
	flex: none;
	align-items: center;
	white-space: nowrap;
}

.pk-vorm .pk-vorm__pick-btn:hover,
.pk-vorm .pk-vorm__file::file-selector-button:hover {
	border-color: var(--pk-brand);
	background: var(--pk-sand);
}

/* Up to two lines fit inside the 48 px row, so a longer error does not move anything. */
.pk-vorm__pick-status {
	min-width: 0;
	color: var(--wp--preset--color--muted, #5e4d40);
	font-size: 0.9375rem;
	line-height: 1.3;
}

.pk-vorm__upload.is-invalid .pk-vorm__pick-status {
	color: var(--pk-danger);
	font-weight: 600;
}

.pk-vorm__upload:not(.is-ready) .pk-vorm__pick-btn,
.pk-vorm__upload:not(.is-ready) .pk-vorm__pick-status,
.pk-vorm__drop-note {
	display: none;
}

/* Hidden visually, still focusable and labelled. */
.pk-vorm .pk-vorm__upload.is-ready .pk-vorm__file {
	position: absolute;
	top: 0;
	left: 0;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	border: 0;
	opacity: 0;
	clip-path: inset(50%);
}

.pk-vorm__files {
	display: grid;
	gap: 0.5rem;
	max-width: 32rem;
	margin: 0.25rem 0 0;
	padding: 0;
	list-style: none;
	font-size: 0.9375rem;
	line-height: 1.3;
}

.pk-vorm__files[hidden] {
	display: none;
}

.pk-vorm__files li {
	margin: 0;
}

.pk-vorm__file-row {
	display: grid;
	grid-template-columns: 2.5rem minmax(0, 1fr) auto 2.5rem;
	align-items: center;
	gap: 0.75rem;
}

.pk-vorm__thumb {
	width: 2.5rem;
	height: 2.5rem;
	overflow: hidden;
	border-radius: 6px;
	background: var(--pk-sand);
}

.pk-vorm__thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.pk-vorm__file-name {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.pk-vorm__file-meta {
	color: var(--wp--preset--color--muted, #5e4d40);
	font-size: 0.875rem;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.pk-vorm__file-row.is-invalid .pk-vorm__file-meta {
	color: var(--pk-danger);
	font-weight: 600;
}

.pk-vorm .pk-vorm__file-remove {
	display: grid;
	place-items: center;
	width: 2.5rem;
	height: 2.5rem;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: none;
	color: var(--wp--preset--color--muted, #5e4d40);
	cursor: pointer;
}

.pk-vorm .pk-vorm__file-remove:hover {
	background: var(--pk-sand);
	color: var(--pk-brand);
}

.pk-vorm .pk-vorm__files-clear {
	min-height: 40px;
	padding: 0;
	border: 0;
	background: none;
	color: var(--pk-brand);
	font: inherit;
	text-decoration: underline;
	text-underline-offset: 0.15em;
	cursor: pointer;
}

/* Only while files are dragged over the field: brand outline, sand tint, short note. */
.pk-vorm__upload.is-dragover .pk-vorm__drop-note {
	position: absolute;
	z-index: 1;
	inset: -0.5rem;
	display: grid;
	place-items: center;
	padding: 0.5rem;
	border: 2px solid var(--pk-brand);
	border-radius: var(--pk-radius-s);
	background: rgb(247 240 230 / 0.94);
	color: var(--pk-brand);
	font-weight: 600;
	text-align: center;
	pointer-events: none;
}

/* Checkbox/radio groups: fieldset reset, legend looks like a field label. */
.pk-vorm .pk-vorm__choices {
	margin: 0;
	padding: 0;
	border: 0;
}

.pk-vorm__choices legend {
	padding: 0;
	margin-bottom: 0.375rem;
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.4;
}

.pk-vorm__options {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 0 1rem;
}

/* Two columns from 480 px. On phones one column: at 360–390 px a 2-column cell was narrower than
   "serveerimistarvikud" and the label ran out of the form (31.10); most labels wrapped to two lines anyway. */
@media (min-width: 480px) {
	.pk-vorm__options {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

/* Whole row is the hit area (40 px tall). */
.pk-vorm__option {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	min-height: 40px;
}

.pk-vorm__option input {
	flex: none;
	width: 1.375rem;
	height: 1.375rem;
	margin: 0;
	accent-color: var(--pk-brand);
}

.pk-vorm__option input:focus-visible {
	outline: 3px solid var(--pk-focus);
	outline-offset: 2px;
}

.pk-vorm .pk-vorm__option label {
	flex: 1;
	padding: 0.35rem 0;
	line-height: 1.3;
	font-weight: 400;
	cursor: pointer;
}

/* Consent: checkbox centred on the first text line (docs/17 C1). */
.pk-vorm .pk-vorm__consent {
	display: flex;
	align-items: flex-start;
	gap: 0.75rem;
	margin-bottom: -0.75rem;
}

.pk-vorm__consent input[type="checkbox"] {
	flex: none;
	width: 1.5rem;
	height: 1.5rem;
	margin: calc((1lh - 1.5rem) / 2) 0 0;
	accent-color: var(--pk-brand);
}

.pk-vorm__consent input[type="checkbox"]:focus-visible {
	outline: 3px solid var(--pk-focus);
	outline-offset: 2px;
}

.pk-vorm .pk-vorm__consent label {
	font-weight: 400;
}

.pk-vorm__actions {
	display: flex;
}

.pk-vorm__submit {
	box-sizing: border-box;
	width: 100%;
	min-height: 48px;
	padding: 0.625rem 1.75rem;
	border: 2px solid var(--pk-brand);
	border-radius: var(--pk-radius-s);
	background: var(--pk-brand);
	color: #fff;
	font: inherit;
	font-weight: 700;
	cursor: pointer;
}

@media (min-width: 640px) {
	.pk-vorm__submit {
		width: auto;
		min-width: 12rem;
	}
}

.pk-vorm__submit:hover {
	background: #fff;
	color: var(--pk-brand);
}

.pk-vorm__submit[aria-disabled="true"] {
	opacity: 0.65;
	cursor: progress;
}

.pk-vorm__status {
	margin: 0 0 1rem;
	padding: 0.875rem 1rem;
	border: 2px solid;
	border-radius: var(--pk-radius-s);
	background: #fff;
	font-weight: 600;
	line-height: 1.45;
}

.pk-vorm__status.is-ok {
	border-color: var(--pk-ok);
	color: var(--pk-ok);
}

.pk-vorm__status.is-error {
	border-color: var(--pk-danger);
	color: var(--pk-danger);
}

@media (min-width: 640px) {
	.pk-vorm__field--wide {
		grid-column: 1 / -1;
	}
}

/* Honeypot: off-screen, not display:none (some bots skip hidden fields). */
.pk-vorm__trap {
	position: absolute;
	left: -10000px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}
