/* ==========================================================================
   MotorLB — Lebanon New Car Intelligence
   ========================================================================== */

/* Warm "quiet luxury" editorial palette — restyled 2026-10-05, inspired by
   marquecars.com's design language (cream/parchment background, a dramatic
   high-contrast serif for display type, generous negative space) after the
   user liked its look while we were researching names. Not a literal
   clone — adapted to MotorLB's own layout/components, which marquecars.com
   doesn't share. Accent swapped from an initial terracotta/brick to a dark
   charcoal gray same-day at the user's request ("I don't like the brick
   color palette... change it to a dark gray shade") — cream/parchment
   background kept as-is, only the accent (and its gradient/glow tints)
   changed. Every design-token consumer is routed through these CSS
   variables (verified via grep before the original swap — no stray
   hardcoded hex colors outside this block and the print stylesheet), so
   changing values here cascades correctly site-wide. */
:root {
  --bg:            #f3ede2;
  --bg-elevated:   #ebe2d2;
  --bg-card:       #fbf8f3;
  --bg-card-hover: #f4ecdf;
  --border:        #ddd0b8;
  --border-strong: #c7b494;
  --text:          #1c1712;
  --text-muted:    #6b5f4f;
  --text-dim:      #998c78;
  --brand:         #43403a;
  --brand-light:   #6b6660;
  --brand-dark:    #26231f;
  --accent-grad:   linear-gradient(135deg, #8a8378 0%, #6b6660 28%, #43403a 64%, #26231f 100%);
  --ok:            #2fbf71;
  --warn:          #c98a2b;
  --info:          #6b6660;
  --neutral:       #8b7f6c;
  --radius:        14px;
  --radius-sm:     9px;
  --shadow:        0 18px 50px -12px rgba(30, 20, 10, 0.16);
  --glow-shadow:   0 20px 44px -22px rgba(67, 64, 58, 0.28);
  --maxw:          1180px;
  --font:          "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-display:  "Playfair Display", "Georgia", "Times New Roman", serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background:
    radial-gradient(ellipse 900px 560px at 12% 0%, rgba(67, 64, 58, 0.05), transparent 60%),
    radial-gradient(ellipse 720px 520px at 96% 22%, rgba(107, 102, 96, 0.04), transparent 55%),
    var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  position: relative;
}

/* Faint grain for depth — barely visible, keeps large flat panels from
   feeling like plastic. Fixed + pointer-events:none so it never blocks input. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.025;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

section { position: relative; }

.eyebrow {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brand-light);
  margin-bottom: 16px;
}

.section-head {
  max-width: 640px;
  margin-bottom: 44px;
}

.section-head h2 {
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 3.5vw, 2.5rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
  font-weight: 700;
}

.section-head p {
  margin-top: 14px;
  color: var(--text-muted);
  font-size: 1.02rem;
}

/* ---------- Header ---------------------------------------------------------- */

.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  transition: background 0.25s ease, border-color 0.25s ease, backdrop-filter 0.25s ease;
  border-bottom: 1px solid transparent;
}

.site-header.scrolled {
  background: rgba(243, 237, 226, 0.88);
  backdrop-filter: blur(14px);
  border-bottom-color: var(--border);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 74px;
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.01em;
}

.brand-mark img { height: 34px; width: auto; border-radius: 6px; }
.brand-mark .iq { color: var(--brand-light); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 34px;
}

.nav-links a {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color 0.15s ease;
}

.nav-links a:hover { color: var(--text); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text);
  padding: 11px 20px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.16s ease;
  white-space: nowrap;
}

.btn:hover { border-color: var(--brand-light); color: var(--brand-light); }
.btn[hidden] { display: none; }

.btn-primary {
  background: var(--accent-grad);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 10px 30px -10px rgba(67, 64, 58, 0.5);
}

.btn-primary:hover { color: #fff; filter: brightness(1.08); transform: translateY(-1px); }

/* ---------- Hero --------------------------------------------------------- */

.hero {
  position: relative;
  padding: 170px 0 110px;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  top: -32%;
  left: 50%;
  width: 1150px;
  height: 1150px;
  transform: translateX(-50%);
  background:
    radial-gradient(520px 520px at 32% 28%, rgba(138, 131, 120, 0.16), transparent 62%),
    radial-gradient(circle, rgba(67, 64, 58, 0.16) 0%, rgba(67, 64, 58, 0) 60%);
  pointer-events: none;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, #000 0%, transparent 75%);
  opacity: 0.35;
  pointer-events: none;
}

.hero .wrap { position: relative; z-index: 1; }

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 6vw, 4.1rem);
  line-height: 1.04;
  letter-spacing: -0.02em;
  font-weight: 700;
  max-width: 15ch;
}

.hero h1 .grad {
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero .lede {
  margin-top: 24px;
  font-size: clamp(1.02rem, 2vw, 1.22rem);
  color: var(--text-muted);
  max-width: 54ch;
}

.hero-cta {
  margin-top: 38px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.hero-note {
  margin-top: 20px;
  font-size: 0.85rem;
  color: var(--text-dim);
}

/* ---------- Stats bar --------------------------------------------------- */

.stats {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}

.stats .wrap {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--border);
}

.stat {
  background: var(--bg-elevated);
  padding: 34px 24px;
  text-align: center;
}

.stat .num {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 4vw, 2.7rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.stat .label {
  margin-top: 6px;
  font-size: 0.82rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

/* ---------- Explorer (browse + filter) ------------------------------------
   Removed 2026-09-20 ("too much to look at" before the catalog was real),
   restored 2026-09-24 at the user's explicit request ("add the filters I
   requested" — the original price/fuel/drivetrain/transmission/cylinders/
   horsepower/engine-capacity set from 2026-09-13). */

.explorer { padding: 96px 0; border-bottom: 1px solid var(--border); }

.search-box { margin-bottom: 18px; }

.search-box input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 14px 20px;
  border-radius: 999px;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s ease;
}

.search-box input:focus { border-color: var(--brand); }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 20px;
}

.filters select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.price-range {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 10px 4px 14px;
  transition: border-color 0.15s ease;
}
.price-range:focus-within { border-color: var(--brand-light); }
.price-range-label,
.price-range-sep { font-size: 0.86rem; color: var(--text-muted); }
.price-range input {
  width: 84px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 0.86rem;
  padding: 6px 4px;
  outline: none;
}
.price-range input::placeholder { color: var(--text-dim); }

.filters select:hover,
.filters select:focus { border-color: var(--brand-light); color: var(--text); }

.filter-count {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 20px;
}

/* ---------- Cards ------------------------------------------------------------
   .card-grid/.car-card render the Explorer's results grid, plus (unchanged
   since 2026-09-20) the "Find My Car" wizard's results and the Compare
   table's headers — all three share this same markup via cardEl(). */

.clear-btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-dim);
  font-size: 0.84rem;
  padding: 10px 12px;
  border-radius: 999px;
}

.clear-btn:hover { color: var(--brand-light); }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 16px;
}

.car-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  text-align: left;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 168px;
}

.car-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-strong);
  background: var(--bg-card-hover);
  box-shadow: var(--glow-shadow);
}

.car-card .card-photo {
  margin: -22px -22px 0;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--bg-elevated);
}

.car-card .card-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.25s ease;
}

.car-card:hover .card-photo img { transform: scale(1.04); }

.car-card .brand-tag {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand-light);
}

.car-card h3 {
  font-size: 1.16rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.car-card .spec-line {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: auto;
}

.car-card .spec-line span:not(:last-child)::after {
  content: "·";
  margin: 0 7px;
  color: var(--text-dim);
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 70px 20px;
  color: var(--text-dim);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}

/* ---------- Modal ------------------------------------------------------------ */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(4, 6, 9, 0.72);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.open { opacity: 1; pointer-events: auto; }

.modal {
  width: 100%;
  max-width: 540px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 30px;
  transform: translateY(12px) scale(0.98);
  transition: transform 0.2s ease;
  max-height: 86vh;
  overflow-y: auto;
}

.modal-overlay.open .modal { transform: none; }

/* Car detail modal only — full screen, not the small floating card every
   other overlay (wizard/brand/compare) still uses. User: "when I press on
   a car you open a small window, I want it on full screen" (2026-10-04).
   Scoped to #modalOverlay specifically rather than changing the shared
   .modal base, so the wizard/brand/compare modals are unaffected. Inner
   horizontal padding scales with viewport width (clamp) so text doesn't
   stretch edge-to-edge uncomfortably on a wide desktop screen, while still
   genuinely filling the viewport on mobile. */
#modalOverlay { padding: 0; }
#modalOverlay .modal {
  max-width: none;
  width: 100%;
  height: 100%;
  max-height: 100%;
  border-radius: 0;
  border: 0;
  padding: 48px clamp(20px, 6vw, 120px);
}

.modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  background: none;
  border: 0;
  color: var(--text-dim);
  font-size: 1.4rem;
  line-height: 1;
}

.modal-close:hover { color: var(--text); }

/* The detail modal's close button can float directly over the new
   full-bleed hero photo (see .modal-gallery-top) — give it a frosted
   backdrop there specifically so it stays legible against any photo,
   without changing the plain look of the wizard/brand/compare modals'
   close buttons. */
#modalOverlay .modal-close {
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  background: rgba(10, 13, 18, 0.55);
  backdrop-filter: blur(6px);
  border-radius: 999px;
  color: #fff;
  z-index: 2;
}

#modalOverlay .modal-close:hover { background: rgba(10, 13, 18, 0.75); color: #fff; }

.modal .brand-tag {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand-light);
}

.modal h3 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 8px 0 18px;
}

.spec-table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 4px;
}

.spec-table td {
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  vertical-align: top;
}

.spec-table td:first-child {
  color: var(--text-dim);
  width: 42%;
  padding-right: 14px;
  font-weight: 500;
}

.spec-table tr:last-child td { border-bottom: 0; }

.modal .note-block {
  margin-top: 18px;
  padding: 14px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  color: var(--text-muted);
}

/* ---------- Modal actions: share / print / download PDF -------------- */

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 20px;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 0.16s ease;
  white-space: nowrap;
}

.action-btn:hover { border-color: var(--brand-light); color: var(--brand-light); }
.action-btn[hidden] { display: none; }
.action-btn.is-flash { border-color: var(--brand-light); color: var(--brand-light); }

.print-header,
.print-footer {
  display: none;
}

/* ---------- Print / "Download PDF" (spec sheet only) ------------------
   Both the Print and Download PDF buttons call window.print() — a static
   site has no backend to render a file, so "download" relies on the
   browser's own "Save as PDF" print destination. This block isolates just
   the open car-detail modal on the page and re-skins it light-on-white,
   with a MotorLB header/footer stamped on so an exported sheet is always
   traceable back to the site. Scoped to #modalOverlay specifically (not
   the shared .modal-overlay/.modal classes) so printing while the wizard
   is open behind a result's detail modal only exports the detail sheet,
   not both stacked overlays. */
@media print {
  /* `visibility: hidden` was the earlier approach here, but a hidden element
     still occupies its layout box and still gets paginated — with ~100 cards
     and every section still "there" (just invisible), the browser laid out
     and paginated that entire hidden page height, scattering the modal's
     actual content across dozens of mostly-blank pages. display:none removes
     everything else from layout entirely, so only the modal's own content is
     paginated, starting from page 1. */
  body > *:not(#modalOverlay) { display: none !important; }
  body::after { display: none !important; }
  html, body { background: #fff !important; height: auto !important; }

  #modalOverlay {
    display: block !important;
    position: static !important;
    background: none !important;
    backdrop-filter: none !important;
    padding: 0 !important;
    opacity: 1 !important;
  }

  #modalOverlay .modal {
    position: static !important;
    max-width: none !important;
    max-height: none !important;
    overflow: visible !important;
    box-shadow: none !important;
    border: 0 !important;
    background: #fff !important;
    color: #000 !important;
    padding: 0 !important;
    transform: none !important;
  }

  #modalOverlay .modal * { color: #000; }

  .no-print { display: none !important; }

  /* .modal-gallery-top's negative margins (see the screen rule) bleed the
     hero photo to the edge of the full-screen modal — meaningless once
     print forces the modal's own padding to 0 above, and left alone would
     pull the image outside the printed page bounds. Reset to a normal
     contained block instead. */
  #modalOverlay .modal-gallery-top {
    margin: 0 0 16px !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }
  #modalOverlay .modal-gallery-top img { border-radius: 4px !important; }

  /* Keep small self-contained boxes from being split across a page break
     with most of the box on one page and a sliver (or nothing) on the next —
     the "warranty box alone on its own page" symptom from the layout bug
     above was made worse by boxes splitting awkwardly once pagination was
     otherwise sane. */
  #modalOverlay .print-header,
  #modalOverlay .note-block,
  #modalOverlay .contact-block,
  #modalOverlay .spec-section,
  #modalOverlay .spec-warranty,
  #modalOverlay .spec-sheet,
  #modalOverlay .spec-sheet figure {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  #modalOverlay .modal a { color: #1f6fe5; text-decoration: underline; }
  #modalOverlay .spec-table td { border-bottom: 1px solid #ccc; }
  #modalOverlay .note-block,
  #modalOverlay .contact-block,
  #modalOverlay .spec-warranty {
    background: #f4f4f4 !important;
    border-color: #ccc !important;
  }
  #modalOverlay .spec-list li::before { background: #999 !important; }
  #modalOverlay .spec-pairs > div { border-bottom-color: #ccc !important; }
  #modalOverlay .spec-sheet img { border-color: #ccc !important; }
  #modalOverlay .sheet-tag {
    background: none !important;
    border-color: #999 !important;
  }

  .print-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 14px;
    margin-bottom: 14px;
    border-bottom: 2px solid #000;
  }
  .print-header img { height: 32px; width: auto; }
  .print-header span {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
  }

  .print-footer {
    display: block;
    margin-top: 24px;
    padding-top: 12px;
    border-top: 1px solid #999;
    font-size: 0.75rem;
    color: #333;
  }
}

/* ---------- Deep spec sheet (modal) --------------------------------- */

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.sheet-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  color: var(--brand-light);
  border: 1px solid rgba(107, 102, 96, 0.35);
  background: rgba(107, 102, 96, 0.08);
}

.sheet-tag::before {
  content: "◆";
  font-size: 0.7em;
}

.spec-details:not(:empty) { margin-top: 20px; }

.spec-section { margin-top: 18px; }
.spec-section:first-child { margin-top: 0; }

.spec-section h5 {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand-light);
  margin-bottom: 10px;
}

.spec-list {
  list-style: none;
  display: grid;
  gap: 7px;
}

.spec-list li {
  position: relative;
  padding-left: 18px;
  font-size: 0.86rem;
  color: var(--text-muted);
}

.spec-list li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 8px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--border-strong);
}

.spec-pairs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 18px;
}

.spec-pairs > div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 7px;
  font-size: 0.86rem;
}

.spec-pairs dt { color: var(--text-dim); }
.spec-pairs dd { color: var(--text); text-align: right; }

/* ---------- Fixed feature checklist (FEATURE_SCHEMA) ------------------ */

.feature-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 18px;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
  color: var(--text-muted);
}

.feature-item .mark {
  flex: none;
  width: 14px;
  text-align: center;
  font-weight: 700;
}

.feature-item.is-yes .mark { color: var(--ok); }
.feature-item.is-no { color: var(--text-dim); }
.feature-item.is-no .mark { color: var(--text-dim); }

.feature-item .value {
  color: var(--text);
  font-weight: 600;
}

/* ---------- Compare -------------------------------------------------- */

.compare-toggle {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: rgba(10, 13, 18, 0.72);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.16s ease;
}

.compare-toggle:hover { border-color: var(--brand-light); color: var(--brand-light); }

.compare-toggle.is-selected {
  background: var(--accent-grad);
  border-color: transparent;
  color: #fff;
}

.compare-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 260;
  background: var(--bg-card);
  border-top: 1px solid var(--border-strong);
  box-shadow: 0 -12px 30px -14px rgba(30, 20, 10, 0.22);
  padding: 14px 24px;
}

.compare-bar[hidden] { display: none; }

.compare-bar-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.compare-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 160px;
}

.compare-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 6px 6px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}

.compare-chip-remove {
  background: none;
  border: 0;
  color: var(--text-dim);
  font-size: 1rem;
  line-height: 1;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.compare-chip-remove:hover { color: var(--text); background: var(--bg-card-hover); }

.compare-hint { font-size: 0.82rem; color: var(--warn); flex-basis: 100%; }
.compare-hint[hidden] { display: none; }

.compare-bar-actions { display: flex; align-items: center; gap: 10px; }
.compare-count { font-size: 0.8rem; color: var(--text-dim); white-space: nowrap; }

.compare-modal { max-width: 960px; }

.compare-diff-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
  color: var(--text-muted);
  margin: -6px 0 18px;
  cursor: pointer;
}

.compare-scroll {
  overflow-x: auto;
  margin: 0 -30px;
  padding: 0 30px;
}

.compare-table {
  display: grid;
  grid-template-columns: 160px repeat(var(--compare-cols), minmax(180px, 1fr));
  min-width: 640px;
}

.compare-row { display: contents; }

.compare-row > * {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 0.86rem;
}

.compare-row-label {
  color: var(--text-dim);
  font-weight: 500;
  position: sticky;
  left: 0;
  background: var(--bg-card);
}

.compare-cell { color: var(--text); text-align: center; }
.compare-cell.feature-item { display: inline-flex; width: 100%; justify-content: center; }
.compare-none { color: var(--text-dim); }

.compare-row.is-diff > * { background: rgba(107, 102, 96, 0.07); }
.compare-row.is-diff .compare-row-label { background: rgba(107, 102, 96, 0.12); }

.compare-group-title .compare-row-label {
  color: var(--brand-light);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  padding-top: 18px;
  border-bottom: 0;
}

.compare-group-title > div:not(.compare-row-label) { border-bottom: 0; }

.compare-header > .compare-col-header {
  padding: 0 12px 16px;
  border-bottom: 2px solid var(--border-strong);
}

.compare-col-header {
  text-align: center;
  position: relative;
}

.compare-remove {
  position: absolute;
  top: -4px;
  right: 4px;
  background: none;
  border: 0;
  color: var(--text-dim);
  font-size: 1.1rem;
  line-height: 1;
  width: 24px;
  height: 24px;
}

.compare-remove:hover { color: var(--text); }

.compare-photo {
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-elevated);
  margin-bottom: 10px;
}

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

.compare-col-header .brand-row { justify-content: center; margin-bottom: 4px; }
.compare-col-header h4 { font-size: 0.98rem; font-weight: 700; }

.compare-view-btn {
  background: none;
  border: 0;
  color: var(--brand-light);
  font-size: 0.78rem;
  font-weight: 600;
  margin-top: 6px;
}

.compare-view-btn:hover { text-decoration: underline; }

.compare-empty { color: var(--text-muted); padding: 30px 0; text-align: center; }

.spec-warranty {
  font-size: 0.86rem;
  color: var(--text-muted);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.spec-sheet { margin-top: 20px; }

.spec-sheet img {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.spec-sheet figcaption {
  margin-top: 8px;
  font-size: 0.76rem;
  color: var(--text-dim);
}

.spec-sheet figcaption a { color: var(--brand-light); }

.spec-gallery {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.spec-gallery figure { margin: 0; }

.spec-gallery img {
  width: 100%;
  display: block;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}

.spec-gallery figcaption {
  margin-top: 6px;
  font-size: 0.74rem;
  color: var(--text-dim);
}

.gallery-note {
  margin-top: 8px;
  font-size: 0.72rem;
  color: var(--text-dim);
  font-style: italic;
}

/* Hero photo slot at the very top of the car detail modal, above brand/
   title/specs — single full-width column (not the 2-up .spec-gallery grid
   used further down the page) so it reads as one prominent hero shot,
   even if a model ever has more than one gallery photo. */
.modal-gallery-top.spec-gallery {
  grid-template-columns: 1fr;
  margin: -48px calc(-1 * clamp(20px, 6vw, 120px)) 28px;
}

.modal-gallery-top img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 0;
  border: 0;
}

.modal-gallery-top figcaption { margin: 8px clamp(20px, 6vw, 120px) 0; }

@media (max-width: 640px) {
  .modal-gallery-top.spec-gallery { margin-bottom: 20px; }
}

@media (max-width: 520px) {
  .spec-pairs { grid-template-columns: 1fr; }
  .spec-gallery { grid-template-columns: 1fr; }
}

/* ---------- Coverage / brands -------------------------------------------- */

.coverage { padding: 96px 0; background: var(--bg-elevated); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }

.browse-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 22px; }
.browse-actions .btn[hidden] { display: none; }
#brandGrid[hidden], #cardGrid[hidden], .show-more[hidden] { display: none; }
.show-more { display: flex; justify-content: center; margin-top: 28px; }

.brand-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

/* Reverted to the site's usual dark theme 2026-09-24 at the user's request
   ("change them back to the way they were before"). Note this brings back
   the faint-dark-logo problem the 2026-09-21 light-card version (#eef1f5
   bg, dark text) was built to fix — Kia/Nissan/Seat/Cadillac/GMC/
   Mercedes-Benz/etc. read low-contrast on dark again. Known tradeoff,
   flagged to the user before reverting; don't "fix" it by silently
   re-adding a glow/badge (rejected earlier) or the light card without a
   fresh ask. */
.brand-chip {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-chip:hover { border-color: var(--brand); transform: translateY(-2px); box-shadow: var(--glow-shadow); }

.brand-chip .b-text { min-width: 0; }
.brand-chip .b-name {
  font-weight: 650;
  font-size: 0.95rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-chip .b-count { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }

/* ---------- Brand logos --------------------------------------------------- */

/* No badge/chip, no glow on the logo image itself — the PNGs are properly
   background-removed (transparent). Coverage now sits them on a light
   .brand-chip card (above) specifically so dark/metallic marks (Kia,
   Nissan, Seat, Cadillac, GMC, Mercedes-Benz, etc.) get real contrast;
   cards and the detail modal still place them on the dark theme as-is —
   known faint-logo tradeoff there, see site/README.md. */
.brand-logo {
  flex: none;
  display: grid;
  place-items: center;
}

.brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.brand-logo.sm { width: 30px; height: 30px; }
.brand-logo.md { width: 48px; height: 48px; }
.brand-logo.tag { width: 24px; height: 24px; }

.brand-row { display: flex; align-items: center; gap: 8px; }

#modalBrand { display: inline-flex; align-items: center; gap: 7px; }

/* ---------- News ------------------------------------------------------------ */

.news { padding: 96px 0; border-top: 1px solid var(--border); }

.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  margin-bottom: 40px;
}

.news-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.news-meta { display: flex; align-items: center; gap: 10px; }

.news-tag {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
}

.news-tag.is-release { color: var(--brand-light); border-color: rgba(107, 102, 96, 0.35); background: rgba(107, 102, 96, 0.08); }
.news-tag.is-availability { color: var(--ok); border-color: rgba(47, 191, 113, 0.35); background: rgba(47, 191, 113, 0.08); }

.news-date { font-size: 0.8rem; color: var(--text-dim); }

.news-card h3 { font-family: var(--font-display); font-size: 1.1rem; font-weight: 700; letter-spacing: -0.01em; }
.news-card p { color: var(--text-muted); font-size: 0.9rem; }
.news-card a { color: var(--brand-light); font-size: 0.86rem; font-weight: 600; margin-top: auto; }
.news-card a:hover { text-decoration: underline; }

.newsletter {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 30px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px 24px;
  flex-wrap: wrap;
}

.newsletter-text h3 { font-family: var(--font-display); font-size: 1.15rem; font-weight: 700; margin-bottom: 6px; }
.newsletter-text p { color: var(--text-muted); font-size: 0.9rem; max-width: 42ch; }

.newsletter-form { display: flex; gap: 10px; flex: none; }

.newsletter-form input {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 11px 16px;
  border-radius: 999px;
  font-size: 0.9rem;
  min-width: 220px;
  outline: none;
  transition: border-color 0.15s ease;
}

.newsletter-form input:focus { border-color: var(--brand); }

.newsletter-note {
  flex-basis: 100%;
  font-size: 0.76rem;
  color: var(--text-dim);
  margin-top: -8px;
}

/* ---------- Partners (dealers/importers) --------------------------------- */

.partners { padding: 96px 0; border-top: 1px solid var(--border); }

.partner-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 40px;
}

.partner-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 26px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.partner-card .num {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--brand-light);
  margin-bottom: 6px;
}

.partner-card h3 { font-family: var(--font-display); font-size: 1.05rem; font-weight: 700; letter-spacing: -0.01em; }
.partner-card p { color: var(--text-muted); font-size: 0.9rem; }

.partner-link {
  margin-top: 10px;
  color: var(--brand-light);
  font-size: 0.86rem;
  font-weight: 600;
}

.partner-link:hover { text-decoration: underline; }

@media (max-width: 780px) {
  .partner-grid { grid-template-columns: 1fr; }
}

/* ---------- CTA / footer --------------------------------------------------- */

.cta {
  padding: 96px 0;
  text-align: center;
  background:
    radial-gradient(ellipse 60% 100% at 50% 0%, rgba(67, 64, 58, 0.16), transparent 70%),
    var(--bg);
  border-top: 1px solid var(--border);
}

.cta h2 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  max-width: 18ch;
  margin: 0 auto 16px;
}

.cta p { color: var(--text-muted); max-width: 52ch; margin: 0 auto 30px; }

.cta-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 46px 0 40px;
  background: var(--bg-elevated);
}

.site-footer .wrap {
  display: flex;
  justify-content: space-between;
  gap: 30px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.site-footer .f-brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; }
.site-footer .f-brand img { height: 28px; border-radius: 5px; }
.site-footer .f-tag { color: var(--text-dim); font-size: 0.84rem; margin-top: 10px; max-width: 32ch; font-style: italic; }

.site-footer .f-links { display: flex; gap: 40px; flex-wrap: wrap; }
.site-footer .f-col h5 { font-size: 0.78rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 12px; }
.site-footer .f-col a { display: block; font-size: 0.88rem; color: var(--text-muted); padding: 4px 0; }
.site-footer .f-col a:hover { color: var(--text); }

.footer-legal {
  border-top: 1px solid var(--border);
  margin-top: 36px;
  padding-top: 22px;
  font-size: 0.78rem;
  color: var(--text-dim);
  line-height: 1.7;
}

/* ---------- Account button ------------------------------------------------ */

.btn.is-owner {
  background: rgba(107, 102, 96, 0.14);
  border-color: rgba(107, 102, 96, 0.45);
  color: var(--brand-light);
}

.btn.is-owner:hover { color: var(--brand-light); filter: brightness(1.12); transform: none; }

/* ---------- Dealer contact panel (car modal) --------------------------------- */

.contact-block { margin-top: 18px; }

.contact-unlocked {
  padding: 16px 18px;
  background: rgba(47, 191, 113, 0.07);
  border: 1px solid rgba(47, 191, 113, 0.3);
  border-radius: var(--radius-sm);
}

.contact-flag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ok);
  margin-bottom: 10px;
}

.contact-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-top: 1px solid rgba(47, 191, 113, 0.18);
  font-size: 0.9rem;
}

.contact-row:first-of-type { border-top: 0; }
.contact-row span { color: var(--text-muted); }
.contact-row strong { color: var(--text); font-weight: 600; }

/* ---------- Find My Car wizard ------------------------------------------ */

/* Car detail modal always wins over the wizard modal it can be opened from
   on top of. */
#modalOverlay { z-index: 220; }

/* Brand models (opened from Coverage) sits above the wizard, and Compare
   above that — both mutually exclusive entry points from the base page —
   with the detail modal always on top regardless of which one it was
   opened from, same nested-overlay pattern throughout. */
#brandOverlay { z-index: 205; }
#compareOverlay { z-index: 210; }

.wizard-modal { max-width: 620px; }
/* Brand models — full screen, like the car detail modal (user request
   2026-10-13: "when i press on a brand let it open in full screen"). */
#brandOverlay { padding: 0; }
.brand-modal {
  max-width: none;
  width: 100%;
  height: 100%;
  max-height: 100%;
  border-radius: 0;
  border: 0;
  padding: 72px clamp(20px, 6vw, 120px) 48px;
}
.brand-modal .brand-row { margin-bottom: 8px; }
.brand-back {
  display: inline-block;
  background: none;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 8px 16px;
  margin-bottom: 18px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text);
}
.brand-back[hidden] { display: none; }
.brand-back:hover { border-color: var(--brand); background: var(--bg-card-hover); }
.family-card { cursor: pointer; }
.family-go { display: block; margin-top: 14px; font-size: 0.86rem; font-weight: 650; color: var(--brand); }
.family-card:hover .family-go { color: var(--brand-dark); text-decoration: underline; }

.wizard-progress {
  display: flex;
  gap: 6px;
  margin-bottom: 24px;
}

.wizard-progress span {
  flex: 1;
  height: 4px;
  border-radius: 999px;
  background: var(--border);
  transition: background 0.2s ease;
}

.wizard-progress span.done { background: var(--accent-grad); }

.wizard-sub { color: var(--text-muted); font-size: 0.9rem; margin-top: -10px; margin-bottom: 4px; }

.wizard-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 22px 0 20px;
}

.wizard-price {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-end;
  margin: 22px 0 20px;
}
.wizard-price label {
  flex: 1 1 150px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}
.wp-field {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 14px;
  font-size: 1rem;
  color: var(--text-muted);
}
.wp-field:focus-within { border-color: var(--brand); }
.wp-field input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 1rem;
  padding: 14px 0;
  outline: none;
}

.wizard-option {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  text-align: left;
  font-size: 0.94rem;
  font-weight: 650;
  color: var(--text);
  transition: border-color 0.15s ease, transform 0.15s ease, background 0.15s ease;
}

.wizard-option:hover {
  border-color: var(--brand);
  transform: translateY(-2px);
  background: var(--bg-card-hover);
  box-shadow: var(--glow-shadow);
}

.wizard-option .opt-sub {
  display: block;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-dim);
  margin-top: 4px;
}

.wizard-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.wizard-nav button {
  background: none;
  border: 0;
  padding: 4px 2px;
  color: var(--text-dim);
  font-size: 0.85rem;
  font-weight: 600;
}

.wizard-nav button:hover:not(:disabled) { color: var(--brand-light); }
.wizard-nav button:disabled { opacity: 0.35; cursor: default; }

.wizard-results .card-grid {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  margin: 20px 0 22px;
}

.wizard-footer-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.wizard-footer-actions .btn { flex: 1; justify-content: center; min-width: 180px; }

@media (max-width: 520px) {
  .wizard-options { grid-template-columns: 1fr; }
}

/* ---------- Reveal animation -------------------------------------------- */

.reveal { opacity: 0; transform: translateY(20px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Responsive ------------------------------------------------------- */

@media (max-width: 860px) {
  .nav-links { gap: 18px; }
}

@media (max-width: 520px) {
  .wrap { padding: 0 18px; }
  .hero { padding: 140px 0 80px; }
  .stats .wrap { grid-template-columns: 1fr; }
  .nav-links { gap: 12px; }
  .nav-links a { font-size: 0.8rem; }
  .brand-mark span { font-size: 0.95rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
  .reveal { opacity: 1; transform: none; }
}

/* ---------- Expert advice (paid second opinion) -------------------------- */

#adviceOverlay { z-index: 215; }
.advice-modal { max-width: 640px; }

.advice { padding: 96px 0; border-top: 1px solid var(--border); }

.advice-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 40px;
}

.advice-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 26px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.advice-card .num {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--brand-light);
  margin-bottom: 6px;
}

.advice-card h3 { font-family: var(--font-display); font-size: 1.05rem; font-weight: 700; }
.advice-card p { color: var(--text-muted); font-size: 0.9rem; }

.advice-pick {
  margin-top: 10px;
  align-self: flex-start;
  background: none;
  border: 0;
  padding: 0;
  color: var(--brand);
  font-size: 0.86rem;
  font-weight: 600;
}

.advice-pick:hover { text-decoration: underline; }

@media (max-width: 780px) {
  .advice-grid { grid-template-columns: 1fr; }
}

/* "What's next" panel under the Compare table */
.next-step { margin-top: 32px; padding-top: 28px; border-top: 1px solid var(--border); }
.next-step h4 { font-family: var(--font-display); font-size: 1.2rem; margin-bottom: 14px; }

.next-step-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.next-step-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}

.next-step-card h5 { font-size: 0.78rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-dim); }
.next-step-card p { color: var(--text-muted); font-size: 0.9rem; }

.next-step-dealers { list-style: none; width: 100%; display: grid; gap: 8px; margin-top: 4px; }
.next-step-dealers li { display: flex; flex-direction: column; font-size: 0.85rem; color: var(--text-muted); }
.next-step-dealers li strong { color: var(--text); font-weight: 600; }
.next-step-dealers a { color: var(--brand); text-decoration: underline; }

@media (max-width: 640px) {
  .next-step-grid { grid-template-columns: 1fr; }
}

/* Request form */
.advice-lead { color: var(--text-muted); font-size: 0.92rem; margin-bottom: 18px; }
#adviceForm { display: grid; gap: 16px; }
.advice-field { border: 0; display: grid; gap: 6px; min-width: 0; }
.advice-field legend,
.advice-label { font-size: 0.78rem; font-weight: 600; letter-spacing: 0.04em; color: var(--text-muted); margin-bottom: 4px; }

#adviceForm input[type="text"],
#adviceForm input[type="tel"],
#adviceForm input[type="email"],
#adviceForm textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.9rem;
  outline: none;
  resize: vertical;
  transition: border-color 0.15s ease;
}

#adviceForm input:focus,
#adviceForm textarea:focus { border-color: var(--brand); }

.advice-cars { list-style: none; display: grid; gap: 6px; }
.advice-cars li {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  font-size: 0.9rem;
  font-weight: 600;
}

.advice-options { display: grid; gap: 8px; }

.advice-option {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.advice-option:hover { border-color: var(--border-strong); }
.advice-option:has(input:checked) { border-color: var(--brand); background: var(--bg-card); }
.advice-option input { margin-top: 4px; accent-color: var(--brand); }
.advice-option-body { display: grid; gap: 2px; font-size: 0.86rem; color: var(--text-muted); }
.advice-option-body strong { color: var(--text); font-size: 0.92rem; }
.advice-option-body em { font-style: normal; font-size: 0.78rem; color: var(--text-dim); }

.advice-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
@media (max-width: 640px) { .advice-row { grid-template-columns: 1fr; } }

.advice-error { color: #b3261e; font-size: 0.86rem; }
.advice-note { font-size: 0.76rem; color: var(--text-dim); }
#adviceForm .btn { justify-self: start; }

/* The fixed compare tray (z-index 260) would cover the end of these two
   overlays' scroll area — hide it while the advice form is open (it's a
   form, the tray is just noise there) and leave room under the compare
   view so its "what's next" buttons are never hidden behind the tray. */
body:has(#adviceOverlay.open) .compare-bar { display: none; }
.compare-modal { padding-bottom: 130px; }

/* ---------- Separate pages (2026-10-08) ------------------------------------
   The site used to be one long page with #anchors; it's now one HTML file
   per page (see README -> "Pages"). These rules cover what that split needs:
   room under the fixed header for whichever section starts a page, a nav
   that tells you where you are, and a nav that still fits on a phone now
   that there are seven entries instead of five. */

.page-main > section:first-child:not(.hero) { padding-top: 150px; border-top: 0; }

.nav-links a.is-active {
  color: var(--text);
  box-shadow: 0 2px 0 0 var(--brand);
  padding-bottom: 3px;
}

.brand-mark { flex: none; }
.site-header .wrap { gap: 20px; }
.nav-links {
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  justify-content: flex-end;
}
.nav-links::-webkit-scrollbar { display: none; }
.nav-links a { white-space: nowrap; flex: none; }

@media (max-width: 1100px) { .nav-links { gap: 22px; } }
@media (max-width: 860px) {
  .nav-links { gap: 18px; justify-content: flex-start; }
  .site-header .wrap { gap: 14px; }
}

.text-link { color: var(--brand); text-decoration: underline; }

/* Home: "where to next" cards */
.quick { padding: 90px 0 100px; }

.quick-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.quick-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 24px;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.quick-card:hover { transform: translateY(-3px); border-color: var(--border-strong); box-shadow: var(--glow-shadow); }
.quick-card .num { font-family: var(--font-display); font-size: 1.4rem; font-weight: 700; color: var(--brand-light); }
.quick-card h3 { font-family: var(--font-display); font-size: 1.1rem; font-weight: 700; }
.quick-card p { color: var(--text-muted); font-size: 0.88rem; flex: 1; }
.quick-go { margin-top: 10px; color: var(--brand); font-size: 0.86rem; font-weight: 600; }

@media (max-width: 960px) { .quick-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .quick-grid { grid-template-columns: 1fr; } }

/* Hint that the phone nav scrolls sideways: fade the right edge. */
@media (max-width: 900px) {
  .nav-links {
    -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent);
    mask-image: linear-gradient(90deg, #000 88%, transparent);
    padding-right: 18px;
  }
}

/* ---------- Cut-out car renders (Porsche images, 2026-10-08) ------------------
   Transparent side-view renders are ~3:1 wide. The regular photo slots crop
   to 16:9 with object-fit: cover, which would cut the nose and tail off the
   car — so for gallery items flagged `cutout` the whole car is shown, centred
   on a plain backdrop. The image is absolutely positioned to fill a box whose
   size comes from aspect-ratio: sizing it with `height: 100%` inside a grid/
   auto-height parent collapses to 0 in Safari, which made the pictures
   vanish for the first Safari viewer. Absolute fill works the same in every
   browser. */
.car-card .card-photo.is-cutout { position: relative; aspect-ratio: 16 / 8; background: var(--bg-elevated); }
.car-card .card-photo.is-cutout img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 14px 16px;
}
.car-card:hover .card-photo.is-cutout img { transform: scale(1.03); }

.compare-photo.is-cutout { position: relative; background: var(--bg-elevated); }
.compare-photo.is-cutout img { position: absolute; inset: 0; object-fit: contain; padding: 8px; }

.modal-gallery-top.is-cutout img {
  object-fit: contain;
  aspect-ratio: 16 / 7;
  height: auto;
  padding: 36px clamp(20px, 8vw, 140px);
  background: var(--bg-elevated);
}

/* Playfair defaults to old-style numerals, which makes "911"/"718" look tiny
   next to letters — use lining figures on model headings. */
.car-card h3, #brandOverlayTitle { font-variant-numeric: lining-nums; }


/* ---------- Store app (Capacitor) & notched phones ---------------------------
   viewport-fit=cover lets the page run under the notch / home indicator, so
   the fixed header and compare tray keep clear of them via the safe-area
   insets (all 0 on a normal desktop browser, so no visible change there). */
.site-header { padding-top: env(safe-area-inset-top); }
.compare-bar { padding-bottom: env(safe-area-inset-bottom); }
.modal-overlay .modal-close,
#modalOverlay .modal-close { top: calc(16px + env(safe-area-inset-top)); }
.page-main > section:first-child:not(.hero) { padding-top: calc(150px + env(safe-area-inset-top)); }
.hero { padding-top: calc(170px + env(safe-area-inset-top)); }
/* Printing/PDF export doesn't work inside the app's web view. */
.is-native-app #printSheet,
.is-native-app #downloadPdf { display: none; }


/* ---------- Back button + phone-friendly compare (2026-10-14) --------------------
   User (iPhone app): "make the go back button more obvious" / compare "not working
   well on the phone" / compare 2 cars as well as 3. */

.modal-back { display: none; }
#modalOverlay .modal-back,
#brandOverlay .modal-back { display: inline-flex; }

.modal-back {
  position: fixed;
  top: calc(14px + env(safe-area-inset-top));
  left: 16px;
  z-index: 5;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 20px 0 16px;
  border: 0;
  border-radius: 999px;
  background: rgba(28, 26, 24, 0.86);
  backdrop-filter: blur(8px);
  color: #fff;
  font-size: 1rem;
  font-weight: 650;
  box-shadow: 0 6px 18px -6px rgba(0, 0, 0, 0.45);
  cursor: pointer;
}
.modal-back:hover { background: rgba(28, 26, 24, 1); }

/* The in-page "All <brand> models" step-back button: bigger, filled. */
.brand-back {
  min-height: 44px;
  padding: 0 20px;
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-size: 0.95rem;
}
.brand-back:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.brand-modal { padding-top: calc(72px + env(safe-area-inset-top)); }

/* Bigger touch targets for the + / ✓ compare button and tray chips on touch screens. */
@media (pointer: coarse) {
  .compare-toggle { width: 44px; height: 44px; top: 8px; right: 8px; font-size: 1.4rem; }
  .compare-chip-remove { width: 30px; height: 30px; font-size: 1.2rem; }
  .compare-remove { width: 40px; height: 40px; top: -8px; right: -6px; font-size: 1.4rem; }
}

@media (max-width: 700px) {
  /* Compare opens full screen on phones, with the cars side by side (2 or 3 columns)
     and each row's label above its values — no sideways scrolling. */
  #compareOverlay { padding: 0; }
  #compareOverlay .modal-back { display: inline-flex; }
  #compareOverlay .compare-modal {
    max-width: none;
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    border: 0;
    padding: calc(76px + env(safe-area-inset-top)) 14px calc(150px + env(safe-area-inset-bottom));
  }
  .compare-scroll { margin: 0; padding: 0; overflow-x: visible; }
  .compare-table {
    grid-template-columns: repeat(var(--compare-cols), minmax(0, 1fr));
    min-width: 0;
    column-gap: 6px;
  }
  .compare-row-label {
    grid-column: 1 / -1;
    position: static;
    background: transparent !important;
    padding: 12px 4px 2px;
    border-bottom: 0;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-dim);
  }
  .compare-header > .compare-row-label,
  .compare-group-title > div:not(.compare-row-label) { display: none; }
  .compare-group-title .compare-row-label { padding-top: 22px; color: var(--brand); }
  .compare-row > * { padding: 4px 6px 10px; font-size: 0.84rem; overflow-wrap: anywhere; }
  .compare-row.is-diff .compare-cell { background: rgba(107, 102, 96, 0.1); border-radius: 8px; }
  .compare-row.is-diff .compare-row-label { background: transparent; }
  .compare-header > .compare-col-header { padding: 0 6px 14px; }
  .compare-col-header h4 { font-size: 0.86rem; line-height: 1.25; }
  .compare-col-header .brand-row { display: none; }
  .compare-view-btn { font-size: 0.74rem; }

  /* Tray: full-width, count on top, Compare button full width and easy to hit. */
  .compare-bar { padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); }
  .compare-bar-inner { gap: 10px; }
  .compare-bar-actions { width: 100%; flex-wrap: wrap; gap: 8px 12px; }
  .compare-count { flex-basis: 100%; }
  .compare-bar-actions .clear-btn { flex: 0 0 auto; }
  .compare-bar-actions .btn { flex: 1 1 0; min-width: 0; min-height: 48px; justify-content: center; }
  .compare-chip { font-size: 0.78rem; }
  /* While the comparison is open the tray is redundant (cars are removed with the × on
     each photo) and would cover half the table on a phone. */
  body:has(#compareOverlay.open) .compare-bar { display: none; }
  #compareOverlay .compare-modal { padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
}

/* ---------- Phone/app interface pass (2026-10-14) --------------------------------
   1. App UI (`html.is-app` — the store app, or any page opened with ?appui=1): bottom tab bar
      instead of the top menu, no footer.
   2. Filters panel on phones + removable active-filter tags (all sizes).
   3. Compact home hero in the app.   4. Two brand cards per row on phones. */

/* --- search row + active filter tags (all sizes) --- */
.search-row { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 14px; }
.search-row .search-box { flex: 1; margin: 0; }
.filters-toggle, .filters-sheet-head, .filters-sheet-foot { display: none; }
.active-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.active-filters:empty { display: none; }
.filter-tag {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 34px; padding: 0 12px 0 14px;
  border: 1px solid var(--border-strong); border-radius: 999px;
  background: var(--bg-card); color: var(--text); font-size: 0.82rem; font-weight: 600;
}
.filter-tag span { color: var(--text-dim); font-size: 1.05rem; line-height: 1; }
.filter-tag:hover { border-color: var(--brand); }

/* --- tab bar + More sheet (only rendered in app UI) --- */
.tab-bar { display: none; }
.is-app { --tabbar-h: 64px; }
.is-app .tab-bar {
  display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 150;
  background: rgba(251, 248, 243, 0.95); backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
}
.tab-bar a, .tab-bar button {
  flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-height: 52px; background: none; border: 0; color: var(--text-dim);
  font-size: 0.68rem; font-weight: 650; text-decoration: none; cursor: pointer;
}
.tab-bar svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tab-bar .is-active { color: var(--text); }
.tab-bar .is-active svg { stroke-width: 2.3; }
.tab-badge {
  position: absolute; top: 3px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px;
  display: grid; place-items: center; border-radius: 9px; background: var(--brand); color: #fff;
  font-size: 0.66rem; font-style: normal; font-weight: 700;
}
.tab-badge[hidden] { display: none; }

.is-app body { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
.is-app .nav-links, .is-app .site-footer, .is-app #ownerBtn { display: none; }
.is-app .site-header .wrap { height: 60px; }
.is-app .page-main > section:first-child:not(.hero) { padding-top: calc(100px + env(safe-area-inset-top)); }
/* The compare tray sits just above the tab bar; full-screen overlays cover both. */
.is-app .compare-bar { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: 12px; }
.is-app body:has(.modal-overlay.open) .compare-bar { bottom: 0; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }

.more-overlay {
  position: fixed; inset: 0; z-index: 280; display: flex; align-items: flex-end;
  background: rgba(20, 16, 12, 0.5); opacity: 0; pointer-events: none; transition: opacity 0.2s ease;
}
.more-overlay.open { opacity: 1; pointer-events: auto; }
.more-sheet {
  width: 100%; max-height: 88%; overflow-y: auto; background: var(--bg-card);
  border-radius: 22px 22px 0 0; padding: 12px 20px calc(24px + env(safe-area-inset-bottom));
  transform: translateY(24px); transition: transform 0.22s ease;
}
.more-overlay.open .more-sheet { transform: none; }
.more-handle { width: 40px; height: 5px; border-radius: 3px; background: var(--border-strong); margin: 0 auto 14px; }
.more-sheet h3 { font-size: 1.4rem; margin-bottom: 8px; }
.more-links a {
  display: block; padding: 14px 4px; border-bottom: 1px solid var(--border); color: var(--text); text-decoration: none;
}
.more-links a b { display: block; font-size: 1.02rem; }
.more-links a small { display: block; margin-top: 2px; color: var(--text-muted); font-size: 0.82rem; }
.more-links a.is-active b { text-decoration: underline; }
.more-legal { margin: 16px 0; font-size: 0.74rem; line-height: 1.5; color: var(--text-dim); }
.more-close {
  width: 100%; min-height: 48px; border: 1px solid var(--border-strong); border-radius: 999px;
  background: none; color: var(--text); font-size: 0.95rem; font-weight: 650;
}

/* --- compact home hero in the app --- */
.is-app .hero { padding: calc(92px + env(safe-area-inset-top)) 0 32px; }
.is-app .hero h1 { font-size: 2.15rem; line-height: 1.1; }
.is-app .hero .lede { display: none; }
.is-app .hero-cta { margin-top: 24px; flex-direction: column; align-items: stretch; gap: 10px; }
.is-app .hero-cta .btn { justify-content: center; min-height: 52px; }
.is-app .hero-note { margin-top: 14px; }
.is-app .stats .wrap { grid-template-columns: repeat(2, 1fr); }
.is-app .stat { padding: 18px 10px; }
.is-app .quick { padding-top: 40px; }
.is-app body[data-page="cars"] .section-head p { display: none; }

@media (max-width: 700px) {
  /* --- filters become a full-screen panel behind a Filters button --- */
  .filters-toggle {
    display: inline-flex; align-items: center; gap: 8px; min-height: 52px; padding: 0 20px;
    border: 1px solid var(--border-strong); border-radius: 999px; background: var(--bg-card);
    color: var(--text); font-size: 0.95rem; font-weight: 650;
  }
  .filters-badge {
    display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px;
    border-radius: 11px; background: var(--brand); color: #fff; font-size: 0.74rem; font-weight: 700;
  }
  .filters-badge[hidden] { display: none; }
  .filters {
    display: none; position: fixed; inset: 0; z-index: 300; margin: 0;
    background: var(--bg); overflow-y: auto; flex-direction: column; align-items: stretch; flex-wrap: nowrap; gap: 12px;
    padding: calc(92px + env(safe-area-inset-top)) 18px calc(110px + env(safe-area-inset-bottom));
  }
  body.filters-open .filters { display: flex; }
  .filters select { width: 100%; min-height: 50px; font-size: 1rem; }
  .filters .price-range { width: 100%; }
  .filters .price-range input { flex: 1; width: auto; min-width: 0; font-size: 1rem; }
  .filters .clear-btn { align-self: flex-start; }
  .filters-sheet-head {
    display: flex; align-items: center; justify-content: space-between; position: fixed; top: 0; left: 0; right: 0; z-index: 2;
    padding: calc(14px + env(safe-area-inset-top)) 18px 12px; background: var(--bg); border-bottom: 1px solid var(--border);
  }
  .filters-sheet-head h3 { font-size: 1.4rem; }
  .filters-sheet-close { width: 44px; height: 44px; border: 0; background: none; font-size: 2rem; line-height: 1; color: var(--text-muted); }
  .filters-sheet-foot {
    display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 2;
    padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--border);
  }
  .filters-sheet-foot .btn { width: 100%; min-height: 52px; justify-content: center; }

  /* --- two brand cards per row --- */
  .brand-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .brand-chip { flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px; }
  .brand-chip .brand-logo.md { width: 64px; height: 40px; }
  .brand-chip .b-text { width: 100%; }
  .brand-chip .b-name { font-size: 0.92rem; }
}

/* Safari/WKWebView: `height:100%` on an <img> inside a grid box can ignore the box height (tall logos such as
   Avatr overflowed onto the brand name in the iPhone app), so fill the box absolutely instead. */
.brand-logo { position: relative; display: block; }
.brand-logo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }


/* ---------- MotorLB wordmark (logo option A): italic condensed caps, "LB" in bronze ---------- */
.brand-mark span,
.site-footer .f-brand span,
.print-header span {
  font-family: "Barlow Condensed", var(--font-display);
  font-style: italic; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.01em; font-size: 1.55em;
}
.brand-mark .iq,
.site-footer .f-brand span span,
.print-header span span { color: #9a7b4f !important; }
.brand-mark img { border-radius: 8px; }
/* LB sits inside the wordmark span — don't scale it twice. */
.brand-mark span span,
.site-footer .f-brand span span,
.print-header span span { font-size: 1em; }


/* ---------- App feel: no zoom, no text-selection/long-press menus, no rubber-band ---------- */
.is-app { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
.is-app body, .is-app a, .is-app button { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.is-app body { overscroll-behavior-y: none; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.is-app input, .is-app textarea, .is-app select { -webkit-user-select: text; user-select: text; font-size: 16px; } /* 16px stops iOS zooming into focused fields */
.is-app img { -webkit-user-drag: none; -webkit-touch-callout: none; }


/* ---------- Touch fixes (2026-10-14, from iPhone-app testing) ---------- */
/* Hover styles stick after a tap on touch screens (cards stayed "pressed"). */
@media (hover: none) {
  .car-card:hover, .brand-chip:hover, .quick-card:hover { transform: none; box-shadow: none; }
  .car-card:hover { background: var(--bg-card); border-color: var(--border); }
  .brand-chip:hover { border-color: var(--border); }
}
/* One-row compare tray on phones: scrolling chips + a clear Compare button (was ~300px tall). */
@media (max-width: 700px) {
  .compare-bar { padding: 8px 12px; }
  .compare-bar-inner { flex-wrap: wrap; gap: 6px 10px; }
  .compare-chips { flex: 1 1 0; min-width: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .compare-chips::-webkit-scrollbar { display: none; }
  .compare-chip { flex: none; padding: 4px 4px 4px 12px; }
  .compare-count { display: none; }
  .compare-bar-actions { width: auto; flex: none; flex-wrap: nowrap; gap: 4px; }
  .compare-bar-actions .btn { flex: none; min-width: 118px; min-height: 46px; padding: 0 16px; }
  .compare-bar-actions .btn:disabled { opacity: 0.55; }
  .compare-bar-actions .clear-btn { padding: 8px; }
}
@media (max-width: 700px) {
  /* Room for the × so it doesn't sit on top of the car name. */
  .compare-header > .compare-col-header { padding-top: 30px; }
  .compare-remove { top: 0; right: 0; }
}
