/*
 * FAQ accordion. design/DESIGN-SYSTEM.md §4.9, §6.3; design/PAGE-STRUCTURE.md §3.6.
 *
 * Built on <details>/<summary>, so the rows open and close, and every answer is
 * readable, with JavaScript disabled. The `+` / `−` glyph is drawn by CSS from
 * the element's own open state -- no script decides what it says.
 *
 * §6.3 asks for the open transition the prototype lacks. A transition cannot run
 * on content that was display:none a frame ago, so the panel animates
 * grid-template-rows 0fr -> 1fr as a KEYFRAME, which does run on newly rendered
 * content. Closing is instant, exactly like the prototype. The global
 * prefers-reduced-motion block in base.css collapses the duration.
 */

.sp-faq {
	border-top: 1px solid var(--sp-line);
}

.sp-faq__item {
	border-bottom: 1px solid var(--sp-line);
}

/* ----------------------------------------------------------- the control */

.sp-faq__q {
	display: block;
	padding: var(--sp-8) 0;
	list-style: none;
	cursor: pointer;
	color: var(--sp-text);
}

.sp-faq__q::-webkit-details-marker {
	display: none;
}

.sp-faq__q::marker {
	content: "";
}

.sp-faq__q-title {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--sp-7);
	margin: 0;
	font-family: var(--sp-font-display);
	font-style: italic;
	font-weight: 700;
	/* TODO token: FAQ question size (DESIGN-SYSTEM §1.2). */
	font-size: clamp(17px, 1.8vw, 23px);
	line-height: var(--sp-lh-tight);
	text-transform: uppercase;
	color: var(--sp-text);
}

.sp-faq__sign {
	flex: 0 0 auto;
	font-family: var(--sp-font-body);
	font-style: normal;
	font-weight: 400;
	font-size: var(--sp-fs-2xl);
	line-height: 1;
	color: var(--sp-red);
}

.sp-faq__sign::before {
	content: "+";
}

/* U+2212 minus, not a hyphen. */
.sp-faq__item[open] .sp-faq__sign::before {
	content: "−";
}

/* ----------------------------------------------------------- the answer */

.sp-faq__panel {
	display: grid;
	grid-template-rows: 1fr;
}

.sp-faq__a {
	min-height: 0;
	overflow: hidden;
	max-width: var(--sp-container-copy);
	padding: 0 0 var(--sp-9);
}

.sp-faq__a p {
	margin: 0 0 var(--sp-3);
	font-size: var(--sp-fs-md);
	line-height: 1.65;
	/* TODO token: FAQ answer colour, rgba(255,255,255,0.62) (§1.1). */
	color: rgba(255, 255, 255, 0.62);
	text-wrap: pretty;
}

.sp-faq__a p:last-child {
	margin-bottom: 0;
}

.sp-faq__item[open] > .sp-faq__panel {
	animation: spFaqOpen var(--sp-dur-base) var(--sp-ease);
}

@keyframes spFaqOpen {
	from {
		grid-template-rows: 0fr;
		opacity: 0;
	}

	to {
		grid-template-rows: 1fr;
		opacity: 1;
	}
}
