/**
 * Accordion — Common base CSS ( loads for every style ).
 *
 * Owns the shared skeleton: the item stack, header button reset, indicator
 * rotation and the content panel. Per-style files paint borders, fills and
 * chrome. CSS variables drive theme and sizing:
 *   --captwiki-acc-accent     → highlight / active colour
 *   --captwiki-acc-gap        → gap between items
 *   --captwiki-acc-indicator  → indicator icon size
 *
 * @package captain-widgets-kit
 * @since   1.7.0
 */

.captwiki-accordion {
	--captwiki-acc-accent: #6d5efc;
	--captwiki-acc-gap: 12px;
	--captwiki-acc-indicator: 18px;
	display: flex;
	flex-direction: column;
	gap: var( --captwiki-acc-gap );
	width: 100%;
	box-sizing: border-box;
}

.captwiki-accordion *,
.captwiki-accordion *::before,
.captwiki-accordion *::after {
	box-sizing: border-box;
}

/* ── Item ──────────────────────────────────────────────── */
.captwiki-accordion__item {
	position: relative;
	background: transparent;
}

/* ── Header ────────────────────────────────────────────── */
.captwiki-accordion__header {
	margin: 0;
	font-size: inherit;
	line-height: inherit;
}

.captwiki-accordion__button {
	display: flex;
	align-items: center;
	gap: 12px;
	width: 100%;
	padding: 18px 20px;
	background: transparent;
	border: 0;
	cursor: pointer;
	text-align: left;
	font-family: inherit;
	font-size: 17px;
	font-weight: 600;
	line-height: 1.4;
	color: #1f2937;
	transition: color 0.25s ease, background-color 0.25s ease;
}

.captwiki-accordion__button:focus-visible {
	outline: 2px solid var( --captwiki-acc-accent );
	outline-offset: -2px;
}

.captwiki-accordion__icon {
	display: inline-flex;
	align-items: center;
	flex: 0 0 auto;
	font-size: 1.1em;
	line-height: 1;
	color: var( --captwiki-acc-accent );
}

.captwiki-accordion__icon svg {
	width: 1em;
	height: 1em;
	fill: currentColor;
}

.captwiki-accordion__icon i {
	font-style: normal;
}

.captwiki-accordion__title {
	flex: 1 1 auto;
	min-width: 0;
}

/* ── Indicator ─────────────────────────────────────────── */
.captwiki-accordion__indicator {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: var( --captwiki-acc-indicator );
	height: var( --captwiki-acc-indicator );
	transition: transform 0.3s ease, color 0.3s ease;
}

.captwiki-accordion__indicator svg {
	width: 100%;
	height: 100%;
}

.captwiki-accordion__item.is-open .captwiki-accordion__indicator--arrow {
	transform: rotate( 180deg );
}

/* Plus → minus: the vertical line collapses when open. */
.captwiki-accordion__plus-v {
	transition: transform 0.3s ease, opacity 0.3s ease;
	transform-origin: center;
}

.captwiki-accordion__item.is-open .captwiki-accordion__plus-v {
	transform: scaleY( 0 );
	opacity: 0;
}

.captwiki-accordion__item.is-open .captwiki-accordion__indicator--plus {
	transform: rotate( 90deg );
}

/* ── Panel ─────────────────────────────────────────────── */
.captwiki-accordion__panel[hidden] {
	display: none;
}

.captwiki-accordion__content {
	padding: 4px 20px 20px;
	font-size: 15px;
	line-height: 1.7;
	color: #4b5563;
}

.captwiki-accordion__content > :first-child {
	margin-top: 0;
}

.captwiki-accordion__content > :last-child {
	margin-bottom: 0;
}
