/* RXD Accordion Widget */

.rxd-accordion {
	width: 100%;
	font-family: inherit;
	border-style: solid;
	border-width: 1px;
	border-color: #d0d0d0;
}

/* Divider between items */
.rxd-accordion-item + .rxd-accordion-item {
	border-top-style: solid;
	border-top-width: 1px;
	border-top-color: #d0d0d0;
}

/* Header button */
.rxd-accordion-header {
	display: flex;
	align-items: center;
	gap: 12px;
	width: 100%;
	padding: 14px 20px;
	background-color: transparent;
	border: none;
	cursor: pointer;
	text-align: left;
	font-family: inherit;
	font-size: inherit;
	font-weight: 600;
	line-height: 1.4;
}

/* Title */
.rxd-accordion-title {
	flex: 1;
	color: #1a1a1a;
}

/* Icon wrapper */
.rxd-accordion-icon {
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 20px;
	line-height: 1;
	color: inherit;
}

.rxd-accordion-icon img {
	width: 1em;
	height: 1em;
	object-fit: contain;
	display: block;
}

/* Elementor renders icon-picker icons as inline <svg> by default — size
   and color them explicitly rather than relying on Elementor's own
   global icon CSS being present on the page. */
.rxd-accordion-icon svg {
	width: 1em;
	height: 1em;
	fill: currentColor;
	display: block;
}

/* Show closed icon, hide open icon by default */
.rxd-icon-closed {
	display: inline-flex;
	align-items: center;
}

.rxd-icon-open {
	display: none;
}

/* Swap icons when item is open */
.rxd-accordion-item.rxd-accordion-open .rxd-icon-closed {
	display: none;
}

.rxd-accordion-item.rxd-accordion-open .rxd-icon-open {
	display: inline-flex;
	align-items: center;
}

/* ── Icon position ── */
.rxd-accordion--icon-end .rxd-accordion-title  { order: 1; }
.rxd-accordion--icon-end .rxd-accordion-icon   { order: 2; }
.rxd-accordion--icon-start .rxd-accordion-title { order: 2; }
.rxd-accordion--icon-start .rxd-accordion-icon  { order: 1; }

/* Content panel — outer element drives the expand/collapse animation
   using the CSS Grid 0fr→1fr technique. Unlike a fixed max-height cap,
   this animates proportionally to the panel's real content height no
   matter how short or long it is, so it never "snaps" open early.
   Padding/border/background live on the inner wrapper instead of here,
   otherwise the panel's own padding would still render as a visible
   sliver even while collapsed.

   Closed panels use the `inert` attribute (not `hidden`) so they never
   switch from display:grid to display:none — that switch triggers a
   browser reflow at the exact moment the close animation finishes and
   is the primary cause of the visible layout jerk.

   Two separate transition sets let the close be fast (panel gets out of
   the way quickly) and the open be slower and more elegant. CSS resolves
   which set to use based on the destination state, so the correct curve
   is always applied automatically. */
.rxd-accordion-panel {
	display: grid;
	grid-template-rows: 0fr;
	opacity: 0;
	overflow: hidden;
	/* CLOSE — fast ease-in so the panel clears the way quickly */
	transition: grid-template-rows 0.22s cubic-bezier( 0.4, 0, 1, 1 ),
	            opacity 0.18s ease-in;
}

.rxd-accordion-item.rxd-accordion-open .rxd-accordion-panel {
	grid-template-rows: 1fr;
	opacity: 1;
	/* OPEN — slower ease-out for a smooth, elegant reveal */
	transition: grid-template-rows 0.38s cubic-bezier( 0, 0, 0.2, 1 ),
	            opacity 0.38s ease-out;
}

.rxd-accordion-panel[hidden] {
	display: none;
}

.rxd-accordion-panel-inner {
	/* min-height: 0 lets this grid item shrink past its content size —
	   required for grid-template-rows: 0fr to actually collapse to 0. */
	min-height: 0;
	overflow-x: auto;
	overflow-y: hidden;
	-webkit-overflow-scrolling: touch;
	padding: 16px 20px 20px;
	border-top-style: solid;
	border-top-width: 1px;
	border-top-color: #d0d0d0;
}

@media ( prefers-reduced-motion: reduce ) {
	.rxd-accordion-panel,
	.rxd-accordion-item.rxd-accordion-open .rxd-accordion-panel {
		transition: none;
	}
}
