/**
 * LFBC Accordion pattern
 *
 * Stack of native <details>/<summary> elements with a custom marker:
 *   - Marker is a 28×28 white pill with a poppy chevron, drawn as
 *     summary::before. Rotates 180° on [open] (chevron-down → chevron-up).
 *   - Native browser markers are hidden via `list-style: none` and the
 *     legacy `::-webkit-details-marker` override for older Safari.
 *
 * No JS. Items open/close independently — native <details> behavior.
 *
 * Auto-enqueued (frontend + editor) by lfbc_pattern_css_files() in functions.php.
 */

.lfbc-accordion {
	display: flex;
	flex-direction: column;
	gap: 12px;
	margin-inline: auto;
}

/* Reset WP flow-layout vertical rhythm — the flex gap handles spacing. */
.lfbc-accordion > * {
	margin-block-start: 0;
	margin-top: 0;
}

/* Header: title above the Expand/Close All buttons. */
.lfbc-accordion__header {
	margin-bottom: 12px; /* combines with the parent's 12px gap → ~24px before items */
}

.lfbc-accordion__title {
	margin: 0 0 12px;
	color: var(--wp--preset--color--soft-black-500);
	letter-spacing: -0.01em;
}

/* Buttons row: 8px gap per Figma, left-aligned. */
.lfbc-accordion__actions.wp-block-buttons {
	gap: 8px;
	justify-content: flex-start;
}

/* Accordion item: oatmeal card, rounded 8px. */
.lfbc-accordion__item {
	background-color: var(--wp--preset--color--oatmeal-500);
	border-radius: 8px;
	padding: 20px;
	border: 0;
}

/* Open state: extra room on the bottom-right (per Figma). */
.lfbc-accordion__item[open] {
	padding-right: 40px;
	padding-bottom: 40px;
}

/* Hover only applies to closed items — open cards keep their oatmeal fill. */
.lfbc-accordion__item:not([open]):hover {
	background-color: #ede9e0;
}

/* Summary row: chevron pill + title.
 * Not a flex container: summary's content is rich text (e.g. <strong>), and
 * flexbox would wrap each contiguous text run and inline child into its own
 * flex item — putting the `gap` between bolded words too. The marker is
 * positioned absolutely instead, with padding-left reserving its space. */
.lfbc-accordion__item > summary {
	position: relative;
	cursor: pointer;
	list-style: none;
	font-weight: 600;
	font-size: 18px;
	line-height: 1.4;
	color: var(--wp--preset--color--soft-black-500);
	padding-left: 48px;
}

.lfbc-accordion__item > summary::-webkit-details-marker {
	display: none;
}

/* Chevron marker: white pill (28×28) with a centered poppy chevron-down SVG.
 * SVG is inlined so the icon color stays in CSS — no asset file to manage. */
.lfbc-accordion__item > summary::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background-color: #ffffff;
	background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23e8506f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 8 10 12.5 14 8'/></svg>");
	background-repeat: no-repeat;
	background-position: center;
	background-size: 20px 20px;
	transition: transform 0.2s ease;
}

.lfbc-accordion__item[open] > summary::before {
	transform: rotate(180deg);
}

/* Body content: indent 28px so the text aligns with the title (title is
 * already 28px chevron + 20px gap = 48px from the card's left edge; the
 * card's own 20px padding provides the first 20px, this adds the remaining 28). */
.lfbc-accordion__item > *:not(summary) {
	padding-inline-start: 28px;
	margin: 0;
}

.lfbc-accordion__item > *:not(summary) p {
	font-size: 16px;
	line-height: 1.5;
	color: var(--wp--preset--color--soft-black-400);
	margin: 0;
}

/* 20px between the summary row and the first body block. */
.lfbc-accordion__item > summary + * {
	margin-top: 20px;
}

/* 20px between subsequent body blocks (e.g. paragraph + paragraph). */
.lfbc-accordion__item > *:not(summary) + *:not(summary) {
	margin-top: 20px;
}
