/**
 * FPDSD-3975 — Collapse a community's Quick Delivery Homes / New Home Plans
 * section when the matching admin toggle is on. Body classes are added in
 * classes/community-section-visibility.php; this file is enqueued only on a
 * community page that has a section toggled off.
 *
 * Targeting (consistent across all community clone families):
 *   QHD: #quick = title + description (has an id). The cards live in a separate
 *        sibling container with NO id of its own, so it is matched by CONTENT,
 *        not position: the Apartments widget emits a hidden
 *        <div class="fp-section-hidden" data-section="quick_delivery_homes"> when
 *        the section is suppressed, and :has() collapses the section's own
 *        container that holds it.
 *   NHP: #plans = title + cards in one container (has an id) — hidden directly.
 * The promo banner (#promo-banner) is never matched, so it stays visible.
 *
 * The :has() is scoped INSIDE .elementor-widget-theme-post-content (the Theme-
 * Builder single template renders each community's own doc through a Post Content
 * widget). Without that scope :has() would also match the single template's outer
 * wrapper container — which contains the marker deep inside — and collapse the
 * whole page. :has() is baseline-supported.
 */

body.fp-hide-qdh-section #quick,
body.fp-hide-qdh-section .elementor-widget-theme-post-content .e-parent:has( .fp-section-hidden[data-section="quick_delivery_homes"] ) {
	display: none !important;
}

body.fp-hide-nhp-section #plans {
	display: none !important;
}

/* Also hide the in-page jump-nav button for a hidden section (Elementor button
   widget, matched by anchor href) so the menu can't link to a missing section. */
body.fp-hide-qdh-section .elementor-widget-button:has( a.elementor-button[href="#quick"] ) {
	display: none !important;
}

body.fp-hide-nhp-section .elementor-widget-button:has( a.elementor-button[href="#plans"] ) {
	display: none !important;
}
