/*
 * [kd_faq] — accordion-style FAQ block.
 * Built on the shared .kdtc-calc design system; only the parts unique to
 * an accordion (the search box, question buttons, animated panels) live
 * here.
 */

/* Stretch to fill its container instead of capping at kdtc-shared's 640px,
 * so width can be set from Elementor (same override kd-download.css and
 * kd-names.css use). */
.kdtc-calc.kdtc-faq-block {
	max-width: 100%;
	width: 100%;
}

.kdtc-faq__search {
	margin-bottom: 1.1em;
}

.kdtc-faq__search-input {
	width: 100%;
	font: inherit;
	font-size: 1em;
	border: 1px solid var(--kdtc-border);
	border-radius: var(--kdtc-radius-sm);
	background: #fff;
	color: var(--kdtc-ink);
	background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%235b6472'%3e%3cpath fill-rule='evenodd' d='M9 3.5a5.5 5.5 0 100 11 5.5 5.5 0 000-11zM2 9a7 7 0 1112.45 4.39l3.08 3.08a.75.75 0 11-1.06 1.06l-3.08-3.08A7 7 0 012 9z' clip-rule='evenodd'/%3e%3c/svg%3e");
	background-repeat: no-repeat;
	background-position: left 0.75em center;
	background-size: 1.05em;
	/* The theme's own form-field styles were overriding padding-left as a
	 * longhand property, collapsing the space this needs for the search
	 * icon and pushing the placeholder text underneath it. Setting all
	 * four sides through the shorthand with !important wins that fight
	 * the same way the text-color fixes above do. */
	padding: 0.65em 0.9em 0.65em 2.5em !important;
}

.kdtc-faq__search-input:focus {
	outline: none;
	border-color: var(--kdtc-accent);
	box-shadow: 0 0 0 3px var(--kdtc-accent-soft);
}

.kdtc-faq__search-input::-webkit-search-cancel-button {
	cursor: pointer;
}

.kdtc-faq-item {
	border: 1px solid var(--kdtc-border);
	border-radius: var(--kdtc-radius-sm);
	margin-bottom: 0.6em;
	overflow: hidden;
}

.kdtc-faq-item:last-child {
	margin-bottom: 0;
}

/*
 * The theme (Hello Elementor's reset.css) carries a global rule —
 * [type="button"]:focus, [type="button"]:hover, button:focus,
 * button:hover { background-color: #cc3366; color: #fff; } — that fires
 * on every plain <button>, ours included, for BOTH mouse hover and the
 * focus a button keeps after being clicked. That single theme rule was
 * the real source of every red/white contrast bug reported on this
 * component: it explains the red-background-with-navy-text look on a
 * freshly clicked question (its color lost to the theme, background
 * never contested), the invisible-white-on-light-blue look on hover
 * once color got pinned but background stayed theme-only, and it also
 * means a *closed* question that still has focus (tabbed to, or just
 * clicked and not yet reopened) can flash that same red/white combo.
 * Rather than patch one state at a time, every interactive state below
 * pins both background and color explicitly, in this order so a tie in
 * specificity resolves the way we want: closed default, then :hover,
 * then :focus, then open — each later block winning over the earlier
 * ones when more than one applies at once (e.g. an open question is
 * also focused immediately after the click that opened it).
 */
.kdtc-faq-item__question {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.8em;
	width: 100%;
	text-align: left;
	background: var(--kdtc-panel-bg) !important;
	border: none;
	padding: 0.9em 1.05em;
	font: inherit;
	font-size: 0.98em;
	font-weight: 700;
	color: var(--kdtc-ink) !important;
	cursor: pointer;
	transition: background 120ms ease;
}

.kdtc-faq-item__question:hover {
	background: var(--kdtc-accent-soft) !important;
	color: var(--kdtc-ink) !important;
}

.kdtc-faq-item__question:hover .kdtc-faq__chevron {
	fill: var(--kdtc-muted) !important;
}

.kdtc-faq-item__question:focus-visible {
	outline: 2px solid var(--kdtc-accent);
	outline-offset: -2px;
}

/* Plain :focus (not just :focus-visible) so a mouse click — which
 * doesn't trigger :focus-visible in most browsers — still overrides
 * the theme's focus styling on a question that isn't open. */
.kdtc-faq-item__question:focus {
	background: var(--kdtc-panel-bg) !important;
	color: var(--kdtc-ink) !important;
}

.kdtc-faq-item__question:focus .kdtc-faq__chevron {
	fill: var(--kdtc-muted) !important;
}

/* Open state wins over both :hover and :focus above (same specificity,
 * later in the file), so a question looks the same whether it was just
 * clicked (open + focused), is being re-hovered (open + hovered), or
 * neither (opened programmatically, e.g. the first question on load). */
.kdtc-faq-item--open > .kdtc-faq-item__question {
	background: var(--kdtc-accent-soft) !important;
	color: var(--kdtc-accent-dark) !important;
}

.kdtc-faq-item__question-text {
	flex: 1 1 auto;
}

.kdtc-faq__chevron {
	flex: 0 0 auto;
	width: 18px;
	height: 18px;
	fill: var(--kdtc-muted);
	transition: transform 160ms ease;
}

.kdtc-faq-item--open .kdtc-faq__chevron {
	transform: rotate(180deg);
	fill: var(--kdtc-accent-dark) !important;
}

.kdtc-faq-item__answer {
	max-height: 0;
	overflow: hidden;
	transition: max-height 220ms ease;
}

.kdtc-faq-item__answer-inner {
	padding: 0.15em 1.05em 1.05em;
	color: var(--kdtc-ink);
	font-size: 0.96em;
	line-height: 1.6;
}

.kdtc-faq-item__answer-inner p {
	margin: 0 0 0.8em;
}

.kdtc-faq-item__answer-inner p:last-child {
	margin-bottom: 0;
}

.kdtc-faq-item__answer-inner a {
	color: var(--kdtc-accent-dark);
}

.kdtc-faq__empty {
	text-align: center;
	color: var(--kdtc-muted);
	padding: 1.4em 1em;
	margin: 0;
}

.kdtc-faq__clear {
	background: none;
	border: none;
	padding: 0;
	font: inherit;
	color: var(--kdtc-accent-dark);
	text-decoration: underline;
	cursor: pointer;
}
