/*
 * Section: good to know (the "jl-questions" group).
 *
 * Questions and answers, split five to seven: on the left a small label, a
 * heading and a short line, which stay in place below the floating header on
 * wide screens; on the right the questions as hairline rows, each with a thin
 * "+" that turns into a cross when its answer is open.
 *
 * The questions are Details blocks inside a Group with the class "jl-faq",
 * so they are also published as FAQ structured data (functions.php). They
 * share one name, so opening one closes the others. The shared FAQ look in
 * jlaude.css is set aside here for this section's own.
 *
 * Colours, fonts and edge spacing come from the theme. The reveal only runs
 * once the script is running (html.jl-js). The section must not clip its
 * overflow, or the heading would stop staying in place.
 */

.jl-questions.jl-questions {
	--qu-pad: 48px;
	--qu-gap: 24px;
	--qu-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
	display: grid;
	grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
	gap: 32px var(--qu-gap);
	align-items: start;
	margin-block: 0;
	padding: clamp(96px, 14vh, 150px) var(--qu-pad) 150px;
	background-color: var(--wp--preset--color--base);
	color: var(--wp--preset--color--contrast);
}

/* WordPress spaces out a Group's children; every part here sets its own spacing. */
.jl-questions.jl-questions > *,
.jl-questions .jl-questions__head > *,
.jl-questions .jl-faq > * {
	margin-block: 0;
}

/* ---------- Label, heading and line ---------- */

.jl-questions .jl-questions__head {
	position: sticky;
	top: calc(var(--wp-admin--admin-bar--height, 0px) + var(--jl-header-h) + 24px);
}

.jl-questions .jl-questions__head h2 {
	max-width: 560px;
	margin-top: 28px;
	font-size: clamp(2.5rem, 4.6vw, 4.25rem);
	letter-spacing: -0.03em;
	line-height: 1;
	text-wrap: balance;
}

.jl-questions .jl-questions__lead {
	max-width: 360px;
	margin-top: 28px;
	font-size: 1.1875rem;
	letter-spacing: -0.01em;
	line-height: 1.35;
}

/* ---------- Questions ---------- */

.jl-questions .jl-faq {
	border-bottom: 1px solid var(--jl-line);
}

.jl-questions .jl-faq .wp-block-details {
	border-top: 1px solid var(--jl-line);
	border-bottom: 0;
}

.jl-questions .jl-faq .wp-block-details summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 20px;
	min-height: 56px;
	padding: 26px 0;
	color: var(--wp--preset--color--contrast);
	font-family: var(--wp--preset--font-family--fraunces);
	font-size: 1.5rem;
	letter-spacing: -0.02em;
	line-height: 1.15;
	list-style: none;
	cursor: pointer;
	transition: color 0.4s var(--qu-ease);
}

.jl-questions .jl-faq .wp-block-details summary::-webkit-details-marker {
	display: none;
}

/* A thin "+" drawn with two lines; it turns into a cross when the answer is open. */
.jl-questions .jl-faq .wp-block-details summary::after {
	content: "";
	flex: none;
	width: 20px;
	height: 20px;
	background:
		linear-gradient(currentColor, currentColor) center / 14px 1.2px no-repeat,
		linear-gradient(currentColor, currentColor) center / 1.2px 14px no-repeat;
	color: inherit;
	transition: transform 0.45s var(--qu-ease);
}

.jl-questions .jl-faq .wp-block-details[open] summary::after {
	transform: rotate(45deg);
}

.jl-questions .jl-faq .wp-block-details summary:hover {
	color: var(--wp--preset--color--accent-3);
}

.jl-questions .jl-faq .wp-block-details summary:focus-visible {
	outline-offset: 2px;
}

.jl-questions .jl-faq .wp-block-details > :not(summary) {
	max-width: 560px;
	margin: 0;
	padding: 0 48px 32px 0;
	color: var(--wp--preset--color--accent-4);
	font-size: 1.0625rem;
	line-height: 1.6;
}

/* ---------- Motion (front only, once the script is running) ---------- */

.jl-js .jl-questions .jl-questions__head h2:not(.is-split):not(.is-done) {
	opacity: 0;
}

.jl-questions .jl-questions__head h2 .jl-word {
	display: inline-block;
	opacity: 0;
	transform: translateY(0.45em);
	transition: opacity 0.9s ease var(--d, 0ms), transform 1s var(--qu-ease) var(--d, 0ms);
}

.jl-questions .jl-questions__head h2.is-in .jl-word {
	opacity: 1;
	transform: none;
}

.jl-js .jl-questions .jl-questions__head > .jl-tag,
.jl-js .jl-questions .jl-questions__lead,
.jl-js .jl-questions .jl-faq {
	opacity: 0;
	transform: translateY(24px);
	transition: opacity 0.9s var(--qu-ease) var(--d, 0ms), transform 0.9s var(--qu-ease) var(--d, 0ms);
}

.jl-js .jl-questions.is-in .jl-questions__head > .jl-tag,
.jl-js .jl-questions.is-in .jl-questions__lead,
.jl-js .jl-questions.is-in .jl-faq {
	opacity: 1;
	transform: none;
}

.jl-js .jl-questions .jl-questions__lead,
.jl-js .jl-questions .jl-faq {
	--d: 200ms;
}

/* ---------- Tablet: the heading above the questions ---------- */
@media (max-width: 1099px) {
	.jl-questions.jl-questions {
		--qu-pad: 40px;
		--qu-gap: 20px;
		grid-template-columns: minmax(0, 1fr);
		gap: 40px;
		padding-top: 96px;
		padding-bottom: 120px;
	}

	.jl-questions .jl-questions__head {
		position: static;
	}

	.jl-questions .jl-questions__head h2 {
		margin-top: 24px;
	}

	.jl-questions .jl-faq .wp-block-details summary {
		padding: 22px 0;
		font-size: 1.375rem;
	}
}

/* ---------- Mobile: the short line is left out ---------- */
@media (max-width: 699px) {
	.jl-questions.jl-questions {
		--qu-pad: 24px;
		--qu-gap: 12px;
		gap: 32px;
		padding-top: 72px;
		padding-bottom: 96px;
	}

	.jl-questions .jl-questions__head h2 {
		margin-top: 20px;
	}

	.jl-questions .jl-questions__lead {
		display: none;
	}

	.jl-questions .jl-faq .wp-block-details summary {
		padding: 18px 0;
		font-size: 1.1875rem;
	}

	.jl-questions .jl-faq .wp-block-details > :not(summary) {
		padding: 0 0 24px;
	}
}

/* Set by the script if it could not prepare the section: everything shows at rest. */
.jl-questions.is-plain h2,
.jl-questions.is-plain .jl-word,
.jl-questions.is-plain .jl-tag,
.jl-questions.is-plain .jl-questions__lead,
.jl-questions.is-plain .jl-faq {
	opacity: 1 !important;
	transform: none !important;
}

@media (prefers-reduced-motion: reduce) {
	.jl-js .jl-questions h2,
	.jl-js .jl-questions .jl-tag,
	.jl-js .jl-questions .jl-questions__lead,
	.jl-js .jl-questions .jl-faq {
		opacity: 1;
		transform: none;
	}

	.jl-questions.jl-questions *,
	.jl-questions.jl-questions *::after {
		transition: none !important;
	}
}
