/*
 * ACF FAQ Accordion – Frontend Styles
 * Performant, WCAG AA compliant, CSS-only animation.
 * All colour/typography overrides come from Elementor controls (inline CSS vars).
 */

/* ── Wrapper ─────────────────────────────────────────────────────────────── */
.faq-accordion {
	width: 100%;
	margin: 0;
	padding: 0;
	list-style: none;
}

/* ── Item ────────────────────────────────────────────────────────────────── */
.faq-item {
	border-bottom: 1px solid #e0e0e0; /* fallback; overridden by Elementor selector */
	border-bottom-style: solid;
}

.faq-item:first-child {
	border-top: 1px solid #e0e0e0;
	border-top-color: inherit;
}

/* ── Question button ─────────────────────────────────────────────────────── */
.faq-question {
	/* Reset */
	all: unset;
	box-sizing: border-box;

	/* Layout */
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	width: 100%;
	padding: 20px 0;
	cursor: pointer;

	/* Accessible focus ring — WCAG 2.4.7 */
	outline: none;
}

.faq-question:focus-visible {
	outline: 3px solid currentColor;
	outline-offset: 2px;
	border-radius: 2px;
}

/* Touch target — WCAG 2.5.5 (44 × 44 px minimum) */
.faq-question {
	min-height: 44px;
}

.faq-question-text {
	flex: 1;
	text-align: left;
	color: #1a1a1a; /* fallback; overridden by Elementor */
}

/* ── Chevron icon ────────────────────────────────────────────────────────── */
.faq-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	width: 20px;
	height: 20px;
	color: #666666; /* fallback; overridden by Elementor */
	transition: transform 0.3s ease;

	/* GPU-accelerated, avoids layout recalc */
	will-change: transform;
}

.faq-icon svg {
	width: 100%;
	height: 100%;
	display: block;
	overflow: visible;
}

/* Rotate chevron when open */
.faq-item.is-open .faq-icon {
	transform: rotate(180deg);
}

/* ── Answer panel ────────────────────────────────────────────────────────── */

/*
 * CSS-only slide animation.
 * We use max-height + opacity transitions. The hidden attribute hides from
 * AT (screen readers) correctly; JS removes it on open.
 */
.faq-answer {
	overflow: hidden;
	max-height: 0;
	opacity: 0;
	transition:
		max-height 0.35s ease,
		opacity    0.25s ease;
	will-change: max-height, opacity;
}

/* When JS removes [hidden], .faq-item.is-open drives the open state */
.faq-answer[hidden] {
	display: block !important; /* Override UA hidden so CSS transition works */
	max-height: 0;
	opacity: 0;
}

.faq-item.is-open .faq-answer {
	max-height: 2000px; /* generous ceiling; transition duration caps visual speed */
	opacity: 1;
}

.faq-answer-inner {
	padding-bottom: 20px; /* fallback; overridden by Elementor */
	color: #444444;       /* fallback; overridden by Elementor */
}

/* ── Answer inner content resets ────────────────────────────────────────── */
.faq-answer-inner p:first-child { margin-top: 0; }
.faq-answer-inner p:last-child  { margin-bottom: 0; }

/* ── Reduced motion — WCAG 2.3.3 ────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
	.faq-icon,
	.faq-answer {
		transition: none;
	}
	.faq-item.is-open .faq-answer {
		max-height: none;
	}
}

/* ── Editor-only notice ──────────────────────────────────────────────────── */
.faq-widget-notice {
	padding: 12px 16px;
	background: #fff3cd;
	border: 1px solid #ffc107;
	border-radius: 4px;
	color: #856404;
	font-size: 14px;
}

/* ── High-contrast mode support ─────────────────────────────────────────── */
@media (forced-colors: active) {
	.faq-question:focus-visible {
		outline: 3px solid ButtonText;
	}
	.faq-icon {
		forced-color-adjust: auto;
	}
}
