/*
 * Forms that plugins print through a Shortcode block: Contact Form 7's (the
 * application on /internships/, inside a Details block since 5h).
 *
 * The form's template is the client's, edited in Contact Form 7. So every rule
 * here is for a kind of field or for Contact Form 7's own markup, never for one
 * field or one form: a field added later looks like the others, and one taken
 * out leaves no gap.
 *
 * The fields are the newsletter form's (48px tall, 16px text, white, the small
 * corners), with a border because they sit on white, and stop at the same
 * 560px. A question is in the headings' colour; the options under it are in the
 * body's.
 */
.wpcf7 {
	--sutherland-form-field-width: 560px;
}

/* One question, one block: the same space under each, none under the last. */
.wpcf7 form p,
.wpcf7 form fieldset {
	margin-block: 0 var(--wp--preset--spacing--30);
}

.wpcf7 form > p:last-of-type {
	margin-block-end: 0;
}

/*
 * A group of radio buttons or checkboxes is a fieldset with its question as the
 * legend (`wp si launch forms`, 5j): it reads as the other fields' labels do,
 * without the browser's frame. The fieldset carries the paragraph's spacing.
 */
.wpcf7 form fieldset {
	min-width: 0;
	margin-inline: 0;
	padding: 0;
	border: 0;
}

.wpcf7 form fieldset > p {
	margin-block: 0;
}

/*
 * A question: a field's label, a group's legend, or the words that share a
 * field's paragraph where the template gives them no label.
 */
.wpcf7 label,
.wpcf7 legend,
.wpcf7 form p:has(> .wpcf7-form-control-wrap) {
	color: var(--wp--preset--color--heading);
	font-weight: 600;
}

.wpcf7 legend {
	margin-block-end: var(--wp--preset--spacing--10);
	padding: 0;
}

/* A field starts on its own line, a little under its question. */
.wpcf7 .wpcf7-form-control-wrap {
	display: block;
}

.wpcf7 label > .wpcf7-form-control-wrap,
.wpcf7 br + .wpcf7-form-control-wrap {
	margin-block-start: 6px;
}

/*
 * The fields: everything a visitor types in or picks from. Contact Form 7's
 * inputs have `size="40"`, about 340px, wider than a phone's column: the width
 * is the column's, up to the limit. The weight is set because a field inside
 * its label would take the label's.
 */
.wpcf7 input:not([type="checkbox"], [type="radio"], [type="file"], [type="range"], [type="color"], [type="submit"], [type="button"], [type="reset"], [type="hidden"]),
.wpcf7 select,
.wpcf7 textarea {
	box-sizing: border-box;
	display: block;
	width: 100%;
	max-width: var(--sutherland-form-field-width);
	min-height: 48px;
	margin: 0;
	padding: 11px 16px;
	border: 1px solid var(--wp--preset--color--muted);
	border-radius: var(--wp--preset--border-radius--small);
	background-color: var(--wp--preset--color--white);
	color: var(--wp--preset--color--heading);
	font-family: inherit;
	font-size: var(--wp--preset--font-size--medium);
	font-weight: 400;
	line-height: 1.5;
}

/*
 * A date or a number is short: so is its field. The height is set because
 * Chrome's date field is 2px taller when left alone.
 */
.wpcf7 input:is([type="date"], [type="number"]) {
	max-width: 240px;
	height: 48px;
}

/*
 * A drop-down menu draws its own arrow: Safari gives its own menu a height of
 * its choosing, whatever is asked.
 */
.wpcf7 select:not([multiple], [size]) {
	padding-inline-end: 44px;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%23333' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='m1 1.5 5 5 5-5'/%3E%3C/svg%3E");
	background-position: right 16px center;
	background-size: 12px;
	background-repeat: no-repeat;
	appearance: none;
}

/* A text box grows downwards only: sideways it would leave the column. */
.wpcf7 textarea {
	resize: vertical;
}

.wpcf7 ::placeholder {
	color: var(--wp--preset--color--muted);
	opacity: 1;
}

/*
 * Radio buttons and checkboxes, drawn here so that they are the same in every
 * browser: the fields' border, and the navy of the focus ring once chosen.
 */
.wpcf7 input:is([type="checkbox"], [type="radio"]) {
	box-sizing: border-box;
	flex: none;
	width: 20px;
	height: 20px;
	margin: 2px 0;
	border: 1px solid var(--wp--preset--color--muted);
	border-radius: var(--wp--preset--border-radius--small);
	background-color: var(--wp--preset--color--white);
	appearance: none;
	cursor: pointer;
}

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

.wpcf7 input:is([type="checkbox"], [type="radio"]):checked {
	border-color: var(--wp--preset--color--navy);
	background-color: var(--wp--preset--color--navy);
}

.wpcf7 input[type="checkbox"]:checked {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round' d='m3.5 8.5 3 3 6-7'/%3E%3C/svg%3E");
	background-position: center;
	background-size: 14px;
	background-repeat: no-repeat;
}

.wpcf7 input[type="radio"]:checked {
	box-shadow: inset 0 0 0 4px var(--wp--preset--color--white);
}

/* Where the visitor's system sets the colours, the browser draws them. */
@media (forced-colors: active) {

	.wpcf7 input:is([type="checkbox"], [type="radio"]) {
		appearance: auto;
	}
}

/*
 * A group's options, one under the other, each a box and its words. Contact
 * Form 7 prints an option with or without a label element
 * (`use_label_element`): both are a row here.
 */
.wpcf7 :is(.wpcf7-checkbox, .wpcf7-radio, .wpcf7-acceptance) {
	display: grid;
	gap: var(--wp--preset--spacing--10) var(--wp--preset--spacing--20);
}

.wpcf7 .wpcf7-list-item {
	display: flex;
	gap: 6px var(--wp--preset--spacing--10);
	align-items: center;
	margin: 0;
}

.wpcf7 .wpcf7-list-item > input {
	align-self: flex-start;
}

.wpcf7 .wpcf7-list-item,
.wpcf7 .wpcf7-list-item label {
	color: var(--wp--preset--color--body);
	font-weight: 400;
}

.wpcf7 .wpcf7-list-item label {
	display: flex;
	gap: var(--wp--preset--spacing--10);
	align-items: flex-start;
	cursor: pointer;
}

/*
 * "Other", with its field beside it (`free_text`), or under it in a narrow
 * column.
 */
.wpcf7 .wpcf7-list-item:has(.wpcf7-free-text) {
	flex-wrap: wrap;
}

.wpcf7 .wpcf7-list-item .wpcf7-free-text {
	flex: 1 1 200px;
	width: auto;
	max-width: 320px;
}

/* A file: the browser's own button, as a quiet button of the site. */
.wpcf7 input[type="file"] {
	box-sizing: border-box;
	display: block;
	width: 100%;
	max-width: var(--sutherland-form-field-width);
	color: var(--wp--preset--color--body);
	font-family: inherit;
	font-size: var(--wp--preset--font-size--medium);
	font-weight: 400;
	line-height: 1.5;
}

.wpcf7 input[type="file"]::file-selector-button {
	margin-inline-end: 12px;
	padding: 7px 16px;
	border: 1px solid var(--wp--preset--color--muted);
	border-radius: var(--wp--preset--border-radius--small);
	background-color: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--heading);
	font: inherit;
	cursor: pointer;
	transition: var(--wp--custom--transition--button);
}

.wpcf7 input[type="file"]::file-selector-button:hover {
	border-color: var(--wp--preset--color--navy);
	color: var(--wp--preset--color--navy);
}

/* The submit button: the theme's Fill button (plan §6.2 decision 3). */
.wpcf7 .wpcf7-submit {
	padding: 0.3em 1em;
	border: 2px solid transparent;
	border-radius: var(--wp--preset--border-radius--small);
	background-color: var(--wp--preset--color--crimson);
	color: var(--wp--preset--color--white);
	font-family: inherit;
	font-size: 20px;
	line-height: 1.7;
	cursor: pointer;
	transition: var(--wp--custom--transition--button);
}

.wpcf7 .wpcf7-submit:hover {
	background-color: var(--wp--preset--color--navy);
}

/* Contact Form 7 disables it until a required consent is ticked. */
.wpcf7 .wpcf7-submit:disabled {
	background-color: var(--wp--preset--color--muted);
}

/* The theme's focus ring on every field, the date field included. */
.wpcf7 input:focus-visible,
.wpcf7 select:focus-visible,
.wpcf7 textarea:focus-visible,
.wpcf7 button:focus-visible {
	outline: 2px solid var(--wp--custom--color--focus);
	outline-offset: 2px;
}

/*
 * What Contact Form 7 says back: under a field that isn't right, and under the
 * form.
 */
.wpcf7 :is(input, select, textarea).wpcf7-not-valid {
	border-color: var(--wp--preset--color--crimson);
	box-shadow: 0 0 0 1px var(--wp--preset--color--crimson);
}

.wpcf7 .wpcf7-not-valid-tip {
	margin-block-start: 6px;
	color: var(--wp--preset--color--crimson);
	font-weight: 400;
}

/* Two classes on the form: Contact Form 7's own rule for it comes later. */
.wpcf7 form.wpcf7-form .wpcf7-response-output {
	box-sizing: border-box;
	max-width: var(--sutherland-form-field-width);
	margin: var(--wp--preset--spacing--20) 0 0;
	padding: 12px 16px;
	border-radius: var(--wp--preset--border-radius--small);
	color: var(--wp--preset--color--heading);
}
