/* =============================================================================
   Price-enquiry modal — shown wherever the catalogue says POA.

   Uses the theme's own tokens throughout; there is no Figma frame for this
   dialog, so it borrows the quick-add sheet's proportions rather than
   inventing a new visual language.
   ============================================================================= */

#enquiry-modal {
	width: min(520px, calc(100vw - 32px));
	max-width: none;
	/* A <dialog> is capped at the viewport by the UA stylesheet but does not
	   scroll on its own, so on a short screen the Send button was simply cut
	   off the bottom. */
	max-height: calc(100dvh - 32px);
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 0;
	border: 1px solid var(--fig-neutral-100);
	border-radius: var(--r-sm);
	background: var(--fig-siegel-white);
	box-shadow: 0 24px 60px rgba(0, 0, 0, .18);
}

#enquiry-modal::backdrop {
	background: rgba(0, 0, 0, .45);
}

.enquiry {
	display: flex;
	flex-direction: column;
	gap: 20px;
	padding: 24px;
}

/* The hand-built form, used only when Gravity Forms is inactive. It used to
   BE .enquiry; now .enquiry is the wrapper that holds the heading, the
   product block and whichever form is rendering, so this carries the column
   rhythm on its own and none of the padding. */
.enquiry__legacy {
	display: flex;
	flex-direction: column;
	gap: 20px;
	margin: 0;
}

.enquiry__header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
}

.enquiry__title {
	margin: 0;
	color: var(--text-heading-primary);
}

.enquiry__close {
	flex-shrink: 0;
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: none;
	border: 0;
	padding: 0;
	cursor: pointer;
	color: var(--text-heading-primary);
}

.enquiry__close:focus-visible {
	outline: 2px solid var(--btn-stroke-focused);
	outline-offset: 2px;
}

/* The product being asked about, so the customer can see they picked the right
   one before sending. */
.enquiry__product {
	padding: 12px 16px;
	background: var(--fig-neutral-50);
	border-radius: var(--r-sm);
}

.enquiry__product-name {
	margin: 0;
	color: var(--text-heading-primary);
}

.enquiry__product-meta {
	margin: 4px 0 0;
	color: var(--text-body-primary);
}

.enquiry__product-meta:empty,
.enquiry__product-name:empty {
	display: none;
}

.enquiry__fields {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px 16px;
}

.enquiry__field {
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-width: 0;
}

.enquiry__field--full {
	grid-column: 1 / -1;
}

.enquiry__label {
	color: var(--text-body-primary);
	text-transform: uppercase;
	letter-spacing: var(--ls-wide);
}

.enquiry__field input,
.enquiry__field textarea {
	box-sizing: border-box;
	width: 100%;
	padding: 10px 12px;
	font: var(--fw-regular) 1rem/1.2625rem var(--font-body);
	color: var(--text-heading-primary);
	background: var(--fig-siegel-white);
	border: 1px solid var(--fig-neutral-100);
	border-radius: var(--r-sm);
}

.enquiry__field input:focus-visible,
.enquiry__field textarea:focus-visible {
	outline: 2px solid var(--btn-stroke-focused);
	outline-offset: -1px;
}

/* Honeypot — off-screen rather than display:none, which some bots detect. */
.enquiry__hp {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.enquiry__submit {
	width: 100%;
	min-height: 53px;
	background: var(--btn-primary);
	color: var(--fig-siegel-white);
	border: 1px solid var(--btn-primary);
	border-radius: var(--r-sm);
	cursor: pointer;
	font: var(--fw-bold) 0.875rem/1rem var(--font-heading);
	letter-spacing: var(--ls-wide);
	transition: background var(--dur-fast) linear;
}

@media (hover: hover) and (pointer: fine) {
	.enquiry__submit:hover { background: var(--btn-primary-hover, #b01320); }
}

@media (prefers-reduced-motion: reduce) {
	.enquiry__submit { transition: none; }
}

/* =============================================================================
   Gravity Forms inside the dialog

   The enquiry is a Gravity Form (inc/gravity-forms.php). GF owns validation,
   entries, notifications and the confirmation; these rules put its markup
   back into the dialog's own fields and button. The wrapper carries
   gform-theme__disable-framework, so GF's framework stylesheet has already
   stood down - what is left to do is layout and the theme's field styling.
   ============================================================================= */

.enquiry__gf,
.enquiry__gf .gform_wrapper,
.enquiry__gf .gform-body,
.enquiry__gf .gform_body {
	width: 100%;
}

.enquiry__gf .gform_wrapper {
	margin: 0;
}

.enquiry__gf form {
	display: flex;
	flex-direction: column;
	gap: 20px;
	margin: 0;
}

.enquiry__gf .gform-body,
.enquiry__gf .gform_body,
.enquiry__gf .gform_page,
.enquiry__gf .gform_page_fields {
	margin: 0;
	padding: 0;
}

/* Twelve columns, the same device the contact form uses, so a field's width
   is set by its layoutGridColumnSpan in the form definition rather than by a
   selector here. Name, email, phone and quantity are 6; message is 12. */
.enquiry__gf .gform_fields {
	display: grid !important;
	grid-template-columns: repeat(12, minmax(0, 1fr)) !important;
	column-gap: 16px !important;
	row-gap: 12px !important;
	width: 100%;
	margin: 0;
	padding: 0;
	list-style: none;
}

.enquiry__gf .gfield {
	grid-column: 1 / -1;
	min-width: 0;
	margin: 0 !important;
	padding: 0 !important;
}

.enquiry__gf .siegel-gf-enquiry-name,
.enquiry__gf .siegel-gf-enquiry-email,
.enquiry__gf .siegel-gf-enquiry-phone,
.enquiry__gf .siegel-gf-enquiry-quantity {
	grid-column: span 6;
}

/* The four hidden fields carrying the product. GF still emits a wrapper for
   them, and a wrapper in a grid takes a row whether or not anything is in
   it. */
.enquiry__gf .gform_hidden,
.enquiry__gf .gfield--type-hidden {
	display: none !important;
}

.enquiry__gf .gfield_label,
.enquiry__gf .gform-field-label:not(.gform-field-label--type-inline) {
	display: block;
	margin: 0 0 6px;
	color: var(--text-body-primary);
	font: var(--fw-bold) .75rem/1rem var(--font-heading);
	letter-spacing: var(--ls-wide);
	text-transform: uppercase;
}

/* GF spells its required marker out in full - "Your name(Required)" - which
   is a lot of furniture for a five-field dialog, and not what the rest of the
   site does. The words are replaced with the asterisk the design uses. The
   input still carries aria-required, so this changes nothing for a screen
   reader. */
.enquiry__gf .gfield_required_text {
	display: none;
}

.enquiry__gf .gfield_required::after {
	content: " *";
	color: var(--fig-siegel-red);
}

/* ...once. The marker is a span inside a span, both carrying the class. */
.enquiry__gf .gfield_required .gfield_required::after {
	content: none;
}

.enquiry__gf .gform_required_legend {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	margin: -1px !important;
	padding: 0 !important;
	overflow: hidden !important;
	clip-path: inset(50%) !important;
	white-space: nowrap !important;
}

.enquiry__gf .ginput_container {
	margin: 0;
}

.enquiry__gf input[type="text"],
.enquiry__gf input[type="email"],
.enquiry__gf input[type="tel"],
.enquiry__gf textarea {
	box-sizing: border-box;
	width: 100%;
	padding: 10px 12px;
	margin: 0;
	font: var(--fw-regular) 1rem/1.2625rem var(--font-body);
	color: var(--text-heading-primary);
	background: var(--fig-siegel-white);
	border: 1px solid var(--fig-neutral-100);
	border-radius: var(--r-sm);
}

/* GF writes rows="10" and sizes the control from it, which put a 288px
   textarea in a 520px dialog and pushed the Send button off the bottom.
   Three rows is the shape of the field in the design; drag it taller if you
   are writing an essay. Specific enough to beat GF's own height. */
/* The id is load-bearing. Gravity Forms sizes this from rows="10" with
   .gform_wrapper.gravity-theme textarea.large - three classes - so a
   two-class selector here lost and the field stayed 288px tall. */
#enquiry-modal .enquiry__gf textarea {
	height: 84px;
	min-height: 84px;
	resize: vertical;
}

.enquiry__gf input:focus-visible,
.enquiry__gf textarea:focus-visible {
	outline: 2px solid var(--btn-stroke-focused);
	outline-offset: -1px;
}

.enquiry__gf .gform_footer {
	margin: 0;
	padding: 0;
}

/* GF renders a <button> in current versions and an <input type="submit"> in
   older ones. Both, so the dialog's button does not change shape with a
   plugin update. */
.enquiry__gf .gform_footer input[type="submit"],
.enquiry__gf .gform_footer button,
.enquiry__gf .gform_button {
	box-sizing: border-box;
	/* Centred. Gravity Forms' button inherits the form's text-align, so at
	   100% width the words sat against the left edge - reported by the
	   client. flex rather than text-align, because the button is a flex
	   parent to its own label and spinner. */
	display: flex;
	align-items: center;
	justify-content: center;
	text-align: center;
	width: 100%;
	min-height: 53px;
	padding: 0 16px;
	background: var(--btn-primary);
	color: var(--fig-siegel-white);
	border: 1px solid var(--btn-primary);
	border-radius: var(--r-sm);
	cursor: pointer;
	font: var(--fw-bold) 0.875rem/1rem var(--font-heading);
	letter-spacing: var(--ls-wide);
	text-transform: uppercase;
	transition: background var(--dur-fast) linear;
}

@media (hover: hover) and (pointer: fine) {
	/* --btn-primary-hover, with no literal fallback: that #b01320 was a
	   guess and it is not the colour the rest of the site darkens to. Every
	   other button on the site uses this token (see the hover block in
	   woocommerce.css), so the enquiry button now darkens by exactly the
	   same amount. */
	.enquiry__gf .gform_footer input[type="submit"]:hover,
	.enquiry__gf .gform_footer button:hover,
	.enquiry__gf .gform_button:hover {
		background: var(--btn-primary-hover);
		border-color: var(--btn-primary-hover);
	}
}

/* Gravity Forms' own stylesheet carries `button:hover { color: #515151 }`.
   On a red fill that reads as the label vanishing - reported by the client.
   Outside the hover media query so focus and active are covered too. */
.enquiry__gf .gform_footer input[type="submit"]:hover,
.enquiry__gf .gform_footer input[type="submit"]:focus,
.enquiry__gf .gform_footer input[type="submit"]:active,
.enquiry__gf .gform_footer button:hover,
.enquiry__gf .gform_footer button:focus,
.enquiry__gf .gform_footer button:active,
.enquiry__gf .gform_button:hover,
.enquiry__gf .gform_button:focus,
.enquiry__gf .gform_button:active {
	color: var(--fig-siegel-white);
}

@media (prefers-reduced-motion: reduce) {
	.enquiry__gf .gform_footer input[type="submit"],
	.enquiry__gf .gform_footer button,
	.enquiry__gf .gform_button {
		transition: none;
	}
}

.enquiry__gf .gform_ajax_spinner {
	display: inline-block;
	margin-inline-start: 10px;
	vertical-align: middle;
}

/* Validation. Red text under the field and a red edge on the control, which
   is the same pair the contact form uses. */
.enquiry__gf .gfield_validation_message,
.enquiry__gf .validation_message {
	margin: 6px 0 0;
	padding: 0;
	background: none;
	border: 0;
	color: var(--fig-red-600);
	font: var(--fw-regular) 0.8125rem/1.125rem var(--font-body);
}

.enquiry__gf .gfield_error input,
.enquiry__gf .gfield_error textarea {
	border-color: var(--fig-siegel-red);
}

/* Id again: GF styles this box with .gform_wrapper.gravity-theme
   .gform_validation_errors, three classes, and measured on the live form it
   was still drawing its own #c02b0a on a 3px radius. */
#enquiry-modal .enquiry__gf .gform_validation_errors {
	margin: 0 0 16px;
	padding: 12px 16px;
	border: 1px solid var(--fig-siegel-red);
	border-radius: var(--r-sm);
	background: var(--fig-red-100);
	color: var(--fig-red-700);
	font: var(--fw-regular) 0.875rem/1.25rem var(--font-body);
}

#enquiry-modal .enquiry__gf .gform_validation_errors h2,
#enquiry-modal .enquiry__gf .gform_validation_errors .gform_submission_error {
	margin: 0;
	font: inherit;
	color: inherit;
}

/* The confirmation replaces the form in place, because the submission is
   ajax. It is the only thing left in the dialog at that point, so it gets
   room rather than sitting flush at the top of an empty box. */
#enquiry-modal .enquiry__gf .gform_confirmation_message {
	margin: 0;
	padding: 20px 0;
	color: var(--text-heading-primary);
	font: var(--fw-regular) 1rem/1.5rem var(--font-body);
}

/* The PDP button that opens it — same shape as ADD TO CART so the column
   rhythm does not shift between a priced and an unpriced product. */
.pdp-cta__add--enquire {
	justify-content: center;
}

/* Confirmation toast after the redirect back from admin-post.php. */
.enquiry-note {
	position: fixed;
	left: 50%;
	bottom: 24px;
	transform: translateX(-50%);
	z-index: 400;
	max-width: min(520px, calc(100vw - 32px));
	padding: 14px 20px;
	border-radius: var(--r-sm);
	font: var(--fw-regular) 1rem/1.2625rem var(--font-body);
	color: var(--fig-siegel-white);
	background: var(--text-heading-primary);
	box-shadow: 0 12px 30px rgba(0, 0, 0, .2);
}

.enquiry-note--error { background: var(--fig-red-600); }

@media (max-width: 600px) {
	.enquiry__fields { grid-template-columns: 1fr; }
	.enquiry { padding: 20px; }

	/* Two 6-column fields in a 335px dialog leaves ~150px each, which is not
	   enough for an email address. One per row below 600. */
	.enquiry__gf .siegel-gf-enquiry-name,
	.enquiry__gf .siegel-gf-enquiry-email,
	.enquiry__gf .siegel-gf-enquiry-phone,
	.enquiry__gf .siegel-gf-enquiry-quantity {
		grid-column: 1 / -1;
	}
}
