/* ==========================================================================
   Generic accordion (ahan-accordion) — reusable anywhere, any depth.
   The row's title is a real link; the chevron button only toggles.
   ========================================================================== */

.ahan-accordion {
	border-bottom: 1px solid var(--c-border);
}

.ahan-accordion--leaf {
	display: block;
}

.ahan-accordion__row {
	display: flex;
	align-items: center;
	gap: 8px;
}

.ahan-accordion__link {
	flex: 1;
	display: block;
	padding: 12px 0;
	color: var(--c-text);
	text-decoration: none;
	font-size: var(--fs-sm);
	transition: color var(--dur) var(--ease);
}

.ahan-accordion--leaf .ahan-accordion__link {
	padding-inline-start: 0;
}

.ahan-accordion__link:hover {
	color: var(--c-primary);
}

.ahan-accordion__toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	flex-shrink: 0;
	border: 0;
	background: none;
	color: var(--c-text);
	cursor: pointer;
}

.ahan-accordion__chevron {
	display: inline-flex;
	line-height: 0;
}

/* The chevron is drawn pointing right: closed = down, open = up. The class sits on a <span> (svg inside)
   or on the <svg> itself (off-canvas), so both forms are styled. */
.ahan-accordion__chevron svg,
svg.ahan-accordion__chevron {
	width: 16px;
	height: 16px;
	transform: rotate(90deg);
	transition: transform var(--dur) var(--ease);
}

.ahan-accordion.is-open > .ahan-accordion__row .ahan-accordion__chevron svg,
.ahan-accordion.is-open > .ahan-accordion__row svg.ahan-accordion__chevron {
	transform: rotate(-90deg);
}

/* Heading variant: the whole heading is one button (no link inside). */
.ahan-accordion__heading {
	margin: 0;
	font: inherit;
}

.ahan-accordion__trigger {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	width: 100%;
	padding: 12px 0;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	text-align: start;
	cursor: pointer;
}

.ahan-accordion.is-open > .ahan-accordion__heading .ahan-accordion__chevron svg {
	transform: rotate(-90deg);
}

/* Height is driven by accordion.js (max-height 0 <-> scrollHeight). */
.ahan-accordion__panel {
	padding: 0 0 0 var(--gap);
	overflow: hidden;
	max-height: 0;
	transition: max-height .25s ease, padding-bottom .25s ease;
}

.ahan-accordion.is-open > .ahan-accordion__panel {
	padding-bottom: 10px;
}

.ahan-accordion__panel .ahan-accordion {
	border-bottom: 0;
}

/* Mobile-only modifier: an accordion below 768px, a plain always-open section above. */
.ahan-accordion--mobile > .ahan-accordion__panel {
	padding-left: 0;
}

@media (min-width: 768px) {
	.ahan-accordion--mobile {
		border-bottom: 0;
	}

	.ahan-accordion--mobile .ahan-accordion__trigger {
		padding: 0;
		cursor: default;
		pointer-events: none;
	}

	.ahan-accordion--mobile .ahan-accordion__chevron {
		display: none;
	}

	.ahan-accordion--mobile > .ahan-accordion__panel {
		max-height: none !important;
		overflow: visible;
		padding-bottom: 0;
	}
}

/* Not "none": accordion.js re-hides the panel on transitionend. */
@media (prefers-reduced-motion: reduce) {
	.ahan-accordion__link,
	.ahan-accordion__panel,
	.ahan-accordion__chevron svg {
		transition-duration: .01ms;
	}
}

/* hover-states: question rows and the off-canvas toggle take the primary colour on hover. */
.ahan-accordion__trigger,
.ahan-accordion__toggle {
	transition: color var(--dur-fast) var(--ease);
}

@media (hover: hover) {
	.ahan-accordion__trigger:hover,
	.ahan-accordion__toggle:hover {
		color: var(--c-primary);
	}
}