/**
 * Search enhancements — "Seneste set" chip rail.
 *
 * Lives at the BOTTOM of the results grid (see archive-listing.php) so it
 * never competes with the primary search/filter UI. Each chip is a
 * compact card-style pill with thumbnail, title, city · m² meta and
 * price. Designed to stay visually quiet while still being informative.
 */

/* ---------- Seneste set (rail wrapper) ---------- */

.stowly-recent {
	margin: 24px 0 0;
	padding: 12px 0 0;
	border-top: 1px dashed var(--stowly-color-line, #e9e6e4);
}

.stowly-recent__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 10px;
}

.stowly-recent__title {
	margin: 0;
	font-size: 12px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--stowly-color-ink-soft, #6b6b6b);
}

/* ---------- Ryd historik (ghost pill button) ----------
   Defensive colours: we explicitly set the text colour on :hover and
   :focus-visible to defeat the theme's default link/button hover that
   turns things bright blue. No underline + no native focus ring — we
   use a ring emulation via box-shadow instead. */
.stowly-recent__clear {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 10px;
	background: transparent;
	border: 1px solid transparent;
	border-radius: 999px;
	font: inherit;
	font-size: 12px;
	line-height: 1;
	color: var(--stowly-color-ink-soft, #6b6b6b);
	cursor: pointer;
	text-decoration: none;
	transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
	-webkit-appearance: none;
	appearance: none;
}

.stowly-recent__clear:hover,
.stowly-recent__clear:focus,
.stowly-recent__clear:focus-visible,
.stowly-recent__clear:active {
	background: var(--stowly-color-surface-soft, #f4f1ed);
	border-color: var(--stowly-color-line, #e9e6e4);
	color: var(--stowly-color-ink, #1b1b1b);
	text-decoration: none;
	outline: none;
}

.stowly-recent__clear:focus-visible {
	box-shadow: 0 0 0 3px rgba(27, 27, 27, 0.12);
}

.stowly-recent__clear-icon {
	flex: 0 0 auto;
	width: 13px;
	height: 13px;
	color: currentColor;
}

/* ---------- Horizontal rail ---------- */

.stowly-recent__rail {
	display: flex;
	flex-wrap: nowrap;
	gap: 10px;
	overflow-x: auto;
	padding: 2px 0 6px;
	scrollbar-width: thin;
	-webkit-overflow-scrolling: touch;
}

.stowly-recent__rail::-webkit-scrollbar {
	height: 4px;
}

.stowly-recent__rail::-webkit-scrollbar-thumb {
	background: #e0ddda;
	border-radius: 999px;
}

/* ---------- Individual card ---------- */

.stowly-recent__card {
	display: inline-flex;
	align-items: center;
	gap: 12px;
	flex: 0 0 auto;
	min-width: 240px;
	max-width: 300px;
	padding: 7px 16px 7px 7px;
	border-radius: 999px;
	background: var(--stowly-color-surface);
	border: 1px solid var(--stowly-color-line, #e9e6e4);
	color: inherit;
	text-decoration: none;
	transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.stowly-recent__card:hover,
.stowly-recent__card:focus-visible {
	background: var(--stowly-color-surface);
	border-color: var(--stowly-color-line-strong, #d6d2ce);
	text-decoration: none;
	transform: translateY(-1px);
	box-shadow: 0 6px 18px -12px rgba(0, 0, 0, 0.18);
	outline: none;
}

.stowly-recent__image {
	flex: 0 0 auto;
	width: 44px;
	height: 44px;
	/* Full circle to echo the pill-shaped card around it and read as
	   a single, cohesive chip rather than a rounded square stuck in a
	   pill. */
	border-radius: 50%;
	overflow: hidden;
	background: #efeae6;
}

.stowly-recent__image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.stowly-recent__body {
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
	overflow: hidden;
	flex: 1 1 auto;
}

.stowly-recent__listing-title {
	margin: 0;
	font-weight: 600;
	font-size: 14.5px;
	line-height: 1.25;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	color: var(--stowly-color-ink, #1b1b1b);
}

.stowly-recent__subline {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 12.5px;
	line-height: 1.3;
	white-space: nowrap;
	overflow: hidden;
}

.stowly-recent__meta {
	color: var(--stowly-color-ink-soft, #6b6b6b);
	overflow: hidden;
	text-overflow: ellipsis;
	min-width: 0;
}

.stowly-recent__price {
	margin-left: auto;
	font-weight: 600;
	color: var(--stowly-color-ink, #1b1b1b);
	font-variant-numeric: tabular-nums;
	flex: 0 0 auto;
}

@media (max-width: 600px) {
	.stowly-recent__card {
		min-width: 220px;
		max-width: 260px;
	}

	.stowly-recent__listing-title {
		font-size: 14px;
	}

	.stowly-recent__subline {
		font-size: 12px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.stowly-recent__card,
	.stowly-recent__clear {
		transition: none;
	}
}
