/*
 * Luke Forms — style front-endu.
 *
 * Reguły bazowe celowo używają `:where()` (specyficzność 0), więc każdy motyw
 * ze stylami dla `.contact-form`, `.field` czy `.form-row` wygrywa bez `!important`.
 * Styl własny wtyczki jest tu tylko po to, żeby formularz wyglądał poprawnie
 * również tam, gdzie motyw takich klas nie zna.
 */

:where(.luke-form) {
	--lf-ink: #16170f;
	--lf-muted: #6a6c62;
	--lf-line: #cfd0ca;
	--lf-accent: #ffcd01;
	--lf-error: #9f1d1d;
	--lf-radius: 16px;

	display: block;
	position: relative;
	padding: clamp(22px, 3vw, 34px);
	border-radius: var(--lf-radius);
	background: #fff;
	color: var(--lf-ink);
}

:where(.luke-form) .form-row {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 24px;
}

:where(.luke-form) .field {
	padding-top: 18px;
	border-bottom: 1px solid var(--lf-line);
}

:where(.luke-form) .field label {
	display: block;
	margin-bottom: 2px;
	color: var(--lf-muted);
	font-size: 11px;
	font-weight: 500;
}

:where(.luke-form) .field input,
:where(.luke-form) .field select {
	width: 100%;
	height: 43px;
	padding: 0;
	border: 0;
	outline: 0;
	background: transparent;
	color: inherit;
	font: inherit;
	font-size: 17px;
}

:where(.luke-form) .field textarea {
	width: 100%;
	min-height: 118px;
	padding: 4px 0 10px;
	border: 0;
	outline: 0;
	background: transparent;
	color: inherit;
	font: inherit;
	font-size: 17px;
	line-height: 1.5;
	resize: vertical;
}

:where(.luke-form) .field-error {
	display: block;
	min-height: 16px;
	margin-top: 4px;
	color: var(--lf-error);
	font-size: 11px;
}

:where(.luke-form) .field-hint {
	display: block;
	margin-top: 4px;
	color: var(--lf-muted);
	font-size: 11px;
}

/* --- Elementy, których motyw zwykle nie stylizuje ------------------------ */

.luke-form .field-select select {
	appearance: none;
	cursor: pointer;
	background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
	background-position: right 8px center, right 3px center;
	background-size: 5px 5px, 5px 5px;
	background-repeat: no-repeat;
	padding-right: 22px;
}

.luke-form .field-date input,
.luke-form .field-time input,
.luke-form .field-number input {
	max-width: 100%;
}

.luke-form .luke-form-heading {
	margin: 30px 0 0;
	font-size: 15px;
	font-weight: 600;
	letter-spacing: -0.01em;
}

.luke-form .luke-form-paragraph {
	margin: 8px 0 0;
	color: var(--lf-muted, #6a6c62);
	font-size: 13px;
	line-height: 1.55;
}

.luke-form .luke-form-required {
	margin-left: 2px;
	color: #b82424;
}

.luke-form .field.is-error,
.luke-form fieldset.is-error {
	border-color: #b82424;
}

/* Honeypot: niewidoczny dla ludzi, obecny w DOM dla botów. */
.luke-form .luke-form-hp {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

/* --- Zgody --------------------------------------------------------------- */

:where(.luke-form) .consent {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin-top: 22px;
	color: var(--lf-muted);
	font-size: 12px;
	line-height: 1.5;
	cursor: pointer;
}

:where(.luke-form) .consent input {
	flex: 0 0 auto;
	width: 18px;
	height: 18px;
	margin-top: 1px;
	accent-color: var(--lf-ink);
}

.luke-form .luke-form-consent-wrap + .luke-form-consent-wrap .consent {
	margin-top: 12px;
}

/* --- Wybór jedno- i wielokrotny ------------------------------------------ */

:where(.luke-form) fieldset.field-choice {
	min-width: 0;
	margin: 24px 0 0;
	padding: 0;
	border: 0;
}

:where(.luke-form) fieldset.field-choice legend {
	margin-bottom: 10px;
	padding: 0;
	color: var(--lf-muted);
	font-size: 12px;
	font-weight: 500;
}

:where(.luke-form) .luke-form-options {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
	gap: 8px;
}

:where(.luke-form) .luke-form-options label {
	min-width: 0;
	cursor: pointer;
}

.luke-form .luke-form-options input {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
}

:where(.luke-form) .luke-form-options span {
	min-height: 42px;
	padding: 8px 12px;
	display: grid;
	place-items: center;
	border: 1px solid var(--lf-line);
	border-radius: 999px;
	font-size: 11px;
	line-height: 1.2;
	text-align: center;
	transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

:where(.luke-form) .luke-form-options input:checked + span {
	border-color: var(--lf-ink);
	background: var(--lf-ink);
	color: #fff;
}

.luke-form .luke-form-options input:focus-visible + span {
	outline: 2px solid var(--lf-accent, #ffcd01);
	outline-offset: 2px;
}

/* --- Captcha, akcje, status ---------------------------------------------- */

.luke-form .luke-form-captcha {
	margin-top: 22px;
	min-height: 0;
}

.luke-form .luke-form-captcha:empty {
	margin-top: 0;
}

:where(.luke-form) .form-actions {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 18px;
	margin-top: 26px;
}

:where(.luke-form) .form-note {
	color: var(--lf-muted);
	font-size: 11px;
}

:where(.luke-form) .luke-form-submit {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 14px 22px;
	border: 0;
	border-radius: 999px;
	background: var(--lf-accent);
	color: var(--lf-ink);
	font: inherit;
	font-size: 14px;
	font-weight: 500;
	cursor: pointer;
}

.luke-form .luke-form-submit[disabled] {
	opacity: 0.65;
	cursor: progress;
}

.luke-form .luke-form-submit.is-loading .button-icon {
	opacity: 0.35;
}

:where(.luke-form) .luke-form-status {
	margin: 14px 0 0;
	min-height: 18px;
	font-size: 13px;
	line-height: 1.5;
}

.luke-form .luke-form-status.is-error {
	color: var(--lf-error, #9f1d1d);
}

.luke-form .luke-form-status.is-success {
	color: #1c6b2f;
	font-weight: 500;
}

.luke-form .luke-form-notice {
	margin: 14px 0 0;
	padding: 10px 12px;
	border-radius: 8px;
	background: #fff4d1;
	color: #6b5300;
	font-size: 12px;
}

@media ( max-width: 640px ) {
	:where(.luke-form) .form-row {
		grid-template-columns: minmax(0, 1fr);
		gap: 0;
	}

	:where(.luke-form) .form-actions {
		flex-direction: column;
		align-items: stretch;
	}
}

@media ( prefers-reduced-motion: reduce ) {
	.luke-form * {
		transition-duration: 0.01ms !important;
	}
}
