/**
 * Scaffidi FAQ – Frontend-Styles.
 * Alles unter .sc-faq gescopt, damit Kallyas/Zion-Styles nicht durchschlagen
 * und umgekehrt. Akzentfarbe und max-width kommen als scoped Custom-Properties
 * vom Wrapper (per Einstellung/Shortcode überschreibbar).
 */

.sc-faq {
	--sc-faq-accent: #005ca9;
	--sc-faq-max-width: 52rem;
	--sc-faq-border: #e2e2e2;
	--sc-faq-text: #1a1a1a;
	--sc-faq-muted: #555555;
	--sc-faq-heading: #4b4b4b;
	--sc-faq-bg: #ffffff;
	--sc-faq-anim: 0.3s;

	box-sizing: border-box;
	max-width: var(--sc-faq-max-width);
	margin-left: auto;
	margin-right: auto;
	color: var(--sc-faq-text);
	/* An der Website ausgerichtet (Open Sans). */
	font-family: "Open Sans", Helvetica, Arial, sans-serif;
	line-height: 1.55;
}

.sc-faq *,
.sc-faq *::before,
.sc-faq *::after {
	box-sizing: border-box;
}

/* Wie die Theme-Ueberschriften (h2: Open Sans, 30/40, weight 400, #4b4b4b). */
.sc-faq__title {
	margin: 0 0 1rem;
	font-family: "Open Sans", Helvetica, Arial, sans-serif;
	font-size: 30px;
	line-height: 40px;
	font-weight: 400;
	color: var(--sc-faq-heading);
}

.sc-faq__intro {
	margin: 0 0 1.5rem;
}

.sc-faq__intro > *:first-child {
	margin-top: 0;
}

.sc-faq__intro > *:last-child {
	margin-bottom: 0;
}

.sc-faq__group {
	margin: 0 0 1.75rem;
}

.sc-faq__group-title {
	margin: 0 0 0.75rem;
	font-family: "Open Sans", Helvetica, Arial, sans-serif;
	font-size: 30px;
	line-height: 40px;
	font-weight: 400;
	color: var(--sc-faq-heading);
}

.sc-faq__list {
	display: block;
}

.sc-faq__item {
	border: 1px solid var(--sc-faq-border);
	border-radius: 8px;
	background: var(--sc-faq-bg);
	margin: 0 0 0.6rem;
}

/* Frage-Ueberschrift: Theme-Margins/-Groessen neutralisieren. */
.sc-faq__question {
	margin: 0;
	padding: 0;
	font-size: inherit;
	line-height: inherit;
	font-weight: inherit;
}

/* Trigger: geerbte Theme-Button-Styles neutralisieren, dann kontrolliert aufbauen. */
.sc-faq__trigger {
	all: unset;
	box-sizing: border-box;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.85rem;
	width: 100%;
	padding: 1.35rem 1.375rem;
	cursor: pointer;
	font: inherit;
	font-weight: 600;
	text-align: left;
	color: inherit;
}

.sc-faq__q-text {
	flex: 1 1 auto;
}

/* Plus/Minus-Icon; Zustand haengt am ARIA-Attribut => immer synchron. */
.sc-faq__icon {
	position: relative;
	flex: 0 0 auto;
	width: 1em;
	height: 1em;
}

.sc-faq__icon::before,
.sc-faq__icon::after {
	content: "";
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	margin: auto;
	background: var(--sc-faq-accent);
}

.sc-faq__icon::before {
	width: 100%;
	height: 2px;
}

.sc-faq__icon::after {
	width: 2px;
	height: 100%;
}

/* Offen: ganzes Icon dreht sich (Bewegung) + vertikaler Balken verschwindet (Plus -> Minus). */
.sc-faq__trigger[aria-expanded="true"] .sc-faq__icon {
	transform: rotate(180deg);
}

.sc-faq__trigger[aria-expanded="true"] .sc-faq__icon::after {
	transform: scaleY(0);
}

/*
 * Panel: sanftes Auf-/Zuklappen ueber grid-template-rows 0fr -> 1fr.
 * Der geschlossene Ruhezustand nutzt weiterhin das hidden-Attribut
 * (display:none via UA) -> raus aus Fokus-/A11y-Baum. Nur der sichtbare
 * (nicht-hidden) Zustand wird als Grid animiert.
 */
.sc-faq__panel:not([hidden]) {
	overflow: hidden;
}

.sc-faq__answer {
	padding: 0.35rem 1.375rem 1.5rem;
}

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

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

.sc-faq__answer a {
	color: var(--sc-faq-accent);
}

.sc-faq__outro {
	margin: 1.75rem 0 0;
	text-align: center;
	color: var(--sc-faq-muted);
	font-size: 1.0625rem;
	line-height: 1.6;
}

.sc-faq__outro > *:first-child {
	margin-top: 0;
}

.sc-faq__outro > *:last-child {
	margin-bottom: 0;
}

.sc-faq__outro a {
	color: var(--sc-faq-accent);
}

/* Sichtbarer Fokus nur bei Tastaturnutzung; outline bleibt in forced-colors sichtbar. */
.sc-faq__trigger:focus {
	outline: none;
}

.sc-faq__trigger:focus-visible {
	outline: 3px solid var(--sc-faq-accent);
	outline-offset: 2px;
	border-radius: 4px;
}

@media (forced-colors: active) {
	.sc-faq__trigger:focus-visible {
		outline-color: Highlight;
	}
	.sc-faq__icon::before,
	.sc-faq__icon::after {
		background: CanvasText;
	}
}

/*
 * Icon-Animation nur, wenn keine Reduzierung gewuenscht ist (Default: ruhig).
 * Das Auf-/Zuklappen des Panels animiert JS pixelgenau (Web Animations API)
 * und respektiert prefers-reduced-motion selbst.
 */
@media (prefers-reduced-motion: no-preference) {
	.sc-faq__icon,
	.sc-faq__icon::after {
		transition: transform var(--sc-faq-anim) cubic-bezier(0.4, 0, 0.2, 1);
	}
}
