/**
 * Beaufort — forms and the office directory.
 *
 * Inputs are the one place the design system permits a radius, and then only
 * 2px — enough to stop them feeling digitally harsh, not enough to read as
 * rounded.
 */

/* ===========================================================================
   OFFICE DIRECTORY
   ======================================================================== */

.bf-offices__heading {
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--label-caps);
	font-weight: 700;
	letter-spacing: 0.14em;
	line-height: 1;
	text-transform: uppercase;
	color: var(--wp--preset--color--secondary);
	margin: 0 0 1.5rem;
	padding-bottom: 1rem;
	border-bottom: var(--bf-hairline);
}

.bf-offices__list {
	display: grid;
	gap: var(--wp--preset--spacing--40);
}

.bf-office {
	border: var(--bf-hairline);
	background: var(--wp--preset--color--white);
	padding: 2rem;
}

.bf-office__head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 1rem;
	margin-bottom: 1.5rem;
}

.bf-office__name {
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--headline-lg);
	font-weight: 400;
	letter-spacing: 0.02em;
	line-height: 1.2;
	color: var(--wp--preset--color--navy);
	margin: 0;
}

.bf-office__badge {
	flex-shrink: 0;
	background: var(--wp--preset--color--surface-container);
	color: var(--wp--preset--color--graphite);
	font-size: 0.5625rem;
	font-weight: 700;
	letter-spacing: 0.14em;
	line-height: 1;
	text-transform: uppercase;
	padding: 0.5rem 0.75rem;
	margin-top: 0.375rem;
}

.bf-office__address {
	font-style: normal;
	font-size: var(--wp--preset--font-size--body-md);
	line-height: 1.7;
	color: var(--wp--preset--color--graphite);
	margin: 0;
}

/*
 * Secondary, not outline: Outline (#73787d) on white measures 4.46:1, just
 * under the 4.5:1 AA threshold for body text. Secondary clears it.
 */
.bf-office__po {
	font-size: 0.75rem;
	line-height: 1.6;
	color: var(--wp--preset--color--secondary);
	margin: 0.75rem 0 0;
}

.bf-office__contacts {
	display: grid;
	gap: 0.625rem;
	border-top: var(--bf-hairline);
	margin-top: 1.5rem;
	padding-top: 1.5rem;
}

.bf-office__line {
	display: inline-flex;
	align-items: center;
	gap: 0.625rem;
	font-size: var(--wp--preset--font-size--body-md);
	font-weight: 600;
	color: var(--wp--preset--color--navy);
	text-decoration: none;
}

.bf-office__line:hover {
	text-decoration: underline;
	text-underline-offset: 4px;
}

.bf-office__icon {
	flex-shrink: 0;
	color: var(--wp--preset--color--outline);
}

.bf-office__map {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	margin-top: 1.5rem;
	padding-top: 1.25rem;
	border-top: var(--bf-hairline);
	width: 100%;
	font-size: 0.625rem;
	font-weight: 700;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--wp--preset--color--secondary);
	text-decoration: none;
	transition: color 200ms linear;
}

.bf-office__map:hover {
	color: var(--wp--preset--color--navy);
}

.bf-office__map svg {
	transition: transform 250ms var(--bf-ease-power3);
}

.bf-office__map:hover svg {
	transform: translate( 3px, -3px );
}

/* ===========================================================================
   FORM PANEL
   ======================================================================== */

.bf-form-panel {
	border: var(--bf-hairline);
	background: var(--wp--preset--color--white);
	padding: clamp( 1.75rem, 4vw, 3rem );
}

.bf-form-panel__heading {
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--headline-lg);
	font-weight: 400;
	letter-spacing: 0.02em;
	line-height: 1.2;
	color: var(--wp--preset--color--navy);
	margin: 0 0 0.75rem;
}

.bf-form-panel__intro {
	font-size: var(--wp--preset--font-size--body-md);
	line-height: 1.7;
	color: var(--wp--preset--color--graphite);
	margin: 0 0 var(--wp--preset--spacing--50);
	max-width: 46ch;
}

/* ===========================================================================
   FIELDS
   ======================================================================== */

.bf-form__row {
	display: grid;
	gap: var(--wp--preset--spacing--40);
	grid-template-columns: 1fr;
}

/* `minmax(0, 1fr)` so a long value cannot stretch its column past its share. */
@media ( min-width: 600px ) {
	.bf-form__row {
		grid-template-columns: repeat( 2, minmax( 0, 1fr ) );
	}
}

.bf-form,
.bf-form__row,
.bf-field {
	min-width: 0;
}

.bf-field {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	margin: 0 0 var(--wp--preset--spacing--40);
}

.bf-form__row .bf-field {
	margin-bottom: 0;
}

.bf-form__row + .bf-form__row,
.bf-form__row + .bf-field {
	margin-top: var(--wp--preset--spacing--40);
}

/* --- Choice fields ------------------------------------------------------ */

/*
 * Radios, checkbox groups and single consent boxes. A group is a fieldset so
 * the question is announced once as its legend, rather than being repeated
 * into every option's accessible name.
 */
.bf-field--choices {
	border: 0;
	padding: 0;
	min-inline-size: 0;
}

.bf-field--choices .bf-field__label {
	padding: 0;
	margin-bottom: 0.75rem;
}

.bf-choice {
	display: flex;
	align-items: flex-start;
	gap: 0.625rem;
	font-size: var(--wp--preset--font-size--body-md);
	line-height: 1.5;
	color: var(--wp--preset--color--graphite);
	cursor: pointer;
	margin-bottom: 0.5rem;
}

.bf-choice:last-child {
	margin-bottom: 0;
}

/*
 * Native controls, restyled only where the design system demands it: square
 * checkboxes, a hairline border, navy fill. Left as real inputs so keyboard
 * behaviour, form association and assistive technology all work unchanged.
 */
.bf-choice input[type="checkbox"],
.bf-choice input[type="radio"] {
	appearance: none;
	-webkit-appearance: none;
	flex-shrink: 0;
	width: 1.125rem;
	height: 1.125rem;
	margin: 0.1875rem 0 0;
	border: 1px solid var(--wp--preset--color--outline);
	background: var(--wp--preset--color--white);
	border-radius: 0;
	display: grid;
	place-content: center;
	cursor: pointer;
	transition: border-color 200ms linear, background-color 200ms linear;
}

.bf-choice input[type="radio"] {
	border-radius: 50%;
}

.bf-choice input:checked {
	background: var(--wp--preset--color--navy);
	border-color: var(--wp--preset--color--navy);
}

.bf-choice input[type="checkbox"]:checked::after {
	content: "";
	width: 0.5rem;
	height: 0.3125rem;
	border-left: 2px solid var(--wp--preset--color--white);
	border-bottom: 2px solid var(--wp--preset--color--white);
	transform: translateY( -1px ) rotate( -45deg );
}

.bf-choice input[type="radio"]:checked::after {
	content: "";
	width: 0.375rem;
	height: 0.375rem;
	border-radius: 50%;
	background: var(--wp--preset--color--white);
}

.bf-choice input:focus-visible {
	outline: 2px solid var(--wp--preset--color--navy);
	outline-offset: 2px;
}

.bf-field--consent .bf-choice {
	margin-bottom: 0;
}

/* An editor-only notice when no form is selected; invisible to visitors. */
.bf-form-panel--empty {
	border: var(--bf-hairline);
	padding: var(--wp--preset--spacing--40);
	color: var(--wp--preset--color--secondary);
	font-size: var(--wp--preset--font-size--body-md);
}

.bf-field__label {
	font-size: var(--wp--preset--font-size--label-caps);
	font-weight: 700;
	letter-spacing: 0.12em;
	line-height: 1;
	text-transform: uppercase;
	color: var(--wp--preset--color--secondary);
}

.bf-field__req {
	color: var(--wp--preset--color--secondary);
	margin-left: 0.125rem;
}

/*
 * `box-sizing` is load-bearing here. Browsers default form controls to
 * content-box, so `width: 100%` plus 2rem of padding and the border made every
 * input overshoot its grid column and overlap the field beside it.
 */
.bf-field__input {
	box-sizing: border-box;
	width: 100%;
	max-width: 100%;
	border: var(--bf-hairline);
	border-radius: 2px;
	background: var(--wp--preset--color--white);
	color: var(--wp--preset--color--ink);
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--body-lg);
	line-height: 1.5;
	padding: 0.8125rem 1rem;
	transition: border-color 200ms linear;
}

.bf-field__input::placeholder {
	color: var(--wp--preset--color--outline);
}

.bf-field__input:focus {
	border-color: var(--wp--preset--color--navy);
	outline: 2px solid var(--wp--preset--color--navy);
	outline-offset: 1px;
}

.bf-field__input.is-invalid {
	border-color: var(--wp--preset--color--error);
}

.bf-field__textarea {
	resize: vertical;
	min-height: 8rem;
}

/*
 * A drawn chevron rather than the platform's own, so the control matches the
 * rest of the icon set across browsers.
 */
.bf-field__select {
	appearance: none;
	padding-right: 2.75rem;
	background-image: url( "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2373787d' stroke-width='1.25' stroke-linecap='butt' stroke-linejoin='miter'%3E%3Cpath d='m5 8 7 7 7-7'/%3E%3C/svg%3E" );
	background-repeat: no-repeat;
	background-position: right 1rem center;
	background-size: 1rem;
}

/* The honeypot. Removed from view and from the accessibility tree. */
.bf-field--trap {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset( 50% );
	white-space: nowrap;
}

/* ===========================================================================
   SUBMIT & STATUS
   ======================================================================== */

.bf-form__foot {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	margin-top: var(--wp--preset--spacing--50);
}

.bf-form__submit {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: var(--wp--preset--color--navy);
	border: 1px solid var(--wp--preset--color--navy);
	border-radius: 0;
	color: var(--wp--preset--color--white);
	cursor: pointer;
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--label-caps);
	font-weight: 700;
	letter-spacing: 0.1em;
	line-height: 1;
	text-transform: uppercase;
	padding: 1.125rem 2.5rem;
	transition: background-color 200ms linear, border-color 200ms linear;
}

.bf-form__submit:hover:not( :disabled ) {
	background: var(--wp--preset--color--navy-mid);
	border-color: var(--wp--preset--color--navy-mid);
}

.bf-form__submit:disabled {
	opacity: 0.55;
	cursor: progress;
}

.bf-form__note {
	font-size: 0.6875rem;
	color: var(--wp--preset--color--secondary);
	margin: 0;
}

/*
 * The status region is always present so screen readers register the live
 * region before it is populated; it only takes up space once it has content.
 */
.bf-form__status:empty {
	display: none;
}

.bf-form__status {
	margin-top: var(--wp--preset--spacing--40);
	padding: 1rem 1.25rem;
	border-left: 2px solid var(--wp--preset--color--outline);
	background: var(--wp--preset--color--mist-low);
	font-size: var(--wp--preset--font-size--body-md);
	line-height: 1.6;
	color: var(--wp--preset--color--graphite);
}

.bf-form__status.is-ok {
	border-left-color: var(--wp--preset--color--navy);
	color: var(--wp--preset--color--navy);
}

.bf-form__status.is-error {
	border-left-color: var(--wp--preset--color--error);
	color: var(--wp--preset--color--error);
}

/* ===========================================================================
   CONTACT LAYOUT
   ======================================================================== */

.bf-contact-grid {
	display: grid;
	gap: var(--wp--preset--spacing--60);
	grid-template-columns: 1fr;
	align-items: start;
}

@media ( min-width: 900px ) {
	.bf-contact-grid {
		grid-template-columns: minmax( 0, 22rem ) minmax( 0, 1fr );
		gap: var(--wp--preset--spacing--70);
	}
}
