/**
 * Driveway — engagement components (handle `stepfox-cd-engage`, dep `stepfox-cd`).
 *
 * Blocks: favorites-list, compare-table, recently-viewed, saved-searches,
 * saved-link, compare-link, dealer-card, dealers-grid — plus the floating
 * compare tray and the little fallback toast that favorites.js / compare.js
 * build on every page. This sheet is enqueued on every front-end page
 * (favorites.php), because the tray and the header pills can appear anywhere.
 *
 * The vehicle card itself (article.sfcd-card[data-sfcd-id]) is styled once in
 * cards.css; the dealer card here is its own markup (article.sfcd-dc) so it
 * looks identical in grids, sidebars, the locator and Elementor.
 *
 * RULES
 * 1. Every colour is a palette preset `var(--wp--preset--color--<slug>, <light>)`
 *    read ONCE into the local `--sfe-*` aliases declared on the component
 *    roots (not :root), so the theme's dark re-map flips everything. White
 *    (#fff) is used only for text over photography; text on filled brand
 *    colours uses the `base` preset.
 * 2. Mobile first. Layout widens at 600 / 769 / 1025px (Stepfox Looks devices:
 *    mobile <=768, tablet <=1024). The page never scrolls sideways; the compare
 *    table scrolls inside its own region, label column pinned.
 * 3. Motion is decorative only and is switched off under
 *    prefers-reduced-motion; hover lifts are gated on (hover:hover).
 * 4. JS-only states hang off classes/attributes the scripts add; without JS
 *    every shell still shows a complete, honest empty state.
 */

/* ======================================================================
   0. LOCAL TOKENS
   ====================================================================== */

.sfcd-fl,
.sfcd-ct,
.sfcd-rv,
.sfcd-sv,
.sfcd-dc,
.sfcd-dg,
.sfcd-pill,
.sfcd-pill-wrap,
.sfcd-tray,
.sfcd-toast-lite,
.sfcd-toast {
	--sfe-base: var(--wp--preset--color--base, #f2f3f5);
	--sfe-panel: var(--wp--preset--color--panel, #ffffff);
	--sfe-panel-2: var(--wp--preset--color--panel-2, #e6e8ec);
	--sfe-line: var(--wp--preset--color--line, rgba(14, 17, 22, 0.10));
	--sfe-edge: var(--wp--preset--color--edge, rgba(14, 17, 22, 0.08));
	--sfe-ink: var(--wp--preset--color--ink, #0e1116);
	--sfe-muted: var(--wp--preset--color--muted, #596372);
	--sfe-accent: var(--wp--preset--color--accent, #c2410c);
	--sfe-accent-strong: var(--sfcd-accent-strong, var(--wp--preset--color--accent, #c2410c));
	--sfe-accent-2: var(--wp--preset--color--accent-2, #1d4ed8);
	--sfe-neon: var(--wp--preset--color--neon, #0b8a5f);
	--sfe-navy: var(--wp--preset--color--violet, #1b2a4a);
	--sfe-turf: var(--wp--preset--color--turf, #dfe8f7);
	--sfe-gold: var(--wp--preset--color--gold, #8a6400);
	--sfe-glass: var(--wp--preset--color--glass, rgba(255, 255, 255, 0.86));
	--sfe-glass-2: var(--wp--preset--color--glass-2, rgba(242, 243, 245, 0.80));
	--sfe-on-fill: var(--wp--preset--color--base, #f2f3f5);
	--sfe-f-display: var(--wp--preset--font-family--display, "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif);
	--sfe-f-ui: var(--wp--preset--font-family--ui, "Inter", system-ui, -apple-system, "Segoe UI", sans-serif);
	--sfe-f-body: var(--wp--preset--font-family--body, "Inter", system-ui, -apple-system, "Segoe UI", sans-serif);
	--sfe-f-num: var(--wp--preset--font-family--num, "Space Grotesk", var(--wp--preset--font-family--ui, system-ui), sans-serif);
	--sfe-shadow-1: var(--wp--preset--shadow--depth-1, 0 1px 2px rgba(14, 17, 22, 0.06), 0 2px 6px rgba(14, 17, 22, 0.04));
	--sfe-shadow-2: var(--wp--preset--shadow--depth-2, 0 2px 4px rgba(14, 17, 22, 0.05), 0 10px 28px rgba(14, 17, 22, 0.08));
	--sfe-shadow-3: var(--wp--preset--shadow--depth-3, 0 6px 14px rgba(14, 17, 22, 0.08), 0 22px 48px rgba(14, 17, 22, 0.12));
	--sfe-shadow-4: var(--wp--preset--shadow--depth-4, 0 12px 28px rgba(14, 17, 22, 0.12), 0 40px 80px rgba(14, 17, 22, 0.18));
	--sfe-ring: 0 0 0 3px color-mix(in srgb, var(--sfe-accent-2) 32%, transparent);
	--sfe-r-card: var(--sfcd-radius-card, 16px);
	--sfe-r-btn: var(--sfcd-radius-btn, 12px);
	--sfe-gap: clamp(16px, 2vw, 28px);
	--sfe-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
	box-sizing: border-box;
}

.sfcd-fl,
.sfcd-ct,
.sfcd-rv,
.sfcd-sv,
.sfcd-dg {
	color: var(--sfe-ink);
	font-family: var(--sfe-f-body);
}

:where(.sfcd-fl, .sfcd-ct, .sfcd-rv, .sfcd-sv, .sfcd-dc, .sfcd-dg, .sfcd-pill, .sfcd-tray, .sfcd-toast-lite, .sfcd-toast) *,
:where(.sfcd-fl, .sfcd-ct, .sfcd-rv, .sfcd-sv, .sfcd-dc, .sfcd-dg, .sfcd-pill, .sfcd-tray, .sfcd-toast-lite, .sfcd-toast) *::before,
:where(.sfcd-fl, .sfcd-ct, .sfcd-rv, .sfcd-sv, .sfcd-dc, .sfcd-dg, .sfcd-pill, .sfcd-tray, .sfcd-toast-lite, .sfcd-toast) *::after {
	box-sizing: border-box;
}

:where(.sfcd-fl, .sfcd-ct, .sfcd-rv, .sfcd-sv, .sfcd-dc, .sfcd-pill) .sfcd-sr {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	padding: 0 !important;
	margin: -1px !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
	white-space: nowrap !important;
	border: 0 !important;
}

:where(.sfcd-fl, .sfcd-ct, .sfcd-sv, .sfcd-dc, .sfcd-pill, .sfcd-state) .sfcd-i {
	flex: none;
	display: inline-block;
	vertical-align: middle;
}

.sfcd-fl[hidden],
.sfcd-ct[hidden],
.sfcd-rv[hidden],
.sfcd-sv[hidden] {
	display: none;
}

/* ======================================================================
   1. SHARED ATOMS (select, switch, state, toast, skeleton)
   ====================================================================== */

/* Select with chevron. */
.sfcd-sel {
	position: relative;
	display: block;
	min-width: 0;
}

.sfcd-sel > select {
	appearance: none;
	-webkit-appearance: none;
	width: 100%;
	min-height: 44px;
	padding: 0 40px 0 14px;
	border: 1px solid var(--sfe-line);
	border-radius: var(--sfe-r-btn);
	background-color: var(--sfe-panel);
	color: var(--sfe-ink);
	font: 600 15px/1.3 var(--sfe-f-ui);
	text-overflow: ellipsis;
	cursor: pointer;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.sfcd-sel > .sfcd-i {
	position: absolute;
	top: 50%;
	right: 14px;
	width: 16px;
	height: 16px;
	transform: translateY(-50%);
	pointer-events: none;
	color: var(--sfe-muted);
}

.sfcd-sel > select:focus-visible {
	outline: none;
	border-color: var(--sfe-accent-2);
	box-shadow: var(--sfe-ring);
}

@media (hover: hover) {
	.sfcd-sel > select:hover {
		border-color: color-mix(in srgb, var(--sfe-ink) 35%, transparent);
	}
}

/* Switch (differences-only toggle). */
.sfcd-switch {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 10px;
	min-height: 44px;
	color: var(--sfe-ink);
	font: 600 14px/1.2 var(--sfe-f-ui);
	cursor: pointer;
}

.sfcd-switch input {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
	margin: 0;
}

.sfcd-switch__track {
	position: relative;
	flex: none;
	width: 42px;
	height: 24px;
	border-radius: 999px;
	background: color-mix(in srgb, var(--sfe-ink) 24%, transparent);
	transition: background-color 0.2s ease;
}

.sfcd-switch__track::after {
	content: "";
	position: absolute;
	top: 3px;
	left: 3px;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: var(--sfe-panel);
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
	transition: transform 0.2s var(--sfe-ease);
}

.sfcd-switch input:checked + .sfcd-switch__track {
	background: var(--sfe-accent-2);
}

.sfcd-switch input:checked + .sfcd-switch__track::after {
	transform: translateX(18px);
}

.sfcd-switch input:focus-visible + .sfcd-switch__track {
	box-shadow: var(--sfe-ring);
}

/* Component buttons: the CORE .sfcd-btn atoms, a touch taller. */
:where(.sfcd-fl, .sfcd-ct, .sfcd-state) .sfcd-btn {
	min-height: 44px;
	font-family: var(--sfe-f-ui);
}

:where(.sfcd-fl, .sfcd-ct) .sfcd-btn--danger {
	--sfcd-btn-fg: var(--sfe-accent-strong);
}

/* Large empty state (favorites, compare). */
.sfcd-state {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
	max-width: 560px;
	margin: 0 auto;
	padding: clamp(32px, 6vw, 64px) 24px;
	text-align: center;
}

.sfcd-state[hidden] {
	display: none;
}

.sfcd-state .sfcd-state__title {
	margin: 10px 0 0;
	color: var(--sfe-ink);
	font: 800 clamp(24px, 3vw, 34px)/1.1 var(--sfe-f-display);
	letter-spacing: -0.015em;
	text-transform: none;
}

.sfcd-state .sfcd-state__text {
	margin: 0 0 12px;
	max-width: 46ch;
	color: var(--sfe-muted);
	font: 400 16px/1.6 var(--sfe-f-body);
}

.sfcd-ill {
	width: 180px;
	height: auto;
	overflow: visible;
}

.sfcd-ill__shadow {
	fill: var(--sfe-line);
}

.sfcd-ill__car {
	fill: var(--sfe-panel);
	stroke: var(--sfe-ink);
	stroke-width: 3;
	stroke-linejoin: round;
}

.sfcd-ill__glass {
	fill: var(--sfe-turf);
	stroke: var(--sfe-line);
	stroke-width: 1.5;
	stroke-linejoin: round;
}

.sfcd-ill__line {
	fill: none;
	stroke: var(--sfe-line);
	stroke-width: 2;
}

.sfcd-ill__lamp {
	fill: none;
	stroke: var(--sfe-accent);
	stroke-width: 3.5;
	stroke-linecap: round;
}

.sfcd-ill__tyre {
	fill: var(--sfe-ink);
}

.sfcd-ill__hub {
	fill: var(--sfe-panel-2);
}

.sfcd-ill__badge {
	fill: var(--sfe-accent-strong);
}

.sfcd-ill__badge-ink {
	fill: var(--sfe-on-fill);
	stroke: none;
}

.sfcd-ill__badge-ink--line {
	fill: none;
	stroke: var(--sfe-on-fill);
	stroke-width: 2.6;
	stroke-linecap: round;
	stroke-linejoin: round;
}

@media (prefers-reduced-motion: no-preference) {
	.sfcd-state:not([hidden]) .sfcd-ill__badge,
	.sfcd-state:not([hidden]) .sfcd-ill__badge-ink {
		transform-box: fill-box;
		transform-origin: center;
		animation: sfcd-pop 2.8s var(--sfe-ease) infinite;
	}
}

@keyframes sfcd-pop {
	0%,
	70%,
	100% {
		transform: scale(1);
	}

	80% {
		transform: scale(1.12);
	}
}

/* In-page toast (undo / copied). */
.sfcd-toast {
	position: fixed;
	left: 50%;
	bottom: max(20px, env(safe-area-inset-bottom));
	z-index: 9990;
	display: inline-flex;
	align-items: center;
	gap: 14px;
	max-width: calc(100vw - 32px);
	padding: 12px 14px 12px 18px;
	border-radius: 14px;
	background: var(--sfe-ink);
	color: var(--sfe-base);
	box-shadow: var(--sfe-shadow-4);
	font: 600 14px/1.35 var(--sfe-f-ui);
	transform: translateX(-50%);
	width: max-content;
}

.sfcd-toast[hidden] {
	display: none;
}

@media (prefers-reduced-motion: no-preference) {
	.sfcd-toast {
		animation: sfcd-toast-in 0.25s var(--sfe-ease);
	}
}

.sfcd-toast button {
	min-height: 32px;
	padding: 6px 12px;
	border: 0;
	border-radius: 8px;
	background: color-mix(in srgb, var(--sfe-base) 18%, transparent);
	color: inherit;
	font: 800 13px/1 var(--sfe-f-ui);
	cursor: pointer;
}

.sfcd-toast button:focus-visible {
	outline: 2px solid var(--sfe-base);
	outline-offset: 2px;
}

body.has-sfcd-tray .sfcd-toast {
	bottom: calc(max(20px, env(safe-area-inset-bottom)) + 84px);
}

/* "Copy this link" fallback when the clipboard is unavailable. */
.sfcd-toast__copy {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 10px;
	font: 700 13px/1.3 var(--sfe-f-ui);
}

.sfcd-toast__copy input {
	width: min(420px, calc(100vw - 80px));
	min-height: 36px;
	padding: 0 10px;
	border: 0;
	border-radius: 8px;
	background: color-mix(in srgb, var(--sfe-base) 16%, transparent);
	color: inherit;
	font: 500 13px/1 var(--sfe-f-ui);
}

@keyframes sfcd-toast-in {
	from {
		opacity: 0;
		transform: translate(-50%, 12px);
	}
}

/* Built-in fallback toast (favorites.js, when window.sfcdToast is absent). */
.sfcd-toast-lite {
	position: fixed;
	left: 50%;
	bottom: max(20px, env(safe-area-inset-bottom));
	z-index: 9995;
	display: flex;
	align-items: center;
	gap: 14px;
	max-width: calc(100vw - 32px);
	padding: 12px 16px;
	border-radius: 14px;
	background: var(--sfe-ink);
	color: var(--sfe-base);
	box-shadow: var(--sfe-shadow-4);
	font: 600 14px/1.35 var(--sfe-f-ui);
	width: max-content;
	opacity: 0;
	pointer-events: none;
	transform: translate(-50%, 16px);
	transition: opacity 0.25s ease, transform 0.3s var(--sfe-ease);
}

.sfcd-toast-lite.is-visible {
	opacity: 1;
	pointer-events: auto;
	transform: translate(-50%, 0);
}

.sfcd-toast-lite a.sfcd-toast-lite__action,
.sfcd-toast-lite a.sfcd-toast-lite__action:visited {
	color: inherit;
	font-weight: 800;
	text-decoration: underline;
	text-underline-offset: 3px;
	white-space: nowrap;
}

body.has-sfcd-tray .sfcd-toast-lite {
	bottom: calc(max(20px, env(safe-area-inset-bottom)) + 84px);
}

/* Skeleton fallback (card.php normally provides its own skeleton card). */
.sfcd-skel {
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding-bottom: 12px;
}

.sfcd-skel__img,
.sfcd-skel__line {
	display: block;
	border-radius: 12px;
	background: linear-gradient(90deg, var(--sfe-panel-2, #e6e8ec) 0%, var(--sfe-panel, #fff) 50%, var(--sfe-panel-2, #e6e8ec) 100%);
	background-size: 200% 100%;
}

.sfcd-skel__img {
	aspect-ratio: 4 / 3;
	border-radius: var(--sfe-r-card, 16px);
}

.sfcd-skel__line {
	height: 14px;
	width: 80%;
}

.sfcd-skel__line.is-short {
	width: 50%;
}

@media (prefers-reduced-motion: no-preference) {
	.sfcd-skel__img,
	.sfcd-skel__line {
		animation: sfcd-shimmer 1.4s linear infinite;
	}
}

@keyframes sfcd-shimmer {
	to {
		background-position: -200% 0;
	}
}

/* ======================================================================
   2. FAVORITES LIST
   ====================================================================== */

.sfcd-fl__toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px 18px;
	margin-bottom: clamp(18px, 2.4vw, 28px);
}

.sfcd-fl__toolbar[hidden],
.sfcd-fl__shared[hidden],
.sfcd-fl__loading[hidden],
.sfcd-fl__grid[hidden] {
	display: none;
}

.sfcd-fl__count {
	margin: 0;
	color: var(--sfe-ink);
	font: 700 16px/1.3 var(--sfe-f-ui);
}

.sfcd-fl__count strong {
	font-family: var(--sfe-f-num);
	font-weight: 800;
	font-variant-numeric: tabular-nums;
}

.sfcd-fl__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
}

.sfcd-fl__sort {
	min-width: 210px;
}

.sfcd-fl__shared {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 20px;
	padding: 14px 18px;
	border: 1px solid color-mix(in srgb, var(--sfe-accent-2) 30%, transparent);
	border-radius: var(--sfe-r-card);
	background: color-mix(in srgb, var(--sfe-turf) 70%, var(--sfe-panel));
}

.sfcd-fl__shared p {
	margin: 0;
	font: 700 15px/1.4 var(--sfe-f-ui);
}

/* Card grid: 1 → 2 → N columns (data value --sfcd-cols). */
.sfcd-fl__grid,
.sfcd-fl__loading {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: var(--sfe-gap);
	align-items: stretch;
}

.sfcd-fl__grid > *,
.sfcd-fl__loading > * {
	min-width: 0;
}

@media (min-width: 600px) {
	.sfcd-fl__grid:not([style*="--sfcd-cols:1"]),
	.sfcd-fl__loading:not([style*="--sfcd-cols:1"]) {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (min-width: 1025px) {
	.sfcd-fl__grid,
	.sfcd-fl__loading {
		grid-template-columns: repeat(var(--sfcd-cols, 3), minmax(0, 1fr));
	}
}

.sfcd-fl__grid > .is-leaving {
	opacity: 0;
	transform: scale(0.96);
	transition: opacity 0.25s ease, transform 0.25s ease;
}

/* ======================================================================
   3. COMPARE TABLE
   ====================================================================== */

.sfcd-ct__toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px 18px;
	margin-bottom: 18px;
}

.sfcd-ct__toolbar[hidden],
.sfcd-ct__hint[hidden],
.sfcd-ct__loading[hidden],
.sfcd-ct__toolbar [hidden] {
	display: none;
}

.sfcd-ct__count {
	margin: 0;
	color: var(--sfe-ink);
	font: 700 16px/1.3 var(--sfe-f-ui);
}

.sfcd-ct__count strong {
	font-family: var(--sfe-f-num);
	font-weight: 800;
	font-variant-numeric: tabular-nums;
}

.sfcd-ct__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 14px;
}

.sfcd-ct__hint {
	margin: 0 0 16px;
	padding: 12px 16px;
	border-radius: 12px;
	background: color-mix(in srgb, var(--sfe-turf) 70%, var(--sfe-panel));
	color: var(--sfe-ink);
	font: 600 14px/1.45 var(--sfe-f-ui);
}

.sfcd-ct__loading {
	display: grid;
	gap: 12px;
	padding: 24px 0;
}

.sfcd-ct__body {
	position: relative;
	max-width: 100%;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior-x: contain;
	border: 1px solid var(--sfe-line);
	border-radius: calc(var(--sfe-r-card) + 4px);
	background: var(--sfe-panel);
	box-shadow: var(--sfe-shadow-1);
}

.sfcd-ct__body:empty {
	display: none;
}

.sfcd-ct__body:focus-visible {
	outline: 2px solid var(--sfe-accent-2);
	outline-offset: 2px;
}

.sfcd-ct__table {
	width: 100%;
	min-width: calc(150px + var(--sfcd-n, 3) * 220px);
	border-collapse: separate;
	border-spacing: 0;
	table-layout: fixed;
	color: var(--sfe-ink);
	font: 500 15px/1.45 var(--sfe-f-ui);
}

.sfcd-ct__table col.sfcd-ct__labels {
	width: 150px;
}

@media (min-width: 769px) {
	.sfcd-ct__table {
		min-width: calc(190px + var(--sfcd-n, 3) * 240px);
	}

	.sfcd-ct__table col.sfcd-ct__labels {
		width: 190px;
	}
}

.sfcd-ct__table th,
.sfcd-ct__table td {
	padding: 14px 16px;
	border-top: 1px solid var(--sfe-line);
	text-align: left;
	vertical-align: top;
}

.sfcd-ct__table thead th,
.sfcd-ct__table thead td {
	border-top: 0;
	vertical-align: top;
}

@media (max-width: 768px) {
	.sfcd-ct__table {
		min-width: calc(112px + var(--sfcd-n, 3) * 190px);
		font-size: 14px;
	}

	.sfcd-ct__table col.sfcd-ct__labels {
		width: 112px;
	}

	.sfcd-ct__table th,
	.sfcd-ct__table td {
		padding: 12px;
	}

	.sfcd-ct__table th[scope="row"] {
		font-size: 11px;
		letter-spacing: 0.04em;
	}

	.sfcd-ct__price {
		font-size: 20px;
	}
}

/* Sticky label column. */
.sfcd-ct__table th[scope="row"] {
	position: sticky;
	left: 0;
	z-index: 2;
	background: var(--sfe-panel);
	color: var(--sfe-muted);
	font: 700 12px/1.35 var(--sfe-f-ui);
	letter-spacing: 0.06em;
	text-transform: uppercase;
	box-shadow: 1px 0 0 var(--sfe-line);
}

.sfcd-ct__table thead th.sfcd-ct__corner {
	position: sticky;
	left: 0;
	z-index: 3;
	background: var(--sfe-panel);
	box-shadow: 1px 0 0 var(--sfe-line);
}

.sfcd-ct__table thead th.sfcd-ct__col {
	border-top: 3px solid transparent;
	font-weight: 500;
	letter-spacing: normal;
	text-transform: none;
}

.sfcd-ct__table thead th.sfcd-ct__col.is-top {
	border-top-color: var(--sfe-neon);
}

/* Group headings. */
.sfcd-ct__group th {
	padding-top: 22px;
	padding-bottom: 10px;
	background: var(--sfe-panel-2);
	color: var(--sfe-ink);
	font: 800 12px/1 var(--sfe-f-ui);
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

.sfcd-ct__group--2 th {
	padding-top: 14px;
	padding-bottom: 8px;
	background: color-mix(in srgb, var(--sfe-panel-2) 55%, var(--sfe-panel));
	color: var(--sfe-muted);
	font-size: 11px;
	letter-spacing: 0.1em;
}

/* The group label stays in view while the cars scroll sideways. */
.sfcd-ct__gl {
	position: sticky;
	left: 16px;
	display: inline-block;
}

@media (max-width: 768px) {
	.sfcd-ct__gl {
		left: 12px;
	}
}

/* Car header cells. */
.sfcd-ct__home {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.sfcd-ct__photo {
	position: relative;
	display: block;
	overflow: hidden;
	aspect-ratio: 4 / 3;
	border-radius: 12px;
	background: var(--sfe-panel-2);
}

.sfcd-ct__photo img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.sfcd-ct__status {
	position: absolute;
	left: 8px;
	bottom: 8px;
	padding: 4px 10px;
	border-radius: 999px;
	background: var(--sfe-ink);
	color: var(--sfe-base);
	font: 800 11px/1.2 var(--sfe-f-ui);
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.sfcd-ct__remove,
.sfcd-ct__save {
	position: absolute;
	top: 8px;
	z-index: 2;
	display: grid;
	place-items: center;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--sfe-glass);
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
	color: var(--sfe-ink);
	box-shadow: var(--sfe-shadow-1);
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.sfcd-ct__remove {
	right: 8px;
}

.sfcd-ct__save {
	right: 52px;
}

.sfcd-ct__save svg {
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linejoin: round;
}

.sfcd-ct__save[aria-pressed="true"] {
	color: var(--sfe-accent-strong);
}

.sfcd-ct__save[aria-pressed="true"] svg {
	fill: currentColor;
}

.sfcd-ct__remove:hover {
	background: var(--sfe-accent-strong);
	color: var(--sfe-on-fill);
}

.sfcd-ct__remove:focus-visible,
.sfcd-ct__save:focus-visible {
	outline: 2px solid var(--sfe-accent-2);
	outline-offset: 2px;
}

/* h2 under the page H1 (compare.js picks the level): theme / kit heading
 * rules must not restyle it. */
.sfcd-ct .sfcd-ct__title {
	margin: 0;
	color: var(--sfe-ink);
	font: 800 16px/1.25 var(--sfe-f-display);
	letter-spacing: -0.005em;
	text-transform: none;
}

.sfcd-ct__title a {
	color: var(--sfe-ink);
	text-decoration: none;
}

.sfcd-ct__title a:hover {
	color: var(--sfe-accent-strong);
	text-decoration: underline;
	text-underline-offset: 3px;
}

.sfcd-ct__price {
	margin: 4px 0 0;
	color: var(--sfe-ink);
	font: 800 22px/1.1 var(--sfe-f-num);
	font-variant-numeric: tabular-nums;
}

.sfcd-ct__pay {
	margin: 0;
	color: var(--sfe-muted);
	font: 600 13px/1.3 var(--sfe-f-ui);
	font-variant-numeric: tabular-nums;
}

.sfcd-ct__sub {
	margin: 0;
	color: var(--sfe-muted);
	font: 600 13px/1.3 var(--sfe-f-ui);
}

.sfcd-ct__wins {
	margin: 2px 0 0;
	color: var(--sfe-muted);
	font: 600 12px/1.3 var(--sfe-f-ui);
}

.sfcd-ct__wins.is-top strong {
	color: var(--sfe-neon);
	font-weight: 800;
}

.sfcd-ct a.sfcd-ct__cta,
.sfcd-ct a.sfcd-ct__cta:visited {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	align-self: flex-start;
	min-height: 40px;
	margin-top: 4px;
	padding: 0 16px;
	border: 1px solid var(--sfe-line);
	border-radius: var(--sfe-r-btn);
	background: var(--sfe-panel);
	color: var(--sfe-ink);
	font: 700 14px/1 var(--sfe-f-ui);
	text-decoration: none;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}

.sfcd-ct a.sfcd-ct__cta:hover {
	background: var(--sfe-panel-2);
	border-color: color-mix(in srgb, var(--sfe-ink) 30%, transparent);
}

.sfcd-ct a.sfcd-ct__cta:focus-visible {
	outline: 2px solid var(--sfe-accent-2);
	outline-offset: 2px;
}

/* Cells. */
.sfcd-ct__table td.is-num {
	font-family: var(--sfe-f-num);
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

.sfcd-ct__table td.is-strong {
	font-size: 1.1em;
	font-weight: 800;
}

.sfcd-ct__table td.is-feat {
	padding-top: 10px;
	padding-bottom: 10px;
}

.sfcd-ct__table td.is-best {
	background: color-mix(in srgb, var(--sfe-neon) 11%, var(--sfe-panel));
	box-shadow: inset 3px 0 0 var(--sfe-neon);
}

.sfcd-ct__best {
	display: inline-flex;
	align-items: center;
	margin-left: 8px;
	padding: 3px 8px;
	border-radius: 999px;
	background: var(--sfe-neon);
	color: var(--sfe-on-fill);
	font: 800 10px/1.2 var(--sfe-f-ui);
	letter-spacing: 0.08em;
	text-transform: uppercase;
	vertical-align: 2px;
}

.sfcd-ct__yes {
	color: var(--sfe-neon);
}

.sfcd-ct__no {
	color: color-mix(in srgb, var(--sfe-muted) 65%, transparent);
}

.sfcd-ct__dash {
	color: var(--sfe-muted);
}

.sfcd-ct__mono {
	font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
	font-size: 0.86em;
	letter-spacing: 0.02em;
	word-break: break-all;
}

/* Deal rating: label + dot (never colour alone). */
.sfcd-ct__deal {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	font-weight: 800;
}

.sfcd-ct__deal::before {
	content: "";
	flex: none;
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: var(--sfe-muted);
}

.sfcd-ct__deal--great::before {
	background: var(--sfe-neon);
}

.sfcd-ct__deal--good::before {
	background: var(--sfe-accent-2);
}

.sfcd-ct__deal--fair::before {
	background: var(--sfe-gold);
}

.sfcd-ct__deal--high::before {
	background: var(--sfe-accent);
}

.sfcd-ct__dealpct {
	display: block;
	margin-top: 2px;
	color: var(--sfe-muted);
	font: 600 12px/1.3 var(--sfe-f-ui);
}

/* Differences only. */
.sfcd-ct.is-diff-only tr.is-same,
.sfcd-ct.is-diff-only tr.is-all-same {
	display: none;
}

/* Phones: the switch gets its own row; share and print shrink to icons. */
@media (max-width: 600px) {
	.sfcd-ct__actions {
		gap: 8px;
	}

	.sfcd-ct__actions .sfcd-switch {
		flex: 1 0 100%;
	}

	.sfcd-ct__actions .sfcd-btn {
		padding-inline: 12px;
	}

	.sfcd-ct__actions [data-sfcd-ct-share],
	.sfcd-ct__actions [data-sfcd-ct-print] {
		width: 44px;
		padding: 0;
	}

	.sfcd-ct__actions [data-sfcd-ct-share] > span,
	.sfcd-ct__actions [data-sfcd-ct-print] > span {
		position: absolute;
		width: 1px;
		height: 1px;
		margin: -1px;
		overflow: hidden;
		clip: rect(0, 0, 0, 0);
		white-space: nowrap;
	}

	.sfcd-fl__sort {
		flex: 1 0 100%;
	}

	.sfcd-fl__actions {
		width: 100%;
	}
}

/* ======================================================================
   4. RECENTLY VIEWED
   ====================================================================== */

.sfcd-rv__head {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 8px 16px;
	margin-bottom: clamp(14px, 2vw, 22px);
}

.sfcd-rv .sfcd-rv__title {
	margin: 0;
	color: var(--sfe-ink);
	font: 800 clamp(22px, 2.4vw, 30px)/1.1 var(--sfe-f-display);
	letter-spacing: -0.015em;
	text-transform: none;
}

.sfcd-rv__clear {
	min-height: 36px;
	padding: 0 12px;
	border: 0;
	border-radius: 999px;
	background: transparent;
	color: var(--sfe-muted);
	font: 700 13px/1 var(--sfe-f-ui);
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
}

.sfcd-rv__clear:hover {
	color: var(--sfe-ink);
}

.sfcd-rv__clear:focus-visible {
	outline: 2px solid var(--sfe-accent-2);
	outline-offset: 2px;
}

.sfcd-rv .sfcd-rv__clear[hidden],
.sfcd-rv .sfcd-rv__loading[hidden],
.sfcd-rv .sfcd-rv__list[hidden],
.sfcd-rv .sfcd-rv__empty[hidden] {
	display: none;
}

.sfcd-rv__empty {
	margin: 0;
	padding: 20px 22px;
	border: 1px dashed var(--sfe-line);
	border-radius: var(--sfe-r-card);
	color: var(--sfe-muted);
	font: 500 15px/1.5 var(--sfe-f-ui);
}

/* Rail (default): scroll-snap, the next card peeks. */
.sfcd-rv--rail .sfcd-rv__list {
	display: flex;
	gap: var(--sfe-gap);
	margin: 0 calc(var(--sfe-gap) * -0.5);
	padding: 4px calc(var(--sfe-gap) * 0.5) 14px;
	overflow-x: auto;
	scroll-snap-type: x proximity;
	scroll-padding-inline: calc(var(--sfe-gap) * 0.5);
	overscroll-behavior-x: contain;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: thin;
}

.sfcd-rv--rail .sfcd-rv__list > * {
	flex: 0 0 min(82%, 320px);
	min-width: 0;
	scroll-snap-align: start;
}

@media (min-width: 769px) {
	.sfcd-rv--rail .sfcd-rv__list > * {
		flex-basis: calc((100% - (var(--sfcd-per-view, 3) - 1) * var(--sfe-gap)) / var(--sfcd-per-view, 3));
		min-width: 240px;
	}
}

/* Grid. */
.sfcd-rv--grid .sfcd-rv__list {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: var(--sfe-gap);
}

.sfcd-rv--grid .sfcd-rv__list > * {
	min-width: 0;
}

@media (min-width: 600px) {
	.sfcd-rv--grid .sfcd-rv__list {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (min-width: 1025px) {
	.sfcd-rv--grid .sfcd-rv__list {
		grid-template-columns: repeat(var(--sfcd-cols, 3), minmax(0, 1fr));
	}
}

.sfcd-rv__loading.sfcd-rv__list {
	pointer-events: none;
}

/* ======================================================================
   5. SAVED SEARCHES (built by favorites.js)
   ====================================================================== */

.sfcd-sv {
	margin: 0 0 32px;
	padding: 20px 22px;
	border: 1px solid var(--sfe-line);
	border-radius: var(--sfe-r-card);
	background: var(--sfe-panel);
	box-shadow: var(--sfe-shadow-1);
}

.sfcd-fl .sfcd-sv.is-empty {
	margin: 32px 0 0;
}

.sfcd-sv:focus {
	outline: none;
}

.sfcd-sv:focus-visible {
	outline: 2px solid var(--sfe-accent-2);
	outline-offset: 2px;
}

.sfcd-sv__head {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 14px;
}

.sfcd-sv.is-empty .sfcd-sv__head {
	margin-bottom: 6px;
}

.sfcd-sv .sfcd-sv__title {
	margin: 0;
	color: var(--sfe-ink);
	font: 800 clamp(18px, 2vw, 22px)/1.2 var(--sfe-f-display);
	letter-spacing: -0.01em;
	text-transform: none;
}

.sfcd-sv__count {
	display: inline-grid;
	place-items: center;
	min-width: 24px;
	height: 24px;
	padding: 0 8px;
	border-radius: 999px;
	background: var(--sfe-ink);
	color: var(--sfe-base);
	font: 800 12px/1 var(--sfe-f-num);
	font-variant-numeric: tabular-nums;
}

.sfcd-sv__empty {
	margin: 0;
	color: var(--sfe-muted);
	font: 500 15px/1.55 var(--sfe-f-ui);
}

.sfcd-sv a.sfcd-sv__cta,
.sfcd-sv a.sfcd-sv__cta:visited {
	color: var(--sfe-accent-strong);
	font-weight: 700;
	text-decoration: underline;
	text-underline-offset: 3px;
}

.sfcd-sv__list {
	display: grid;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.sfcd-sv__item {
	position: relative;
	display: grid;
	grid-template-columns: auto minmax(0, 1fr) auto auto;
	align-items: center;
	gap: 6px 12px;
	padding: 10px 10px 10px 12px;
	border: 1px solid var(--sfe-line);
	border-radius: 14px;
	background: var(--sfe-panel);
	transition: border-color 0.15s ease, background-color 0.15s ease;
}

@media (hover: hover) {
	.sfcd-sv__item:hover {
		border-color: color-mix(in srgb, var(--sfe-ink) 28%, transparent);
		background: color-mix(in srgb, var(--sfe-panel-2) 50%, var(--sfe-panel));
	}
}

.sfcd-sv__icon {
	display: grid;
	place-items: center;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: color-mix(in srgb, var(--sfe-accent) 14%, transparent);
	color: var(--sfe-accent-strong);
}

.sfcd-sv__text {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.sfcd-sv a.sfcd-sv__link,
.sfcd-sv a.sfcd-sv__link:visited {
	overflow: hidden;
	color: var(--sfe-ink);
	font: 700 15px/1.3 var(--sfe-f-ui);
	text-decoration: none;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.sfcd-sv a.sfcd-sv__link:hover {
	color: var(--sfe-accent-strong);
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* Whole row is the primary link. */
.sfcd-sv a.sfcd-sv__link::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
	border-radius: 14px;
}

.sfcd-sv a.sfcd-sv__link:focus-visible {
	outline: none;
}

.sfcd-sv a.sfcd-sv__link:focus-visible::after {
	outline: 2px solid var(--sfe-accent-2);
	outline-offset: 2px;
}

.sfcd-sv__meta {
	overflow: hidden;
	color: var(--sfe-muted);
	font: 600 12.5px/1.3 var(--sfe-f-ui);
	text-overflow: ellipsis;
	white-space: nowrap;
}

.sfcd-sv a.sfcd-sv__run,
.sfcd-sv a.sfcd-sv__run:visited {
	position: relative;
	z-index: 2;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-height: 36px;
	padding: 0 14px;
	border-radius: 999px;
	background: var(--sfe-panel-2);
	color: var(--sfe-ink);
	font: 700 13px/1 var(--sfe-f-ui);
	text-decoration: none;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.sfcd-sv a.sfcd-sv__run:hover {
	background: var(--sfe-accent-strong);
	color: var(--sfe-on-fill);
}

.sfcd-sv a.sfcd-sv__run:focus-visible {
	outline: 2px solid var(--sfe-accent-2);
	outline-offset: 2px;
}

.sfcd-sv__remove {
	position: relative;
	z-index: 2;
	display: grid;
	place-items: center;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--sfe-muted);
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.sfcd-sv__remove:hover {
	background: color-mix(in srgb, var(--sfe-accent) 14%, transparent);
	color: var(--sfe-accent-strong);
}

.sfcd-sv__remove:focus-visible {
	outline: 2px solid var(--sfe-accent-2);
	outline-offset: 2px;
}

@media (max-width: 560px) {
	.sfcd-sv {
		padding: 16px;
	}

	.sfcd-sv__item {
		grid-template-columns: auto minmax(0, 1fr) auto;
	}

	.sfcd-sv a.sfcd-sv__run {
		display: none;
	}
}

/* ======================================================================
   6. HEADER PILLS (saved-link, compare-link)
   ====================================================================== */

.sfcd-pill-wrap {
	display: inline-flex;
}

.sfcd-pill-wrap .sfcd-pill {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	height: 40px;
	padding: 0 14px 0 12px;
	border: 1px solid var(--sfe-line);
	border-radius: 999px;
	background: transparent;
	color: var(--sfe-ink);
	font: 600 14.5px/1 var(--sfe-f-ui);
	text-decoration: none;
	white-space: nowrap;
	transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.sfcd-pill-wrap .sfcd-pill:hover,
.sfcd-pill-wrap .sfcd-pill:visited:hover {
	background: color-mix(in srgb, var(--sfe-ink) 6%, transparent);
	border-color: color-mix(in srgb, var(--sfe-ink) 28%, transparent);
	color: var(--sfe-ink);
	text-decoration: none;
}

.sfcd-pill-wrap .sfcd-pill:visited {
	color: var(--sfe-ink);
}

.sfcd-pill-wrap .sfcd-pill:focus-visible {
	outline: 2px solid var(--sfe-accent-2);
	outline-offset: 2px;
}

.sfcd-pill__icon {
	position: relative;
	display: inline-flex;
	line-height: 0;
}

.sfcd-pill__icon svg {
	transition: fill 0.2s ease, stroke 0.2s ease;
}

.sfcd-pill .sfcd-pill__count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 20px;
	height: 20px;
	margin-right: -4px;
	padding: 0 6px;
	border-radius: 999px;
	background: var(--sfe-accent-strong);
	color: var(--sfe-on-fill);
	font: 800 11px/1 var(--sfe-f-num);
	font-feature-settings: "tnum" 1, "lnum" 1;
}

.sfcd-pill .sfcd-pill__count[hidden] {
	display: none;
}

/* Saved: the heart stays an outline with a light ember wash. */
.sfcd-pill--saved.has-items .sfcd-pill__icon svg {
	fill: color-mix(in srgb, var(--sfe-accent) 18%, transparent);
	stroke: var(--sfe-accent);
}

/* Compare: cobalt count, cobalt icon once cars are queued. */
.sfcd-pill--compare .sfcd-pill__count {
	background: var(--sfe-accent-2);
}

.sfcd-pill--compare.has-items .sfcd-pill__icon svg {
	stroke: var(--sfe-accent-2);
}

.sfcd-pill--compare.has-items {
	border-color: color-mix(in srgb, var(--sfe-accent-2) 40%, var(--sfe-line));
}

/* Icon only: a round button, the count pinned to its corner. */
.sfcd-pill-wrap.is-icon .sfcd-pill {
	width: 40px;
	padding: 0;
	justify-content: center;
}

.sfcd-pill-wrap.is-icon .sfcd-pill .sfcd-pill__count {
	position: absolute;
	top: -4px;
	right: -4px;
	min-width: 18px;
	height: 18px;
	margin: 0;
	padding: 0 5px;
	font-size: 10px;
	box-shadow: 0 0 0 2px var(--wp--preset--color--glass, var(--sfe-panel));
}

@media (prefers-reduced-motion: no-preference) {
	.sfcd-pill .sfcd-pill__count.is-bump {
		animation: sfcd-bump 0.45s var(--sfe-ease);
	}
}

@keyframes sfcd-bump {
	0% {
		transform: scale(1);
	}

	40% {
		transform: scale(1.45);
	}

	100% {
		transform: scale(1);
	}
}

/* ======================================================================
   7. COMPARE TRAY (built by compare.js on every page)
   ====================================================================== */

body.has-sfcd-tray {
	padding-bottom: 96px;
}

.sfcd-tray {
	position: fixed;
	left: 50%;
	bottom: max(16px, env(safe-area-inset-bottom));
	z-index: 9990;
	display: flex;
	align-items: center;
	gap: 16px;
	width: max-content;
	max-width: calc(100vw - 24px);
	padding: 10px 12px 10px 16px;
	border: 1px solid var(--sfe-edge);
	border-radius: 20px;
	background: var(--sfe-glass-2);
	-webkit-backdrop-filter: blur(18px) saturate(1.5);
	backdrop-filter: blur(18px) saturate(1.5);
	color: var(--sfe-ink);
	box-shadow: var(--sfe-shadow-4);
	font-family: var(--sfe-f-ui);
	opacity: 0;
	pointer-events: none;
	transform: translate(-50%, 140%);
	transition: transform 0.4s var(--sfe-ease), opacity 0.25s ease;
}

.sfcd-tray.is-visible {
	opacity: 1;
	pointer-events: auto;
	transform: translate(-50%, 0);
}

.sfcd-tray[hidden] {
	display: none;
}

.sfcd-tray__list {
	display: flex;
	gap: 10px;
	margin: 0;
	padding: 6px 6px 0 0;
	list-style: none;
}

.sfcd-tray__item {
	position: relative;
}

.sfcd-tray__thumb {
	display: block;
	width: 58px;
	height: 44px;
	overflow: hidden;
	border-radius: 10px;
	background: var(--sfe-panel-2);
	box-shadow: 0 0 0 2px var(--sfe-panel);
}

.sfcd-tray__thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.sfcd-tray__item.is-empty .sfcd-tray__thumb {
	border: 1.5px dashed color-mix(in srgb, var(--sfe-ink) 28%, transparent);
	background: transparent;
	box-shadow: none;
}

.sfcd-tray__x {
	position: absolute;
	top: -6px;
	right: -6px;
	display: grid;
	place-items: center;
	width: 24px;
	height: 24px;
	padding: 0;
	border: 2px solid var(--sfe-panel);
	border-radius: 50%;
	background: var(--sfe-ink);
	color: var(--sfe-base);
	cursor: pointer;
	transition: background-color 0.15s ease, transform 0.15s ease;
}

.sfcd-tray__x svg {
	width: 11px;
	height: 11px;
}

.sfcd-tray__x:hover {
	background: var(--sfe-accent-strong);
	color: var(--sfe-on-fill);
}

.sfcd-tray__x:focus-visible {
	outline: 2px solid var(--sfe-accent-2);
	outline-offset: 2px;
}

.sfcd-tray__text {
	margin: 0;
	font: 700 14px/1.2 var(--sfe-f-ui);
	white-space: nowrap;
}

.sfcd-tray__actions {
	display: flex;
	align-items: center;
	gap: 6px;
}

.sfcd-tray__clear,
.sfcd-tray a.sfcd-tray__go,
.sfcd-tray a.sfcd-tray__go:visited {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	padding: 0 16px;
	border: 0;
	border-radius: 14px;
	font: 700 14px/1 var(--sfe-f-ui);
	cursor: pointer;
	text-decoration: none;
	white-space: nowrap;
}

.sfcd-tray__clear {
	background: transparent;
	color: var(--sfe-muted);
}

.sfcd-tray__clear:hover {
	color: var(--sfe-ink);
}

.sfcd-tray a.sfcd-tray__go {
	background: var(--sfe-accent-strong);
	color: var(--sfe-on-fill);
	transition: filter 0.15s ease;
}

.sfcd-tray a.sfcd-tray__go:hover {
	filter: brightness(1.08);
}

.sfcd-tray a.sfcd-tray__go.is-disabled {
	opacity: 0.45;
	pointer-events: none;
}

.sfcd-tray__clear:focus-visible,
.sfcd-tray a.sfcd-tray__go:focus-visible {
	outline: 2px solid var(--sfe-accent-2);
	outline-offset: 2px;
}

@media (max-width: 600px) {
	body.has-sfcd-tray {
		padding-bottom: 88px;
	}

	.sfcd-tray {
		left: 12px;
		right: 12px;
		justify-content: space-between;
		gap: 10px;
		width: auto;
		max-width: none;
		padding: 8px 8px 8px 12px;
		transform: translateY(140%);
	}

	.sfcd-tray.is-visible {
		transform: none;
	}

	.sfcd-tray__thumb {
		width: 46px;
		height: 36px;
	}

	.sfcd-tray__list {
		gap: 8px;
	}

	/* The count stays in the live region for assistive tech. */
	.sfcd-tray__text {
		position: absolute;
		width: 1px;
		height: 1px;
		margin: -1px;
		overflow: hidden;
		clip: rect(0, 0, 0, 0);
		white-space: nowrap;
	}

	.sfcd-tray__clear {
		padding: 0 10px;
	}

	.sfcd-tray__item.is-empty {
		display: none;
	}
}

/* Small phones: the remove buttons on the thumbnails are enough. */
@media (max-width: 440px) {
	.sfcd-tray__clear {
		display: none;
	}

	.sfcd-tray__thumb {
		width: 42px;
		height: 34px;
	}
}

/* The vehicle page's mobile action bar sits at the very bottom: lift the tray. */
@media (max-width: 768px) {
	body:has(.sfcd-sticky-bar) .sfcd-tray {
		bottom: calc(max(16px, env(safe-area-inset-bottom)) + 76px);
	}

	body:has(.sfcd-sticky-bar).has-sfcd-tray {
		padding-bottom: 160px;
	}
}

/* ======================================================================
   8. DEALER CARD + DEALERS GRID
   ====================================================================== */

/* The dealer-card BLOCK root stays a neutral box; the card is .sfcd-dc. */
.sfcd-dealer-card:not([data-sfcd-dealer]) {
	display: block;
	max-width: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
}

.sfcd-dc {
	position: relative;
	display: flex;
	flex-direction: column;
	min-width: 0;
	border: 1px solid var(--sfe-line);
	border-radius: var(--sfe-r-card);
	background: var(--sfe-panel);
	color: var(--sfe-ink);
	box-shadow: var(--sfe-shadow-1);
	font-family: var(--sfe-f-ui);
	transition: box-shadow 0.25s ease, transform 0.25s var(--sfe-ease), border-color 0.25s ease;
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
	.sfcd-dc:hover {
		border-color: color-mix(in srgb, var(--sfe-ink) 22%, transparent);
		box-shadow: var(--sfe-shadow-3);
		transform: translateY(-3px);
	}

	.sfcd-dc:hover .sfcd-dc__img {
		transform: scale(1.04);
	}
}

.sfcd-dc__media {
	position: relative;
	flex: none;
}

.sfcd-dc__photo {
	position: relative;
	display: block;
	overflow: hidden;
	aspect-ratio: 16 / 10;
	border-radius: calc(var(--sfe-r-card) - 1px) calc(var(--sfe-r-card) - 1px) 0 0;
	background: var(--sfe-panel-2);
}

.sfcd-dc__img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.6s var(--sfe-ease);
}

.sfcd-dc__photo--blank {
	display: grid;
	place-items: center;
	background: var(--wp--preset--gradient--dusk, linear-gradient(180deg, var(--sfe-navy), var(--sfe-ink)));
	/* White over photography is the one allowed use of #fff. */
	color: rgba(255, 255, 255, 0.5);
}

.sfcd-dc__chips {
	position: absolute;
	top: 12px;
	left: 12px;
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	max-width: calc(100% - 24px);
}

.sfcd-dc__chip {
	display: inline-flex;
	align-items: center;
	min-height: 26px;
	padding: 0 10px;
	border: 1px solid var(--sfe-edge);
	border-radius: 999px;
	background: var(--sfe-glass);
	-webkit-backdrop-filter: blur(10px);
	backdrop-filter: blur(10px);
	color: var(--sfe-ink);
	font: 700 11.5px/1 var(--sfe-f-ui);
	letter-spacing: 0.02em;
}

.sfcd-dc__logo {
	position: absolute;
	left: 18px;
	bottom: -28px;
	z-index: 2;
	display: grid;
	place-items: center;
	width: 60px;
	height: 60px;
	overflow: hidden;
	border: 3px solid var(--sfe-panel);
	border-radius: 18px;
	background: var(--sfe-panel);
	box-shadow: var(--sfe-shadow-2);
}

.sfcd-dc__logo > *,
.sfcd-dc__logo img {
	max-width: 100%;
	max-height: 100%;
}

.sfcd-dc__logo-img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.sfcd-dc__monogram {
	display: grid;
	place-items: center;
	width: 100%;
	height: 100%;
	background: var(--sfe-navy);
	color: var(--sfe-on-fill);
	font: 800 20px/1 var(--sfe-f-display);
	letter-spacing: 0.02em;
}

.sfcd-dc__body {
	position: relative;
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 10px;
	min-width: 0;
	padding: 38px 20px 20px;
}

.sfcd-dc .sfcd-dc__name {
	margin: 0;
	color: var(--sfe-ink);
	font: 800 clamp(18px, 1.5vw, 21px)/1.2 var(--sfe-f-display);
	letter-spacing: -0.01em;
	text-transform: none;
}

.sfcd-dc a.sfcd-dc__link,
.sfcd-dc a.sfcd-dc__link:visited {
	color: inherit;
	text-decoration: none;
}

/* The name link stretches over the whole card (buttons sit above it). */
.sfcd-dc a.sfcd-dc__link::after {
	content: "";
	position: absolute;
	inset: -1px;
	z-index: 1;
	border-radius: var(--sfe-r-card);
}

.sfcd-dc a.sfcd-dc__link:hover {
	color: var(--sfe-accent-strong);
}

.sfcd-dc a.sfcd-dc__link:focus-visible {
	outline: none;
}

.sfcd-dc a.sfcd-dc__link:focus-visible::after {
	outline: 3px solid var(--sfe-accent-2);
	outline-offset: 2px;
}

/* Rating (local fallback markup; P-LOOPS' helper brings its own). */
.sfcd-dc__rating {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px 8px;
	font: 700 14px/1 var(--sfe-f-ui);
}

.sfcd-dc__stars {
	display: inline-flex;
	gap: 2px;
}

.sfcd-dc__star {
	display: inline-flex;
	color: color-mix(in srgb, var(--sfe-muted) 45%, transparent);
}

.sfcd-dc__star svg {
	fill: currentColor;
}

.sfcd-dc__star.is-on {
	color: var(--sfe-gold);
}

.sfcd-dc__score {
	font-family: var(--sfe-f-num);
	font-weight: 800;
	font-variant-numeric: tabular-nums;
}

.sfcd-dc__reviews {
	color: var(--sfe-muted);
	font-weight: 600;
}

.sfcd-dc__addr,
.sfcd-dc__city {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	margin: 0;
	color: var(--sfe-muted);
	font: 500 14px/1.45 var(--sfe-f-ui);
}

.sfcd-dc__addr .sfcd-i,
.sfcd-dc__city .sfcd-i {
	margin-top: 2px;
}

.sfcd-dc__open {
	display: flex;
}

.sfcd-dc__open-badge {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	min-height: 26px;
	padding: 0 11px 0 9px;
	border-radius: 999px;
	background: color-mix(in srgb, var(--sfe-muted) 14%, transparent);
	color: var(--sfe-muted);
	font: 700 12px/1 var(--sfe-f-ui);
}

.sfcd-dc__open-badge i {
	flex: none;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: currentColor;
}

.sfcd-dc__open-badge.is-open {
	background: color-mix(in srgb, var(--sfe-neon) 15%, transparent);
	color: var(--sfe-neon);
}

.sfcd-dc__brands {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.sfcd-dc__brands li {
	padding: 5px 10px;
	border-radius: 999px;
	background: var(--sfe-panel-2);
	color: var(--sfe-ink);
	font: 600 12px/1.2 var(--sfe-f-ui);
}

.sfcd-dc__brands li.sfcd-dc__more {
	background: transparent;
	color: var(--sfe-muted);
	box-shadow: inset 0 0 0 1px var(--sfe-line);
}

.sfcd-dc__stats {
	display: grid;
	grid-auto-flow: column;
	/* min-content floor: in a 4-up row (≈240px card) "$112.9k" must not run into the next stat. */
	grid-auto-columns: minmax(min-content, 1fr);
	gap: 12px;
	margin: 2px 0 0;
	padding: 14px 0 0;
	border-top: 1px solid var(--sfe-line);
	list-style: none;
}

.sfcd-dc__stats li {
	display: flex;
	flex-direction: column;
	gap: 3px;
	min-width: 0;
}

.sfcd-dc__stats strong {
	color: var(--sfe-ink);
	font: 800 19px/1.1 var(--sfe-f-num);
	font-variant-numeric: tabular-nums;
}

.sfcd-dc__stats span {
	color: var(--sfe-muted);
	font: 600 12px/1.25 var(--sfe-f-ui);
}

.sfcd-dc__actions {
	position: relative;
	z-index: 2;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin-top: auto;
	padding-top: 6px;
}

.sfcd-dc a.sfcd-dc__btn,
.sfcd-dc a.sfcd-dc__btn:visited {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 44px;
	padding: 0 14px;
	border: 1px solid var(--sfe-line);
	border-radius: 999px;
	background: var(--sfe-panel);
	color: var(--sfe-ink);
	font: 700 13.5px/1 var(--sfe-f-ui);
	text-decoration: none;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}

.sfcd-dc a.sfcd-dc__btn--icon {
	width: 44px;
	padding: 0;
}

.sfcd-dc a.sfcd-dc__btn:hover {
	background: var(--sfe-panel-2);
	border-color: color-mix(in srgb, var(--sfe-ink) 30%, transparent);
}

.sfcd-dc a.sfcd-dc__cta,
.sfcd-dc a.sfcd-dc__cta:visited {
	display: inline-flex;
	flex: 1 1 140px;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-height: 44px;
	padding: 0 16px;
	border-radius: var(--sfe-r-btn);
	background: var(--sfe-accent-strong);
	color: var(--sfe-on-fill);
	font: 700 14px/1 var(--sfe-f-ui);
	text-decoration: none;
	transition: filter 0.15s ease;
}

.sfcd-dc a.sfcd-dc__cta:hover {
	filter: brightness(1.08);
}

.sfcd-dc a.sfcd-dc__btn:focus-visible,
.sfcd-dc a.sfcd-dc__cta:focus-visible {
	outline: 2px solid var(--sfe-accent-2);
	outline-offset: 2px;
}

/* Compact: logo + name + rating + city + open badge in one slim row. */
.sfcd-dc--compact .sfcd-dc__body {
	flex-direction: row;
	align-items: center;
	gap: 14px;
	padding: 14px 16px;
}

.sfcd-dc--compact .sfcd-dc__logo--inline {
	position: static;
	flex: none;
	width: 52px;
	height: 52px;
	border-width: 2px;
	border-radius: 16px;
	box-shadow: none;
	overflow: hidden;
}

.sfcd-dc__main {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}

.sfcd-dc--compact .sfcd-dc__name {
	font-size: 16px;
}

.sfcd-dc--compact .sfcd-dc__rating {
	font-size: 13px;
}

/* Horizontal: photo left on wide containers, stacked on phones. */
@media (min-width: 769px) {
	.sfcd-dc--horizontal {
		flex-direction: row;
	}

	.sfcd-dc--horizontal .sfcd-dc__media {
		flex: 0 0 38%;
		min-width: 240px;
	}

	.sfcd-dc--horizontal .sfcd-dc__photo {
		height: 100%;
		min-height: 240px;
		aspect-ratio: auto;
		border-radius: calc(var(--sfe-r-card) - 1px) 0 0 calc(var(--sfe-r-card) - 1px);
	}

	.sfcd-dc--horizontal .sfcd-dc__logo {
		bottom: 16px;
	}

	.sfcd-dc--horizontal .sfcd-dc__body {
		padding: 24px;
	}
}

/* Grid. */
.sfcd-dg__list {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: var(--sfe-gap);
	align-items: stretch;
}

.sfcd-dg__list > * {
	min-width: 0;
}

@media (min-width: 600px) {
	.sfcd-dg__list:where(:not([style*="--sfcd-cols:1"])) {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (min-width: 1025px) {
	.sfcd-dg__list {
		grid-template-columns: repeat(var(--sfcd-cols, 4), minmax(0, 1fr));
	}
}

/* Phone swipe rail. */
@media (max-width: 599px) {
	.sfcd-dg.is-mobile-rail .sfcd-dg__list {
		display: flex;
		margin: 0 -16px;
		padding: 4px 16px 14px;
		overflow-x: auto;
		scroll-snap-type: x proximity;
		scroll-padding-inline: 16px;
		overscroll-behavior-x: contain;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: thin;
	}

	.sfcd-dg.is-mobile-rail .sfcd-dg__list > * {
		flex: 0 0 min(84%, 340px);
		scroll-snap-align: start;
	}
}

.sfcd-dg.is-no-contact .sfcd-dc__actions {
	display: none;
}

.sfcd-dc__actions:empty {
	display: none;
}

/* ======================================================================
   9. REDUCED MOTION + PRINT
   ====================================================================== */

@media (prefers-reduced-motion: reduce) {
	.sfcd-tray,
	.sfcd-toast-lite,
	.sfcd-dc,
	.sfcd-dc__img,
	.sfcd-switch__track,
	.sfcd-switch__track::after,
	.sfcd-fl__grid > .is-leaving {
		transition-duration: 0.001ms !important;
	}
}

@media print {
	.sfcd-tray,
	.sfcd-toast,
	.sfcd-toast-lite,
	.sfcd-pill-wrap {
		display: none !important;
	}

	body.has-sfcd-tray {
		padding-bottom: 0 !important;
	}

	.sfcd-ct__toolbar,
	.sfcd-ct__hint,
	.sfcd-ct__remove,
	.sfcd-ct__save,
	.sfcd-ct a.sfcd-ct__cta {
		display: none !important;
	}

	.sfcd-ct__body {
		overflow: visible;
		border: 0;
		box-shadow: none;
	}

	.sfcd-ct__table {
		min-width: 0;
		font-size: 11px;
	}

	.sfcd-ct__table th[scope="row"],
	.sfcd-ct__gl,
	.sfcd-ct__table thead th.sfcd-ct__corner {
		position: static;
		box-shadow: none;
	}

	.sfcd-ct__table th,
	.sfcd-ct__table td {
		padding: 6px 8px;
		-webkit-print-color-adjust: exact;
		print-color-adjust: exact;
	}

	.sfcd-ct__table tr {
		break-inside: avoid;
	}
}

/* ---- Touch: the 40px header pills keep their look, the hit area is 44px --- */
@media (pointer: coarse), (max-width: 767.98px) {
	.sfcd-pill-wrap .sfcd-pill::after {
		content: "";
		position: absolute;
		inset: -3px;
	}
}
