/*
 * Block: core/details. Loads only on pages that render a Details block
 * (wp_enqueue_block_style). Plain details get a coloured marker. Inside a
 * group with the "FAQ list" style (.is-style-faq-list) each details becomes
 * an accordion row: flex summary in the heading face, a plus in a tint square
 * that turns into a cross when open, answers capped at 70ch. Background,
 * border, radius and padding of the rows come from the faq-list partial.
 */

/* ---------- defaults ---------- */

.wp-block-details > summary {
	cursor: pointer;
}

.wp-block-details > summary::marker {
	color: var(--wp--preset--color--primary);
}

.wp-block-details > :not(summary) {
	margin-block: 0.5em 0;
}

/* ---------- FAQ list ---------- */

.is-style-faq-list .wp-block-details > summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	box-sizing: border-box;
	min-height: 44px;
	list-style: none;
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--large);
	font-weight: var(--wp--custom--typography--font-weight--heading, 600);
	line-height: 1.3;
	letter-spacing: var(--wp--custom--typography--letter-spacing--heading, 0);
	color: var(--wp--preset--color--contrast);
	transition: color var(--wp--custom--transition--fast, 0.15s ease);
}

.is-style-faq-list .wp-block-details > summary::-webkit-details-marker {
	display: none;
}

.is-style-faq-list .wp-block-details > summary::marker {
	content: "";
}

.is-style-faq-list .wp-block-details > summary:hover {
	color: var(--wp--preset--color--secondary);
}

/* The plus: a tint square with two secondary bars drawn by gradients, so both
   colours stay tokens (a single SVG mask could carry only one colour). */
.is-style-faq-list .wp-block-details > summary::after {
	content: "";
	flex: none;
	width: 30px;
	height: 30px;
	border-radius: var(--wp--custom--radius--small, 0.375rem);
	background:
		linear-gradient(var(--wp--preset--color--secondary), var(--wp--preset--color--secondary)) center / 2px 14px no-repeat,
		linear-gradient(var(--wp--preset--color--secondary), var(--wp--preset--color--secondary)) center / 14px 2px no-repeat,
		var(--wp--preset--color--tint);
	transition: transform var(--wp--custom--transition--base, 0.2s ease);
}

.is-style-faq-list .wp-block-details[open] > summary::after {
	transform: rotate(45deg);
}

/* Answers */
.is-style-faq-list .wp-block-details > :not(summary) {
	max-width: 70ch;
	margin-block: 0.75rem 0;
	color: var(--wp--preset--color--contrast-2);
}

.is-style-faq-list .wp-block-details > :not(summary) + :not(summary) {
	margin-block-start: 0.6em;
}

/* Rows are separate cards: restore the gap and the top border that the
   plain-list rule in theme.json removes between adjacent details. */
.is-style-faq-list .wp-block-details + .wp-block-details {
	margin-block-start: var(--wp--style--block-gap, var(--wp--preset--spacing--30));
	border-top: var(--wp--custom--border--width, 1px) solid var(--wp--preset--color--border);
}

/* ---------- motion ---------- */

@media (prefers-reduced-motion: reduce) {
	.is-style-faq-list .wp-block-details > summary,
	.is-style-faq-list .wp-block-details > summary::after {
		transition: none;
	}
}
