/* ============================================================
   K & M Cars — Classic & trustworthy theme
   Navy + warm gold accents, cream backgrounds, serif headings.
   ============================================================ */

:root {
  --navy: #1a2b4a;
  --navy-deep: #131f36;
  --gold: #c9a227;
  --gold-dark: #a8861a;
  --cream: #f7f3ea;
  --cream-card: #fffdf8;
  --ink: #20242c;
  --muted: #6b6452;
  --line: #e3dccb;
  --good: #2f7a4f;
  --shadow: 0 6px 20px rgba(26, 43, 74, 0.10);
  --shadow-lg: 0 14px 40px rgba(26, 43, 74, 0.16);
  --radius: 10px;
  --maxw: 1180px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--cream);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: Georgia, "Times New Roman", serif;
  color: var(--navy);
  line-height: 1.2;
  margin: 0 0 0.5em;
}

a { color: var(--navy); }

img { max-width: 100%; display: block; }

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 22px;
}

.muted { color: var(--muted); }
.center { text-align: center; }

/* ---------- buttons ---------- */
.btn {
  display: inline-block;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  border: 2px solid transparent;
  border-radius: 6px;
  padding: 12px 22px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}
.btn-primary { background: var(--gold); color: var(--navy-deep); }
.btn-primary:hover { background: var(--gold-dark); }
.btn-outline {
  background: transparent; color: var(--navy); border-color: var(--navy);
}
.btn-outline:hover { background: var(--navy); color: #fff; }
.btn-ghost {
  background: rgba(255,255,255,0.12); color: #fff; border-color: rgba(255,255,255,0.5);
}
.btn-ghost:hover { background: #fff; color: var(--navy); }
.btn-danger { background: #b23b3b; color: #fff; }
.btn-danger:hover { background: #8f2c2c; }
.btn-sm { padding: 8px 14px; font-size: 0.9rem; }
.btn-block { display: block; width: 100%; }

/* ---------- header / nav ---------- */
.site-header {
  background: var(--navy);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow);
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  max-width: var(--maxw);
  margin: 0 auto;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: #fff;
}
.brand .mark {
  width: 44px; height: 44px;
  border: 2px solid var(--gold);
  border-radius: 8px;
  display: grid; place-items: center;
  font-family: Georgia, serif;
  font-weight: 700;
  color: var(--gold);
  font-size: 1.1rem;
  flex: none;
}
.brand .brand-name {
  font-family: Georgia, serif;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.brand .brand-sub {
  display: block;
  font-family: Arial, sans-serif;
  font-size: 0.68rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold);
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
  margin: 0; padding: 0;
}
.nav-links a {
  color: #e9edf4;
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.95rem;
}
.nav-links a:hover, .nav-links a.active {
  background: rgba(255,255,255,0.12);
  color: #fff;
}
.nav-links a.nav-cta {
  background: var(--gold);
  color: var(--navy-deep);
}
.nav-links a.nav-cta:hover { background: var(--gold-dark); }
.nav-toggle {
  display: none;
  background: none; border: 0; color: #fff;
  font-size: 1.6rem; cursor: pointer;
}

/* ---------- hero ---------- */
.hero {
  background:
    linear-gradient(rgba(19,31,54,0.82), rgba(19,31,54,0.92)),
    url("../images/hero.svg") center/cover no-repeat,
    var(--navy);
  color: #fff;
  text-align: center;
  padding: 86px 22px 92px;
}
.hero h1 {
  color: #fff;
  font-size: clamp(2rem, 5vw, 3.2rem);
  margin-bottom: 0.3em;
}
.hero p {
  font-size: 1.2rem;
  max-width: 640px;
  margin: 0 auto 1.6em;
  color: #e9edf4;
}
.hero .hero-actions {
  display: flex; gap: 14px; justify-content: center; flex-wrap: wrap;
}
.hero-badges {
  display: flex; gap: 26px; justify-content: center; flex-wrap: wrap;
  margin-top: 46px;
}
.hero-badge { color: var(--gold); font-size: 0.95rem; font-weight: 600; }
.hero-badge strong {
  display: block; color: #fff; font-family: Georgia, serif;
  font-size: 1.9rem; font-weight: 700;
}

/* ---------- sections ---------- */
.section { padding: 64px 0; }
.section-head { text-align: center; margin-bottom: 40px; }
.section-head h2 { font-size: 2rem; }
.section-head .eyebrow {
  text-transform: uppercase; letter-spacing: 3px; font-size: 0.78rem;
  color: var(--gold-dark); font-weight: 700; margin-bottom: 8px;
}
.section-alt { background: var(--cream-card); border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line); }

/* ---------- vehicle grid + cards ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 26px;
}
.car-card {
  background: var(--cream-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  display: flex; flex-direction: column;
}
.car-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.car-photo {
  position: relative;
  aspect-ratio: 4 / 3;
  background: #e8e2d6;
  overflow: hidden;
}
.car-photo img { width: 100%; height: 100%; object-fit: cover; }
.car-badge {
  position: absolute; top: 12px; left: 12px;
  background: var(--gold); color: var(--navy-deep);
  font-size: 0.72rem; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase; padding: 4px 10px; border-radius: 4px;
}
.car-body { padding: 18px 20px 20px; display: flex; flex-direction: column; flex: 1; }
.car-title { font-size: 1.2rem; margin-bottom: 4px; }
.car-price {
  font-family: Georgia, serif; font-size: 1.5rem; font-weight: 700;
  color: var(--good); margin: 2px 0 12px;
}
.car-specs {
  list-style: none; margin: 0 0 16px; padding: 0;
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px;
  font-size: 0.9rem; color: var(--muted);
}
.car-specs li::before { content: ""; }
.car-card .btn { margin-top: auto; }

/* ---------- filters ---------- */
.filters {
  display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end;
  background: var(--cream-card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px; margin-bottom: 32px;
  box-shadow: var(--shadow);
}
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 0.78rem; font-weight: 700; color: var(--navy);
  text-transform: uppercase; letter-spacing: 0.5px; }
.field select, .field input {
  font: inherit; padding: 9px 11px; border: 1px solid var(--line);
  border-radius: 6px; background: #fff; min-width: 150px; color: var(--ink);
}
.filters .field-grow { flex: 1; min-width: 200px; }
.filters .field-grow input { width: 100%; }
.results-meta { margin: 0 0 18px; color: var(--muted); font-size: 0.95rem; }

/* ---------- vehicle detail ---------- */
.detail-wrap { display: grid; grid-template-columns: 1.3fr 1fr; gap: 40px; }
.gallery-main {
  aspect-ratio: 4 / 3; background: #e8e2d6;
  border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden;
}
.gallery-main img { width: 100%; height: 100%; object-fit: cover; }
.gallery-thumbs {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(82px, 1fr));
  gap: 10px; margin-top: 12px;
}
.gallery-thumbs button {
  padding: 0; border: 2px solid transparent; border-radius: 6px;
  overflow: hidden; cursor: pointer; aspect-ratio: 4/3; background: #e8e2d6;
}
.gallery-thumbs button.active { border-color: var(--gold); }
.gallery-thumbs img { width: 100%; height: 100%; object-fit: cover; }
.detail-price {
  font-family: Georgia, serif; font-size: 2.2rem; font-weight: 700;
  color: var(--good); margin: 4px 0 6px;
}
.spec-table { width: 100%; border-collapse: collapse; margin: 18px 0 24px; }
.spec-table th, .spec-table td {
  text-align: left; padding: 9px 4px; border-bottom: 1px solid var(--line);
  font-size: 0.95rem;
}
.spec-table th { color: var(--muted); font-weight: 600; width: 45%; }
.detail-actions { display: grid; gap: 10px; margin-top: 18px; }
.detail-desc { margin-top: 30px; }

/* ---------- contact ---------- */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 44px; }
.info-list { list-style: none; padding: 0; margin: 0 0 24px; }
.info-list li { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.info-list .ico {
  width: 42px; height: 42px; flex: none; border-radius: 8px;
  background: var(--navy); color: var(--gold); display: grid; place-items: center;
  font-size: 1.2rem;
}
.info-list .label { font-size: 0.78rem; text-transform: uppercase;
  letter-spacing: 1px; color: var(--muted); font-weight: 700; }
.info-list .value { font-size: 1.05rem; font-weight: 600; color: var(--navy); text-decoration: none; }
.info-list .value:hover { color: var(--gold-dark); }
.contact-cta-row { display: flex; gap: 12px; flex-wrap: wrap; margin: 8px 0 24px; }
.map-embed {
  width: 100%; aspect-ratio: 16/9; border: 1px solid var(--line);
  border-radius: var(--radius); margin-top: 12px;
}
.hours-table { width: 100%; border-collapse: collapse; }
.hours-table td { padding: 8px 0; border-bottom: 1px solid var(--line); }
.hours-table td:last-child { text-align: right; font-weight: 600; color: var(--navy); }

/* ---------- forms ---------- */
.form-card {
  background: var(--cream-card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow);
}
.form-row { display: grid; gap: 16px; margin-bottom: 16px; }
.form-row.two { grid-template-columns: 1fr 1fr; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-weight: 700; font-size: 0.88rem; color: var(--navy); }
.form-group input, .form-group select, .form-group textarea {
  font: inherit; padding: 11px 12px; border: 1px solid var(--line);
  border-radius: 6px; background: #fff; color: var(--ink); width: 100%;
}
.form-group textarea { resize: vertical; min-height: 120px; }
.form-note { font-size: 0.85rem; color: var(--muted); }
.alert {
  padding: 14px 16px; border-radius: 8px; margin-bottom: 18px;
  font-weight: 600; display: none;
}
.alert.show { display: block; }
.alert-success { background: #e3f3ea; color: var(--good); border: 1px solid #b9e0c8; }
.alert-info { background: #eef2fb; color: var(--navy); border: 1px solid #cfd9ef; }

/* ---------- admin ---------- */
.admin-bar {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
  justify-content: space-between; margin-bottom: 24px;
}
.admin-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.admin-table { width: 100%; border-collapse: collapse; background: var(--cream-card);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.admin-table th, .admin-table td {
  text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line);
  font-size: 0.92rem; vertical-align: middle;
}
.admin-table th { background: var(--navy); color: #fff; font-family: Arial, sans-serif;
  font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.5px; }
.admin-table tr:last-child td { border-bottom: 0; }
.admin-thumb { width: 64px; height: 48px; object-fit: cover; border-radius: 4px; background:#e8e2d6; }
.row-actions { display: flex; gap: 8px; }
.tag-featured { background: var(--gold); color: var(--navy-deep); font-size: 0.7rem;
  font-weight: 700; padding: 2px 8px; border-radius: 4px; text-transform: uppercase; }

/* photo upload preview */
.photo-previews { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px,1fr));
  gap: 10px; margin-top: 10px; }
.photo-previews .thumb { position: relative; aspect-ratio: 4/3; border-radius: 6px;
  overflow: hidden; border: 1px solid var(--line); background:#e8e2d6; }
.photo-previews .thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-previews .thumb button {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px;
  border: 0; border-radius: 50%; background: rgba(178,59,59,0.92); color:#fff;
  cursor: pointer; font-size: 0.9rem; line-height: 1; display:grid; place-items:center;
}

/* modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(19,31,54,0.55);
  display: none; align-items: flex-start; justify-content: center;
  padding: 40px 16px; z-index: 100; overflow-y: auto;
}
.modal-overlay.show { display: flex; }
.modal {
  background: var(--cream); border-radius: var(--radius); max-width: 760px;
  width: 100%; box-shadow: var(--shadow-lg); padding: 0;
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 26px; border-bottom: 1px solid var(--line); background: var(--cream-card);
  border-radius: var(--radius) var(--radius) 0 0;
}
.modal-head h3 { margin: 0; }
.modal-body { padding: 26px; }
.modal-foot { padding: 18px 26px; border-top: 1px solid var(--line); display: flex;
  justify-content: flex-end; gap: 12px; }
.modal-close { background: none; border: 0; font-size: 1.6rem; cursor: pointer; color: var(--muted); }

/* ---------- empty state ---------- */
.empty {
  text-align: center; padding: 60px 20px; color: var(--muted);
  border: 2px dashed var(--line); border-radius: var(--radius);
}

/* ---------- footer ---------- */
.site-footer { background: var(--navy-deep); color: #cdd6e6; margin-top: 40px; }
.footer-grid {
  display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 36px;
  padding: 50px 22px; max-width: var(--maxw); margin: 0 auto;
}
.site-footer h4 { color: #fff; font-size: 1.05rem; }
.site-footer a { color: #cdd6e6; text-decoration: none; }
.site-footer a:hover { color: var(--gold); }
.footer-links { list-style: none; padding: 0; margin: 0; }
.footer-links li { padding: 4px 0; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.12); padding: 18px 22px;
  text-align: center; font-size: 0.85rem; color: #9aa6bd;
}
.footer-bottom a { color: #9aa6bd; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .detail-wrap, .contact-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: 26px; }
  .nav-toggle { display: block; }
  .nav-links {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--navy); padding: 8px 14px 14px;
    box-shadow: var(--shadow);
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 12px 10px; }
  .form-row.two { grid-template-columns: 1fr; }
}
