/*
 * Single listing.
 *
 * Almost every field on a listing is optional -- only 66% have a phone, 28% an
 * email, 29% an Instagram -- and the premium fields are empty on all 605 free
 * listings. Core has no conditional block, so a bound paragraph with no value
 * renders as an empty <p> and a bound button renders an <a> with no href.
 * Collapsing them is the irreducible bit that has to be CSS.
 *
 * Tokens come from theme.json. No hardcoded colour or spacing values.
 */

/* An unfilled binding leaves an empty element behind. */
.wb-listing__field:empty,
.wb-listing__badge:empty,
.wb-listing__label:empty {
	display: none;
}

/* A section whose only real content was an empty binding has nothing to show. */
.wb-listing__premium:not(:has(.wb-listing__field:not(:empty))) {
	display: none;
}

/* A bound button with no URL renders an anchor with no href -- not a link. */
.wb-listing__cta:has(> a:not([href])),
.wb-listing__cta:has(> a[href=""]) {
	display: none;
}

/* The card leads the page now, so cap it rather than let a short contact
   block stretch the full content width -- and keep it flush left, since the
   constrained layout would otherwise centre a max-width child. */
.wb-listing__card {
	max-width: 30rem;
}

/* No listing has a description yet, so the body collapses entirely rather
   than leaving a gap under the card. */
.wb-listing__body:not(:has(.wb-listing__field:not(:empty))):not(:has(.wp-block-post-content > *)) {
	display: none;
}

/* Hours arrive as multi-line text from a textarea. */
.wb-listing__hours {
	white-space: pre-line;
}

.wb-listing__badge:not(:empty) {
	align-self: start;
	border: 1px solid currentColor;
	border-radius: 999px;
	padding: 0.15em 0.75em;
	text-transform: uppercase;
	letter-spacing: 0.08em;
}
