/**
 * TCB Global
 *
 * Site-wide rules that apply to every TCB build, loaded on every front-end
 * page. Unlike every other stylesheet in this plugin, nothing here is scoped to
 * a widget — so keep it small, and only add a rule when it is genuinely true of
 * every client site.
 */

/* --------------------------------------------------------------------------
   Collapse containers left empty by unset dynamic content
   --------------------------------------------------------------------------
   Every TCB build binds its sections to ACF, and not every page fills every
   field. Elementor already drops a widget whose dynamic tag resolves to
   nothing — the heading and the text editor genuinely leave the DOM — but it
   keeps the container that held them:

       <div class="elementor-element elementor-element-xxxxxxx e-con e-child">
               </div>

   That wrapper is still a flex child, so it still consumes the parent's
   row-gap. Two empty blocks in a column produce a hole the height of two gaps
   with nothing in it, and it reads as a broken layout rather than as absent
   copy.

   Notes on the selector, each of which is load-bearing:

   - `:has(*)` tests for ELEMENT children only, so a wrapper holding nothing but
     Elementor's whitespace matches `:not(:has(*))`. Plain `:empty` does not
     work — whitespace text nodes defeat it.

   - `[data-settings]` is excluded. A container with a background emits
     `data-settings='{"background_background":"classic"}'`, and containers like
     that are decorative and meant to render empty. Same for `.e-con-inner`,
     which is laid out by its parent.

   - `.e-child` and `!important` are not belt-and-braces. Elementor's
     `widget-nested-tabs.css` ships `.e-con:first-child{display:flex}` at the
     same specificity (0,2,0), so without them a first-child tab pane would win
     on source order and the tabs would break.

   - `body:not(.elementor-editor-active)` keeps this off inside the editor
     preview. An empty container has to stay visible there or it cannot be
     selected and nothing can be dropped into it.
   -------------------------------------------------------------------------- */
body:not(.elementor-editor-active) .e-con.e-child:not(.e-con-inner):not([data-settings]):not(:has(*)){
	display: none !important;
}

/* --------------------------------------------------------------------------
   Keep injected links inline inside icon lists
   --------------------------------------------------------------------------
   Elementor styles any anchor in a list item as a flex box:

       .elementor-widget .elementor-icon-list-item a { display: flex }

   That is correct for its own markup, where the anchor wraps the whole item
   (icon + text) when the item is linked. It is wrong for an anchor injected
   *inside* the text — which is what auto-internal-linking plugins do when a
   list item happens to contain one of their keywords. The link becomes
   block-level and the item breaks onto two lines: "Surrey" on one, "BC" on the
   next.

   Scoped to anchors inside .elementor-icon-list-text so Elementor's own
   full-item links, which are siblings of that element rather than children,
   keep their flex layout.
   -------------------------------------------------------------------------- */
.elementor-widget .elementor-icon-list-item .elementor-icon-list-text a{
	display: inline;
	align-items: initial;
}

/* --------------------------------------------------------------------------
   Stop post-content prose spacing leaking into embedded Elementor templates
   --------------------------------------------------------------------------
   The child theme spaces prose with `.article-content p { margin-top: 16px;
   margin-bottom: 16px }`. That is right for the body of a post and wrong for a
   template mounted inside it via [elementor-template] — a form panel, a CTA —
   because those widgets already carry their own spacing, so the first
   paragraph in a widget gains 16px that the same template does not have
   anywhere else on the site.

   The existing per-site rule cancels the bottom margin with a :last-child
   selector but has no counterpart for the top, which is the half that shows:
   it lands between a heading and the paragraph under it.

   Specificity here is (0,3,0) against the theme's (0,1,1), so no !important
   is needed. Scoped to the first child so paragraphs *within* a text editor
   keep the spacing between them.
   -------------------------------------------------------------------------- */
.article-content .elementor-widget-container > *:first-child{
	margin-top: 0;
}
