/*
 * The section's forms — the graduate's questionnaire (page-alumni-join.php)
 * and the request for mentoring, a pop-up on the catalog and the profiles
 * (parts/alumni-mentor-modal.php) — on top of page-alumni.css, whose boxes,
 * strips and buttons they use. Loaded with assets/js/pages/alumni/alumni-form.js
 * by enqueue.php wherever there is such a form.
 *
 * Same rules as the rest of the section: square corners, hairlines, semantic
 * tokens for paper and text so the dark theme follows; the mentor's brand
 * red and the navy button are fixed colours.
 */

/*
 * style.css styles every form on the site after the old contact forms: a span
 * inside a div is a 10px caption, a strong is an error kept hidden until the
 * field is wrong, a paragraph is centred, inputs are an underline with a 24px
 * font and no checkbox drawn, the submit button a white pill. None of it fits
 * here, so within this form it is taken back — by specificity, as in the
 * catalog's filters.
 */
.alumni-form div span,
.alumni-form div strong {
	display: revert;
	color: inherit;
	font-size: inherit;
	font-weight: revert;
	line-height: inherit;
}

.alumni-form div strong::before {
	content: none;
}

.alumni-form p {
	display: block;
	text-align: start;
}

.alumni-form p > * + * {
	margin-top: 0;
}

.alumni-form .alumni-form__submit {
	display: inline-flex;
	width: auto;
	max-width: none;
	min-height: 52px;
	padding: 0 32px;
	border: 1px solid transparent;
	border-radius: 0;
	background: var(--color-blue-200);
	color: var(--color-white);
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.2;
}

.alumni-form .alumni-form__submit:hover {
	background: var(--color-blue-100);
}

.alumni-form {
	display: grid;
	gap: clamp(36px, 4vw, 52px);
}

/* A fieldset with a legend for a strip: the legend is pulled into the box's
   top edge the way the profile's <h2> strips sit. */
.alumni-form__section {
	min-width: 0;
	margin: 0;
	padding: 0;
}

.alumni-form__section > legend.alumni-strip {
	float: left;
	box-sizing: border-box;
	width: 100%;
}

.alumni-form__section > legend + * {
	clear: both;
}

.alumni-form__strip-note {
	margin-left: 8px;
	color: var(--color-text-muted);
	font-weight: 400;
	letter-spacing: 0;
	text-transform: none;
}

.alumni-form__body {
	display: grid;
	gap: 18px;
	padding: 20px 0 0;
}

/* One grid of six for every row, so the fields of different rows end on the
   same lines: thirds for the name, the contacts and a narrow field beside a
   wide one (position — company, year — faculty), halves for the photos. */
.alumni-form__row {
	display: grid;
	grid-template-columns: repeat(6, minmax(0, 1fr));
	gap: 18px;
}

.alumni-form__row > * {
	grid-column: span 3;
}

.alumni-form__row--3 > * {
	grid-column: span 2;
}

.alumni-form__row--1-2 > :first-child {
	grid-column: span 2;
}

.alumni-form__row--1-2 > :last-child {
	grid-column: span 4;
}

/* The links side by side, on the same thirds. */
.alumni-form__links {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 18px;
}

.alumni-form__field {
	display: grid;
	/* A neighbour with a hint makes the row taller; the label and the input
	   stay at the top rather than spread over the extra height. */
	align-content: start;
	gap: 6px;
	min-width: 0;
	margin: 0;
	padding: 0;
	border: 0;
}

.alumni-form .alumni-form__label {
	padding: 0;
	color: var(--color-text-heading);
	font-size: 0.9375rem;
	font-weight: 500;
	line-height: 1.4;
}

/* A group's legend is outside the fieldset's grid, so its gap does not reach
   it: the same 6px is given by hand, a little more over the checkboxes. */
.alumni-form .alumni-form__group > legend.alumni-form__label {
	padding-bottom: 10px;
}

.alumni-form .alumni-form__required {
	color: var(--color-error);
}

.alumni-form__hint {
	margin: 0;
	color: var(--color-text-muted);
	font-size: 0.8125rem;
	line-height: 1.45;
}

.alumni-form__body > .alumni-form__hint {
	margin-top: -10px;
}

.alumni-form__hint--top {
	margin-bottom: 4px;
}

/* Two classes, as in the catalog's filters: the site's reset styles inputs
   by type with one, and would win. */
.alumni-form .alumni-form__input {
	box-sizing: border-box;
	width: 100%;
	min-height: 44px;
	margin: 0;
	padding: 10px 12px;
	border: 1px solid var(--alumni-line);
	border-radius: 0;
	background-color: var(--color-bg-primary);
	color: var(--color-text-primary);
	font: inherit;
	font-size: 0.9375rem;
	line-height: 1.4;
	transition: border-color 0.2s ease;
}

.alumni-form .alumni-form__input::placeholder {
	color: var(--color-text-muted);
}

.alumni-form .alumni-form__input:focus {
	outline: none;
	border-color: var(--color-accent);
}

.alumni-form .alumni-form__input[aria-invalid="true"] {
	border-color: var(--color-error);
}

.alumni-form .alumni-form__textarea {
	min-height: 0;
	resize: vertical;
	line-height: 1.55;
}

.alumni-form .alumni-form__select {
	padding-right: 36px;
	appearance: none;
	-webkit-appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256' fill='%2386939b'%3E%3Cpath d='M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 12px center;
	background-size: 14px;
	cursor: pointer;
}

.alumni-form input[type="checkbox"] {
	flex: none;
	width: 18px;
	height: 18px;
	margin: 2px 0 0;
	padding: 0;
	border: revert;
	background: revert;
	-webkit-appearance: checkbox;
	appearance: auto;
	accent-color: var(--color-accent);
	cursor: pointer;
}

.alumni-form__choices {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 10px 18px;
}

.alumni-form__choice {
	display: flex;
	gap: 10px;
	color: var(--color-text-primary);
	font-size: 0.9375rem;
	line-height: 1.45;
	cursor: pointer;
}

/* ------------------------------------------------------------- the roles */

.alumni-form__roles {
	display: grid;
	gap: 10px;
}

.alumni-form__role {
	display: flex;
	align-items: flex-start;
	gap: 14px;
	padding: 14px 16px;
	border: 1px solid var(--alumni-line);
	background: var(--color-bg-primary);
	cursor: pointer;
	transition: border-color 0.2s ease, background-color 0.2s ease;
}

.alumni-form__role:hover {
	border-color: var(--color-accent);
}

.alumni-form__role:has(input:checked) {
	border-color: var(--color-accent);
	background: var(--alumni-tint);
}

.alumni-form__role--mentor:has(input:checked) {
	border-color: var(--alumni-blue);
}

.alumni-form__role input[type="checkbox"] {
	margin-top: 11px;
}

.alumni-form .alumni-form__role-text {
	display: grid;
	gap: 2px;
	color: var(--color-text-secondary);
	font-size: 0.875rem;
	line-height: 1.45;
}

.alumni-form .alumni-form__role-text strong {
	color: var(--color-text-heading);
	font-size: 0.9375rem;
	font-weight: 600;
}

/* ------------------------------------------------------------ the photos */

.alumni-photo-pick__box {
	display: flex;
	align-items: flex-start;
	gap: 14px;
}

.alumni-form .alumni-photo-pick__preview {
	display: grid;
	flex: none;
	place-items: center;
	width: 96px;
	height: 96px;
	overflow: hidden;
	border: 1px dashed var(--alumni-line);
	background: var(--alumni-strip);
	color: var(--color-text-muted);
}

.alumni-photo-pick__preview .ph-icon {
	width: 28px;
	height: 28px;
}

.alumni-photo-pick__preview img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.alumni-photo-pick.is-chosen .alumni-photo-pick__preview {
	border-style: solid;
}

.alumni-photo-pick__controls {
	display: grid;
	justify-items: start;
	gap: 6px;
	min-width: 0;
}

.alumni-button.alumni-photo-pick__choose {
	min-height: 40px;
	padding: 0 16px;
	cursor: pointer;
}

/* The file input stays in the page for the keyboard and the label, out of sight. */
.alumni-photo-pick__input {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	opacity: 0;
}

.alumni-photo-pick__input:focus-visible + .alumni-photo-pick__remove,
.alumni-photo-pick:focus-within .alumni-photo-pick__choose {
	outline: 2px solid var(--color-accent);
	outline-offset: 2px;
}

.alumni-photo-pick__remove {
	padding: 0;
	border: 0;
	background: none;
	color: var(--color-link);
	font: inherit;
	font-size: 0.875rem;
	text-decoration: underline;
	cursor: pointer;
}

.alumni-photo-pick__remove[hidden] {
	display: none;
}

/* ------------------------------------------------------------- sending */

.alumni-form__send {
	display: grid;
	gap: 18px;
	padding: 4px 0 0;
}

.alumni-form__consent {
	display: flex;
	gap: 12px;
	color: var(--color-text-secondary);
	font-size: 0.875rem;
	line-height: 1.55;
	cursor: pointer;
}

.alumni-form__errors {
	padding: 12px 16px;
	border-left: 4px solid var(--color-error);
	background: rgba(var(--color-error--rgb), 0.1);
	color: var(--color-text-primary);
	font-size: 0.9375rem;
	line-height: 1.5;
}

.alumni-form__errors[hidden] {
	display: none;
}

.alumni-form__errors:focus {
	outline: none;
}

.alumni-form__errors ul {
	margin: 6px 0 0;
	padding-left: 20px;
}

.alumni-form__submit {
	justify-self: start;
	cursor: pointer;
}

.alumni-form__submit[disabled] {
	opacity: 0.6;
	cursor: progress;
}

.alumni-form__trap {
	position: absolute;
	left: -10000px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* -------------------------------------------------------------- the end */

/* Scrolled to after sending: clear of the site's sticky header. */
.alumni-form-done {
	scroll-margin-top: 140px;
}

.alumni-form-done[hidden] {
	display: none;
}

.alumni-form-done:focus {
	outline: none;
}

.alumni-form-done__body {
	display: grid;
	justify-items: start;
	gap: 16px;
	padding: clamp(20px, 3vw, 32px);
	color: var(--color-text-primary);
	font-size: 1rem;
	line-height: 1.6;
}

.alumni-form-done__body p {
	margin: 0;
	max-width: 60ch;
}

.alumni-form-done__icon {
	display: grid;
	place-items: center;
	width: 48px;
	height: 48px;
	background: var(--alumni-mentor-bg);
	color: var(--alumni-mentor-text);
}

.alumni-form-done__icon .ph-icon {
	width: 26px;
	height: 26px;
}

/* --------------------------------------------------------------- narrow */

@media (max-width: 767px) {
	.alumni-form__row,
	.alumni-form__links,
	.alumni-form__choices {
		grid-template-columns: minmax(0, 1fr);
	}

	.alumni-form__row > *,
	.alumni-form__row--3 > *,
	.alumni-form__row--1-2 > :first-child,
	.alumni-form__row--1-2 > :last-child {
		grid-column: auto;
	}

	.alumni-form__links {
		gap: 8px;
	}

	.alumni-form__body {
		padding: 16px 0 0;
	}

	.alumni-form__submit {
		justify-self: stretch;
	}
}
