/**
 * Casas Choice — single-open accordion (.accordion-container, see
 * inc/accordion.php + assets/js/accordion.js).
 *
 * Markup (baked into page content by the editor, not a template):
 *
 *   .accordion-container            (one independent open/close group)
 *     .accordion-item × N
 *       .accordion-title            (header row — h3+h2 in one child div,
 *                                     the round arrow-icon circle in the
 *                                     other; both plain Greenshift
 *                                     containers with no class of their
 *                                     own, so they're targeted structurally
 *                                     below: :last-child for the icon)
 *         svg > path                (chevron, fill="#333538" baked into the
 *                                     saved markup, turns white via CSS
 *                                     while its item is open)
 *       .accordion-content          (panel body; padding + text colour
 *                                     below, divider borders live on
 *                                     .accordion-item instead)
 *
 * `.is-js`/`.is-open`/`.is-measuring` are added by accordion.js. Every
 * collapse rule below is scoped under `.is-js` so a page with JS disabled
 * (or still loading) simply shows the existing, always-expanded content —
 * same "no broken layout without JS" rule assets/js/marquee.js follows.
 *
 * Ancestor-qualified selectors (`.accordion-container .accordion-content`
 * rather than the bare class) aren't for specificity against anything in
 * this file — they're to reliably beat Greenshift's own single-class
 * `.gspb_container` rules (e.g. its default `display:flex`) regardless of
 * which stylesheet happens to load second.
 */

.accordion-container .accordion-item {
	border-bottom: 1px solid rgba( 51, 53, 56, 0.25 );
}

.accordion-container .accordion-item:first-child {
	border-top: 0;
}

.accordion-container .accordion-title {
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 16px 0;
}

.accordion-container .accordion-item.is-open > .accordion-title {
	padding: 12px 0;
}

@media ( max-width: 782px ) {
	.accordion-container .accordion-title {
		align-items: center;
	}
}

/* Default circle sizing for the icon wrapper — a plain, class-less div on
 * the 5 hand-typed Greenshift pages, where its own per-block ID style
 * (baked into that page's saved content) already sets this and wins on
 * specificity regardless of load order, so this default only actually
 * applies where nothing more specific already does (e.g. [cc_faqs],
 * inc/lp-local.php, which has no such inline style of its own). */
.accordion-container .accordion-title > div:last-child {
	display: flex;
	align-items: center;
	justify-content: center;
	flex: none;
	width: 48px;
	height: 48px;
	border-radius: 999px;
	border: 1px solid var( --theme-palette-color-7, #C4C7CA );
	transition: background-color 0.25s ease;
}

@media ( max-width: 782px ) {
	.accordion-container .accordion-title > div:last-child {
		width: 40px;
		height: 40px;
	}

	.accordion-container .accordion-title__group {
		gap: 8px;
	}

	.accordion-container .accordion-title__group h3,
	.accordion-container .accordion-title__group h4 {
		font-size: 20px !important;
	}
}

.accordion-container .accordion-item.is-open > .accordion-title > div:last-child {
	background-color: #333538;
	border-color: rgba( 196, 199, 202, 0.6 );
}

@media (hover: hover) {
	.accordion-container .accordion-title:hover > div:last-child {
		background-color: #333538;
		border-color: rgba( 196, 199, 202, 0.6 );
	}
}

.accordion-container .accordion-title:focus-visible {
	outline: 2px solid #333538;
	outline-offset: 2px;
}

/* Number + heading pair for shortcode-rendered accordions ([cc_faqs],
 * [cc_page_accordion] — inc/lp-local.php, inc/page-accordion.php), which
 * have no per-block Greenshift spacing of their own to fall back on like
 * the 5 hand-typed pages do. Hex/var-with-fallback rather than this
 * theme's `--cc-*` custom properties (assets/css/comprar.css) since those
 * are only defined when that stylesheet happens to also be enqueued —
 * [cc_page_accordion] can appear on a page that never loads it. */
.accordion-container .accordion-title__group {
	display: flex;
	align-items: flex-start;
	gap: 16px;
}

.accordion-container .accordion-title__group h3 {
	margin: 0;
	font-size: 26px;
	font-weight: 400;
	color: #333538;
}

/* Active-item accent colour is a desktop-only detail — the mobile layout
 * keeps every number the same neutral colour regardless of open state. */
@media ( min-width: 783px ) {
	.accordion-container .accordion-item.is-open > .accordion-title .accordion-title__group h3 {
		color: var( --theme-palette-color-1, #00A6CE );
	}
}

.accordion-container .accordion-title__group h4 {
	margin: 0;
	font-size: 26px;
	font-weight: 400;
	color: #333538;
}

/* Padding lives on the rendered children, never on this div itself — it's
 * the grid item the 0fr/1fr collapse (below) animates, and any padding of
 * its own would floor its collapsed height above 0 (padding can't shrink
 * with `min-height:0` the way content does), leaving a sliver of the
 * "closed" panel visible. */
.accordion-container .accordion-content > div > * {
	padding-left: 46px;
}

.accordion-container .accordion-content > div > *:last-child {
	padding-bottom: 16px;
}

@media ( max-width: 782px ) {
	.accordion-container .accordion-content > div > * {
		padding-left: 0;
	}
}

.accordion-container .accordion-content p {
	margin: 0 0 10px;
	color: rgba( 51, 53, 56, 1 );
	line-height: 1.9;
}

.accordion-container .accordion-content p:last-child {
	margin-bottom: 0;
}

.accordion-container .accordion-title svg {
	display: block;
	transition: transform 0.35s ease;
}

.accordion-container .accordion-item.is-open > .accordion-title svg {
	transform: rotate( 180deg );
}

.accordion-container .accordion-item.is-open > .accordion-title svg path {
	fill: #ffffff;
}

@media (hover: hover) {
	.accordion-container .accordion-title:hover svg path {
		fill: #ffffff;
	}
}

@media (hover: hover) {
	.accordion-container .accordion-title:hover .accordion-title__group h3 {
		color: var( --theme-palette-color-1, #00A6CE );
	}
}

/* Collapse/expand — CSS Grid's `0fr` → `1fr` trick animates to the
 * content's natural height without JS ever measuring/writing a pixel
 * value; `min-height:0` on the inner wrapper is required for the `0fr`
 * track to actually reach zero (grid items default to `min-height:auto`,
 * which would otherwise floor the row at the content's intrinsic size). */
.accordion-container.is-js .accordion-content {
	display: grid;
	grid-template-rows: 0fr;
	overflow: hidden;
	transition: grid-template-rows 0.35s ease;
}

.accordion-container.is-js .accordion-content > div {
	min-height: 0;
	overflow: hidden;
}

.accordion-container.is-js .accordion-item.is-open > .accordion-content {
	grid-template-rows: 1fr;
}

/* accordion.js briefly toggles every item open (one at a time) to measure
 * the container's tallest possible state — see its lockHeight(). Disabling
 * the transition during that pass keeps it invisible to the visitor. */
.accordion-container.is-measuring .accordion-content {
	transition: none !important;
}

@media ( prefers-reduced-motion: reduce ) {
	.accordion-container .accordion-content,
	.accordion-container .accordion-title svg,
	.accordion-container .accordion-title > div:last-child {
		transition: none;
	}
}
