:root {
  /* Notion-inspired palette for vehiculos.eu.org (see DESIGN.md) */
  --primary: #0a1530;          /* navy — primary CTAs, prices, active chips */
  --primary-dark: #1a2a52;     /* navy-mid — hover */
  --primary-deep: #070f24;     /* navy-deep — hero band end */
  --accent: #0075de;           /* link-blue — links, secondary CTAs */
  --accent-dark: #005bab;
  --ink: #1a1a1a;
  --body: #3f3f3f;
  --muted: #787671;            /* steel */
  --bg: #f6f5f4;               /* surface */
  --surface: #ffffff;
  --surface-soft: #fafaf9;
  --border: #e5e3df;           /* hairline */
  --radius: 12px;
  --radius-md: 8px;
  --shadow: 0 1px 3px rgba(15,15,15,.04), 0 4px 12px rgba(15,15,15,.08);
  --ff: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: var(--ff);
  background: var(--bg); color: var(--ink); line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ---------- Topbar ---------- */
.topbar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.brand { font-size: 18px; font-weight: 700; color: var(--primary); letter-spacing: -0.01em; }
.brand strong { color: var(--primary); }
.topbar-home { font-size: 14px; color: var(--ink); font-weight: 600; display: inline-flex; align-items: center; gap: 5px; }
.topbar-home:hover { color: var(--primary); }
.main-content { max-width: 1200px; margin: 0 auto; padding: 24px 16px 80px; }

/* ---------- Landing ---------- */
.landing { max-width: 1000px; margin: 0 auto; padding: 48px 24px; min-height: 100vh; display: flex; flex-direction: column; }
.landing-hero { text-align: center; padding: 48px 0 32px; }
.landing-hero h1 { font-size: 44px; margin: 0 0 8px; }
.landing-hero h1 span { color: var(--primary); }
.landing-tagline { color: var(--muted); font-size: 18px; }
.landing-countries h2 { text-align: center; font-size: 24px; margin: 32px 0 24px; }
.country-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.country-card {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 32px 20px; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s;
}
.country-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.country-flag { font-size: 44px; }
.country-name { font-size: 20px; font-weight: 700; }
.country-domain { color: var(--muted); font-size: 13px; }
.country-cta { color: var(--primary); font-weight: 600; font-size: 14px; margin-top: 8px; }
.country-card-soon { opacity: .55; }
.country-card-soon .country-cta { color: var(--muted); }
.landing-footer { margin-top: auto; text-align: center; color: var(--muted); font-size: 13px; padding-top: 48px; }

/* ---------- Search hero ---------- */
.search-hero { padding: 16px 0 24px; }
.search-hero h1 { font-size: 28px; margin: 0 0 16px; }
.search-form {
  display: flex; flex-wrap: wrap; gap: 10px; background: var(--surface);
  padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  align-items: center; /* don't stretch selects to the tallest sibling */
}
.search-form select, .search-form input {
  padding: 0 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 13.5px; background: #fff; min-width: 0;
  height: 38px; line-height: normal;
  /* Consistent height across browsers/OS (native select height varies) */
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
  padding-right: 28px; /* room for the arrow */
}
.search-form input { appearance: auto; -webkit-appearance: auto; background-image: none; padding-right: 10px; }
/* Brand / referencia / city grow; precio / año stay compact */
.search-form select[name="marca"],
.search-form select[name="referencia"],
.search-form select[name="ciudad"] { flex: 1 1 150px; }
.search-form select[name="precio"],
.search-form select[name="anio"] { flex: 0 1 150px; }
.search-form input[type=number] { flex: 1 1 110px; }
.search-form button {
  padding: 0 18px; background: var(--primary); color: #fff; border: 0; border-radius: 8px;
  font-size: 14px; font-weight: 600; cursor: pointer; flex: 0 0 auto; height: 38px; line-height: 38px;
}
.search-form button:hover { background: var(--primary-dark); }
.btn-clear { align-self: center; color: var(--muted); font-size: 13px; padding: 8px; }
.result-count { color: var(--muted); font-size: 14px; margin: 12px 2px 0; }

/* ---------- Vehicle cards ---------- */
.vehicles-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; margin-top: 20px;
}
.veh-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s;
  display: flex; flex-direction: column;
}
.veh-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.veh-card-img { aspect-ratio: 4/3; background: #eef2f7; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.veh-card-img img { width: 100%; height: 100%; object-fit: cover; }
.veh-card-img .no-img { font-size: 48px; opacity: .4; }
.veh-card-body { padding: 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.veh-card-body h3 { margin: 0; font-size: 16px; font-weight: 600; line-height: 1.3; }
.veh-card-specs { display: flex; flex-wrap: wrap; gap: 6px; }
.veh-card-specs span {
  font-size: 12px; background: var(--surface-soft); border: 1px solid var(--border);
  padding: 2px 8px; border-radius: var(--radius-md); color: var(--muted);
}
.veh-card-loc { font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.veh-card-price { font-size: 20px; font-weight: 700; color: var(--primary); margin-top: auto; }
.veh-inactive { opacity: .6; }
.empty { color: var(--muted); text-align: center; padding: 60px 0; font-size: 16px; }

/* ---------- Pagination ---------- */
.pagination { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 32px; }
.pagination a {
  padding: 8px 14px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; font-size: 14px;
}
.pagination a.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- Detail ---------- */
.detail-wrap { display: grid; grid-template-columns: 1fr 320px; gap: 28px; }
.detail-main h1 { font-size: 26px; margin: 16px 0 4px; }
.detail-price { font-size: 28px; font-weight: 800; color: var(--primary); }
.detail-loc { color: var(--muted); margin: 4px 0 20px; display: inline-flex; align-items: center; gap: 5px; }
.detail-gallery-main { width: 100%; aspect-ratio: 16/10; object-fit: cover; border-radius: var(--radius); }
.detail-gallery.no-img { aspect-ratio: 16/10; background: #eef2f7; display: flex; align-items: center; justify-content: center; font-size: 64px; }
.detail-gallery-thumbs { display: flex; gap: 8px; margin-top: 8px; overflow-x: auto; }
.detail-gallery-thumbs img {
  width: 84px; height: 60px; object-fit: cover; border-radius: 6px; cursor: pointer;
  border: 2px solid transparent; opacity: .75;
}
.detail-gallery-thumbs img.active, .detail-gallery-thumbs img:hover { border-color: var(--primary); opacity: 1; }
.detail-specs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.detail-spec { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 12px; }
.detail-spec .spec-label { display: block; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.detail-spec .spec-val { font-size: 15px; font-weight: 600; }
.detail-acc { display: flex; flex-wrap: wrap; gap: 8px; }
.acc-chip { background: var(--surface-soft); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 6px 12px; font-size: 13px; }
.detail-desc { white-space: pre-line; color: #374151; }
.detail-side { }
.contact-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); position: sticky; top: 80px; }
.contact-card h3 { margin: 0 0 8px; }
.seller-name { font-weight: 600; margin: 0; }
.seller-type { color: var(--muted); font-size: 13px; margin: 0 0 16px; }
.btn {
  display: block; text-align: center; padding: 12px; background: var(--primary); color: #fff;
  border-radius: 8px; font-weight: 600; margin-top: 10px;
}
.btn:hover { background: var(--primary-dark); }
.btn-secondary { background: #fff; color: var(--accent); border: 1px solid var(--accent); }
.btn-secondary:hover { background: #eff6ff; color: var(--accent-dark); }

/* ---------- Footer ---------- */
.site-footer { text-align: center; color: var(--muted); font-size: 13px; padding: 24px 16px 40px; border-top: 1px solid var(--border); margin-top: 40px; }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .detail-wrap { grid-template-columns: 1fr; }
  /* Mobile: smaller H1 (search titles with filters can be long) */
  .search-hero h1 { font-size: 22px; line-height: 1.25; margin-bottom: 12px; }
  /* Mobile: keep wrap layout (not full column) so marca+referencia and
     precio+año share a line. Each select is ~half width; ciudad and button full. */
  .search-form { flex-direction: row; flex-wrap: wrap; }
  /* Don't let selects stretch vertically (desktop [name=...] flex rules have
     higher specificity — override with !important). */
  .search-form select, .search-form input,
  .search-form select[name="marca"], .search-form select[name="referencia"],
  .search-form select[name="ciudad"], .search-form select[name="precio"],
  .search-form select[name="anio"] {
    flex: 1 1 calc(50% - 5px) !important;
    width: auto; height: 38px; min-width: 0;
  }
  .search-form select[name="ciudad"] { flex-basis: 100% !important; }
  .search-form button { height: 38px; flex: 1 1 100% !important; }
  .landing-hero h1 { font-size: 32px; }

  /* ---- Compact horizontal cards on mobile: image left, data right ---- */
  .vehicles-grid { grid-template-columns: 1fr; gap: 14px; }
  .veh-card {
    flex-direction: row; align-items: stretch;
  }
  .veh-card-img {
    flex: 0 0 128px; width: 128px; aspect-ratio: auto;
    height: auto; min-height: 92px;
  }
  .veh-card-body { padding: 8px 10px; gap: 3px; justify-content: center; }
  /* Mobile order: Título → Precio → Specs → Ciudad (DOM is título→specs→ciudad→precio) */
  .veh-card-body h3 { order: 0; }
  .veh-card-price { order: 1; }
  .veh-card-specs { order: 2; }
  .veh-card-loc { order: 3; }
  .veh-card-body h3 { font-size: 14px; line-height: 1.25;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .veh-card-specs { gap: 4px; }
  .veh-card-specs span { font-size: 11px; padding: 1px 6px; }
  .veh-card-loc { font-size: 11.5px; }
  .veh-card-price { font-size: 16px; margin-top: 0; }
  .veh-card-img .no-img { font-size: 32px; }
}

/* ---------- Section block (home + detail "similares") ---------- */
.home-section { margin-top: 40px; }
.home-section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 16px;
}
.home-section-head h2 { font-size: 24px; margin: 0; }
.home-section-link { color: var(--accent); font-weight: 600; font-size: 14px; }
.home-section-link:hover { text-decoration: underline; }
.similar-section { margin-bottom: 8px; }
@media (max-width: 768px) {
  .home-section-head { flex-direction: column; gap: 4px; }
}
