/* iLike Contact — front-end form
 * Two appearance modes:
 *   .ilc-mode-inherit  → adopts the active theme's fonts and colours through
 *                        `inherit` + `currentColor`, so the form blends into any
 *                        theme (light or dark) with no configuration.
 *   .ilc-mode-custom   → uses the accent colour + fonts set in Settings, with a
 *                        Light / Dark base (.ilc-theme-light / .ilc-theme-dark).
 * Structural selectors are scoped under .ilc-wrap so a host theme can't outrank
 * the component, and the fields/button are forced to a consistent look so theme
 * input/button styling can't bleed in.
 * ------------------------------------------------------------------------- */

.ilc-wrap {
	box-sizing: border-box;
	width: 100%;
	max-width: var(--ilc-max-width, none);
	margin: 0;
	padding: 0;
	font-family: var(--ilc-font-body, inherit);
	color: var(--ilc-ink, inherit);
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}

/* When a maximum width is set, centre the form in its container. */
.ilc-wrap.ilc-capped {
	margin-left: auto;
	margin-right: auto;
}

/* ---- Mode: inherit (default) — everything from the theme --------------- */
.ilc-wrap.ilc-mode-inherit {
	--ilc-accent: currentColor;
	--ilc-line: color-mix(in srgb, currentColor 24%, transparent);
	--ilc-line-focus: currentColor;
	--ilc-label-op: 0.70;
	--ilc-intro-op: 0.80;
	--ilc-btn-bg: transparent;
	--ilc-btn-border: currentColor;
	--ilc-btn-hover-bg: color-mix(in srgb, currentColor 12%, transparent);
}

/* Fallback where color-mix isn't supported: use a solid currentColor line. */
@supports not (color: color-mix(in srgb, red, blue)) {
	.ilc-wrap.ilc-mode-inherit {
		--ilc-line: currentColor;
		--ilc-btn-hover-bg: transparent;
	}
}

/* ---- Mode: custom — accent + fonts from Settings ---------------------- */
.ilc-wrap.ilc-mode-custom {
	--ilc-ink: #1a1a1a;
	--ilc-muted: #6b6b6b;
	--ilc-line: rgba(26, 26, 26, 0.18);
	--ilc-line-focus: var(--ilc-accent);
	--ilc-label-op: 1;
	--ilc-intro-op: 1;
	--ilc-btn-bg: var(--ilc-accent);
	--ilc-btn-border: var(--ilc-accent);
	--ilc-btn-hover-bg: var(--ilc-accent);
}

.ilc-wrap.ilc-mode-custom.ilc-theme-dark {
	--ilc-ink: #f3efe7;
	--ilc-muted: rgba(243, 239, 231, 0.62);
	--ilc-line: rgba(243, 239, 231, 0.22);
}

.ilc-wrap *,
.ilc-wrap *::before,
.ilc-wrap *::after {
	box-sizing: border-box;
}

/* Header ----------------------------------------------------------------- */
.ilc-wrap .ilc-head {
	margin: 0 0 1.75rem;
}

.ilc-wrap .ilc-title {
	font-family: var(--ilc-font-head, inherit);
	font-weight: 500;
	font-size: clamp(1.9rem, 4vw, 2.75rem);
	line-height: 1.1;
	letter-spacing: 0.01em;
	margin: 0 0 0.5rem;
	color: inherit;
}

.ilc-wrap .ilc-intro {
	font-family: var(--ilc-font-body, inherit);
	font-size: 1rem;
	line-height: 1.6;
	margin: 0;
	color: var(--ilc-muted, currentColor);
	opacity: var(--ilc-intro-op, 1);
}

/* Honeypot --------------------------------------------------------------- */
.ilc-wrap .ilc-hp {
	position: absolute !important;
	left: -9999px !important;
	top: auto !important;
	width: 1px !important;
	height: 1px !important;
	overflow: hidden !important;
}

.ilc-wrap .ilc-form {
	margin: 0;
}

.ilc-wrap .ilc-field {
	margin: 0 0 1.5rem;
}

/* Labels ----------------------------------------------------------------- */
.ilc-wrap .ilc-label {
	display: block;
	font-family: var(--ilc-font-body, inherit);
	font-size: 0.72rem;
	font-weight: 600;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--ilc-muted, currentColor);
	opacity: var(--ilc-label-op, 1);
	margin: 0 0 0.55rem;
}

.ilc-wrap .ilc-req {
	color: var(--ilc-accent);
	opacity: 0.9;
}

/* Fields — consistent underline-only look, forced past theme styling ----- */
.ilc-wrap .ilc-input,
.ilc-wrap .ilc-textarea {
	display: block;
	width: 100%;
	margin: 0;
	padding: 0.55rem 0 !important;
	border: 0 !important;
	border-bottom: 1px solid var(--ilc-line) !important;
	border-radius: 0 !important;
	background: transparent !important;
	background-image: none !important;
	box-shadow: none !important;
	font-family: var(--ilc-font-body, inherit);
	font-size: 1.02rem;
	line-height: 1.5;
	color: var(--ilc-ink, inherit) !important;
	-webkit-appearance: none;
	appearance: none;
	transition: border-color 0.25s ease;
}

.ilc-wrap .ilc-textarea {
	resize: vertical;
	min-height: 7.5rem;
}

.ilc-wrap .ilc-input::placeholder,
.ilc-wrap .ilc-textarea::placeholder {
	color: var(--ilc-muted, currentColor);
	opacity: 0.55;
}

.ilc-wrap .ilc-input:focus,
.ilc-wrap .ilc-textarea:focus {
	outline: none;
	border-bottom-color: var(--ilc-line-focus) !important;
}

.ilc-wrap .ilc-input:focus-visible,
.ilc-wrap .ilc-textarea:focus-visible {
	outline: 2px solid var(--ilc-accent);
	outline-offset: 3px;
}

/* Field error state ------------------------------------------------------ */
.ilc-wrap .ilc-field.ilc-field--error .ilc-input,
.ilc-wrap .ilc-field.ilc-field--error .ilc-textarea {
	border-bottom-color: #d05a5a !important;
}

.ilc-wrap .ilc-field-error {
	display: block;
	margin-top: 0.4rem;
	font-size: 0.8rem;
	color: #d05a5a;
}

/* Verification step ------------------------------------------------------ */
.ilc-wrap .ilc-verify {
	margin-top: 0.5rem;
}

.ilc-wrap .ilc-verify .cf-turnstile {
	margin-top: 0.25rem;
}

.ilc-wrap .ilc-verify input[name="ilc_va"] {
	max-width: 160px;
}

/* Submit button — blends via currentColor in inherit mode ---------------- */
.ilc-wrap .ilc-actions {
	margin-top: 2rem;
}

.ilc-wrap .ilc-submit {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.6rem;
	min-width: 200px;
	padding: 0.95rem 2.2rem !important;
	border: 1px solid var(--ilc-btn-border) !important;
	border-radius: 0 !important;
	background: var(--ilc-btn-bg) !important;
	color: var(--ilc-accent-ink, currentColor) !important;
	font-family: var(--ilc-font-body, inherit);
	font-size: 0.78rem;
	font-weight: 600;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	line-height: 1.2;
	cursor: pointer;
	box-shadow: none !important;
	transition: background-color 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
}

/* In inherit mode the button text is the theme text colour (currentColor). */
.ilc-wrap.ilc-mode-inherit .ilc-submit {
	color: currentColor !important;
}

.ilc-wrap.ilc-mode-inherit .ilc-submit:hover {
	background: var(--ilc-btn-hover-bg) !important;
}

.ilc-wrap.ilc-mode-custom .ilc-submit:hover {
	opacity: 0.88;
}

.ilc-wrap .ilc-submit:active {
	transform: translateY(1px);
}

.ilc-wrap .ilc-submit:focus-visible {
	outline: 2px solid var(--ilc-accent);
	outline-offset: 3px;
}

.ilc-wrap .ilc-submit[disabled] {
	cursor: default;
	opacity: 0.6;
}

.ilc-wrap .ilc-spinner {
	display: none;
	width: 15px;
	height: 15px;
	border: 2px solid currentColor;
	border-top-color: transparent;
	border-radius: 50%;
	animation: ilc-spin 0.7s linear infinite;
}

.ilc-wrap.ilc-loading .ilc-spinner {
	display: inline-block;
}

@keyframes ilc-spin {
	to { transform: rotate(360deg); }
}

/* Alert banner — text stays the theme colour, meaning shown via border --- */
.ilc-wrap .ilc-alert {
	margin: 0 0 1.5rem;
	padding: 0.9rem 1.1rem;
	font-size: 0.92rem;
	line-height: 1.5;
	color: inherit;
	background: color-mix(in srgb, currentColor 6%, transparent);
	border-left: 3px solid transparent;
}

@supports not (color: color-mix(in srgb, red, blue)) {
	.ilc-wrap .ilc-alert { background: transparent; }
}

.ilc-wrap .ilc-alert.ilc-alert--ok {
	border-left-color: #3fa06a;
}

.ilc-wrap .ilc-alert.ilc-alert--err {
	border-left-color: #d05a5a;
}

/* Success state replaces the form. */
.ilc-wrap.ilc-sent .ilc-form {
	display: none;
}

@media (max-width: 600px) {
	.ilc-wrap .ilc-submit {
		width: 100%;
	}
	.ilc-wrap .ilc-verify input[name="ilc_va"] {
		max-width: 100%;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ilc-wrap .ilc-spinner {
		animation-duration: 1.6s;
	}
	.ilc-wrap .ilc-submit {
		transition: none;
	}
}

/* reCAPTCHA v3 legal disclosure (shown under the button in reCAPTCHA mode) --- */
.ilc-wrap .ilc-recaptcha-note {
	margin: 1rem 0 0;
	font-size: 0.72rem;
	line-height: 1.5;
	color: var(--ilc-muted, currentColor);
	opacity: var(--ilc-label-op, 0.7);
}

.ilc-wrap .ilc-recaptcha-note a {
	color: inherit;
	text-decoration: underline;
}

/* Notice above the form (set in Settings) ---------------------------------- */
.ilc-wrap .ilc-notice {
	margin: 0 0 1.5rem;
	padding: 0.9rem 1.1rem;
	font-size: 0.92rem;
	line-height: 1.55;
	color: inherit;
	background: color-mix(in srgb, currentColor 6%, transparent);
	border-left: 3px solid var(--ilc-accent);
}

@supports not (color: color-mix(in srgb, red, blue)) {
	.ilc-wrap .ilc-notice { background: transparent; }
}

.ilc-wrap .ilc-notice :first-child { margin-top: 0; }
.ilc-wrap .ilc-notice :last-child { margin-bottom: 0; }
.ilc-wrap .ilc-notice a { color: inherit; text-decoration: underline; }
