/* Ported from Code Snippets: "JD: Empty rail suppression" (id 47), pulled fresh from production 2026-08-24.
   NOTE: brief's folder diagram named this empty-rail.php; ported as CSS + enqueued via wp_enqueue_style
   since the source content is pure CSS with no PHP logic. See CHANGELOG. */

/* ======================================================================
   JD: Empty rail suppression

   Companion to the empty-SECTION suppression in "JD: Org page view-toggle
   CSS" (snippet 33), which handles the four main-column blocks. That one
   keys off Elementor's .e-loop-nothing-found-message marker - a signal only
   Loop Grids emit. The rail has no Loop Grids, so it needs its own.

   The signal here: a shortcode widget whose shortcode returned nothing
   renders as exactly <div class="elementor-shortcode"></div> - no
   whitespace inside, so :empty matches. Verified against Beijing
   Developing Group, which emits 11 empty shortcode widgets and 10 filled.

   Scoped by body class rather than by the template wrapper. Checked: the
   header and footer contain zero empty shortcode widgets, so page-wide
   scoping is safe here. If a shortcode widget is ever added to the header
   or footer that is deliberately empty-but-spacing, tighten this scope.

   Three levels, applied in order.
   ====================================================================== */

/* -- 1 - the empty widgets themselves ---------------------------------
   Each one still occupies a flex row and contributes the container's gap,
   which is what padded Beijing's Contact card with blank space below the
   country line. */
body.single-iaap-organisations   .elementor-widget-shortcode:has(> .elementor-widget-container > .elementor-shortcode:empty),
body.single-related_organisation .elementor-widget-shortcode:has(> .elementor-widget-container > .elementor-shortcode:empty),
body.single-analyst              .elementor-widget-shortcode:has(> .elementor-widget-container > .elementor-shortcode:empty){
	display: none;
}

/* -- 2 - social icons the organisation never supplied ------------------
   Elementor's Social Icons widget renders every icon it was configured
   with, whether or not the dynamic URL resolves - producing <a> elements
   with no href at all. Beijing shows a globe icon linking nowhere, which
   looks clickable and is not. Hide the grid item so it takes no space,
   then hide the whole social block if nothing real survives. */
body.single-iaap-organisations   .elementor-social-icons-wrapper .elementor-grid-item:has(> a:not([href])),
body.single-related_organisation .elementor-social-icons-wrapper .elementor-grid-item:has(> a:not([href])){
	display: none;
}
body.single-iaap-organisations   .jd-sidebar-social:not(:has(a[href])),
body.single-related_organisation .jd-sidebar-social:not(:has(a[href])){
	display: none;
}

/* -- 3 - rail cards left with nothing ---------------------------------
   Only the pure-shortcode cards are listed. The CONTACT card is
   deliberately excluded on the organisation templates: it also carries the
   map and the social block, so "no non-empty shortcode" is not the same as
   "nothing to show" - Beijing has no contact shortcodes worth speaking of
   but a real map, and hiding that card would lose the only locational fact
   on the page. */
body.single-iaap-organisations .elementor-element-jd-sidebar-links-card:not(:has(.elementor-shortcode:not(:empty))),
body.single-iaap-organisations .elementor-element-jd-sidebar-iaap-listing-wrap:not(:has(.elementor-shortcode:not(:empty))){
	display: none;
}

/* -- 4 - analyst template (Phase 2, single-post / 216) -----------------
   Every analyst rail card and the About section is a single shortcode
   widget, so "the shortcode came back empty" and "nothing to show" are the
   same condition here - unlike the organisation Contact card, there is no
   map or social block riding along that could still be worth keeping.

   The IAAP Credential card was removed from the template entirely (its
   affiliation/membership facts are already in the header meta block), so
   it no longer needs an entry here. The Practice Details card is
   deliberately NOT listed: jd_analyst_practice_shortcode() always renders
   a dl with 'â€”'/'Not specified' fallbacks rather than skipping the row, so
   it is never empty and never needs suppressing.

   CORRECTION (same day): the Location card was listed here too when it
   still held only the jd_analyst_location_shortcode() widget. It was then
   rebuilt to carry a live Google Map (a native dyncontel-acf-google-maps
   widget) instead of a shortcode - per Stephen's instruction to restore
   the real embedded map rather than a text placeholder. That widget has no
   .elementor-shortcode element at all, so "not(:has(.elementor-shortcode
   :not(:empty)))" was always true for it and the rule was hiding the whole
   card, map included, on every analyst page. Removed from this list - the
   card now always has real content (the map, which falls back to the
   widget's default location when map_analyst is unset) and never needs
   suppressing. */
body.single-analyst .elementor-element-jd-analyst-about-section:not(:has(.elementor-shortcode:not(:empty))),
body.single-analyst .elementor-element-jd-analyst-contact-card:not(:has(.elementor-shortcode:not(:empty))){
	display: none;
}

/* -- 5 - course template (Phase 4, single-post / 7863) ------------------
   Who Should Apply (course_applicants, 36% fill) and Learning Outcomes
   (course_learning_outcomes, 47% fill) are each a single shortcode-driven
   section - "the shortcode came back empty" and "nothing to show" are the
   same condition here, same as the analyst About section. Overview is not
   listed: post_content is filled on 99.8% of published courses, so it is
   left unconditional rather than adding suppression logic for a case that
   almost never occurs. */
body.single-courses .jd-hide-if-empty:not(:has(.elementor-shortcode:not(:empty))){
	display: none;
}
