/**
 * FAQ block — frontend styles.
 *
 * Matches the segmented look from the design reference: each Q/A is a
 * <details> row separated by a thin divider, with a plus/minus or chevron
 * icon on the right that flips when the panel opens.
 *
 * Open / close exclusivity (when singleOpen is true) is handled natively
 * by the `name` attribute on <details> — no JS required.
 */

.wp-block-wb-faq {
	display: block;
	width: 100%;
}

.wp-block-wb-faq.alignwide {
	max-width: var(--wp--style--global--wide-size, 1200px);
	margin-left: auto;
	margin-right: auto;
}

.wp-block-wb-faq.alignfull {
	max-width: none;
	width: 100%;
}

.wb-faq__item {
	border-top: 1px solid
		var(
			--wb-faq-separator-color,
			var(--wp--preset--color--contrast-3, #d9d2c8)
		);
	padding: 1rem 0;
}

.wb-faq__item:last-child {
	border-bottom: 1px solid
		var(
			--wb-faq-separator-color,
			var(--wp--preset--color--contrast-3, #d9d2c8)
		);
}

.wb-faq__summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	cursor: pointer;
	list-style: none;
	padding: 0.25rem 0;
}

.wb-faq__summary::-webkit-details-marker {
	display: none;
}

.wb-faq__summary::marker {
	content: "";
}

.wb-faq__summary:hover .wb-faq__icon,
.wb-faq__summary:focus-visible .wb-faq__icon {
	opacity: 1;
}

.wb-faq__summary:focus-visible {
	outline: 2px solid var(--wp--preset--color--primary, #0073aa);
	outline-offset: 4px;
	border-radius: 2px;
}

.wb-faq__question {
	margin: 0;
	font-size: inherit;
	font-weight: 600;
	line-height: 1.4;
}

.wb-faq__answer {
	padding: 0.5rem 0 0.25rem;
	line-height: 1.6;
}

.wb-faq__answer > :first-child {
	margin-top: 0;
}

.wb-faq__answer > :last-child {
	margin-bottom: 0;
}

/* ─── Icons ─────────────────────────────────────────────────────────── */

.wb-faq__icon {
	flex: 0 0 auto;
	width: 18px;
	height: 18px;
	position: relative;
	opacity: 0.7;
	transition:
		opacity 0.15s ease,
		transform 0.2s ease;
}

/* Plus / minus */
.wb-faq--icon-plus-minus .wb-faq__icon::before,
.wb-faq--icon-plus-minus .wb-faq__icon::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	background-color: currentColor;
	transform: translate(-50%, -50%);
}

.wb-faq--icon-plus-minus .wb-faq__icon::before {
	width: 100%;
	height: 1.5px;
}

.wb-faq--icon-plus-minus .wb-faq__icon::after {
	width: 1.5px;
	height: 100%;
	transition:
		transform 0.2s ease,
		opacity 0.15s ease;
}

.wb-faq--icon-plus-minus .wb-faq__item[open] .wb-faq__icon::after {
	transform: translate(-50%, -50%) scaleY(0);
	opacity: 0;
}

/* Chevron */
.wb-faq--icon-chevron .wb-faq__icon::before {
	content: "";
	position: absolute;
	top: 35%;
	left: 50%;
	width: 10px;
	height: 10px;
	border-right: 1.5px solid currentColor;
	border-bottom: 1.5px solid currentColor;
	transform: translate(-50%, -50%) rotate(45deg);
	transition: transform 0.2s ease;
}

.wb-faq--icon-chevron .wb-faq__item[open] .wb-faq__icon::before {
	top: 60%;
	transform: translate(-50%, -50%) rotate(-135deg);
}

/* ─── Reduced motion ───────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
	.wb-faq__icon,
	.wb-faq--icon-plus-minus .wb-faq__icon::after,
	.wb-faq--icon-chevron .wb-faq__icon::before {
		transition: none;
	}
}
