/* =========================================================
   MUNICIPAL (CITY TAG) PAGE STYLES
   Pinal Post child theme - css/municipal_pages.css

   Loaded only on the six city tag archives (/san-tan-post/,
   /casa-grande-post/, /maricopa-post/, /florence-post/,
   /coolidge-post/, /apache-junction-post/). The enqueue in
   functions.php gates on pinalpost_city_vanity_map() from
   inc/city-tag-canonical.php, so adding a city there is the
   only step needed to get this file on a new city page.

   Versioned by filemtime() in functions.php, so saving this
   file busts the cache. style.css does NOT do that (it goes
   by the theme-header Version), which is why these rules
   live here instead.

   Rules use stable classes only -- never generated
   ultp-block-XXXXXX IDs or wp-container-* hashes, which
   change whenever a template is re-saved.
   ========================================================= */


/* =========================================================
   1. HIDE EMPTY SECTIONS  (Trending / Upcoming Events / any)

   Problem: smaller cities often have no "popular this week"
   posts and no upcoming events. PostX then prints a
   "No Post Found" box and The Events Calendar prints
   "There are no upcoming events." -- each under its own
   heading, with a separator after it. We want the whole
   section (heading + block + separator) to vanish.

   HOW IT WORKS
     Each section is wrapped in a core Group block carrying
     ONE marker class, pp-hide-if-empty. If the group CONTAINS
     a plugin's empty-state element, the group is hidden.
     Nothing else on the page is affected, and an empty PostX
     list anywhere else on the site still shows "No Post
     Found" (useful while debugging a misconfigured query).

     The Group's own layout side effects (constrained width,
     block-gap margins) are stripped server-side by
     inc/hide-empty-sections.php, so the wrapped blocks keep
     exactly the width and spacing they had before grouping.
     Do not set Layout or Block spacing on the group; they
     are discarded anyway.

   EDITOR SETUP (same steps for every section, every template)
     1. In PostX > Builder, select the section's Heading, the
        block under it (Post Grid, Post List, or the Custom
        HTML holding [tribe_events_list ...]), and the
        Separator below it.
     2. Group them (toolbar > Group).
     3. Group > Advanced > Additional CSS class(es):
            pp-hide-if-empty
     That is all. Repeat for each section that should vanish
     when empty.

   EMPTY-STATE SELECTORS (confirmed against live markup)
     PostX grid/list    .ultp-not-found-message
                        (an empty grid outputs ONLY this div,
                        no block wrapper -- which is why a
                        wrapper we control is required)
     TEC list widget    .tribe-events-c-messages__message
                        ([tribe_events_list] renders the v2
                        widget-events-list view)
   If a plugin update changes its empty-state class, this is
   the only place to update.

   Relies on CSS :has(), supported in all current browsers
   (Chrome/Edge 105+, Safari 15.4+, Firefox 121+).
   ========================================================= */

.pp-hide-if-empty:has(.ultp-not-found-message),
.pp-hide-if-empty:has(.tribe-events-c-messages__message) {
  display: none !important;
}


/* =========================================================
   2. (reserved) CITY PAGE HEADER / LAYOUT TWEAKS
   Add city-archive-only rules below. Scope to the tag
   archive, e.g.
     body.tag .ultp-builder-content ...
   or to a specific city via its body class, e.g.
     body.tag-coolidge ...
   (WordPress adds tag-{slug} to <body> on tag archives.)
   ========================================================= */
