/**
 * ACF Section Slot widget.
 *
 * A slot with no matching rows outputs nothing, but Elementor still prints the
 * widget wrapper — and the container it has to live in. Left alone those empty
 * boxes keep their padding and claim a share of the parent's gap, which shows
 * up as a stray blank band that is very hard to trace back.
 *
 * An Elementor display condition cannot solve this: its ACF check only knows
 * whether the whole `extra_sections` repeater is empty, not whether this
 * particular position has a row, so one extra section anywhere would reveal
 * every slot. Hence CSS.
 *
 * Put the CSS class `afinia-slot-container` on the container that holds a slot
 * widget, and keep that container to the slot alone — the rule below hides the
 * whole container, so anything else inside would disappear with it.
 */

/* The widget wrapper itself. */
.elementor-widget-afinia-acf-section-slot:has( > .elementor-widget-container:empty ) {
	display: none;
}

/* The container around it. Descendant combinator on purpose: it has to match
   both boxed containers (.e-con > .e-con-inner > widget) and full-width ones
   (.e-con > widget). */
.afinia-slot-container:has( .elementor-widget-afinia-acf-section-slot > .elementor-widget-container:empty ) {
	display: none;
}

/* Fallback where :has() is unavailable — collapses the empty boxes rather than
   hiding them, so no padding or min-height survives. */
.elementor-widget-afinia-acf-section-slot > .elementor-widget-container:empty {
	display: none;
}

.afinia-slot-container:empty {
	display: none;
	padding: 0;
	margin: 0;
}

/* The slot's own wrapper must not become a layout box of its own — injected
   templates should sit in the flow exactly as if they were written inline. */
.afinia-section-slot {
	display: contents;
}
