/* Forms: the Forminator quote form, its photo previews, and the link that
   points at it from the contact page.

   Loaded only on the pages that need it (see functions.php). Everything here
   uses the tokens from site.css / the active scheme -- no new colours, so a
   scheme switch carries the form with it. Forminator's own classes are styled
   from outside, scoped under .bys-quote, rather than by editing the plugin. */

/* ---------- link to the quote page (contact page) ---------- */

.quote-link {
	display: block;
	margin-bottom: 2rem;
	padding: 1.15rem 1.35rem;
	border: 1px solid var(--surface-line);
	border-left: 3px solid var(--accent);
	border-radius: var(--radius-sm);
	background: var(--surface);
	color: inherit;
	text-decoration: none;
	transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.quote-link:hover,
.quote-link:focus-visible {
	border-color: var(--accent);
	transform: translateY(-2px);
	box-shadow: var(--shadow, 0 10px 26px rgba(11, 79, 58, 0.14));
}

.quote-link .eyebrow {
	display: block;
	margin-bottom: 0.35rem;
}

.quote-link-title {
	display: block;
	font-family: var(--display);
	font-size: 1.12rem;
	line-height: 1.3;
}

.quote-link-note {
	display: block;
	margin-top: 0.3rem;
	color: var(--fg-soft);
	font-size: 0.92rem;
}

/* ---------- the form ---------- */

.bys-quote {
	max-width: 720px;
	margin: 0 auto;
}

.bys-quote .forminator-ui.forminator-custom-form {
	font-family: var(--sans);
	color: var(--fg);
}

/* one field per row, with room to breathe */
.bys-quote .forminator-row {
	margin-bottom: 1.5rem;
}

.bys-quote .forminator-label {
	display: block;
	margin-bottom: 0.45rem;
	color: var(--fg);
	font-family: var(--display);
	font-size: 0.98rem;
	font-weight: 600;
	letter-spacing: 0.01em;
}

.bys-quote .forminator-required {
	color: var(--accent);
}

.bys-quote .forminator-description {
	margin-top: 0.4rem;
	color: var(--fg-soft);
	font-size: 0.88rem;
	line-height: 1.5;
}

.bys-quote .forminator-input,
.bys-quote .forminator-textarea,
.bys-quote select.forminator-select2,
.bys-quote .forminator-input-with-phone {
	width: 100%;
	padding: 0.85rem 1rem;
	border: 1px solid var(--surface-line);
	border-radius: var(--radius-sm);
	background: var(--surface);
	color: var(--fg);
	font-family: var(--sans);
	font-size: 1rem;
	line-height: 1.5;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.bys-quote .forminator-textarea {
	min-height: 9rem;
	resize: vertical;
}

.bys-quote .forminator-input:focus,
.bys-quote .forminator-textarea:focus {
	border-color: var(--accent);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
	outline: none;
}

.bys-quote .forminator-input::placeholder,
.bys-quote .forminator-textarea::placeholder {
	color: var(--fg-soft);
	opacity: 0.7;
}

/* ---------- checkboxes and radios as chips ---------- */

.bys-quote .forminator-checkbox,
.bys-quote .forminator-radio {
	display: inline-flex;
	align-items: center;
	gap: 0.55rem;
	margin: 0 0.5rem 0.5rem 0;
	padding: 0.6rem 0.95rem;
	border: 1px solid var(--surface-line);
	border-radius: var(--pill);
	background: var(--surface);
	cursor: pointer;
	font-size: 0.95rem;
	transition: border-color 0.2s ease, background 0.2s ease;
}

.bys-quote .forminator-checkbox:hover,
.bys-quote .forminator-radio:hover {
	border-color: var(--accent);
}

.bys-quote .forminator-checkbox:has(input:checked),
.bys-quote .forminator-radio:has(input:checked) {
	border-color: var(--accent);
	background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}

.bys-quote .forminator-checkbox:has(input:focus-visible),
.bys-quote .forminator-radio:has(input:focus-visible) {
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

/* The tick itself is the native input -- Forminator's own box/bullet spans
   only get drawn by its design stylesheet, which is off here. Colouring the
   native control keeps the platform's keyboard and screen-reader behaviour. */
.bys-quote .forminator-checkbox input,
.bys-quote .forminator-radio input {
	flex: none;
	width: 1.05rem;
	height: 1.05rem;
	margin: 0;
	accent-color: var(--accent);
}

.bys-quote .forminator-checkbox-box,
.bys-quote .forminator-radio-bullet {
	display: none;
}

/* ---------- upload ----------
   With Forminator's own design off, the file input is the browser's bare
   "Choose files" control, so the dropzone look is ours: the input itself
   becomes the framed area, and ::file-selector-button the button inside it. */

.bys-quote .forminator-field-upload .forminator-input-file {
	display: block;
	width: 100%;
	padding: 1.1rem;
	border: 1px dashed var(--surface-line);
	border-radius: var(--radius-sm);
	background: var(--surface);
	color: var(--fg-soft);
	font-family: var(--sans);
	font-size: 0.92rem;
	line-height: 1.6;
	cursor: pointer;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.bys-quote .forminator-input-file:hover {
	border-color: var(--accent);
}

.bys-quote .forminator-input-file:focus-visible {
	border-color: var(--accent);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
	outline: none;
}

.bys-quote .forminator-input-file::file-selector-button {
	margin-right: 0.9rem;
	padding: 0.6rem 1.1rem;
	border: 1px solid var(--surface-line);
	border-radius: var(--pill);
	background: var(--cream-warm);
	color: var(--fg);
	font-family: var(--display);
	font-size: 0.85rem;
	font-weight: 600;
	cursor: pointer;
	transition: border-color 0.2s ease, color 0.2s ease;
}

.bys-quote .forminator-input-file::file-selector-button:hover {
	border-color: var(--accent);
	color: var(--accent);
}

/* the plugin's own list of accepted files, under the input */
.bys-quote .forminator-uploaded-files {
	margin-top: 0.6rem;
	color: var(--fg-soft);
	font-size: 0.85rem;
}

.bys-quote .forminator-upload--remove {
	color: var(--accent);
	cursor: pointer;
}

/* ---------- submit and confirmation ---------- */

.bys-quote .forminator-button-submit {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0.95rem 1.9rem;
	border: 0;
	border-radius: var(--pill);
	background: var(--accent);
	color: var(--on-accent);
	font-family: var(--display);
	font-size: 0.95rem;
	font-weight: 600;
	letter-spacing: 0.02em;
	cursor: pointer;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.bys-quote .forminator-button-submit:hover {
	transform: translateY(-2px);
	box-shadow: var(--shadow, 0 10px 26px rgba(11, 79, 58, 0.14));
}

.bys-quote .forminator-response-message {
	margin-bottom: 1.25rem;
	padding: 1rem 1.25rem;
	border-radius: var(--radius-sm);
	border-left: 3px solid var(--accent);
	background: var(--surface);
	font-size: 1rem;
}

/* Forminator ships the message element empty on every load and fills it after
   a submit; unstyled that is invisible, but ours has padding, so hide it. */
.bys-quote .forminator-response-message:empty {
	display: none;
}

.bys-quote .forminator-error-message {
	margin-top: 0.35rem;
	color: #9b2226;
	font-size: 0.85rem;
}

@media (max-width: 600px) {
	.bys-quote .forminator-checkbox,
	.bys-quote .forminator-radio {
		width: 100%;
	}
}

/* ---------- photo upload (js/photo-upload.js) ----------
   Built for a phone first: every control is at least 44px, and every input is
   16px or larger, because anything smaller makes iOS Safari zoom the page on
   focus and the form feels broken. */

.bys-sr-only {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	border: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
}

.bys-photo-guide {
	margin: 0 0 0.9rem;
	padding: 0.9rem 1.1rem;
	border-left: 3px solid var(--accent);
	border-radius: var(--radius-sm);
	background: var(--surface);
	font-size: 0.95rem;
	line-height: 1.5;
}

.bys-photo-guide p { margin: 0 0 0.4rem; font-weight: 600; }

.bys-photo-guide ul {
	margin: 0;
	padding-left: 1.1rem;
	color: var(--fg-soft);
}

.bys-photo-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	margin-top: 0.9rem;
}

.bys-photo-btn {
	flex: 1 1 auto;
	min-height: 48px;
	min-width: 44px;
	padding: 0.85rem 1.3rem;
	border: 1px solid var(--surface-line);
	border-radius: var(--pill);
	background: var(--surface);
	color: var(--fg);
	font-family: var(--display);
	font-size: 1rem;
	font-weight: 600;
	cursor: pointer;
	transition: border-color 0.2s ease, color 0.2s ease;
}

.bys-photo-btn:hover:not(:disabled),
.bys-photo-btn:focus-visible {
	border-color: var(--accent);
	color: var(--accent);
}

.bys-photo-btn:disabled { opacity: 0.55; cursor: default; }

.forminator-multi-upload.is-dragging {
	border-color: var(--accent);
	background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}

.bys-photo-list {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
	gap: 0.85rem;
	margin: 1rem 0 0;
	padding: 0;
	list-style: none;
}

.bys-photo {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
}

.bys-photo img {
	display: block;
	width: 100%;
	aspect-ratio: 3 / 2;
	object-fit: cover;
	border: 1px solid var(--surface-line);
	border-radius: var(--radius-sm);
}

.bys-photo-meta {
	color: var(--fg-soft);
	font-size: 0.8rem;
	line-height: 1.3;
}

.bys-photo-remove {
	position: absolute;
	top: 0.3rem;
	right: 0.3rem;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(22, 48, 31, 0.78);
	color: #fff;
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
}

.bys-photo-remove:hover,
.bys-photo-remove:focus-visible {
	background: var(--pine, #16301F);
	outline-offset: 2px;
}

.bys-photo-status {
	margin: 0.75rem 0 0;
	color: var(--fg-soft);
	font-size: 0.9rem;
}

.bys-photo-error {
	margin: 0.5rem 0 0;
	color: #9b2226;
	font-size: 0.9rem;
	line-height: 1.45;
}

.bys-photo-error:empty { display: none; }

.bys-quote .forminator-button-submit.is-busy { opacity: 0.6; cursor: progress; }

/* iOS zooms the page when a focused input is under 16px. */
.bys-quote .forminator-input,
.bys-quote .forminator-textarea,
.bys-quote .forminator-input-file {
	font-size: 16px;
}

/* The plugin renders its own list of the files it has validated. Ours shows
   the thumbnails and the sizes, so its copy is kept out of sight -- but left
   in the DOM, because its validator counts the entries. */
.bys-quote .forminator-uploaded-files { display: none; }

/* ---------- the confirmation: by the submit button, until dismissed ----------
   Forminator renders its response message as the form's first child. A flex
   column lets `order` put it last -- straight under the submit button -- with
   no change to the plugin's markup. */

.bys-quote form.forminator-custom-form {
	display: flex;
	flex-direction: column;
}

.bys-quote .forminator-response-message {
	order: 99;
	position: relative;
	margin: 1.25rem 0 0;
	padding-right: 3.5rem;   /* room for the close button */
}

.bys-message-close {
	position: absolute;
	top: 50%;
	right: 0.35rem;
	transform: translateY(-50%);
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--fg-soft);
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
}

.bys-message-close:hover,
.bys-message-close:focus-visible {
	background: color-mix(in srgb, var(--accent) 12%, transparent);
	color: var(--fg);
}

/* a photo sent as the original (the phone couldn't resize it) has no preview */
.bys-photo img:not([src]) {
	background: var(--surface);
	border-style: dashed;
}
