/* ==========================================================================
   EXPLORE — the three-pane category interface

   Overrides for My Listing's own Explore section (`.cts-explore`, markup in
   my-listing/templates/explore/), which the six /explore/<bucket> pages render
   directly. inc/explore.php says why it is the parent's interface and not one
   of ours: the filter rail, the result card and the details page are all
   configured per listing type in wp-admin, and rebuilding them here would take
   that away from the client.

   So this sheet is deliberately thin. It aligns the parent's interface with
   the token layer in style.css -- our blue, our radius scale, our type -- and
   fixes two things the parent gets wrong. It does not relayout the panes: the
   three-column geometry, the collapsible map and the mobile tab switching are
   the parent's and they work.

   The category row is the one place we add rather than align. It is the second
   bar under the site header, and templates/explore/partials/topbar.php builds
   it from real links to the six category pages rather than the parent's
   JavaScript type switcher.
   ========================================================================== */

/* --- The category row ----------------------------------------------------
 *
 * Reads as a continuation of the header rather than as the top of the page
 * content: white ground, one hairline under it, and the active category
 * marked with an accent rule.
 *
 * The rule is 3px, not the 8px the category tiles carry. The 8px rule in
 * docs/design-reference.md is a signature mark under a 24px title on a
 * 16:11 photograph; at 14px in a 60px bar the same weight reads as a
 * highlighter pen. This is the same idea at the scale of the thing it marks.
 */
.kbia-explore-head {
	border-bottom: 1px solid var(--kbia-border);
	background: var(--kbia-surface);
}

.kbia-explore-head .finder-title h2 {
	color: var(--kbia-heading);
	font-family: var(--kbia-font-heading);
	font-weight: 600;
}

/* The label is the <h4> inside the anchor, and the parent theme colours it
   directly -- colouring the anchor alone looks right in devtools and changes
   nothing on screen, because the h4's own rule wins. Both are set here: the
   h4 carries the text, the anchor carries the listing type's icon. */
.kbia-explore-head .explore-types .item > a,
.kbia-explore-head .explore-types .item > a h4 {
	color: var(--kbia-muted);
	font-weight: 600;
	transition: color var(--kbia-dur) var(--kbia-ease-out);
}

.kbia-explore-head .explore-types .item > a:hover,
.kbia-explore-head .explore-types .item > a:hover h4,
.kbia-explore-head .explore-types .item > a:focus-visible,
.kbia-explore-head .explore-types .item > a:focus-visible h4 {
	color: var(--kbia-heading);
}

.kbia-explore-head .explore-types .item.active > a,
.kbia-explore-head .explore-types .item.active > a h4 {
	color: var(--kbia-heading);
}

/* On the item, not the anchor: the anchor is only as wide as its own padding
   allows, and the rule should span the category's full slot in the row. */
.kbia-explore-head .explore-types .item {
	position: relative;
}

.kbia-explore-head .explore-types .item.active::after {
	content: "";
	position: absolute;
	right: 0;
	bottom: 0; /* the row clips its own overflow, so -1px loses a third of it */
	left: 0;
	height: 3px;
	background: var(--kbia-accent);
}

@media (prefers-reduced-motion: reduce) {
	.kbia-explore-head .explore-types .item > a,
	.kbia-explore-head .explore-types .item > a h4 { transition: none; }
}

/* --- The panes -----------------------------------------------------------
 *
 * The parent hard-codes #fff and #fafafa. Same intent, our neutrals, so the
 * page sits in the same family as every other band on the site. */
.cts-explore .finder-search { background: var(--kbia-surface); }
.cts-explore .finder-listings { background: var(--kbia-surface-alt); }

/* --- Controls ------------------------------------------------------------
 *
 * The parent's buttons are #0082f0 at 5px radius -- close enough to our blue
 * to look like a mistake rather than a decision, which is exactly the drift
 * the token layer exists to prevent. */
.cts-explore .search-listings-btn,
.cts-explore .reset-results-27,
.cts-explore .load-more-btn .buttons {
	border-radius: var(--kbia-radius);
	background: var(--kbia-accent);
	color: var(--kbia-on-accent);
	font-family: var(--kbia-font-body);
	font-weight: 600;
}

.cts-explore .search-listings-btn:hover,
.cts-explore .load-more-btn .buttons:hover {
	background: var(--kbia-accent-hover);
	color: var(--kbia-on-accent);
}

/* Reset is a quiet action next to Search and should not compete with it. */
.cts-explore .reset-results-27 {
	background: transparent;
	color: var(--kbia-muted);
}

.cts-explore .reset-results-27:hover {
	background: transparent;
	color: var(--kbia-accent);
}

/* The rail's own tabs -- Filters / Categories. */
.cts-explore .explore-tab-buttons a.active,
.cts-explore .finder-tabs .active > a {
	color: var(--kbia-accent);
}

/* --- Result cards --------------------------------------------------------
 *
 * Square-cornered in the parent. docs/design-reference.md §1: imagery and
 * cards take --kbia-radius-lg, and these are both. Hover is asymmetric to
 * match components.css -- quick to arrive, slow to leave. */
.cts-explore .lf-item {
	overflow: hidden;
	border-radius: var(--kbia-radius-lg);
}

.cts-explore .lf-item-container {
	transition: transform 500ms var(--kbia-ease-out);
}

.cts-explore .lf-item-container:hover {
	transform: translateY(-2px);
	transition-duration: 300ms;
}

.cts-explore .listing-preview-title {
	font-family: var(--kbia-font-heading);
	font-weight: 600;
}

.cts-explore .fl-results-no {
	color: var(--kbia-body);
	font-family: var(--kbia-font-body);
}

@media (prefers-reduced-motion: reduce) {
	.cts-explore .lf-item-container { transition: none; }
	.cts-explore .lf-item-container:hover { transform: none; }
}

/* --- Map controls --------------------------------------------------------
 *
 * A parent-theme bug, not ours: the "Search as I move the map" label computes
 * to zero height, so its text hangs out of the bottom of the white pill it is
 * supposed to sit inside -- visible on the live site today, and reproducible
 * on the untouched /explore page, so not something our overrides introduced.
 *
 * The label carries the text and the checkbox is absolutely positioned over
 * it, which is why the box collapses. Giving it a line box of its own and
 * centring both in the control is enough; the pill's own 40px height is the
 * parent's and is left alone.
 */
.cts-explore .map-controls .md-checkbox {
	display: flex;
	align-items: center;
}

.cts-explore .map-controls .md-checkbox label {
	display: inline-flex;
	align-items: center;
	min-height: 22px;
	line-height: 1.4;
}

.cts-explore .map-controls .map-control {
	border-radius: var(--kbia-radius);
}

/* --- The map coverage note ----------------------------------------------
 *
 * Sits under the interface, in the flow, rather than floating over the map.
 * It is a standing fact about the data -- see kbia_bucket_map_coverage() --
 * not a transient state of the current filter, so it does not belong inside
 * the results column where it would read as part of the result set. */
.kbia-explore__note {
	margin: 0;
	padding: 0.75rem var(--kbia-gutter);
	border-top: 1px solid var(--kbia-border);
	background: var(--kbia-surface-alt);
	color: var(--kbia-muted);
	font-size: var(--kbia-fs-eyebrow);
}

/* --- Narrow screens ------------------------------------------------------
 *
 * The parent switches to its own tabbed layout below 991px -- filters,
 * results and map become three tabs of one column. Nothing here should fight
 * that. The row is left scrollable rather than wrapped: six categories
 * stacked would push the results off a phone screen entirely.
 */
@media (max-width: 991px) {
	.kbia-explore-head .explore-types {
		overflow-x: auto;
		scrollbar-width: none;
	}

	.kbia-explore-head .explore-types::-webkit-scrollbar {
		display: none;
	}

	.kbia-explore__note {
		padding: 0.75rem 1rem;
	}
}

/* Category names stay on one line in the scrollable row. Left to wrap,
   "Food & Drink" and "Professional Services" become three-line items and the
   row grows to 120px on a phone -- a third of the screen spent on navigation
   the visitor has already used. */
@media (max-width: 991px) {
	.kbia-explore-head .explore-types .item h4 {
		white-space: nowrap;
	}
}
