/*
 * Carwise Listings. Every selector is scoped under .cw. No "important" overrides anywhere.
 *
 * Specificity plan (hardened against theme CSS, rev. 5):
 *   Root     .cw.cw                      (0,2,0)  inherited typography reset on the wrapper itself
 *   Reset    .cw.cw.cw :where(el)           (0,2,0)  beats theme element rules and ".entry-content el" (0,1,1)
 *   Parts    .cw.cw .cw-x                (0,3,0)  beats the reset and two-class theme rules such as
 *                                                  Astra's ".ast-single-post .entry-content a" (0,2,1)
 * Sizes are px, not rem: Astra sets html{font-size:93.75%}, which would shrink rem-based text.
 */

/* ---------- Root ---------- */
.cw.cw {
	/* Homepage tokens (D6, 19 Oct). Field border #767C93: 4.14:1 on #fff, 3.73:1 on #F1F3F8 (WCAG 1.4.11). */
	--cw-ink: #22263A;
	--cw-ink-2: #5A6078;
	--cw-line: #E2E5EE;
	--cw-field: #767C93;
	--cw-bg: #ffffff;
	--cw-bg-2: #F1F3F8;
	--cw-accent: #253993;
	--cw-accent-ink: #ffffff;
	--cw-reserved: #8a5a00;
	--cw-sold: #8c1d18;
	--cw-radius: 24px;
	--cw-radius-sm: 12px;
	--cw-pill: 999px;
	--cw-font: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	color: var(--cw-ink);
	font-family: var(--cw-font);
	font-size: 16px;
	font-weight: 400;
	font-style: normal;
	line-height: 1.5;
	letter-spacing: normal;
	word-spacing: normal;
	text-transform: none;
	text-indent: 0;
	text-align: left;
	text-shadow: none;
	text-decoration: none;
	font-variant: normal;
	overflow-wrap: break-word;
	word-break: normal;
	hyphens: manual;
	white-space: normal;
	min-width: 0;
}
/* Template roots: claim the full row even when the theme's container is a flex box (Astra .ast-container). */
main.cw.cw-archive,
main.cw.cw-single { display: block; flex: 1 1 100%; width: 100%; max-width: 100%; }
span.cw.cw-price { font-weight: 700; } /* [cw_car_price] renders a bare span.cw */

.cw.cw,
.cw.cw *,
.cw.cw *::before,
.cw.cw *::after { box-sizing: border-box; }

/* ---------- Reset (theme bleed) ---------- */
/* Inherited text properties on every descendant, including img/svg/path (themes use "*{...}"). */
.cw.cw.cw :where(*) {
	letter-spacing: inherit;
	word-spacing: inherit;
	text-transform: inherit;
	font-variant: inherit;
	overflow-wrap: inherit;
	text-shadow: none;
}
.cw.cw.cw :where(h1, h2, h3, h4, h5, h6, p, span, a, ul, ol, li, dl, dt, dd, div, section, aside, article, header, nav, figure, form, label, button, input, select, strong, b, em, i, small) {
	font-family: inherit;
	font-size: inherit;
	font-weight: inherit;
	font-style: inherit;
	line-height: inherit;
	letter-spacing: inherit;
	text-transform: inherit;
	text-indent: 0;
	text-decoration: none;
	text-shadow: none;
	color: inherit;
	background: none;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	outline-offset: 0;
	margin: 0;
	padding: 0;
	min-width: 0;
	max-width: none;
	height: auto;
	float: none;
	list-style: none;
	opacity: 1;
	filter: none;
	transform: none;
}
.cw.cw.cw :where(h1, h2, h3, h4, h5, h6, p, span, a, ul, ol, li, dl, dt, dd, div, section, aside, label, button)::before,
.cw.cw.cw :where(h1, h2, h3, h4, h5, h6, p, span, a, ul, ol, li, dl, dt, dd, div, section, aside, label, button)::after {
	content: none;
}
.cw.cw.cw :where(button, input, select) { -webkit-appearance: none; appearance: none; line-height: 1.2; cursor: pointer; }
.cw.cw.cw :where(input) { cursor: text; }
.cw.cw.cw :where(img) { max-width: 100%; height: auto; border: 0; border-radius: 0; box-shadow: none; margin: 0; padding: 0; filter: none; opacity: 1; }
.cw.cw.cw :where(svg) { fill: none; stroke: currentColor; max-width: none; margin: 0; }

/* ---------- Layout ---------- */
.cw.cw .cw-wrap { max-width: 1200px; margin: 0 auto; padding: 24px 16px 48px; }
.cw.cw .cw-h1 { font-size: clamp(24px, 17.6px + 1.6vw, 34px); font-weight: 700; line-height: 1.2; margin: 0 0 12px; }
.cw.cw .cw-h2 { font-size: 19px; font-weight: 700; line-height: 1.3; margin: 0 0 12px; }
.cw.cw .cw-icon { flex: none; display: inline-block; vertical-align: middle; width: 20px; height: 20px; fill: none; stroke: currentColor; }

/* ---------- Buttons ---------- */
.cw.cw .cw-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	box-sizing: border-box; height: auto; min-height: 44px; padding: 10px 22px; margin: 0;
	border: 1px solid var(--cw-accent); border-radius: var(--cw-pill); box-shadow: none;
	font-family: var(--cw-font); font-size: 16px; font-weight: 600; font-style: normal; line-height: 1.2;
	letter-spacing: normal; text-transform: none; text-decoration: none; text-indent: 0; text-align: center;
	cursor: pointer; white-space: normal;
}
.cw.cw .cw-btn--primary,
.cw.cw .cw-btn--primary:hover,
.cw.cw .cw-btn--primary:visited { background: var(--cw-accent); color: var(--cw-accent-ink); text-decoration: none; }
.cw.cw .cw-btn--primary:hover { filter: brightness(1.1); }
.cw.cw .cw-btn--ghost,
.cw.cw .cw-btn--ghost:visited { background: transparent; color: var(--cw-accent); text-decoration: none; }
.cw.cw .cw-btn--ghost:hover { background: var(--cw-bg-2); color: var(--cw-accent); text-decoration: none; }
.cw.cw .cw-btn:focus-visible,
.cw.cw a:focus-visible,
.cw.cw select:focus-visible,
.cw.cw input:focus-visible { outline: 2px solid var(--cw-accent); outline-offset: 2px; }

/* ---------- Filters ---------- */
.cw.cw .cw-filters { background: var(--cw-bg-2); border: 1px solid var(--cw-line); border-radius: var(--cw-radius); padding: 16px; margin: 0 0 24px; }
.cw.cw .cw-filters__row { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.cw.cw .cw-field { display: flex; flex-direction: column; gap: 4px; margin: 0; }
.cw.cw .cw-field__label { font-size: 14px; line-height: 1.4; color: var(--cw-ink-2); }
.cw.cw .cw-field select,
.cw.cw .cw-field input { width: 100%; height: auto; min-height: 44px; padding: 8px 12px; border: 1px solid var(--cw-field); border-radius: var(--cw-radius-sm); background: var(--cw-bg); color: var(--cw-ink); font-family: var(--cw-font); font-size: 16px; line-height: 1.2; box-shadow: none; }
.cw.cw .cw-field select { padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%2322263A' stroke-width='1.6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.cw.cw .cw-filters__actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 12px; }

/* ---------- Grid + cards ---------- */
.cw.cw .cw-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.cw.cw .cw-grid--compact { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.cw.cw .cw-card { display: flex; flex-direction: column; margin: 0; padding: 0; background: var(--cw-bg); border: 1px solid var(--cw-line); border-radius: var(--cw-radius); overflow: hidden; }
.cw.cw .cw-card::before,
.cw.cw .cw-card::after,
.cw.cw .cw-card__facts li::before,
.cw.cw .cw-card__facts li::after { content: none; }
.cw.cw .cw-card__link,
.cw.cw .cw-card__link:hover,
.cw.cw .cw-card__link:visited { display: flex; flex-direction: column; flex: 1; color: inherit; text-decoration: none; font-weight: inherit; }
.cw.cw .cw-card__media { position: relative; aspect-ratio: 4 / 3; background: var(--cw-bg-2); }
.cw.cw .cw-card__img { width: 100%; height: 100%; max-width: none; object-fit: cover; display: block; }
.cw.cw .cw-card__placeholder { width: 100%; height: 100%; }
.cw.cw .cw-placeholder { display: flex; align-items: center; justify-content: center; background: var(--cw-bg-2); color: #9AA0B4; }
.cw.cw .cw-placeholder__icon { width: 30%; height: auto; max-width: 120px; aspect-ratio: 1 / 1; stroke-width: 1.2; }
.cw.cw .cw-card__body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.cw.cw .cw-card__title { font-family: var(--cw-font); font-size: 17px; font-weight: 700; line-height: 1.3; letter-spacing: normal; text-transform: none; margin: 0; padding: 0; border: 0; color: var(--cw-ink); }
.cw.cw .cw-card__facts { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--cw-ink-2); font-size: 14px; line-height: 1.4; }
.cw.cw .cw-card__facts li { display: inline-flex; align-items: center; gap: 5px; margin: 0; padding: 0; list-style: none; }
.cw.cw .cw-card__facts .cw-icon { width: 16px; height: 16px; }
.cw.cw .cw-card--sold .cw-card__img { filter: grayscale(0.7); opacity: 0.8; }
.cw.cw .cw-card__body .cw-price { margin-top: auto; }
.cw.cw .cw-card__cta { padding: 0 16px 16px; }
.cw.cw .cw-card__cta .cw-btn { width: 100%; }
.cw.cw .cw-more { margin: 20px 0 0; }
.cw.cw .cw-link,
.cw.cw .cw-link:hover,
.cw.cw .cw-link:visited { display: inline-flex; align-items: center; gap: 8px; color: var(--cw-accent); font-weight: 600; text-decoration: none; }
.cw.cw .cw-empty { padding: 24px; background: var(--cw-bg-2); border-radius: var(--cw-radius); }

/* ---------- Price + badges ---------- */
.cw.cw .cw-price { font-weight: 700; font-size: 18px; line-height: 1.3; margin: 0; font-variant-numeric: tabular-nums; }
.cw.cw .cw-price--lg { font-size: 26px; margin: 0 0 16px; }
.cw.cw .cw-price--struck .cw-price__value { text-decoration: line-through; color: var(--cw-ink-2); }
.cw.cw .cw-price__label { display: block; font-size: 13px; font-weight: 500; line-height: 1.4; color: var(--cw-ink-2); }
.cw.cw .cw-price__value { display: inline; }
.cw.cw .cw-price__note { display: inline; margin-left: 6px; font-size: 13px; font-weight: 500; color: var(--cw-ink-2); }
.cw.cw .cw-badge { display: inline-block; padding: 4px 10px; border-radius: var(--cw-pill); font-size: 13px; font-weight: 700; line-height: 1.4; color: #fff; margin: 0 0 8px; text-transform: none; letter-spacing: normal; }
.cw.cw .cw-card__media .cw-badge { position: absolute; top: 10px; left: 10px; margin: 0; }
.cw.cw .cw-badge--reserved { background: var(--cw-reserved); }
.cw.cw .cw-badge--sold { background: var(--cw-sold); }
.cw.cw .cw-badge--stock { background: var(--cw-ink); }
.cw.cw .cw-badge--auction { background: var(--cw-accent); }
.cw.cw .cw-badge--auction-done { background: var(--cw-ink-2); }
.cw.cw .cw-badge--coming { background: #1f5f73; }

/* ---------- Pagination ---------- */
.cw.cw .cw-pagination { margin-top: 28px; }
.cw.cw .cw-pagination ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.cw.cw .cw-pagination li { margin: 0; padding: 0; }
.cw.cw .cw-pagination a,
.cw.cw .cw-pagination span { display: inline-flex; min-width: 44px; min-height: 44px; align-items: center; justify-content: center; border: 1px solid var(--cw-line); border-radius: var(--cw-pill); text-decoration: none; color: var(--cw-ink); line-height: 1.2; }
.cw.cw .cw-pagination .current { background: var(--cw-accent); border-color: var(--cw-accent); color: var(--cw-accent-ink); }

/* ---------- Single ---------- */
.cw.cw .cw-single__layout { display: grid; gap: 24px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) {
	.cw.cw .cw-single__layout { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: start; }
	.cw.cw .cw-single__aside { position: sticky; top: 24px; }
}
.cw.cw .cw-single__body { max-width: 760px; margin-top: 32px; }
.cw.cw .cw-section { margin: 0 0 28px; border: 0; padding: 0; }
.cw.cw .cw-prose p { margin: 0 0 1em; }

/* ---------- Gallery (no JS) ---------- */
.cw.cw .cw-gallery__track {
	list-style: none; margin: 0; padding: 0; display: flex; overflow-x: auto;
	scroll-snap-type: x mandatory; scroll-behavior: smooth; border-radius: var(--cw-radius);
	background: var(--cw-bg-2);
}
.cw.cw .cw-gallery__slide { flex: 0 0 100%; scroll-snap-align: start; margin: 0; aspect-ratio: 4 / 3; }
.cw.cw .cw-gallery a { display: block; text-decoration: none; }
.cw.cw .cw-gallery__slide a { height: 100%; }
.cw.cw .cw-gallery__img { width: 100%; height: 100%; max-width: none; object-fit: cover; display: block; }
.cw.cw .cw-gallery__thumbs { list-style: none; margin: 10px 0 0; padding: 0; display: flex; gap: 8px; overflow-x: auto; }
.cw.cw .cw-gallery__thumbs li { flex: 0 0 72px; margin: 0; }
.cw.cw .cw-gallery__thumbs img { width: 72px; height: 54px; max-width: none; object-fit: cover; display: block; border-radius: var(--cw-radius-sm); }
.cw.cw .cw-gallery--empty { aspect-ratio: 4 / 3; background: var(--cw-bg-2); border-radius: var(--cw-radius); }
.cw-is-sold .cw.cw .cw-gallery__img { filter: grayscale(0.5); }

/* ---------- Specs ---------- */
.cw.cw .cw-specs { margin: 0; display: grid; grid-template-columns: 1fr; border-top: 1px solid var(--cw-line); }
@media (min-width: 640px) { .cw.cw .cw-specs { grid-template-columns: 1fr 1fr; column-gap: 32px; } }
.cw.cw .cw-specs__row { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--cw-line); }
.cw.cw .cw-specs dt { color: var(--cw-ink-2); margin: 0; font-weight: 400; }
.cw.cw .cw-specs dd { margin: 0; font-weight: 600; text-align: right; overflow-wrap: anywhere; }

/* ---------- CTA ---------- */
.cw.cw .cw-cta { border: 1px solid var(--cw-line); border-radius: var(--cw-radius); padding: 16px; background: var(--cw-bg); }
.cw.cw .cw-cta__heading { font-weight: 700; margin: 0 0 8px; }
.cw.cw .cw-cta__text { margin: 0 0 12px; color: var(--cw-ink-2); }
.cw.cw .cw-cta__buttons { display: flex; flex-direction: column; gap: 10px; }
.cw.cw .cw-report .cw-link { display: inline-flex; align-items: center; gap: 8px; color: var(--cw-accent); font-weight: 600; }

@media (prefers-reduced-motion: reduce) { .cw.cw .cw-gallery__track { scroll-behavior: auto; } }
