/**
 * td/contact-form + td/step
 *
 * Mobile (390 frame): steps then the bronze form panel, stacked and centred.
 * Desktop (1440 frame, from 1024px): steps on the left (content edge), form
 * panel 540px wide on the right edge, vertically centred.
 */

.td-contact-form {
	display: flex;
	flex-direction: column;
	background-color: var(--wp--preset--color--sand);
	color: var(--wp--preset--color--slate);
}

/* Steps column ------------------------------------------------------------- */

.td-contact-form__intro {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--td-section-gap);
	padding: var(--td-section-space) var(--td-gutter);
}

.td-contact-form__header {
	display: flex;
	flex-direction: column;
	gap: 16px;
	align-self: stretch;
	text-align: center;
}

.td-contact-form__eyebrow {
	color: var(--wp--preset--color--bronze);
}

.td-contact-form__title {
	color: var(--wp--preset--color--ink);
}

.td-contact-form__steps {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 32px;
	margin: 0;
	padding: 0;
	list-style: none;
	counter-reset: td-step;
}

.td-step {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	width: 202px;
	max-width: 100%;
	text-align: center;
	counter-increment: td-step;
}

.td-step__label {
	color: var(--wp--preset--color--bronze);
}

.td-step__label::before {
	content: counter(td-step, decimal-leading-zero) " · ";
}

.td-step__label:empty::before {
	content: counter(td-step, decimal-leading-zero);
}

.td-step__body {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.td-step__title {
	font-family: var(--wp--preset--font-family--sans);
	font-size: 14px;
	font-weight: 700;
	line-height: 22px;
	color: var(--wp--preset--color--ink);
}

.td-step__text {
	font-size: 14px;
	line-height: 22px;
}

/* Same title height in every step (two lines, the longest the steps use), so
   the text below starts at the same position; a longer title still grows. */
.td-contact-form__steps .td-step__title {
	min-height: 2lh;
}

/* Form panel --------------------------------------------------------------- */

.td-contact-form__panel {
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 32px;
	padding: 80px var(--td-gutter);
	background-color: var(--wp--preset--color--bronze);
	color: var(--wp--preset--color--ivory);
}

.td-contact-form__panel-intro {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 16px;
	text-align: center;
}

.td-contact-form__form-title {
	font-family: var(--wp--preset--font-family--serif);
	font-size: 22px;
	font-weight: 400;
	line-height: 30px;
	color: var(--wp--preset--color--ivory);
}

.td-contact-form__form-text {
	max-width: 300px;
	font-size: 14px;
	line-height: 22px;
}

.td-contact-form__fields {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 16px;
}

.td-contact-form__field {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.td-contact-form__label,
.td-contact-form__note,
.td-contact-form__consent label {
	font-size: 12px;
	line-height: 13px;
}

.td-contact-form__label {
	text-transform: uppercase;
}

.td-contact-form__input {
	width: 100%;
	height: 38px;
	padding: 0 8px;
	border: 1px solid var(--wp--preset--color--ivory);
	border-radius: 0;
	background-color: var(--wp--preset--color--bronze);
	color: var(--wp--preset--color--ivory);
	font: inherit;
	font-size: 12px;
	line-height: 13px;
}

.td-contact-form__input::placeholder {
	color: var(--wp--preset--color--ivory);
	opacity: 0.7;
}

/* Browser autofill (Chrome, Edge, Safari) paints its own background and text
   colour, and ignores background-color. An inset shadow in the field colour
   covers it, the text colour is set explicitly, and a very long transition
   stops the browser fading its colour back in. Border, padding, font and the
   focus and error states are left as they are. Follows the field colours
   above (also on custom form backgrounds). */
.td-contact-form__input:-webkit-autofill,
.td-contact-form__input:-webkit-autofill:hover,
.td-contact-form__input:-webkit-autofill:focus,
.td-contact-form__input:-webkit-autofill:active,
.td-contact-form__input:autofill {
	box-shadow: 0 0 0 1000px var(--wp--preset--color--bronze) inset;
	-webkit-text-fill-color: var(--wp--preset--color--ivory);
	caret-color: var(--wp--preset--color--ivory);
	transition: background-color 5000s ease-in-out 0s;
}

.td-contact-form__input:focus-visible,
.td-contact-form__consent input:focus-visible {
	outline: 2px solid var(--wp--preset--color--ivory);
	outline-offset: 2px;
}

select.td-contact-form__input {
	padding-right: 32px;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23F1EFE7'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
	background-position: right 8px center;
	background-repeat: no-repeat;
	background-size: 16px;
	appearance: none;
	cursor: pointer;
}

select.td-contact-form__input:invalid {
	color: rgba(241, 239, 231, 0.7);
}

select.td-contact-form__input option {
	color: var(--wp--preset--color--ink);
}

.td-contact-form__consent {
	display: flex;
	align-items: flex-start;
	gap: 8px;
}

/* Round marker as in the design (a checkbox, so it can be unticked). */
.td-contact-form__consent input {
	flex: none;
	width: 12.5px;
	height: 12.5px;
	margin: 0;
	border: 0.83px solid var(--wp--preset--color--ivory);
	border-radius: 50%;
	background-color: var(--wp--preset--color--bronze);
	appearance: none;
	cursor: pointer;
}

.td-contact-form__consent input:checked {
	background: radial-gradient(circle, var(--wp--preset--color--ivory) 0 3px, transparent 3.5px) var(--wp--preset--color--bronze);
}

.td-contact-form__submit {
	width: 100%;
}

.td-contact-form__submit:disabled {
	cursor: progress;
	opacity: 0.7;
}

/* The button sits on the bronze panel, so the global light hover (bronze)
   would make it vanish into the background. Here it warms to champagne
   with ink text (about 9:1), a pressed state one step darker, and an ivory
   focus ring as on the fields. Hover is limited to devices that have one,
   so a tap on a phone does not leave it stuck; a disabled (sending) button
   keeps its resting look. */
.td-contact-form .td-contact-form__submit {
	transition: background-color 0.22s var(--td-ease), color 0.22s var(--td-ease);
}

.td-contact-form .td-contact-form__submit:hover {
	background-color: var(--wp--preset--color--sand);
	color: var(--wp--preset--color--ink);
}

@media (hover: hover) {

	.td-contact-form .td-contact-form__submit:hover:not(:disabled) {
		background-color: var(--wp--preset--color--champagne);
	}
}

.td-contact-form .td-contact-form__submit:focus-visible {
	background-color: var(--wp--preset--color--champagne);
	outline: 2px solid var(--wp--preset--color--ivory);
	outline-offset: 2px;
}

.td-contact-form .td-contact-form__submit:active:not(:disabled) {
	background-color: color-mix(in srgb, var(--wp--preset--color--champagne) 85%, var(--wp--preset--color--ink));
}

/* Inline validation: message plus marked field (not colour alone). */
.td-contact-form__error {
	margin: 0;
	padding-left: 8px;
	border-left: 3px solid var(--wp--preset--color--ivory);
	font-size: 12px;
	font-weight: 600;
	line-height: 16px;
}

.td-contact-form__error[hidden] {
	display: none;
}

.td-contact-form__input[aria-invalid="true"],
.td-contact-form__choices[aria-invalid="true"] {
	border-color: var(--wp--preset--color--ivory);
	border-width: 2px;
}

.td-contact-form__consent input[aria-invalid="true"] {
	outline: 2px solid var(--wp--preset--color--ivory);
	outline-offset: 2px;
}

.td-contact-form__status {
	margin-bottom: 16px;
	padding: 12px 16px;
	background-color: var(--wp--preset--color--ivory);
	color: var(--wp--preset--color--ink);
	font-size: 14px;
	line-height: 22px;
}

/* Honeypot (td_forms_hidden_fields()): off-screen, never shown. */
.td-form-trap {
	position: absolute;
	left: -10000px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

@media (min-width: 600px) {

	.td-contact-form__steps {
		flex-direction: row;
		align-items: flex-start;
		justify-content: center;
		gap: 24px;
	}

	.td-step {
		flex: 0 1 202px;
	}

	.td-contact-form__panel-intro,
	.td-contact-form__form {
		width: 100%;
		max-width: 428px;
		margin-inline: auto;
	}

	.td-contact-form__fields {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		column-gap: 24px;
	}

	.td-contact-form__fields > * {
		grid-column: 1 / -1;
	}

	.td-contact-form__fields > .td-contact-form__field--half {
		grid-column: auto;
	}
}

@media (min-width: 1024px) {

	.td-step__title {
		font-size: 16px;
		line-height: 25px;
	}

	.td-contact-form__form-title {
		font-size: 24px;
	}

	.td-contact-form__fields {
		row-gap: 24px;
	}

	.td-contact-form__field {
		gap: 8px;
	}
}

/* Side by side from 1200px: below that the 540px panel leaves too little
   room for three steps. */
@media (min-width: 1200px) {

	/* Both outer edges sit on the shared content lines: the page gutter, or
	   the edge of the capped content column on ultra-wide screens (% = the
	   section width wherever it is used). */
	.td-contact-form {
		--td-contact-edge: max(var(--td-gutter), calc((100% - var(--td-content)) / 2));
		flex-direction: row;
		align-items: center;
	}

	.td-contact-form__intro {
		flex: 1;
		min-width: 0;
		align-items: flex-start;
		gap: 80px;
		padding-left: var(--td-contact-edge);
	}

	.td-contact-form__header {
		gap: 24px;
		text-align: left;
	}

	.td-contact-form__steps {
		justify-content: flex-start;
		gap: 24px;
	}

	.td-step {
		align-items: flex-start;
		gap: 16px;
		text-align: left;
	}

	.td-step__body {
		gap: 8px;
	}

	/* Panel: full-bleed to the right like the design; its content is the
	   428px form, 56px from the panel's left edge, ending on the right
	   content line (540px wide at 1440 with the design's 56px gutter). */
	.td-contact-form__panel {
		flex: 0 0 calc(428px + 56px + var(--td-contact-edge));
		align-self: stretch;
		gap: 48px;
		padding: 80px var(--td-contact-edge) 80px 56px;
	}

	.td-contact-form__form-text {
		max-width: none;
	}
}

@media (min-width: 1440px) {

	.td-contact-form__steps {
		gap: 48px;
	}
}

/* Request type tabs (radios) and the matching button label ---------------- */

.td-contact-form__tabs {
	display: flex;
	justify-content: center;
	width: fit-content;
	max-width: 100%;
	margin: 0 auto;
	padding: 4px;
	border: 1px solid var(--wp--preset--color--sand);
	border-radius: 30px;
}

.td-contact-form__tab {
	position: relative;
	flex: 0 1 137px;
	min-width: 0;
	cursor: pointer;
}

.td-contact-form__tab input {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	opacity: 0;
	cursor: pointer;
}

.td-contact-form__tab span {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 29px;
	padding: 4px 8px;
	border-radius: 20px;
	color: var(--wp--preset--color--ivory);
	font-size: 10px;
	line-height: 1.2;
	text-align: center;
	text-transform: uppercase;
	transition: background-color 0.2s var(--td-ease), color 0.2s var(--td-ease);
}

.td-contact-form__tab input:checked + span {
	background-color: var(--wp--preset--color--sand);
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
	color: var(--wp--preset--color--bronze);
}

.td-contact-form__tab input:focus-visible + span {
	outline: 2px solid var(--wp--preset--color--ivory);
	outline-offset: 2px;
}

/* Tab labels on one line where there is room (design: 137px + 150px). */
@media (min-width: 600px) {

	.td-contact-form__tab {
		flex: 0 0 auto;
	}

	.td-contact-form__tab span {
		white-space: nowrap;
	}
}

/* One form per tab: the checked tab's form is shown (all stay visible in
   browsers without :has(), so every form remains usable). */
.td-contact-form__panel:has(.td-contact-form__tabs) .td-contact-form__form:not(.is-0),
.td-contact-form__panel:has(.td-contact-form__tab-input--1:checked) .td-contact-form__form.is-0,
.td-contact-form__panel:has(.td-contact-form__tab-input--2:checked) .td-contact-form__form.is-0,
.td-contact-form__panel:has(.td-contact-form__tab-input--3:checked) .td-contact-form__form.is-0 {
	display: none;
}

.td-contact-form__panel:has(.td-contact-form__tab-input--1:checked) .td-contact-form__form.is-1,
.td-contact-form__panel:has(.td-contact-form__tab-input--2:checked) .td-contact-form__form.is-2,
.td-contact-form__panel:has(.td-contact-form__tab-input--3:checked) .td-contact-form__form.is-3 {
	display: block;
}

/* Paragraph, radio and checkbox fields ------------------------------------ */

.td-contact-form__textarea {
	height: 118px;
	padding: 8px;
	resize: vertical;
}

.td-contact-form__choices {
	min-width: 0;
	margin: 0;
	padding: 0;
	border: 0;
}

.td-contact-form__choices legend {
	margin-bottom: 8px;
	padding: 0;
}

.td-contact-form__choice {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	margin-top: 8px;
	font-size: 12px;
	line-height: 13px;
	cursor: pointer;
}

.td-contact-form__choice input {
	flex: none;
	width: 12.5px;
	height: 12.5px;
	margin: 0;
	border: 0.83px solid var(--wp--preset--color--ivory);
	background-color: var(--wp--preset--color--bronze);
	appearance: none;
	cursor: pointer;
}

.td-contact-form__choice input[type="radio"] {
	border-radius: 50%;
}

.td-contact-form__choice input[type="checkbox"] {
	border-radius: 2.5px;
}

.td-contact-form__choice input:checked {
	background: radial-gradient(circle, var(--wp--preset--color--ivory) 0 3px, transparent 3.5px) var(--wp--preset--color--bronze);
}

.td-contact-form__choice input:focus-visible {
	outline: 2px solid var(--wp--preset--color--ivory);
	outline-offset: 2px;
}

.td-contact-form__form-head {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-bottom: 24px;
	text-align: center;
}

.td-contact-form__form-name {
	font-family: var(--wp--preset--font-family--serif);
	font-size: 20px;
	line-height: 26px;
}

.td-contact-form__status.is-editor-note {
	margin-bottom: 0;
	border-left: 4px solid var(--wp--preset--color--ink);
}

/* Contact page style ---------------------------------------------------------
   Mobile (390 frame): centred details and map on ink, then the form panel.
   Desktop (1440 frame, from 1024px): details and map on the left, the 540px
   form panel on the right. */

.td-contact-form.is-style-contact {
	background-color: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--ivory);
}

/* The design frames include the header; the page header sits above. */
.is-style-contact .td-contact-form__intro {
	padding: 64px var(--td-gutter) 80px;
}

.is-style-contact .td-contact-form__eyebrow {
	color: var(--wp--preset--color--champagne);
}

.is-style-contact .td-contact-form__title {
	color: var(--wp--preset--color--ivory);
	font-size: 40px;
	line-height: 40px;
}

.td-contact-form__lede {
	max-width: 473px;
	margin-inline: auto;
	font-size: 14px;
	line-height: 22px;
}

.td-contact-form__contact {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 16px;
	text-align: center;
}

.td-contact-form__details {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
}

.td-contact-form__hours {
	color: var(--wp--preset--color--stone);
}

.td-contact-form__detail-link {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding-block: 4px;
	color: var(--wp--preset--color--ivory);
	text-decoration: none;
}

.td-contact-form__detail-link .td-icon {
	flex: none;
	width: 12px;
	height: 12px;
}

.td-contact-form__detail-link:hover span,
.td-contact-form__detail-link:focus-visible span {
	text-decoration: underline;
	text-underline-offset: 4px;
}

.td-contact-form__detail-link:focus-visible {
	outline: 2px solid var(--wp--preset--color--ivory);
	outline-offset: 2px;
}

.td-contact-form__address {
	font-size: 14px;
	font-style: normal;
	line-height: 22px;
}

/* Map, softened towards ivory like the design. */
.td-contact-form__map {
	position: relative;
	align-self: stretch;
	height: 240px;
	background-color: var(--wp--preset--color--slate);
}

.td-contact-form__map iframe {
	display: block;
	width: 100%;
	height: 100%;
	border: 0;
	filter: grayscale(1);
}

.td-contact-form__map::after {
	content: "";
	position: absolute;
	inset: 0;
	background-color: var(--wp--preset--color--ivory);
	mix-blend-mode: soft-light;
	pointer-events: none;
}

/* Phones and tablets: title and intro, then the form, then the details and
   the map. The intro wrapper is flattened so its children can be ordered
   around the form panel; its spacing is re-applied to them. */
@media (max-width: 1023.98px) {

	.is-style-contact .td-contact-form__intro {
		display: contents;
	}

	.is-style-contact .td-contact-form__header {
		order: 1;
		margin: 64px var(--td-gutter) 0;
	}

	.is-style-contact .td-contact-form__panel {
		order: 2;
		margin-top: var(--td-section-gap);
	}

	.is-style-contact .td-contact-form__contact {
		order: 3;
		margin: var(--td-section-gap) var(--td-gutter) 0;
	}

	.is-style-contact .td-contact-form__map {
		order: 4;
		margin: var(--td-section-gap) var(--td-gutter) 80px;
	}

	/* Without a map the details still end with the section padding. */
	.is-style-contact .td-contact-form__contact:last-child {
		margin-bottom: 80px;
	}
}

@media (min-width: 1024px) {

	.td-contact-form.is-style-contact {
		--td-contact-edge: max(var(--td-gutter), calc((100% - var(--td-content)) / 2));
		flex-direction: row;
		align-items: stretch;
	}

	.is-style-contact .td-contact-form__intro {
		flex: 1;
		min-width: 0;
		align-items: flex-start;
		gap: 24px;
		padding: 80px 56px 80px var(--td-contact-edge);
	}

	.is-style-contact .td-contact-form__header {
		gap: 24px;
		text-align: left;
	}

	.is-style-contact .td-contact-form__title {
		font-size: 64px;
		line-height: 64px;
	}

	.td-contact-form__lede {
		margin-inline: 0;
		font-size: 16px;
		line-height: 25px;
	}

	.td-contact-form__contact {
		align-items: flex-start;
		gap: 24px;
		text-align: left;
	}

	.td-contact-form__details {
		align-items: flex-start;
		gap: 8px;
	}

	.td-contact-form__map {
		max-width: 765px;
	}

	.is-style-contact .td-contact-form__panel {
		flex: 0 0 calc(428px + 56px + var(--td-contact-edge));
		justify-content: flex-start;
		gap: 48px;
		padding: 80px var(--td-contact-edge) 80px 56px;
	}

	.is-style-contact .td-contact-form__panel-intro,
	.is-style-contact .td-contact-form__form {
		margin-inline: 0;
	}
}

/* Editor preview of a field. */
.td-contact-form__input--preview {
	display: flex;
	align-items: center;
	color: rgba(241, 239, 231, 0.7);
}
