/**
 * ACF FAQ widget.
 *
 * Closed panels carry the `hidden` attribute so collapsed answers stay out of
 * the accessibility tree and out of the tab order. The script removes `hidden`
 * before animating open and re-applies it after animating shut, so the
 * animation never comes at the cost of that.
 */

.afinia-faq {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

/* Baseline so the closed/open states fade even before the Colour Transition
   control is touched. Note border-color only animates when both states
   actually have a border — going from style:none to solid cannot tween. */
.afinia-faq-item {
	overflow: hidden;
	transition:
		background-color 200ms ease,
		border-color 200ms ease,
		box-shadow 200ms ease;
}

.afinia-faq-heading {
	margin: 0;
	font: inherit;
}

.afinia-faq-trigger {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	width: 100%;
	margin: 0;
	padding: 18px 20px;
	border: 0;
	background: none;
	font: inherit;
	color: inherit;
	text-align: left;
	cursor: pointer;
	transition:
		color 200ms ease,
		background-color 200ms ease,
		border-color 200ms ease;
}

.afinia-faq-trigger:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: -2px;
}

.afinia-faq-q {
	flex: 1 1 auto;
	min-width: 0;
}

.afinia-faq-icon {
	flex: 0 0 auto;
	width: 20px;
	height: 20px;
	transition: transform var(--afinia-faq-duration, 300ms) ease;
}

.afinia-faq-trigger[aria-expanded="true"] .afinia-faq-icon {
	transform: rotate(180deg);
}

/* The animated box. Height is driven by the script; no padding here, or the
   collapsed state would still be padding-tall. */
.afinia-faq-panel {
	overflow: hidden;
	transition: height var(--afinia-faq-duration, 300ms) ease;
}

.afinia-faq-panel[hidden] {
	display: none;
}

.afinia-faq-panel-inner {
	padding: 0 20px 18px;
}

.afinia-faq-panel-inner > :first-child {
	margin-top: 0;
}

.afinia-faq-panel-inner > :last-child {
	margin-bottom: 0;
}

@media (prefers-reduced-motion: reduce) {

	.afinia-faq-icon,
	.afinia-faq-panel {
		transition: none;
	}
}
