/* ============================================================
   Legacy Auto Trading — inventory browser
   Loaded only by inventory.html, on top of styles.css. Every token,
   radius, shadow and easing below comes from the landing page.

   One deliberate departure: the --grade photo filter is NOT applied to
   vehicle photography. The landing page grades its stock shots because
   they arrive in four unrelated colour stories and have to sit together
   in a warm dark palette. These are product photographs of cars a
   customer is deciding between — a buyer needs the real paint colour,
   so they run ungraded.
   ============================================================ */

/* The scrollbar tokens live in styles.css, next to the rest of the palette —
   the window scrollbar needs them too. Inside these panels the thumb stays
   faint until you are actually in the panel, which keeps the affordance
   without the bar becoming furniture. */

/* ───────────────────────── Page head ───────────────────────── */

/* No --header-h in the top padding. The header is `position: sticky`, so it
   sits in the flow and already takes its own height — adding it here reserved
   the space a second time and left 72px of empty band under the bar before
   the page began. The landing page's hero does need that offset, because the
   hero image runs full-bleed underneath a transparent header; this does not. */
.inv-head {
  padding: clamp(1.75rem, 4vw, 3rem) 0 clamp(1.75rem, 4vw, 2.75rem);
  background:
    radial-gradient(120% 100% at 50% 0%, #1d181333 0%, transparent 60%),
    var(--ink);
}

.inv-title {
  margin: 0 0 .875rem;
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -.02em;
}

.inv-lede { max-width: 62ch; margin: 0 0 2rem; }

/* Search */
.inv-search { position: relative; max-width: 560px; }

.inv-search-icon {
  position: absolute;
  inset-inline-start: 1.0625rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-dim);
  pointer-events: none;
  display: flex;
}

.inv-search input {
  width: 100%;
  min-height: 52px;
  padding: .75rem 1rem;
  padding-inline-start: 3rem;
  padding-inline-end: 2.75rem;
  background: var(--panel);
  color: var(--ice);
  border: 1px solid var(--stroke);
  border-radius: var(--r-field);
  font-family: inherit;
  font-size: 16px;               /* ≥16px keeps iOS from zooming on focus */
  transition: border-color var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
}
.inv-search input::placeholder { color: #877e71; }
.inv-search input::-webkit-search-cancel-button { display: none; }
.inv-search input:hover { border-color: #b8bec78c; }
.inv-search input:focus-visible {
  outline: none;
  border-color: var(--gold);
  box-shadow: var(--focus-ring);
}

.inv-search-clear {
  position: absolute;
  inset-inline-end: .5rem;
  top: 50%;
  transform: translateY(-50%);
  width: 34px; height: 34px;
  display: grid; place-items: center;
  background: none;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}
.inv-search-clear:hover { color: var(--gold); background: #d9b56b14; }

/* ───────────────────────── Layout ───────────────────────── */

.inv-body { padding: clamp(2rem, 5vw, 3rem) 0 clamp(4rem, 8vw, 6rem); }

.inv-layout {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  gap: clamp(1.5rem, 3vw, 2.5rem);
  align-items: start;
}

@media (max-width: 900px) {
  .inv-layout { grid-template-columns: minmax(0, 1fr); }
}

/* ───────────────────────── Filters ───────────────────────── */

.inv-filters {
  position: sticky;
  top: calc(var(--header-h) + 1rem);
  max-height: calc(100dvh - var(--header-h) - 2rem);
  /* The panel itself never scrolls — the group list inside it does. Scrolling
     the panel put the scrollbar hard against the rounded corners, where it
     cut across the radius, and took "Refine / Reset all" off the top with it.
     Clipping here also keeps the corners clean. */
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 1.25rem;
  background: var(--panel);
  border: 1px solid var(--stroke-soft);
  border-radius: var(--r-panel);
  box-shadow: var(--shadow-1), var(--edge-highlight);
}

/* The scrolling part. min-height:0 is what lets a flex child actually shrink
   and scroll rather than growing to fit its content. The scrollbar now runs
   only beside the groups, inset from every corner by the panel's padding. */
.inv-filter-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  /* Room for the bar so the last count does not sit under it. */
  padding-inline-end: .375rem;
  margin-inline-end: -.375rem;
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb) transparent;
  transition: scrollbar-color var(--dur-base) var(--ease-out);
}
.inv-filters:hover .inv-filter-scroll,
.inv-filters:focus-within .inv-filter-scroll { scrollbar-color: var(--scroll-thumb-live) transparent; }

.inv-filter-scroll::-webkit-scrollbar { width: 6px; }
.inv-filter-scroll::-webkit-scrollbar-track { background: transparent; }
.inv-filter-scroll::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb);
  border-radius: 3px;
  transition: background-color var(--dur-base) var(--ease-out);
}
.inv-filters:hover .inv-filter-scroll::-webkit-scrollbar-thumb,
.inv-filters:focus-within .inv-filter-scroll::-webkit-scrollbar-thumb { background: var(--scroll-thumb-live); }

.inv-filters-head {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1rem;
}

.inv-filters-title {
  margin: 0;
  margin-inline-end: auto;
  font-size: 1rem;
  font-weight: 600;
}

.inv-reset {
  background: none;
  border: 0;
  padding: .25rem;
  color: var(--muted);
  font-family: inherit;
  font-size: .8125rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.inv-reset:hover { color: var(--gold); }

.inv-filters-close { display: none; }

/* A collapsible group per facet */
.inv-group { border-top: 1px solid var(--stroke-soft); }
.inv-group:first-child { border-top: 0; }

.inv-group-btn {
  display: flex;
  align-items: center;
  gap: .5rem;
  width: 100%;
  padding: .875rem 0;
  background: none;
  border: 0;
  color: var(--ice);
  font-family: inherit;
  font-size: .875rem;
  font-weight: 500;
  text-align: start;
  cursor: pointer;
}
.inv-group-btn:hover { color: var(--gold-muted); }
.inv-group-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: 8px; }

.inv-group-name { margin-inline-end: auto; }

.inv-group-tally {
  min-width: 20px;
  padding: 1px 6px;
  background: var(--gold);
  color: var(--ink);
  border-radius: var(--r-pill);
  font-size: .6875rem;
  font-weight: 700;
  text-align: center;
}

.inv-group-caret {
  flex: none;
  transition: transform var(--dur-base) var(--ease-out);
  color: var(--muted-dim);
}
.inv-group-btn[aria-expanded="true"] .inv-group-caret { transform: rotate(180deg); }

.inv-group-body { padding-bottom: 1rem; }

/* Checkbox rows */
.inv-opts { display: grid; gap: .125rem; max-height: 232px; overflow-y: auto; }
.inv-opts { scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent; }
.inv-opts::-webkit-scrollbar { width: 5px; }
.inv-opts::-webkit-scrollbar-track { background: transparent; }
.inv-opts::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 3px; }
.inv-opts:hover { scrollbar-color: var(--scroll-thumb-live) transparent; }
.inv-opts:hover::-webkit-scrollbar-thumb { background: var(--scroll-thumb-live); }

.inv-opt {
  display: flex;
  align-items: center;
  gap: .625rem;
  min-height: 34px;
  padding: .25rem .375rem;
  border-radius: 10px;
  font-size: .875rem;
  color: var(--muted);
  cursor: pointer;
}
.inv-opt:hover { background: #ffffff08; color: var(--ice); }
.inv-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }

.inv-opt-box {
  flex: none;
  width: 17px; height: 17px;
  display: grid; place-items: center;
  border: 1.15px solid var(--stroke);
  border-radius: 5px;
  transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.inv-opt-box svg { opacity: 0; color: var(--ink); }
.inv-opt input:checked ~ .inv-opt-box { background: var(--gold); border-color: var(--gold); }
.inv-opt input:checked ~ .inv-opt-box svg { opacity: 1; }
.inv-opt input:focus-visible ~ .inv-opt-box { box-shadow: var(--focus-ring); }
.inv-opt input:checked ~ .inv-opt-label { color: var(--ice); }

/* min-width:0 so a long make name truncates instead of pushing the count out. */
.inv-opt-label {
  margin-inline-end: auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inv-opt-n { flex: none; font-size: .75rem; color: var(--muted-dim); font-variant-numeric: tabular-nums; }

/* A car whose colour the source never stated should not read as a real swatch. */
.inv-swatch {
  flex: none;
  width: 13px; height: 13px;
  border-radius: 50%;
  border: 1px solid #ffffff2e;
}

/* Range pairs (price, year, mileage) */
.inv-range { display: grid; grid-template-columns: 1fr auto 1fr; gap: .5rem; align-items: center; }
.inv-range-sep { color: var(--muted-dim); font-size: .875rem; }

.inv-range input {
  width: 100%;
  min-height: 42px;
  padding: .5rem .625rem;
  background: var(--ink);
  color: var(--ice);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  font-family: inherit;
  font-size: 16px;
  text-align: center;
}
.inv-range input:hover { border-color: #b8bec78c; }
.inv-range input:focus-visible { outline: none; border-color: var(--gold); box-shadow: var(--focus-ring); }
/* Number spinners fight the centred text and add nothing here. */
.inv-range input::-webkit-outer-spin-button,
.inv-range input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.inv-range input[type="number"] { -moz-appearance: textfield; appearance: textfield; }

.inv-range-hint {
  margin: .5rem 0 0;
  font-size: .75rem;
  color: var(--muted-dim);
  font-variant-numeric: tabular-nums;
}

/* Type-ahead inside a long list (makes, models) */
.inv-opt-filter {
  width: 100%;
  min-height: 38px;
  margin-bottom: .5rem;
  padding: .4375rem .75rem;
  background: var(--ink);
  color: var(--ice);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  font-family: inherit;
  font-size: 16px;
}
.inv-opt-filter:focus-visible { outline: none; border-color: var(--gold); box-shadow: var(--focus-ring); }

.inv-group-empty { margin: 0; font-size: .8125rem; color: var(--muted-dim); }

/* ───────────────────────── Toolbar ───────────────────────── */

.inv-toolbar {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.inv-filters-open { display: none; }

.inv-filter-count {
  min-width: 19px;
  padding: 1px 5px;
  background: var(--gold);
  color: var(--ink);
  border-radius: var(--r-pill);
  font-size: .6875rem;
  font-weight: 700;
}

.inv-count {
  margin: 0;
  margin-inline-end: auto;
  font-size: .875rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.inv-count b { color: var(--ice); font-weight: 600; }

.inv-sort { min-width: 208px; }
.inv-sort select { min-height: 40px; padding-block: .4375rem; font-size: .875rem; }

/* Active-filter chips */
.inv-chips { display: flex; flex-wrap: wrap; gap: .4375rem; margin-bottom: 1.125rem; }

.inv-chip {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  min-height: 30px;
  padding: .25rem .5rem .25rem .75rem;
  background: #d9b56b14;
  border: 1px solid #d9b56b47;
  border-radius: var(--r-pill);
  color: var(--gold-muted);
  font-family: inherit;
  font-size: .8125rem;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out);
}
.inv-chip:hover { background: #d9b56b2b; }
.inv-chip span { font-size: 1.0625rem; line-height: 1; opacity: .75; }

/* ───────────────────────── States ───────────────────────── */

.inv-state {
  display: grid;
  justify-items: center;
  gap: .625rem;
  padding: clamp(3rem, 8vw, 5rem) 1.5rem;
  text-align: center;
}
.inv-state p { margin: 0; }
.inv-state-title { font-size: 1.125rem; font-weight: 600; }
.inv-empty-actions { display: flex; flex-wrap: wrap; gap: .625rem; justify-content: center; margin-top: .5rem; }

.inv-spinner {
  width: 26px; height: 26px;
  border: 2px solid #d9b56b3d;
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

/* ───────────────────────── Grid & cards ───────────────────────── */

.inv-grid {
  display: grid;
  /* 240px min gives three columns beside the filter panel at shell width,
     which is the density an inventory grid wants — wider cards just make
     the same number of cars take more scrolling. */
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  gap: clamp(1rem, 2vw, 1.375rem);
  margin: 0;
  padding: 0;
  list-style: none;
}

.inv-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--panel);
  border: 1px solid var(--stroke-soft);
  border-radius: var(--r-card);
  overflow: hidden;
  box-shadow: var(--shadow-1);
  transition: transform var(--dur-base) var(--ease-out),
              border-color var(--dur-base) var(--ease-out),
              box-shadow var(--dur-base) var(--ease-out);
}
.inv-card:hover {
  transform: translateY(-3px);
  border-color: #d9b56b47;
  box-shadow: var(--shadow-2);
}
.inv-card:focus-within {
  border-color: var(--gold);
  box-shadow: var(--shadow-2), var(--glow-gold);
}

/* Photo frame — also the anchor for the brand mark */
.inv-photo {
  position: relative;
  aspect-ratio: 3 / 2;
  background: #0a0908;
  overflow: hidden;
}
/* Direct child only. The brand mark's own <img> also lives inside this
   frame, and a bare `.inv-photo img` would hold it at opacity 0 forever —
   it never gets .is-loaded, so the plate would show with nothing on it. */
.inv-photo > img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out);
}
.inv-photo > img.is-loaded { opacity: 1; }
.inv-card:hover .inv-photo > img { transform: scale(1.03); }

/* Placeholder shown until a photo loads, and kept if none ever does. */
.inv-photo::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, #14110d 30%, #1d1813 50%, #14110d 70%);
  background-size: 220% 100%;
  animation: inv-shimmer 1.4s linear infinite;
}
.inv-photo.is-ready::before,
.inv-photo.is-blank::before { animation: none; }
.inv-photo.is-ready::before { opacity: 0; }

@keyframes inv-shimmer { to { background-position: -220% 0; } }

.inv-photo-none {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted-dim);
  font-size: .8125rem;
}

/* The brand mark that sits on every photograph.

   Pinned to the physical bottom-right in both directions: a watermark is a
   position on an image, not a reading order, and mirroring it in RTL would
   put it where the eye does not expect a mark. The plate behind it is not
   decoration — these are studio photographs on near-white backgrounds, and
   the wordmark is light, so without a scrim it would disappear. */
/* The mark sits on a solid plate rather than straight on the photograph.
   The wordmark is light and these are studio shots on near-white grounds,
   so it needs its own field to read against; opaque (not translucent) also
   keeps it identical over a black car and a white one. */
.inv-mark {
  position: absolute;
  right: .5rem;
  bottom: .5rem;
  display: flex;
  align-items: center;
  padding: .3125rem .5rem;
  /* Frosted glass: the photo shows through, but blurred and darkened enough
     that the light wordmark still reads over a white studio floor. */
  background: #0808088c;
  border: 1px solid #ffffff24;
  border-radius: 8px;
  backdrop-filter: blur(9px) saturate(115%);
  -webkit-backdrop-filter: blur(9px) saturate(115%);
  box-shadow: var(--shadow-1);
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--dur-base) var(--ease-out);
}
.inv-photo.is-ready .inv-mark { opacity: 1; }
.inv-mark img { width: 74px; height: auto; display: block; }

/* Without backdrop-filter the panel is just 55% transparent and the light
   wordmark disappears over a white studio floor. Fall back to a solid plate. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .inv-mark { background: #080808e6; }
}

.inv-detail-media .inv-mark { right: .75rem; bottom: .75rem; }
.inv-detail-media .inv-mark img { width: 104px; }

/* Condition badge */
.inv-badge {
  position: absolute;
  inset-inline-start: .5rem;
  top: .5rem;
  padding: .25rem .5rem;
  background: #08080899;
  border: 1px solid #ffffff1f;
  border-radius: var(--r-pill);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  font-size: .6875rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ice);
}
.inv-badge.is-certified { background: #d9b56be6; border-color: var(--gold); color: var(--ink); }
.inv-badge.is-new { background: #f7f2e8e6; border-color: var(--ice); color: var(--ink); }

.inv-card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: .375rem;
  padding: .9375rem 1rem 1.0625rem;
}

.inv-card-title { margin: 0; font-size: .9375rem; font-weight: 600; line-height: 1.3; }

/* The whole card is clickable, but only the title is a real button, so the
   card keeps one tab stop and screen readers get one sensible name. */
.inv-card-btn {
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  font: inherit;
  text-align: start;
  cursor: pointer;
}
.inv-card-btn::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.inv-card-btn:focus-visible { outline: none; }
.inv-card { position: relative; }

.inv-card-trim {
  margin: 0;
  font-size: .8125rem;
  color: var(--muted);
  line-height: 1.4;
  /* Two lines, then ellipsis — keeps every card in a row the same height. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.inv-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem .625rem;
  margin: .125rem 0 0;
  font-size: .75rem;
  color: var(--muted-dim);
  font-variant-numeric: tabular-nums;
}
.inv-card-meta li { display: flex; align-items: center; gap: .3125rem; }
.inv-card-meta { list-style: none; padding: 0; }

.inv-card-foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .5rem;
  margin-top: auto;
  padding-top: .625rem;
  min-width: 0;
}

.inv-price { min-width: 0; font-size: 1.0625rem; font-weight: 600; color: var(--gold); font-variant-numeric: tabular-nums; }
.inv-price-ask { font-size: .875rem; font-weight: 500; color: var(--muted); }
.inv-card-cta { font-size: .75rem; color: var(--muted-dim); }

/* ───────────────────────── Pager ───────────────────────── */

.inv-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: .375rem;
  margin-top: 2.25rem;
}

.inv-page {
  min-width: 40px;
  min-height: 40px;
  padding: .4375rem .625rem;
  background: transparent;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  color: var(--ice);
  font-family: inherit;
  font-size: .875rem;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}
.inv-page { display: grid; place-items: center; text-decoration: none; }
.inv-page:hover:not(.is-disabled) { border-color: var(--gold); color: var(--gold-muted); background: #d9b56b14; }
.inv-page.is-disabled { opacity: .35; cursor: not-allowed; }
.inv-page[aria-current="page"] { background: var(--gold); border-color: var(--gold); color: var(--ink); font-weight: 600; }
.inv-page-gap { color: var(--muted-dim); padding-inline: .25rem; }

/* ───────────────────────── Detail overlay ───────────────────────── */

.inv-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: clamp(.5rem, 3vw, 2rem);
  /* Respect the notch and home indicator on phones. */
  padding-top: max(clamp(.5rem, 3vw, 2rem), env(safe-area-inset-top));
  padding-bottom: max(clamp(.5rem, 3vw, 2rem), env(safe-area-inset-bottom));
  overscroll-behavior: contain;
}

.inv-overlay-scrim {
  position: absolute;
  inset: 0;
  background: #050403e0;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  animation: inv-fade var(--dur-base) var(--ease-out);
}

.inv-detail {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  width: min(1060px, 100%);
  max-height: calc(100dvh - 2rem);
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--stroke-soft);
  border-radius: var(--r-panel);
  box-shadow: var(--shadow-3);
  animation: inv-rise var(--dur-slow) var(--ease-out);
}

@keyframes inv-fade { from { opacity: 0; } }
@keyframes inv-rise { from { opacity: 0; transform: translateY(14px) scale(.99); } }

.inv-detail-close {
  position: absolute;
  inset-inline-end: .625rem;
  top: .625rem;
  z-index: 3;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  background: #080808b3;
  border: 1px solid var(--stroke);
  border-radius: 50%;
  color: var(--ice);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.inv-detail-close:hover { border-color: var(--gold); color: var(--gold); }

.inv-detail-media { background: #0a0908; min-width: 0; overflow-y: auto; overscroll-behavior: contain; }
.inv-detail-media .inv-photo { aspect-ratio: 3 / 2; }
.inv-detail-media .inv-photo > img { object-fit: contain; background: #0a0908; }

.inv-photo-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  background: #080808a6;
  border: 1px solid var(--stroke);
  border-radius: 50%;
  color: var(--ice);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--dur-base) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.inv-photo:hover .inv-photo-nav,
.inv-photo-nav:focus-visible { opacity: 1; }
.inv-photo-nav:hover { border-color: var(--gold); color: var(--gold); }
.inv-photo-prev { inset-inline-start: .625rem; }
.inv-photo-next { inset-inline-end: .625rem; }
/* Arrows point along the reading direction, so mirror the glyphs in RTL. */
[dir="rtl"] .inv-photo-nav { transform: translateY(-50%) scaleX(-1); }

.inv-photo-count {
  position: absolute;
  inset-inline-start: .75rem;
  bottom: .75rem;
  z-index: 2;
  margin: 0;
  padding: .1875rem .5rem;
  background: #08080899;
  border-radius: var(--r-pill);
  font-size: .75rem;
  color: var(--ice);
  font-variant-numeric: tabular-nums;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.inv-thumbs {
  display: flex;
  gap: .375rem;
  margin: 0;
  padding: .5rem;
  list-style: none;
  overflow-x: auto;
  scrollbar-width: thin;
}
.inv-thumbs { overscroll-behavior-x: contain; }
.inv-thumbs::-webkit-scrollbar { height: 5px; }
.inv-thumbs::-webkit-scrollbar-track { background: transparent; }
.inv-thumbs::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 3px; }
.inv-thumbs:hover::-webkit-scrollbar-thumb { background: var(--scroll-thumb-live); }

.inv-thumb {
  flex: none;
  width: 68px;
  aspect-ratio: 3 / 2;
  padding: 0;
  background: #14110d;
  border: 1.5px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  opacity: .55;
  transition: opacity var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.inv-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.inv-thumb:hover { opacity: .85; }
.inv-thumb[aria-current="true"] { opacity: 1; border-color: var(--gold); }

.inv-detail-info {
  display: flex;
  flex-direction: column;
  gap: .3125rem;
  padding: clamp(1.25rem, 3vw, 1.875rem);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.inv-detail-cond {
  margin: 0;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--gold);
}
.inv-detail-title { margin: 0; font-size: clamp(1.25rem, 3vw, 1.625rem); font-weight: 600; line-height: 1.2; }
.inv-detail-trim { margin: 0; color: var(--muted); font-size: .9375rem; }
.inv-detail-price {
  margin: .625rem 0 0;
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}
.inv-detail-pricenote { margin: .1875rem 0 0; }

.inv-specs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 132px), 1fr));
  gap: .875rem 1rem;
  margin: 1.375rem 0 0;
  padding: 1.25rem 0 0;
  border-top: 1px solid var(--stroke-soft);
}
.inv-spec dt {
  font-size: .6875rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted-dim);
}
.inv-spec dd {
  margin: .1875rem 0 0;
  font-size: .875rem;
  color: var(--ice);
  overflow-wrap: anywhere;
}

/* A spec we worked out from the trim rather than read from the source. The
   dotted rule is the honest signal; the title says so in words. */
.inv-spec dd.is-derived {
  border-bottom: 1px dotted #8e847880;
  cursor: help;
}

.inv-detail-actions { display: grid; gap: .5rem; margin-top: auto; padding-top: 1.5rem; }

/* ───────────────────────── Responsive ───────────────────────── */

@media (max-width: 900px) {
  /* The sidebar becomes a drawer. */
  .inv-filters {
    position: fixed;
    inset: 0;
    z-index: 250;
    max-height: none;
    border: 0;
    border-radius: 0;
    padding: 1.25rem var(--gutter) 3rem;
    transform: translateX(-101%);
    transition: transform var(--dur-slow) var(--ease-out);
  }
  [dir="rtl"] .inv-filters { transform: translateX(101%); }
  .inv-filters.is-open { transform: translateX(0); }

  .inv-filters-head {
    margin: -1.25rem calc(var(--gutter) * -1) 1rem;
    padding: 1.25rem var(--gutter) .875rem;
    background: var(--panel);
    border-bottom: 1px solid var(--stroke-soft);
  }

  .inv-filters-close {
    display: grid;
    place-items: center;
    width: 36px; height: 36px;
    background: none;
    border: 1px solid var(--stroke);
    border-radius: 50%;
    color: var(--ice);
    font-size: 1.375rem;
    line-height: 1;
    cursor: pointer;
  }

  .inv-filters-open { display: inline-flex; }
  .inv-sort { min-width: 0; flex: 1; }
}

@media (max-width: 780px) {
  .inv-detail {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    max-height: calc(100dvh - 1rem);
  }
  .inv-detail-media { overflow: visible; }
}

@media (max-width: 420px) {
  .inv-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Same rule as the landing page: a control's text is a label, not content.
   The VIN, stock number and price in the detail panel stay selectable — those
   are exactly what someone wants to copy. */
.inv-opt,
.inv-group-btn,
.inv-reset,
.inv-chip,
.inv-page,
.inv-thumb,
.inv-card-btn,
.inv-sort select,
.inv-filters-open,
.inv-filters-close,
.inv-detail-close,
.inv-photo-nav {
  -webkit-user-select: none;
  user-select: none;
}

/* ───────────────────────── Touch ─────────────────────────
   Same rule the landing page follows: a coarse pointer needs 44px, and
   where the visual can't grow that far the hit area is padded out
   underneath it instead. */

@media (pointer: coarse) {
  .inv-opt { min-height: 44px; }
  .inv-chip { min-height: 44px; padding-block: .5rem; }
  .inv-page { min-width: 44px; min-height: 44px; }
  .inv-range input { min-height: 44px; }
  .inv-opt-filter { min-height: 44px; }
  .inv-group-btn { padding-block: 1rem; }

  /* Controls that sit outside the filter panel were missed the first time
     round: each was between 24px and 40px tall on a phone. */
  .inv-reset { min-height: 44px; padding-inline: .5rem; }
  .inv-filters-open,
  .inv-sort select { min-height: 44px; }

  .inv-search-clear,
  .inv-detail-close,
  .inv-photo-nav,
  .inv-filters-close { width: 44px; height: 44px; }

  /* The thumbnail strip stays visually small; the row is what grows. */
  .inv-thumbs { padding-block: .75rem; }
  .inv-thumb { width: 76px; }

  /* Arrows are permanently visible — there is no hover to reveal them. */
  .inv-photo-nav { opacity: 1; }
}

/* ───────────────────────── Motion ───────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .inv-card,
  .inv-card:hover,
  .inv-photo img,
  .inv-filters { transition: none; transform: none; }
  .inv-photo::before,
  .inv-spinner { animation: none; }
  .inv-overlay-scrim,
  .inv-detail { animation: none; }
  .inv-filters.is-open { transform: translateX(0); }
}

.inv-noscript {
  padding: 2rem 0 4rem;
  color: var(--muted);
}
