/* Form 4 Me: forms on the site and in the block editor. Colours and fonts
	follow the theme (Theme4me tokens when present, sensible defaults else). */
.f4m, .editor-styles-wrapper {
	--f4m-accent: var(--t4m-primary, #151515);
	--f4m-on-accent: var(--t4m-on-primary, #fff);
	--f4m-ink: var(--t4m-ink, #1d2327);
	--f4m-muted: var(--t4m-muted, #646970);
	--f4m-line: var(--t4m-line, #d7dade);
	--f4m-bg: var(--t4m-surface, #fff);
	--f4m-radius: var(--t4m-radius-sm, 10px);
	--f4m-gap: 16px;
	--f4m-error: #b3261e;
}
.f4m { color: var(--f4m-ink); font-size: 1rem; }
.f4m-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--f4m-gap) calc(var(--f4m-gap) + 4px); align-items: start; }
.f4m-grid > * { grid-column: 1 / -1; margin: 0; }
.f4m-grid > .f4m-w-half { grid-column: span 3; }
.f4m-grid > .f4m-w-third { grid-column: span 2; }
.f4m--columns .f4m-grid > .f4m-w-auto.f4m-short { grid-column: span 3; }
/* Narrow places (phones, side bars): one field per row. */
.f4m { container-type: inline-size; }
@container (max-width: 460px) {
	.f4m-grid > .f4m-w-half, .f4m-grid > .f4m-w-third, .f4m--columns .f4m-grid > .f4m-w-auto.f4m-short { grid-column: 1 / -1; }
	.f4m-address { grid-template-columns: 1fr; }
}
@container (max-width: 300px) {
	.f4m-phone { grid-template-columns: 1fr; }
}

.f4m-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; border: 0; padding: 0; }
.f4m-label { font-weight: 600; font-size: .95em; padding: 0; }
.f4m-req { color: var(--f4m-error); }
.f4m-help { color: var(--f4m-muted); font-size: .85em; }
.f4m-field :is(input[type="text"], input[type="email"], input[type="tel"], input[type="number"], input[type="date"], input[type="time"], input[type="url"], select, textarea) {
	width: 100%; box-sizing: border-box; min-height: 46px; padding: 10px 14px;
	border: 1px solid var(--f4m-line); border-radius: var(--f4m-radius); background: var(--f4m-bg); color: inherit; font: inherit;
	transition: border-color .15s, box-shadow .15s;
}
.f4m-field textarea { min-height: 120px; resize: vertical; }
.f4m-field :is(input, select, textarea):focus { outline: none; border-color: var(--f4m-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--f4m-accent) 22%, transparent); }
.f4m-field input[type="file"] { padding: 10px; border: 1px dashed var(--f4m-line); border-radius: var(--f4m-radius); background: var(--f4m-bg); }
.f4m-choices { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.f4m-choice { display: inline-flex; align-items: flex-start; gap: 8px; font-weight: 400; cursor: pointer; }
.f4m-choice input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--f4m-accent); flex: none; }
.f4m-phone { display: grid; grid-template-columns: minmax(110px, 38%) 1fr; gap: 8px; }
.f4m-address { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
.f4m-address .f4m-sub--street { grid-column: 1 / -1; }
.f4m-sub { display: flex; flex-direction: column; gap: 4px; font-size: .85em; color: var(--f4m-muted); }
.f4m-sub input { font-size: 1rem; color: var(--f4m-ink); }

.f4m-actions { display: flex; }
.f4m-actions--center { justify-content: center; }
.f4m-actions--right { justify-content: flex-end; }
.f4m-actions--full .f4m-button { width: 100%; }
.f4m-button {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 12px 28px;
	border: 0; border-radius: 999px; background: var(--f4m-accent); color: var(--f4m-on-accent);
	font: inherit; font-weight: 600; cursor: pointer; transition: transform .15s, opacity .15s;
}
.f4m-button:hover { opacity: .92; }
.f4m-button:active { transform: translateY(1px); }
.f4m-button[disabled] { opacity: .6; cursor: progress; }

.f4m-error { color: var(--f4m-error); font-size: .85em; }
.f4m-field.is-invalid :is(input, select, textarea) { border-color: var(--f4m-error); }
.f4m-notice { margin: 0 0 var(--f4m-gap); padding: 14px 18px; border-radius: var(--f4m-radius); background: color-mix(in srgb, var(--f4m-accent) 8%, var(--f4m-bg)); }
.f4m-notice--ok { background: #e7f6ec; color: #14532d; }
.f4m-notice--error { background: #fdecea; color: var(--f4m-error); }
.f4m-notice:focus { outline: none; }
.f4m-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }
.f4m-missing { padding: 12px 16px; border: 1px dashed #c3c4c7; border-radius: 8px; color: #646970; }

/* Layouts */
.f4m--card { padding: clamp(20px, 4vw, 36px); border: 1px solid var(--f4m-line); border-radius: var(--t4m-radius, 18px); background: var(--f4m-bg); box-shadow: var(--t4m-shadow, 0 12px 32px rgb(0 0 0 / 8%)); }
.f4m--compact { --f4m-gap: 10px; font-size: .92rem; }
.f4m--compact :is(input[type="text"], input[type="email"], input[type="tel"], input[type="number"], input[type="date"], input[type="time"], input[type="url"], select) { min-height: 40px; padding: 8px 12px; }
.f4m--compact .f4m-button { min-height: 42px; padding: 10px 22px; }

/* Block editor: fields show their width, inputs cannot be typed in. */
/* The block stays full width (so it lines up with the others); its inside shows the width. */
.editor-styles-wrapper .f4m-field.f4m-w-half > * { max-width: calc(50% - 10px); }
.editor-styles-wrapper .f4m-field.f4m-w-third > * { max-width: calc(33.33% - 14px); }
.editor-styles-wrapper .f4m-field :is(input, select, textarea) { pointer-events: none; }
.editor-styles-wrapper .f4m-field { margin-block: 0 18px; }
.f4m-key { font: 11px/1.4 ui-monospace, Menlo, monospace; color: var(--f4m-muted); }

/* Payment box */
.f4m-pay { display: grid; gap: 12px; padding: 16px 18px; border: 1px solid var(--f4m-line); border-radius: var(--f4m-radius); background: color-mix(in srgb, var(--f4m-accent) 5%, var(--f4m-bg)); }
.f4m-pay[hidden] { display: none; }
.f4m-pay__amount { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 0; }
.f4m-pay__amount strong { font-size: 1.4em; }
.f4m-pay__how p { margin: 0 0 4px; }
.f4m-pay__qr img { display: block; max-width: 200px; height: auto; border-radius: 8px; background: #fff; padding: 8px; }
