/**
 * FunQuest archive layout 1.0.0 — Option A (proposed)
 *
 * Place and event category archives: drop the big .fg-cat-banner
 * mascot, put a 72px contained thumb on the right of the H1, and
 * restyle listings that only have a mascot placeholder as compact
 * cards (60px thumb beside the title). New and the favourite heart
 * sit in the card's top-right. The category is a pill under the
 * title. Badges and the heart never overlay the art. Real-photo
 * cards keep their 16:9 image. Event-cards 1.1.1 compact event
 * cards are left alone.
 *
 * Load after AyeCode UI, listing-text, mascot-fit, and event-cards.
 * Does not change listing copy, page 296, or fg-directory.php.
 */

/* ==========================================================================
   Hide the fg-directory category / events banner
   ========================================================================== */

.fg-cat-banner {
	display: none !important;
}

/* Tighten the gap the 140px banner used to occupy. */
.geodir-archive .geodir-search-form-wrapper.mb-3,
.geodir-page-term .geodir-search-form-wrapper.mb-3,
.geodir-page-archive .geodir-search-form-wrapper.mb-3 {
	margin-bottom: 0.75rem !important;
}

.geodir-archive .geodir-loop-actions-container,
.geodir-page-term .geodir-loop-actions-container,
.geodir-page-archive .geodir-loop-actions-container {
	margin-top: 0;
	margin-bottom: 0.35rem;
}

/* ==========================================================================
   Archive H1 + 72px mascot on the right (category / event-category pages)
   ========================================================================== */

.fq-archive-title-row {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 0.75rem;
	margin: 0 0 0.75rem;
}

.fq-archive-title-row > h1.entry-title,
.fq-archive-title-row > h1.main_title {
	flex: 1 1 auto;
	min-width: 0;
	margin: 0;
	align-self: center;
}

.fq-archive-title-row > img.fq-archive-mascot-thumb {
	flex: 0 0 72px;
	width: 72px;
	height: 72px;
	max-width: 72px;
	object-fit: contain;
	object-position: center center;
	border-radius: 12px;
	background-color: var(--fg-bg-cream, #FBFAF6);
	padding: 4px;
	box-sizing: border-box;
	display: block;
}

/* ==========================================================================
   No hyphenation on archive titles and card headings
   Overrides listing-text's hyphens: auto. Wrap at spaces; only a very
   long single word may use overflow-wrap so it cannot blow the box.
   ========================================================================== */

.geodir-archive #left-area > article > h1.entry-title,
.geodir-archive #left-area > article > h1.main_title,
.geodir-page-term #left-area > article > h1.entry-title,
.geodir-page-term #left-area > article > h1.main_title,
.geodir-page-archive #left-area > article > h1.entry-title,
.geodir-page-archive #left-area > article > h1.main_title,
.fq-archive-title-row > h1.entry-title,
.fq-archive-title-row > h1.main_title,
.geodir-listing-posts .geodir-entry-title,
.geodir-category-list-view .geodir-entry-title,
.geodir-gridview .geodir-entry-title {
	hyphens: none !important;
	-webkit-hyphens: none !important;
	-ms-hyphens: none !important;
	word-break: normal;
	overflow-wrap: break-word;
	word-wrap: break-word;
}

/* ==========================================================================
   Compact mascot place cards
   Scoped to .gd_place.fq-place-card-mascot so event-cards and
   real-photo place cards are unchanged.
   ========================================================================== */

:is(.geodir-listing-posts, .geodir-category-list-view, .geodir-gridview) .gd_place.fq-place-card-mascot > .card > .card {
	display: grid;
	grid-template-columns: 60px minmax(0, 1fr) auto auto;
	grid-template-areas:
		". . new heart"
		"thumb title title title"
		"thumb cat cat cat"
		"excerpt excerpt excerpt excerpt"
		"foot foot foot foot";
	column-gap: 0.5rem;
	row-gap: 0.2rem;
	align-items: start;
	position: relative;
	padding: 0.45rem 0.7rem 0.25rem !important; /* beat AyeCode .card.p-0 */
	background-color: #fff;
}

:is(.geodir-listing-posts, .geodir-category-list-view, .geodir-gridview) .gd_place.fq-place-card-mascot .card-img-top,
:is(.geodir-listing-posts, .geodir-category-list-view, .geodir-gridview) .gd_place.fq-place-card-mascot .card-body {
	display: contents;
}

/* Author gravatar sits in a negative-margin row meant to overlap a banner.
   Hide it on compact mascot cards so it cannot cover the thumb or title. */
:is(.geodir-listing-posts, .geodir-category-list-view, .geodir-gridview) .gd_place.fq-place-card-mascot .card-body > .row.gv-hide-3,
:is(.geodir-listing-posts, .geodir-category-list-view, .geodir-gridview) .gd_place.fq-place-card-mascot .row.justify-content-center.gv-hide-3 {
	display: none !important;
}

/* --------------------------------------------------------------------------
   New badge + favourite heart: top-right of the card, no overlap
   -------------------------------------------------------------------------- */

:is(.geodir-listing-posts, .geodir-category-list-view, .geodir-gridview) .gd_place.fq-place-card-mascot .gd-badge-meta:has([data-badge="post_date"]) {
	grid-area: new;
	position: static;
	justify-self: end;
	align-self: center;
	margin: 0 !important;
	z-index: 3;
}

:is(.geodir-listing-posts, .geodir-category-list-view, .geodir-gridview) .gd_place.fq-place-card-mascot .gd-badge[data-badge="post_date"] {
	position: static !important;
	top: auto !important;
	right: auto !important;
	margin: 0 !important;
}

:is(.geodir-listing-posts, .geodir-category-list-view, .geodir-gridview) .gd_place.fq-place-card-mascot .gd-fav-info-wrap {
	grid-area: heart;
	position: static !important;
	top: auto !important;
	right: auto !important;
	bottom: auto !important;
	left: auto !important;
	margin: 0 !important;
	justify-self: end;
	align-self: center;
	z-index: 3;
}

/* --------------------------------------------------------------------------
   60px contained, rounded mascot thumbnail
   Beats mascot-fit's archive 16:9 contain + cream letterbox on this card only.
   Does not target .geodir-images-slider (detail).
   -------------------------------------------------------------------------- */

:is(.geodir-listing-posts, .geodir-category-list-view, .geodir-gridview) .gd_place.fq-place-card-mascot .geodir-post-slider,
:is(.geodir-listing-posts, .geodir-category-list-view, .geodir-gridview) .gd_place.fq-place-card-mascot .geodir-post-slider .geodir-image-container,
:is(.geodir-listing-posts, .geodir-category-list-view, .geodir-gridview) .gd_place.fq-place-card-mascot .geodir-post-slider .geodir-images,
:is(.geodir-listing-posts, .geodir-category-list-view, .geodir-gridview) .gd_place.fq-place-card-mascot .geodir-post-slider .carousel-item {
	grid-area: thumb;
	width: 60px !important;
	height: 60px !important;
	max-width: 60px !important;
	max-height: 60px !important;
	overflow: hidden;
	border-radius: 8px;
	background-color: var(--fg-bg-cream, #FBFAF6);
	align-self: start;
}

:is(.geodir-listing-posts, .geodir-category-list-view, .geodir-gridview) .gd_place.fq-place-card-mascot .geodir-post-slider .ratio,
:is(.geodir-listing-posts, .geodir-category-list-view, .geodir-gridview) .gd_place.fq-place-card-mascot .geodir-post-slider .geodir-link-image {
	--bs-aspect-ratio: auto;
	aspect-ratio: auto !important;
	width: 60px !important;
	height: 60px !important;
	max-width: 60px !important;
	padding: 0 !important;
	display: block;
	position: relative;
}

:is(.geodir-listing-posts, .geodir-category-list-view, .geodir-gridview) .gd_place.fq-place-card-mascot .geodir-post-slider .ratio::before {
	display: none !important;
	padding-top: 0 !important;
	content: none !important;
}

:is(.geodir-listing-posts, .geodir-category-list-view, .geodir-gridview) .gd_place.fq-place-card-mascot .geodir-post-slider img {
	position: static !important;
	top: auto !important;
	left: auto !important;
	width: 60px !important;
	height: 60px !important;
	max-width: 60px !important;
	max-height: 60px !important;
	object-fit: contain !important;
	object-position: center center;
	padding: 4px !important;
	margin: 0 !important;
	background-color: var(--fg-bg-cream, #FBFAF6);
	border-radius: 8px;
}

:is(.geodir-listing-posts, .geodir-category-list-view, .geodir-gridview) .gd_place.fq-place-card-mascot .geodir-post-slider .fa-link {
	display: none !important;
}

/* --------------------------------------------------------------------------
   Title and category pill
   -------------------------------------------------------------------------- */

:is(.geodir-listing-posts, .geodir-category-list-view, .geodir-gridview) .gd_place.fq-place-card-mascot .geodir-post-title {
	grid-area: title;
	min-width: 0;
	padding: 0;
	margin: 0;
}

:is(.geodir-listing-posts, .geodir-category-list-view, .geodir-gridview) .gd_place.fq-place-card-mascot .geodir-entry-title {
	margin: 0;
	font-size: 1.05rem;
	line-height: 1.3;
}

:is(.geodir-listing-posts, .geodir-category-list-view, .geodir-gridview) .gd_place.fq-place-card-mascot .gd-badge-meta:has([data-badge="default_category"]) {
	grid-area: cat;
	justify-self: start;
	align-self: start;
	margin: 0 !important;
	position: static;
}

:is(.geodir-listing-posts, .geodir-category-list-view, .geodir-gridview) .gd_place.fq-place-card-mascot .gd-badge[data-badge="default_category"] {
	position: static !important;
	top: auto !important;
	left: auto !important;
	bottom: auto !important;
	right: auto !important;
	margin: 0 !important;
	display: inline-block;
	font-size: 0.7rem;
	font-weight: 600;
	line-height: 1.3;
	letter-spacing: 0.01em;
	padding: 0.15rem 0.5rem;
	border-radius: 999px;
	background-color: #017A82 !important;
	border-color: #017A82 !important;
	color: #fff !important;
}

:is(.geodir-listing-posts, .geodir-category-list-view, .geodir-gridview) .gd_place.fq-place-card-mascot .geodir-post-content-container {
	grid-area: excerpt;
	min-width: 0;
	padding: 0.15rem 0 0;
}

:is(.geodir-listing-posts, .geodir-category-list-view, .geodir-gridview) .gd_place.fq-place-card-mascot .card-footer {
	grid-area: foot;
	padding: 0.35rem 0 0.15rem !important;
	background: transparent;
}


/* ==========================================================================
   Event archive sort + filter buttons on phones
   "Event Dates" and "Upcoming" should sit side by side as two equal
   columns, not stacked at different widths. Desktop is unchanged.
   Applies only when both .geodir-sort-by and .geodir-event-filter
   are in the toolbar (event archives). Place archives keep a single
   sort control.
   ========================================================================== */

@media (max-width: 767.98px) {
	.geodir-loop-actions-container [role="toolbar"]:has(> .geodir-sort-by):has(.geodir-event-filter) {
		display: flex !important;
		flex-direction: row;
		flex-wrap: nowrap;
		align-items: stretch;
		justify-content: stretch;
		gap: 0.5rem;
		width: 100%;
		margin-bottom: 0.75rem !important;
	}

	.geodir-loop-actions-container [role="toolbar"]:has(> .geodir-sort-by):has(.geodir-event-filter) > .geodir-sort-by,
	.geodir-loop-actions-container [role="toolbar"]:has(> .geodir-sort-by):has(.geodir-event-filter) > .geodir-event-filter {
		flex: 1 1 0;
		min-width: 0;
		width: auto;
		max-width: none;
		display: flex;
	}

	.geodir-loop-actions-container [role="toolbar"]:has(.geodir-event-filter) > .geodir-event-filter > .btn-group {
		flex: 1 1 auto;
		width: 100%;
		min-width: 0;
		display: flex;
	}

	.geodir-loop-actions-container [role="toolbar"]:has(.geodir-event-filter) > .geodir-sort-by > .btn,
	.geodir-loop-actions-container [role="toolbar"]:has(.geodir-event-filter) .geodir-event-filter > .btn-group > .btn {
		flex: 1 1 auto;
		width: 100%;
		min-width: 0;
		border-radius: 8px !important;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		gap: 0.3rem;
		white-space: nowrap;
	}
}


/* ==========================================================================
   Ratings
   Places: hide the grey empty stars until a listing has at least one
   real rating. The place review form still has a rating input so the
   first review can be left. Events: no stars on cards or details, and
   no rating input in the event review form (comments stay).
   ========================================================================== */

/* Place cards and details: hide zero-rating output only. */
.gd_place .geodir-post-rating-value-0,
.gd_place .gd-rating-info-wrap[data-rating="0"],
.single-gd_place .geodir-post-rating-value-0,
.single-gd_place .gd-rating-info-wrap[data-rating="0"],
.gd_place.fq-no-rating .geodir-post-rating,
.single-gd_place.fq-no-rating .geodir-post-rating,
.gd-bubble.gd_place .geodir-post-rating-value-0 {
	display: none !important;
}

/* Collapse a card footer that only held the empty (or event) stars. */
.gd_place .card-footer:has(.gd-rating-info-wrap[data-rating="0"]):not(:has(.gd-rating-info-wrap:not([data-rating="0"]))),
.gd_event .card-footer:has(.geodir-post-rating) {
	display: none !important;
}

/* Events: no rating output and no rating input, anywhere. */
.gd_event .geodir-post-rating,
.gd_event .gd-rating-info-wrap,
.gd_event .gd-rating-output,
.single-gd_event .geodir-post-rating,
.single-gd_event .gd-rating-output,
.single-gd_event .gd-rating-info-wrap,
body.single-gd_event .gd-rating-input-group,
body.single-gd_event .gd-rating-input-wrap,
body.single-gd_event #commentform .gd-rating-input-group,
body.gd_event-template-default .gd-rating-input-group,
.gd_event.fq-no-rating .geodir-post-rating,
.gd-bubble.gd_event .geodir-post-rating {
	display: none !important;
}
