/*
 * CKC accordion (ip/accordion block): title buttons (see inc/accordion-a11y.js).
 *
 * Everything is scoped to .ckc-accordion-ready, which the script adds once an item
 * has its button, so without JavaScript the accordion looks and works as before.
 */

/* The title fills the row up to the arrow, so the button does too. */
.ip-accordion .ckc-accordion-ready .ip-accordion__title {
	flex: 1 1 auto;
}

/* The button looks exactly like the heading text it holds. */
.ip-accordion .ckc-accordion__button {
	display: block;
	width: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: none;
	color: inherit;
	font: inherit;
	letter-spacing: inherit;
	text-align: start;
	text-transform: inherit;
	cursor: pointer;
}

.ip-accordion .ckc-accordion__button:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 4px;
}

/* Where supported, the focus ring goes around the whole row, arrow included. */
@supports selector(:has(*)) {
	.ip-accordion .ckc-accordion__button:focus-visible {
		outline: none;
	}

	.ip-accordion .ckc-accordion-ready .ip-accordion__title-wrapper:has(.ckc-accordion__button:focus-visible) {
		outline: 2px solid var(--ckc-color-text-dark, #212121);
		outline-offset: 4px;
	}
}

/*
 * Closed panels: out of the Tab order and hidden from screen readers. The plugin
 * only makes them transparent (opacity 0, height 0), so their links could still be
 * focused. The plugin's own inline transition animates only the height, so hiding
 * them at once looks the same as before.
 */
.ip-accordion .ip-accordion__item.ckc-accordion-ready:not(.is-open) > .ip-accordion__content {
	visibility: hidden;
}
