/*
"Ask an architect" on the homepage: free Friday-afternoon office hours with our founder. A divider, then two columns
on wide screens: the invitation and the licensing note on a solid Porcelain panel, and a sign-up sheet (the question,
a grid of time slots, name and email) between a heavy rule and a thin one. The form is a design only for now; it
posts nowhere until the booking backend is ready.
*/
.ask {
	position: relative;
	z-index: 2; /* Above the homepage's shape field, like #hello (home.css). */
	margin-bottom: 4rem;

	.divider {
		margin-bottom: 2rem;
	}
}

.ask__body {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: 2.5rem 4rem;
}

/* The invitation: a big "Every Friday afternoon.", the offer, and who can take part. */
.ask__intro {
	display: flex;
	flex: 1 1 22rem;
	flex-direction: column;
	gap: 1.1rem;
	max-width: 34rem;
	padding: 1.25rem;
	background-color: var(--color-porcelain); /* A solid panel, so the shape field never runs behind the text. */

	p {
		margin: 0;
		line-height: 1.6;
	}
}

.ask__lead {
	font-family: "Oswald", "Oswald Fallback", sans-serif;
	font-size: clamp(2.2rem, 4vw, 3.2rem);
	font-weight: 700;
	line-height: 1.1 !important;
	text-box: trim-start cap alphabetic; /* Its top is the top of its capitals, so the form's top rule can line up with it. */

	span {
		color: var(--color-spicy-orange--darker);
	}
}

/* "Due to licensing rules…" and the states as black chips, under a thin rule. */
.ask__licensing {
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
	padding-top: 1rem;
	border-top: 1px solid var(--color-spicy-black);

	p {
		font-size: 1rem;
		line-height: 1.55;
	}
}

.ask__states {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 0;
	padding: 0;
	list-style: none;

	li {
		max-width: none;
	}
}

/* The sign-up sheet. */
.ask__form {
	display: flex;
	flex: 1 1 28rem;
	flex-direction: column;
	gap: 1.4rem;
	min-width: 0;
	margin-top: 1.25rem; /* The intro panel's top padding, so the heavy rule sits level with the top of "Every Friday afternoon." */
	padding: 1.5rem 1.75rem 1.75rem;
	border-top: 3px solid var(--color-spicy-black);
	border-bottom: 1px solid var(--color-spicy-black);
	background-color: var(--color-porcelain);
}

.ask__field {
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
}

/* "Your question" and "Sign up for a slot": black label chips (.intro__chip, layout.css) at the start of their line. */
.ask__field > .intro__chip,
.ask__slots legend {
	align-self: flex-start;
}

.ask__slots {
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
	min-width: 0;
	margin: 0;
	padding: 0;
	border: 0;

	legend {
		float: left; /* Lets the legend sit inside the fieldset's flow, so the gap below it matches the other labels'. */
		margin-bottom: 0.6rem;
	}
}

.ask__when {
	clear: both;
	max-width: none !important;
	margin: 0;
	font-family: "Oswald", "Oswald Fallback", sans-serif;
	font-size: 1.3rem;

	small {
		font-family: "Google Sans Flex", "Google Sans Flex Fallback", sans-serif;
		font-size: 0.95rem;
	}
}

/* Time slots: three to a row of square-cornered buttons; the chosen one goes black, a taken one is dashed and struck through. */
.ask__times {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 6px;
}

.ask__time {
	min-height: 48px;
	border: 2px solid var(--color-spicy-black);
	border-radius: 0;
	background-color: var(--color-porcelain);
	color: var(--color-spicy-black);
	font-family: "Oswald", "Oswald Fallback", sans-serif;
	font-size: 1.15rem;
	cursor: pointer;

	&:hover {
		background-color: var(--color-jasmine);
	}

	&[aria-pressed="true"] {
		background-color: var(--color-spicy-black);
		background-image: url("/assets/images/noise.svg");
		background-repeat: repeat;
		color: var(--color-porcelain);
	}

	&:disabled {
		border-style: dashed;
		border-color: #8a8580;
		background: transparent;
		color: #6b6661;
		text-decoration: line-through;
		cursor: not-allowed;
	}
}

/* Name and email side by side, stacking on narrow screens. */
.ask__contact {
	display: flex;
	flex-wrap: wrap;
	gap: 0.9rem;

	> div {
		display: flex;
		flex: 1 1 12rem;
		flex-direction: column;
		gap: 0.4rem;
	}

	label {
		font-size: 0.95rem;
		font-weight: 600;
	}
}

.ask__form :is(input, textarea) {
	box-sizing: border-box;
	width: 100%;
	min-height: 48px;
	padding: 0.6rem 0.75rem;
	border: 2px solid var(--color-spicy-black);
	border-radius: 0;
	background-color: #ffffff;
	color: var(--color-spicy-black);
	font: inherit;
	font-size: 1.05rem;
	line-height: 1.5;
}

.ask__form textarea {
	resize: vertical;
}

.ask__form :is(input, textarea, button):focus-visible {
	outline: 3px solid var(--color-jasmine);
	outline-offset: 2px;
}

/*
The required acknowledgment: a square checkbox framed like the text fields (2px black, white inside), filling with
grained black and a Porcelain check when ticked, like the chosen time slot.
*/
.ask__agree {
	display: flex;
	align-items: flex-start;
	gap: 0.75rem;

	input {
		flex: none;
		width: 1.5rem;
		min-height: 0;
		height: 1.5rem;
		margin: 0.15rem 0 0;
		padding: 0;
		border: 2px solid var(--color-spicy-black);
		border-radius: 0;
		background-color: #ffffff;
		appearance: none;
		cursor: pointer;

		&:hover {
			background-color: var(--color-jasmine);
		}

		&:checked {
			background-color: var(--color-spicy-black);
			background-image: url("/assets/images/check.svg"), url("/assets/images/noise.svg");
			background-position: center, 0 0;
			background-repeat: no-repeat, repeat;
			background-size: 85%, auto;
		}
	}

	label {
		font-size: 0.95rem;
		line-height: 1.55;
		cursor: pointer;
	}
}

.ask__submit {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.75rem 1.25rem;

	p {
		margin: 0;
		font-size: 0.95rem;
	}
}

.ask__button {
	min-height: 52px;
	padding: 0 1.75rem;
	border: 0;
	border-radius: 0;
	background-color: var(--color-spicy-orange--darker);
	background-image: url("/assets/images/noise.svg");
	background-repeat: repeat;
	color: var(--color-porcelain);
	font-family: "Oswald", "Oswald Fallback", sans-serif;
	font-size: 1.25rem;
	letter-spacing: 0.02em;
	cursor: pointer;

	&:hover {
		filter: brightness(1.15);
	}

	/* Until the box is ticked: the same orange button, faded, so it reads as waiting rather than unavailable. */
	&:disabled {
		opacity: 0.45;
		filter: none;
		cursor: not-allowed;
	}
}

/* Phones: two time slots to a row. */
@media (max-width: 480px) {
	.ask__times {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.ask__form {
		padding-inline: 1rem;
	}
}
