/* Layout: Accordion */

/*
 * One left edge for the whole card: kicker, heading, intro and the list line
 * up. The list used to be inset and centred below the heading, which read as
 * a second, narrower column. Heading and intro keep the spacing base.css
 * gives every section.
 */
.accordion {
	border-top: 1px solid var(--color-border);
}

.accordion__item {
	border-bottom: 1px solid var(--color-border);
}

.accordion__summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-s);
	padding: var(--space-s) 0;
	font-weight: 600;
	font-size: var(--text-lg);
	cursor: pointer;
	list-style: none;
}

.accordion__summary::-webkit-details-marker {
	display: none;
}

.accordion__summary:hover,
.accordion__summary:focus-visible {
	color: var(--color-accent);
}

.accordion__icon {
	position: relative;
	flex: 0 0 auto;
	width: 1.25rem;
	height: 1.25rem;
}

.accordion__icon::before,
.accordion__icon::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 0;
	width: 100%;
	height: 2px;
	background: currentcolor;
	transform: translateY(-50%);
	transition: transform var(--transition), opacity var(--transition);
}

.accordion__icon::after {
	transform: translateY(-50%) rotate(90deg);
}

.accordion__item[open] .accordion__icon::after {
	transform: translateY(-50%) rotate(0deg);
	opacity: 0;
}

.accordion__panel {
	padding-bottom: var(--space-s);
	color: var(--color-muted);
}

/* Progressive enhancement: browsers with interpolate-size animate the open/close. */
@supports (interpolate-size: allow-keywords) {
	:root {
		interpolate-size: allow-keywords;
	}

	.accordion__item::details-content {
		block-size: 0;
		overflow: hidden;
		transition: block-size 250ms ease, content-visibility 250ms allow-discrete;
	}

	.accordion__item[open]::details-content {
		block-size: auto;
	}
}

.accordion__action {
	margin: var(--space-l) 0 0;
	text-align: center;
}

/*
 * Inside an article (post_accordion). Here rather than in post-article.css
 * because the editor preview loads exactly one layout stylesheet, and this is
 * the one that makes it look like an accordion.
 */
.post-accordion__title {
	margin-bottom: var(--space-s);
	font-size: var(--text-xl);
}
