/**
 * Contact page + Gutena Forms styling.
 *
 * Enqueued (by functions.php, owned by Agent A) after style.css and after
 * the Gutena Forms plugin's own stylesheet, so plain class-on-class
 * selectors here are specific enough to win without !important. Real class
 * names come from docs/GUTENA-DOM.md, captured live from the Contact page —
 * this file does not invent or restyle any markup, it only styles what the
 * plugin already renders.
 *
 * Design tokens (--alh-bg, --alh-ink, --alh-muted-2, --alh-accent,
 * --alh-rule, --alh-maxw, the --ac alias) are declared on :root in
 * style.css and used as-is. --alh-error has no shared token, so it is
 * defined locally below.
 */

:root {
	--alh-error: #A8452F;
}

/* ==========================================================================
   1. Page layout
   ========================================================================== */

.alh-contact-wrap {
	max-width: var( --alh-maxw );
	margin: 0 auto;
	padding: 0 40px 120px;
}

.alh-contact-form-wrap {
	max-width: 720px;
}

/* ==========================================================================
   2. Neutralise the plugin's default box-input look before restyling.
   Do this first, or the underline treatment in section 4 stacks on top of
   the plugin's own border/background and produces a double border.
   ========================================================================== */

.gutena-forms-contact-form .gutena-forms-field {
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	display: block;
	width: 100%;
	background: transparent;
	border: none;
	border-radius: 0;
	box-shadow: none;
	padding: 0;
}

/* ==========================================================================
   3. Two-up responsive grid: First/Last name side by side, Hotel-or-Company
   /Email side by side; everything else (checkboxes, Subject, Message,
   submit, messages) spans the full width. Collapses to one column on
   narrow screens for free via auto-fit — no extra media query needed.
   ========================================================================== */

.gutena-forms-contact-form {
	display: grid;
	grid-template-columns: repeat( auto-fit, minmax( 240px, 1fr ) );
	gap: 32px;
}

.gutena-forms-contact-form .field-group-type-checkbox,
.gutena-forms-contact-form .field-group-type-textarea,
.gutena-forms-contact-form .gutena-forms-submit-buttons,
.gutena-forms-contact-form .wp-block-gutena-form-confirm-msg,
.gutena-forms-contact-form .wp-block-gutena-form-error-msg {
	grid-column: 1 / -1;
}

/*
 * Subject is a field-group-type-text field, same as First name / Last name /
 * Hotel-or-Company name, so the type class alone cannot single it out.
 *
 * NOTE: an earlier draft also matched `.field-group-type-text.standalone-text-field`
 * here, on the theory that "standalone" marked a full-width field. That is WRONG
 * and was removed: a live DOM capture of https://al-hospitality.com/contact/ shows
 * First name and Last name BOTH carry `standalone-text-field`, so that selector
 * would have forced every text field to full width and destroyed the two-up grid.
 *
 * Position is therefore the only reliable hook. Field-group order on the live
 * form is: 1 First name, 2 Last name, 3 Hotel or Company name, 4 Email,
 * 5 Services checkboxes, 6 Subject, 7 Message. Subject is the 6th field group.
 * `nth-of-type` is not usable (all groups are divs), so nth-child is used and
 * must be re-verified if fields are ever reordered in the block editor.
 */
.gutena-forms-contact-form .wp-block-gutena-field-group:nth-child( 6 ) {
	grid-column: 1 / -1;
}

/* ==========================================================================
   4. Labels + underline-only inputs
   ========================================================================== */

.gutena-forms-contact-form .heading-input-label-gutena {
	display: block;
	font-family: 'Karla', sans-serif;
	font-size: 11px;
	font-weight: 500;
	letter-spacing: 0.13em;
	text-transform: uppercase;
	color: var( --alh-muted-2 );
	margin-bottom: 10px;
}

.gutena-forms-contact-form .gutena-forms-field {
	font-family: 'Karla', sans-serif;
	font-size: 17px;
	font-weight: 300;
	color: var( --alh-ink );
	padding: 8px 0;
	border-bottom: 1px solid var( --alh-rule );
	transition: border-color 0.2s ease;
}

.gutena-forms-contact-form textarea.gutena-forms-field {
	min-height: 120px;
	resize: vertical;
}

.gutena-forms-contact-form .gutena-forms-field:focus {
	outline: none;
	border-bottom-color: var( --alh-ink );
}

.gutena-forms-contact-form .gutena-forms-field:focus-visible {
	outline: 2px solid var( --alh-accent );
	outline-offset: 4px;
}

.gutena-forms-contact-form .gutena-forms-field-error-msg {
	margin-top: 6px;
	font-size: 13px;
	color: var( --alh-error );
}

/* ==========================================================================
   5. Pill checkboxes (service-interest group)
   ========================================================================== */

.gutena-forms-contact-form .field-group-type-checkbox .wp-block-gutena-form-field {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.gutena-forms-contact-form .field-group-type-checkbox label {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 9px 18px;
	border: 1px solid var( --alh-rule );
	border-radius: 999px;
	font-size: 14px;
	color: var( --alh-ink-2 );
	cursor: pointer;
	transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.gutena-forms-contact-form .field-group-type-checkbox label:hover {
	border-color: var( --alh-ink );
}

.gutena-forms-contact-form .field-group-type-checkbox label:has( :checked ) {
	border-color: var( --alh-ink );
	background: var( --alh-ink );
	color: var( --alh-bg );
}

.gutena-forms-contact-form .field-group-type-checkbox label:focus-within {
	outline: 2px solid var( --alh-accent );
	outline-offset: 3px;
}

.gutena-forms-contact-form .field-group-type-checkbox input[type="checkbox"] {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect( 0, 0, 0, 0 );
	white-space: nowrap;
	border: 0;
}

/* ==========================================================================
   6. Submit button
   ========================================================================== */

.gutena-forms-contact-form .gutena-forms-submit-buttons {
	margin-top: 8px;
}

.gutena-forms-contact-form .gutena-forms-submit-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 14px 36px;
	border: none;
	border-radius: 999px;
	background: var( --alh-ink );
	color: var( --alh-bg );
	font-family: 'Karla', sans-serif;
	font-size: 14px;
	letter-spacing: 0.03em;
	cursor: pointer;
	transition: background-color 0.2s ease;
}

.gutena-forms-contact-form .gutena-forms-submit-button:hover {
	background: var( --alh-accent );
}

.gutena-forms-contact-form .gutena-forms-submit-button:focus-visible {
	outline: 2px solid var( --alh-accent );
	outline-offset: 4px;
}

/* ==========================================================================
   7. Success / error messages
   ========================================================================== */

.gutena-forms-contact-form .wp-block-gutena-form-confirm-msg {
	padding: 16px 20px;
	border: 1px solid var( --alh-accent );
	border-radius: 8px;
	color: var( --alh-accent );
	font-size: 15px;
}

.gutena-forms-contact-form .wp-block-gutena-form-error-msg {
	padding: 16px 20px;
	border: 1px solid var( --alh-error );
	border-radius: 8px;
	color: var( --alh-error );
	font-size: 15px;
}

.gutena-forms-contact-form .gutena-forms-error-text {
	color: var( --alh-error );
}

/* ==========================================================================
   8. Honeypot decoy field (injected by inc/form-enhance.php via nav.js)
   ========================================================================== */

.alh-hp-wrap {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* ==========================================================================
   9. Responsive padding, matching style.css's 1080px / 900px breakpoints
   ========================================================================== */

@media ( max-width: 1080px ) {
	.alh-contact-wrap {
		padding-left: 28px;
		padding-right: 28px;
	}
}

@media ( max-width: 900px ) {
	.alh-contact-wrap {
		padding-left: 24px;
		padding-right: 24px;
	}
}

/* ==========================================================================
   10. Reduced motion
   ========================================================================== */

@media ( prefers-reduced-motion: reduce ) {
	.gutena-forms-contact-form .gutena-forms-field,
	.gutena-forms-contact-form .gutena-forms-submit-button,
	.gutena-forms-contact-form .field-group-type-checkbox label {
		transition: none;
	}
}
