:root {
  --ink: #172026;
  --muted: #5d6972;
  --line: #d8dde1;
  --surface: #ffffff;
  --soft: #f5f7f8;
  --accent: #1f6f5b;
  --accent-strong: #155344;
  --warning: #8a4c12;
}

* {
  box-sizing: border-box;
}

html {
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

body {
  margin: 0;
  background: var(--soft);
}

a {
  color: inherit;
}

.site-header {
  align-items: flex-end;
  background:
    linear-gradient(90deg, rgba(23, 32, 38, 0.9), rgba(23, 32, 38, 0.58)),
    url("https://images.unsplash.com/photo-1503376780353-7e6692767b70?auto=format&fit=crop&w=1800&q=80")
      center / cover;
  color: #fff;
  display: flex;
  gap: 24px;
  justify-content: space-between;
  min-height: 300px;
  padding: 34px clamp(18px, 4vw, 56px);
}

.brand-block {
  max-width: 720px;
}

.eyebrow {
  font-size: 0.78rem;
  font-weight: 700;
  margin: 0 0 10px;
  text-transform: uppercase;
}

h1 {
  font-size: clamp(2.2rem, 6vw, 5rem);
  line-height: 0.95;
  margin: 0;
}

.subhead {
  color: rgba(255, 255, 255, 0.86);
  font-size: clamp(1rem, 2vw, 1.25rem);
  margin: 16px 0 0;
}

.header-action,
.vehicle-action,
.empty-state a {
  align-items: center;
  background: var(--accent);
  border-radius: 8px;
  color: #fff;
  display: inline-flex;
  font-weight: 800;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  text-decoration: none;
  transition:
    background 160ms ease,
    transform 160ms ease;
  white-space: nowrap;
}

.header-action:hover,
.vehicle-action:hover,
.empty-state a:hover {
  background: var(--accent-strong);
  transform: translateY(-1px);
}

main {
  margin: 0 auto;
  max-width: 1220px;
  padding: 22px clamp(14px, 3vw, 34px) 46px;
}

.toolbar {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) auto;
  margin-bottom: 18px;
}

.search-label {
  font-size: 0.82rem;
  font-weight: 800;
  grid-column: 1 / -1;
  text-transform: uppercase;
}

#inventorySearch {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font: inherit;
  min-height: 48px;
  padding: 0 14px;
  width: 100%;
}

.status-line {
  color: var(--muted);
  font-size: 0.92rem;
  text-align: right;
}

.inventory-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.vehicle-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.vehicle-photo-wrap {
  aspect-ratio: 4 / 3;
  background: #e8ecef;
  overflow: hidden;
  position: relative;
}

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

.photo-placeholder {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  font-weight: 800;
  gap: 6px;
  height: 100%;
  justify-content: center;
  padding: 18px;
  text-align: center;
}

.stock-badge {
  background: rgba(23, 32, 38, 0.86);
  border-radius: 999px;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
  left: 12px;
  padding: 5px 9px;
  position: absolute;
  top: 12px;
}

.vehicle-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
}

.vehicle-title {
  margin: 0;
}

.vehicle-title strong {
  display: block;
  font-size: 1.22rem;
  line-height: 1.2;
}

.vehicle-title span {
  color: var(--muted);
  display: block;
  margin-top: 3px;
}

.meta-grid {
  border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.meta-item {
  padding: 10px 0;
}

.meta-item:nth-child(odd) {
  padding-right: 12px;
}

.meta-label {
  color: var(--muted);
  display: block;
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
}

.meta-value {
  display: block;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.description {
  color: var(--muted);
  display: -webkit-box;
  margin: 0;
  min-height: 4.5em;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.vehicle-action {
  margin-top: auto;
  width: 100%;
}

.vehicle-photo-btn {
  background: none;
  border: 0;
  cursor: pointer;
  display: block;
  height: 100%;
  padding: 0;
  width: 100%;
}

.photo-count {
  background: rgba(23, 32, 38, 0.86);
  border-radius: 999px;
  bottom: 12px;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 5px 10px;
  position: absolute;
  right: 12px;
}

.vehicle-details-btn {
  background: #fff;
  border: 1px solid var(--accent);
  border-radius: 8px;
  color: var(--accent-strong);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  min-height: 44px;
  transition:
    background 160ms ease,
    transform 160ms ease;
  width: 100%;
}

.vehicle-details-btn:hover {
  background: var(--soft);
  transform: translateY(-1px);
}

/* ---------- Vehicle details / gallery modal ---------- */

body.modal-open {
  overflow: hidden;
}

.modal {
  align-items: center;
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 18px;
  position: fixed;
  z-index: 50;
}

.modal-backdrop {
  background: rgba(13, 18, 22, 0.72);
  inset: 0;
  position: absolute;
}

.modal-card {
  background: var(--surface);
  border-radius: 12px;
  display: grid;
  gap: 0;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  max-height: calc(100vh - 36px);
  max-width: 1040px;
  overflow: hidden;
  position: relative;
  width: 100%;
}

.modal-close {
  background: rgba(23, 32, 38, 0.86);
  border: 0;
  border-radius: 999px;
  color: #fff;
  cursor: pointer;
  font-size: 1.5rem;
  height: 40px;
  line-height: 1;
  position: absolute;
  right: 12px;
  top: 12px;
  width: 40px;
  z-index: 2;
}

.gallery {
  background: #0d1216;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.gallery-stage {
  align-items: center;
  aspect-ratio: 4 / 3;
  display: flex;
  justify-content: center;
  position: relative;
}

.gallery-image {
  height: 100%;
  object-fit: contain;
  width: 100%;
}

.gallery-empty {
  align-items: center;
  color: #c3ccd2;
  display: flex;
  font-weight: 800;
  height: 100%;
  justify-content: center;
  width: 100%;
}

.gallery-arrow {
  align-items: center;
  background: rgba(13, 18, 22, 0.6);
  border: 0;
  border-radius: 999px;
  color: #fff;
  cursor: pointer;
  display: flex;
  font-size: 1.8rem;
  height: 46px;
  justify-content: center;
  line-height: 1;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  z-index: 2;
}

.gallery-arrow:hover {
  background: rgba(13, 18, 22, 0.85);
}

.gallery-arrow.prev {
  left: 12px;
}

.gallery-arrow.next {
  right: 12px;
}

.gallery-counter {
  background: rgba(13, 18, 22, 0.72);
  border-radius: 999px;
  bottom: 12px;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 800;
  left: 50%;
  padding: 5px 12px;
  position: absolute;
  transform: translateX(-50%);
}

.gallery-thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px;
}

.gallery-thumb {
  background: none;
  border: 2px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  flex: 0 0 auto;
  height: 56px;
  overflow: hidden;
  padding: 0;
  width: 76px;
}

.gallery-thumb.is-active {
  border-color: var(--accent);
}

.gallery-thumb img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.modal-info {
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  padding: 26px 24px;
}

.modal-title {
  font-size: 1.4rem;
  margin: 0;
}

.modal-subtitle {
  color: var(--muted);
  font-weight: 700;
  margin: 0;
}

.modal-description {
  color: var(--muted);
  margin: 0;
}

.modal-info .vehicle-action {
  margin-top: auto;
}

@media (max-width: 760px) {
  .modal-card {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }
}

.empty-state {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 28px auto;
  max-width: 620px;
  padding: 28px;
  text-align: center;
}

.empty-state h2 {
  margin: 0 0 8px;
}

.empty-state p {
  color: var(--muted);
  margin: 0 0 18px;
}

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  padding: 24px clamp(18px, 4vw, 56px);
  text-align: center;
}

.site-footer p {
  margin: 6px auto;
  max-width: 920px;
}

.fine-print {
  font-size: 0.82rem;
}

.hidden {
  display: none;
}

@media (max-width: 760px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
    justify-content: flex-end;
    min-height: 330px;
  }

  .header-action {
    width: 100%;
  }

  .toolbar {
    grid-template-columns: 1fr;
  }

  .status-line {
    text-align: left;
  }
}
