/* =========================================================
   AutoCars — Global, Clean Stylesheet (mobile-first)
   ========================================================= */

/* ---------- Theme tokens ---------- */
:root {
  /* brand */
  --primary: #111111;
  --secondary: #05f;
  --accent: white;
  --hover: #475569;

  /* surfaces & ink */
  --bg: #f9f9fb;
  --surface: #ffffff;
  --ink: #f4f5f7;
  --ink-weak: #475569;
  --muted: #6b7280;
  --line: #e5e7eb;

  /* states */
  --success: #27ae60;
  --info: #3498db;

  /* radius / shadow / spacing */
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-soft: 0 12px 28px rgba(0, 0, 0, 0.06);

  /* spacing scale */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-7: 32px;
}

/* ---- Glassmorphism utility ---- */
.glass {
  background: rgba(42, 41, 41, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(12px) saturate(160%);
  -webkit-backdrop-filter: blur(12px) saturate(160%);
}

/* Dark brand-tinted glass variants (keep your colors) */
.glass--primary {
  background: linear-gradient(0deg, rgba(0, 8, 97, 0.25), rgba(0, 8, 97, 0.25)),
    rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.28);
}

.glass--nav {
  background: linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.16),
    rgba(78, 78, 78, 0.16)
  );
}

/* Fallback if the browser doesn’t support backdrop-filter */
@supports not (
  (
    backdrop-filter: blur(10px),
  )
) {
  .glass,
  .glass--primary,
  .glass--nav {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.06);
  }
}

/* Ensure contrast on glass */
.nav.glass a {
  color: var(--hover);
}
.filter-wrapper.glass {
  color: #fff;
}
.nav.glass {
  border-radius: 12px;
  margin: 8px auto;
  max-width: 1200px;
}
@media (max-width: 900px) {
  .nav.glass {
    border-radius: 0;
    margin: 0;
  }
}

.filter-wrapper.glass {
  border-radius: 16px;
  padding: 16px;
}

/* ---------- Base ---------- */
* {
  box-sizing: border-box;
}
html {
  height: 100%;
}
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica,
    Arial, "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  height: 100%;
}
img {
  max-width: 100%;
  display: block;
}
a {
  color: inherit;
  text-decoration: none;
}

/* Container helpers */
.gb-container,
.container {
  margin: 0 auto;
  padding: 0 var(--s-4);
}
.section {
  padding: var(--s-7) 0;
}

/* Typography */
h1,
h2,
h3 {
  margin: 0 0 0.25em;
}
h1 {
  font-size: clamp(1.9rem, 2.5vw + 1rem, 3rem);
  font-weight: 800;
}
h2 {
  font-size: clamp(1.35rem, 1.2vw + 1rem, 2.2rem);
  font-weight: 800;
  color: var(--primary);
}
h3 {
  font-size: 1.05rem;
  font-weight: 800;
}
p {
  margin: 0.5rem 0;
  line-height: 1.6;
  color: var(--ink-weak);
}

/* Buttons & focus */
.btn-primary {
  display: inline-block;
  border: 0;
  cursor: pointer;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  background: var(--secondary);
  color: #fff;
  font-weight: 700;
}
.btn-primary:hover {
  background: var(--accent);
}
button:focus-visible,
.btn-primary:focus-visible,
a:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(35, 95, 168, 0.26);
  border-radius: 10px;
}

/* =========================================================
   Navigation
   ========================================================= */

/* Tesla-like pill for nav links */
.nav-pill {
  padding: 8px 12px;
  border-radius: 3px; /* full pill */
  transition: background-color 0.18s ease, color 0.18s ease;
  font-weight: 700;
}

/* hover state (uses your #475569 but very light as a background) */
.nav-pill:hover {
  background: rgba(71, 85, 105, 0.17); /* #475569 */
  color: #000000;
}

/* active/current page: sticky pill */
.nav-pill.is-active,
.nav-pill[aria-current="page"] {
  background: rgba(71, 85, 105, 0.15); /* a bit stronger so it “sticks” */
  color: #0f172a;
}

/* keyboard focus for a11y */
.nav-pill:focus-visible {
  outline: none;
}

.nav {
  position: sticky;
  top: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  border-bottom: 1px solid #eaecef;
  backdrop-filter: saturate(140%) blur(6px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.nav .logo img {
  height: 48px;
}
.nav-links {
  display: flex;
  gap: 1.25rem;
  align-items: center;
}
.nav-links a {
  font-weight: bolder;
  color: var(--primary) !important;
}

.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
}
.hamburger span {
  width: 25px;
  height: 3px;
  background: var(--ink);
  border-radius: 3px;
}
.hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}
.hamburger.active span:nth-child(2) {
  opacity: 0;
}
.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(6px, -6px);
}
.close-btn {
  display: none;
}

@media (max-width: 900px) {
  .hamburger {
    display: flex;
  }
  .nav-links {
    position: fixed;
    top: 0;
    right: -100%;
    height: 100dvh;
    width: min(80%, 320px);
    background: #fff;
    padding: 24px;
    flex-direction: column;
    gap: 20px;
    transition: right 0.3s ease;
    border-left: 1px solid var(--line);
    z-index: 999;
  }
  .nav-links.open,
  .nav-links.active {
    right: 0;
  }
  .close-btn {
    display: flex;
    margin-left: auto;
    font-size: 28px;
    cursor: pointer;
    color: var(--ink);
  }
}

/* =========================================================
   Hero
   ========================================================= */
.hero {
  color: #fff;
  text-align: center;
  padding: clamp(40px, 7vw, 72px) var(--s-4);
  background: linear-gradient(rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0.45)),
    url("/assets/polo rolling.png") center/cover no-repeat;
}
.hero p {
  color: #e6e6e6;
  font-size: clamp(1rem, 0.4vw + 0.9rem, 1.2rem);
}
.hero .btn-primary {
  margin-top: var(--s-3);
}

/* =========================================================
   Filter (component uses these classes)
   ========================================================= */
.filter-wrapper {
  color: #fff;
  background: var(--primary);
  border-radius: var(--radius);
  margin: 24px auto;
  padding: 16px;
  box-shadow: var(--shadow-soft);
}
.car-filter {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)); /* desktop: 3 columns */
  gap: 12px;
}
.car-filter select,
.car-filter button {
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 0.95rem;
  padding: 0.6rem 0.75rem;
}
.car-filter select {
  background: #fff;
  color: #111827;
  appearance: none;
  background-image: url('data:image/svg+xml;utf8,<svg fill="%23111827" height="20" width="20" xmlns="http://www.w3.org/2000/svg"><path d="M7 8l3 3 3-3"/></svg>');
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  background-size: 14px;
}
.car-filter button {
  background: var(--secondary);
  color: #fff;
  font-weight: 700;
  justify-self: end; /* push button to the right */
  width: 389px; /* tidy fixed width on desktop */
}
.car-filter button:hover {
  background: var(--accent);
}

@media (max-width: 900px) {
  .car-filter {
    grid-template-columns: repeat(2, 1fr);
  }
  .car-filter button {
    width: 100%;
    justify-self: stretch;
  }
}

@media (max-width: 600px) {
  .car-filter {
    grid-template-columns: 1fr;
  }
}

/* helper so index filter aligns with grid edges */
.index-filter {
  margin: var(--s-6) auto;
}

/* =========================================================
   Featured section (index)
   ========================================================= */
.featured {
  padding: var(--s-7) 0;
  background: var(--bg);
}
.section__title {
  margin: 0 0 var(--s-4);
  font-size: clamp(1.4rem, 1vw + 1rem, 2rem);
  font-weight: 800;
  color: var(--primary);
  text-align: left;
}

/* legacy class support */
.featured-car-grid {
  /* keep older pages working */
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--s-5);
}

/* =========================================================
   Cards (shared by featured + inventory + component)
   ========================================================= */
.card,
.car-card,
.featured-car-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease,
    border-color 0.18s ease;
}
.card:hover,
.car-card:hover,
.featured-car-card:hover {
  transform: translateY(-2px);
  border-color: #dbe0e6;
  box-shadow: var(--shadow-soft);
}

/* media */
.card__media,
.image-wrapper {
  position: relative;
  aspect-ratio: 1/1;
  background: #f3f4f6;
  overflow: hidden;
}
.card__media img,
.image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.media-badge,
.image-overlay {
  position: absolute;
  left: var(--s-3);
  bottom: var(--s-3);
  background: #111827;
  color: #fff;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 6px;
  opacity: 0.95;
}

/* body */
.card__body,
.car-card-content,
.featured-car-card-content {
  padding: var(--s-4);
  display: grid;
  gap: var(--s-2);
}
.card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
}

.price,
.price-badge {
  color: var(--secondary);
  font-weight: 800;
  font-size: 18px;
}
.badge,
.deal-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  color: #fff;
  background: var(--success);
}
.badge--fair,
.deal-badge.fair {
  background: var(--info);
}

.card__title,
.featured-car-title {
  margin: 0;
  font-weight: 800;
  color: var(--primary);
  font-size: 15px;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card__subtitle,
.featured-car-desc {
  margin: 0;
  color: var(--ink-weak);
  font-size: 13px;
}
.card__meta,
.car-meta,
.featured-car-meta {
  color: #6b7280;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card__cta,
.view-details {
  margin-top: var(--s-2);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #164db4;
  font-weight: 600;
  font-size: 14px;
}

/* =========================================================
   Inventory grid (page uses .car-grid)
   ========================================================= */
.car-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--s-5);
  max-width: 1200px;
  margin: 16px auto 0;
  padding: 0 var(--s-4);
}

/* Pagination */
.pagination {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  margin: 24px auto 48px;
  flex-wrap: wrap;
  padding: 0 var(--s-4);
}
.pagination button {
  background: #fff;
  border: 1px solid var(--line);
  color: #111827;
  padding: 8px 12px;
  border-radius: 10px;
  min-width: 40px;
  cursor: pointer;
}
.pagination button:hover {
  border-color: #cbd5e1;
}
.pagination button.active {
  background: #eef7ff;
  border-color: #b7daff;
  color: #164db4;
  font-weight: 700;
}
.pagination .dots {
  color: #6b7280;
  padding: 0 4px;
}

/* =========================================================
   “Why AutoCars” + CTA (home)
   ========================================================= */
.why {
  padding: var(--s-7) 0;
  background: #fff;
  text-align: center;
}
.gb-grid {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--s-5);
  margin-top: var(--s-5);
}
.gb-grid div {
  flex: 0 1 280px;
}
.gb-grid h3 {
  color: var(--secondary);
}
.gb-grid p {
  color: var(--ink);
}

.cta {
  background: var(--secondary);
  color: #fff;
  text-align: center;
  padding: var(--s-7) var(--s-4);
}
.cta a {
  display: inline-block;
  margin-top: var(--s-3);
  background: #fff;
  color: var(--secondary);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
}

/* =========================================================
   Footer
   ========================================================= */
.autocars-footer {
  background: var(--primary);
  color: #cbd5e1;
  padding: 48px 1rem 24px;
  font-size: 0.95rem;
}
.footer-container {
  max-width: 1200px;
  margin: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
  justify-content: space-between;
}
.footer-brand img {
  width: 160px;
  margin-bottom: 12px;
}
.footer-brand p {
  color: #aab0bb;
}
.footer-links h4,
.footer-contact h4 {
  color: #fff;
  margin-bottom: 12px;
}
.footer-links ul,
.footer-contact ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.footer-links li,
.footer-contact p {
  margin: 0 0 0.75rem;
}
.footer-links a,
.footer-contact a {
  color: #cbd5e1;
}
.footer-links a:hover,
.footer-contact a:hover {
  color: var(--secondary);
}
.footer-bottom {
  margin-top: 24px;
  text-align: center;
  border-top: 1px solid #334155;
  padding-top: 12px;
  color: #aab0bb;
  font-size: 0.85rem;
}
@media (max-width: 768px) {
  .footer-container {
    flex-direction: column;
    text-align: center;
    align-items: center;
  }
}

/* =========================================================
   Responsive tweaks
   ========================================================= */
@media (max-width: 600px) {
  .hero {
    padding: 44px var(--s-4);
  }
  .hero h1 {
    font-size: 2rem;
  }
  .hero p {
    font-size: 1rem;
  }
}

/* Motion safety */
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    transform: none !important;
  }
}
@media (max-width: 520px) {
  .glass,
  .glass--primary,
  .glass--nav {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}
/* Root nav styling + smooth transitions */
#autonav {
  transition: background-color 0.18s ease, box-shadow 0.18s ease,
    border-color 0.18s ease;
}

/* Default (top of page, over hero) — transparent, bright links */
#autonav:not(.is-scrolled) {
  background: transparent; /* keep your backdrop blur from tailwind class */
  border-bottom: 1px solid transparent;
  box-shadow: none;
}

/* Make links white when not scrolled (over dark hero image) */


/* Keep the pill readable on transparent background */
#autonav:not(.is-scrolled) .nav-pill:hover {
  /* keep the same slate pill, just ensure text stays readable */
  background: rgba(71, 85, 105, 0.17);
  color: black;
}

/* Scrolled — light glass, darker links for contrast */
#autonav.is-scrolled {
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid rgba(226, 232, 240, 0.8); /* slate-200-ish */
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
  backdrop-filter: saturate(140%) blur(8px);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
}

/* Darker ink on scrolled */
#autonav.is-scrolled #nav-links a {
  color: #0f172a !important; /* ink */
}

/* Pill still works on scrolled state */
#autonav.is-scrolled .nav-pill:hover {
  background: rgba(71, 85, 105, 0.17);
  color: #0f172a;
}

/* Active pill stays visible in both states (kept from your file) */
.nav-pill.is-active,
.nav-pill[aria-current="page"] {
  background: rgba(71, 85, 105, 0.2);
  color: #0f172a;
}
