/**
 * "Talk to Andy" — enquiry modal.
 *
 * Mirrors the Snapshot modal shell (assets/css/snapshot.css) with distinct
 * `enq-` tokens so the two modals coexist without cross-wiring. Mobile-first:
 * fits at 375px with no horizontal scroll; every control is a >=44px tap target.
 * All motion is gated behind (prefers-reduced-motion: no-preference) and the JS
 * `data-enq-no-motion` hook, so reduced-motion users get an instant open with no
 * transition. Theme tokens only (base.css / components.css).
 */

/* ---- Body scroll lock while open ------------------------------- */
body.enq-lock {
	overflow: hidden;
}

/* ---- Overlay + centering --------------------------------------- */
.enq-modal {
	position: fixed;
	inset: 0;
	z-index: 1000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: var(--space-sm);
}

.enq-modal[hidden] {
	display: none;
}

.enq-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(14, 15, 16, 0.72);
	border: 0;
	cursor: pointer;
}

.enq-modal__dialog {
	position: relative;
	z-index: 1;
	width: 100%;
	max-width: 34rem;
	max-height: calc(100vh - 2 * var(--space-sm));
	max-height: calc(100dvh - 2 * var(--space-sm));
	overflow-y: auto;
	background: var(--white);
	color: var(--ink-900);
	border-radius: var(--radius);
	padding: var(--space-lg) var(--space-md) var(--space-md);
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
}

/* ---- Close button ---------------------------------------------- */
.enq-modal__close {
	position: absolute;
	top: var(--space-2xs);
	right: var(--space-2xs);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	color: var(--ink-700);
	background: transparent;
	border: 0;
	border-radius: var(--radius);
	cursor: pointer;
}

.enq-modal__close:hover {
	color: var(--green);
}

.enq-modal__close:focus-visible {
	outline: none;
	box-shadow: var(--focus-ring);
}

/* ---- Screens --------------------------------------------------- */
.enq-modal__screens {
	display: block;
}

.enq-screen {
	display: flex;
	flex-direction: column;
	gap: var(--space-md);
}

/* `[hidden]` must win over the display:flex above (class+attr specificity),
   or the hidden screen renders and drags the honeypot into the tab order. */
.enq-screen[hidden] {
	display: none;
}

/* ---- Intro ----------------------------------------------------- */
.enq-intro {
	gap: var(--space-sm);
}

.enq-intro__eyebrow {
	font-family: var(--font-body);
	font-size: var(--text-sm);
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--green);
	margin: 0;
}

.enq-intro__heading {
	font-family: var(--font-heading);
	font-size: var(--text-xl);
	line-height: 1.25;
	color: var(--ink-900);
	margin: 0;
}

.enq-intro__lead {
	font-family: var(--font-body);
	font-size: var(--text-base);
	line-height: 1.5;
	color: var(--ink-800);
	margin: 0;
}

.enq-intro__book {
	font-family: var(--font-body);
	font-size: var(--text-sm);
	color: var(--grey-text);
	margin: 0;
}

.enq-intro__book a {
	color: var(--green);
	font-weight: 600;
}

/* ---- Form ------------------------------------------------------ */
.enq-form {
	display: flex;
	flex-direction: column;
	gap: var(--space-sm);
}

.enq-field {
	display: flex;
	flex-direction: column;
	gap: var(--space-3xs);
}

.enq-field__label {
	font-family: var(--font-body);
	font-size: var(--text-base);
	font-weight: 600;
	color: var(--ink-900);
}

.enq-field__input {
	width: 100%;
	min-height: 44px;
	font-family: var(--font-body);
	font-size: var(--text-base);
	line-height: 1.4;
	color: var(--ink-900);
	background: var(--white);
	border: 1px solid var(--grey-bg);
	border-radius: var(--radius);
	padding: var(--space-2xs) var(--space-xs);
}

.enq-field__input--area {
	min-height: 6rem;
	resize: vertical;
}

.enq-field__input:focus-visible {
	outline: none;
	box-shadow: var(--focus-ring);
	border-color: var(--green-vibrant);
}

.enq-field__error {
	font-family: var(--font-body);
	font-size: var(--text-sm);
	font-weight: 600;
	color: #A23225; /* Reuse the contact form's error red. */
	margin: 0;
}

.enq-form__submit {
	align-self: flex-start;
}

/* ---- Success --------------------------------------------------- */
.enq-success {
	text-align: center;
	align-items: center;
	gap: var(--space-sm);
	padding: var(--space-sm) 0;
}

.enq-success__icon {
	color: var(--green-vibrant);
	display: inline-flex;
}

.enq-success__heading {
	font-family: var(--font-heading);
	font-size: var(--text-xl);
	line-height: 1.25;
	color: var(--ink-900);
	margin: 0;
}

/* Programmatic focus target (tabindex=-1) so focus lands on the confirmation
   rather than falling through to Close — suppress the focus box, as the
   Snapshot result heading does. */
.enq-success__heading:focus {
	outline: none;
}

.enq-success__lead {
	font-family: var(--font-body);
	font-size: var(--text-base);
	line-height: 1.5;
	color: var(--ink-800);
	margin: 0;
	max-width: 40ch;
}

.enq-success__book {
	align-self: center;
}

.enq-success__close {
	align-self: center;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px; /* Tap-target bar, matching the .btn controls. */
	font-family: var(--font-body);
	font-size: var(--text-sm);
	font-weight: 600;
	color: var(--grey-text);
	background: transparent;
	border: 0;
	padding: var(--space-2xs) var(--space-sm);
	cursor: pointer;
}

.enq-success__close:hover {
	color: var(--green);
}

.enq-success__close:focus-visible {
	outline: none;
	box-shadow: var(--focus-ring);
	border-radius: var(--radius);
}

/* ---- Honeypot (visually hidden, off the a11y-hidden host) ------ */
.enq-hp {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* ---- Motion (opt-in only) -------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
	.enq-modal:not([data-enq-no-motion]) .enq-modal__dialog {
		animation: enq-rise var(--transition-base);
	}

	.enq-modal:not([data-enq-no-motion]) .enq-screen:not([hidden]) {
		animation: enq-fade var(--transition-base);
	}

	.enq-field__input,
	.enq-modal__close,
	.enq-success__close {
		transition: background-color var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
	}
}

@keyframes enq-rise {
	from {
		transform: translateY(12px);
		opacity: 0;
	}
	to {
		transform: translateY(0);
		opacity: 1;
	}
}

@keyframes enq-fade {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

/* ---- Small phones (>=30rem roomier) ---------------------------- */
@media (min-width: 30rem) {
	.enq-modal__dialog {
		padding: var(--space-xl) var(--space-lg) var(--space-lg);
	}
}
