/**
 * Utility & Miscellaneous Styles
 *
 * Site-specific utility classes and one-off overrides that do not belong
 * to a specific component or plugin. Keep this file lean — if a section
 * grows beyond ~30 lines, extract it into its own component file.
 *
 * @package TravelVip
 * @since   1.0.0
 */

/* ==========================================================================
   1. Wheelchair Accessibility Group (Conditional Visibility)
   ========================================================================== */

/**
 * Hides the wheelchair option group on the public-facing frontend when it
 * contains no wheelchair data. Handles both the legacy .empty class (ACF)
 * and the current .is-empty class (native RenderHelper).
 *
 * Intentionally scoped to .wheelchair-group only — a broad
 * .wp-block-group:has(.is-empty) rule would hide any group that contains
 * a single empty block (e.g. vehicle cards where wheelchair is not set).
 *
 * The :has() selector is widely supported in modern browsers (2023+).
 * The body:not(.wp-admin) scope prevents this rule from affecting the
 * Block Editor preview in wp-admin, where the group should remain visible.
 */
body:not(.wp-admin) .wheelchair-group:has(.empty),
body:not(.wp-admin) .wheelchair-group:has(.is-empty) {
	display: none;
}

/* ==========================================================================
   2. Query Loop item — hide when image block has no image
   ========================================================================== */

/**
 * Hides a Query Loop post item (.wp-block-post) when it contains an image
 * block with no actual <img> element. Covers both:
 *   - core/post-featured-image — rendered as <figure class="wp-block-post-featured-image">
 *   - core/image               — rendered as <figure class="wp-block-image">
 *
 * Both cases produce a <figure> with no <img> when no image is set/loaded.
 * Scoped to the frontend only so the Block Editor continues to show placeholders.
 */
body:not(.wp-admin) .wp-block-post:has(.wp-block-post-featured-image:not(:has(img))),
body:not(.wp-admin) .wp-block-post:has(.wp-block-image:not(:has(img))) {
	display: none;
}
