/* ==========================================================================
   Vehicle Details page — additive styles only. Loaded after css/styles.css
   on vehicle-details.html alone, so nothing here can affect the homepage
   or inventory page. Reuses styles.css's :root tokens and .btn family.
   ========================================================================== */

/* .disclosure-banner / .preview-banner both set display:flex, which has the
   same specificity as the UA stylesheet's [hidden]{display:none} and comes
   later in the cascade — without this, toggling .hidden via JS silently
   fails to hide them. See css/admin.css for the same fix. */
[hidden] { display: none !important; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--color-ink);
  margin: 10px 0 20px;
}
.back-link .icon { width: 16px; height: 16px; }
.back-link:hover { color: var(--color-primary); }

.vd-state { padding: 60px 24px; text-align: center; }
.vd-state h1 { margin-bottom: 10px; }
.vd-state p { color: var(--color-body); max-width: 460px; margin-left: auto; margin-right: auto; }

.preview-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #FFFBEB;
  border: 1px solid #F2C94C;
  color: #92660A;
  font-size: 13.5px;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
}
.preview-banner .icon { width: 16px; height: 16px; flex: 0 0 16px; }

.vehicle-detail {
  display: block;
  padding-bottom: 8px;
}

/* Full-bleed breakout: stretches edge-to-edge regardless of the .container
   max-width it's nested in, without needing to restructure the DOM. */
.vehicle-gallery {
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
}

.vehicle-gallery__main {
  position: relative;
  overflow: hidden;
  background: var(--color-bg-alt);
}
.vehicle-gallery__track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.vehicle-gallery__track::-webkit-scrollbar { display: none; }
.vehicle-gallery__slide {
  position: relative;
  flex: 0 0 100%;
  width: 100%;
  scroll-snap-align: start;
}
.vehicle-gallery__track img {
  width: 100%;
  aspect-ratio: 21 / 9;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
}
/* Shown over a slide/thumbnail until its own <img> actually finishes
   loading — a freshly uploaded photo's URL can be the first real request
   this browser ever makes for it (no CDN warm cache yet), so without this
   there's a brief gap where the slide is blank or shows a broken-image
   icon instead of anything useful. */
.vehicle-gallery__slide-spinner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg-alt);
}
.vehicle-gallery__spinner-ring,
.photo-lightbox__spinner {
  width: 28px; height: 28px;
  border: 3px solid rgba(10, 14, 20, 0.15);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: vd-photo-spin 0.7s linear infinite;
}
@keyframes vd-photo-spin { to { transform: rotate(360deg); } }
.vehicle-gallery__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(10, 14, 20, 0.55);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s ease;
}
.vehicle-gallery__nav:hover { background: rgba(10, 14, 20, 0.8); }
.vehicle-gallery__nav--prev { left: 20px; }
.vehicle-gallery__nav--next { right: 20px; }
.vehicle-gallery__note {
  position: absolute;
  left: 24px;
  bottom: 16px;
  margin: 0;
  background: rgba(10, 14, 20, 0.72);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
}
.vehicle-gallery__thumbs { display: flex; gap: 10px; margin: 16px 0 28px; flex-wrap: wrap; }
.vehicle-gallery__thumb {
  position: relative;
  width: 84px; height: 60px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex: 0 0 auto;
}
.vehicle-gallery__thumbs img {
  width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius-sm);
  border: 2px solid transparent; cursor: pointer; display: block;
}
.vehicle-gallery__thumbs img.is-active { border-color: var(--color-primary); }
.vehicle-gallery__thumb .vehicle-gallery__slide-spinner { border-radius: var(--radius-sm); }
.vehicle-gallery__thumb .vehicle-gallery__spinner-ring { width: 16px; height: 16px; border-width: 2px; }

/* ---- Fullscreen photo lightbox ---- */
body.photo-lightbox-open { overflow: hidden; }
.photo-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(8, 10, 14, 0.94);
  display: flex;
  align-items: center;
  justify-content: center;
}
.photo-lightbox__stage {
  position: relative;
  max-width: 94vw;
  max-height: 86vh;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 120px;
  min-height: 120px;
}
.photo-lightbox__stage img {
  max-width: 94vw;
  max-height: 86vh;
  object-fit: contain;
  display: block;
  border-radius: var(--radius-sm);
}
.photo-lightbox__close {
  position: absolute;
  top: max(18px, env(safe-area-inset-top, 0px));
  right: 20px;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s ease;
}
.photo-lightbox__close:hover { background: rgba(255, 255, 255, 0.22); }
.photo-lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s ease;
}
.photo-lightbox__nav:hover { background: rgba(255, 255, 255, 0.22); }
.photo-lightbox__nav--prev { left: 16px; }
.photo-lightbox__nav--next { right: 16px; }
.photo-lightbox__count {
  position: absolute;
  bottom: max(18px, env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  color: rgba(255, 255, 255, 0.85);
  font-size: 13px;
  font-weight: 600;
}
@media (max-width: 640px) {
  .photo-lightbox__nav { width: 40px; height: 40px; font-size: 22px; }
  .photo-lightbox__nav--prev { left: 8px; }
  .photo-lightbox__nav--next { right: 8px; }
}

.vehicle-info__eyebrow {
  text-transform: uppercase;
  letter-spacing: .06em;
  font-size: 12px;
  font-weight: 700;
  color: var(--color-primary);
  margin: 0 0 4px;
}
.vehicle-info h1 { margin-bottom: 10px; text-transform: none; font-size: clamp(24px, 2.6vw, 32px); }

.vehicle-price { display: flex; align-items: baseline; gap: 10px; margin-bottom: 16px; }
.vehicle-price__old { font-size: 16px; color: var(--color-body); text-decoration: line-through; }
.vehicle-price__current { font-size: 30px; font-weight: 800; color: var(--color-primary); }

.vehicle-meta-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  padding: 14px 0;
  margin: 0 0 16px;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  font-size: 14px;
  color: var(--color-ink);
}
.vehicle-meta-list li { display: flex; align-items: center; gap: 6px; }
.vehicle-meta-list .meta-label { color: var(--color-body); }

.disclosure-banner {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 13.5px;
  font-weight: 600;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}
.disclosure-banner--warn { background: #FFF5F4; border: 1px solid #F1B7B0; color: #A3372B; }

.vehicle-info__ids {
  display: flex;
  gap: 20px;
  font-size: 13px;
  color: var(--color-body);
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.vehicle-info__ids strong { color: var(--color-ink); }

.vehicle-info__cta { display: flex; gap: 10px; flex-wrap: wrap; }

.vd-section { padding: 32px 0; border-top: 1px solid var(--color-border); }
.vd-section h2 { font-size: 20px; margin-bottom: 16px; }
.vd-description { color: var(--color-body); max-width: 760px; }
.vd-description--empty { font-style: italic; color: var(--color-body); }

.spec-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px 24px;
  margin: 0;
}
.spec-grid div { display: flex; flex-direction: column; gap: 2px; padding: 10px 0; border-bottom: 1px solid var(--color-border); }
.spec-grid dt { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--color-body); font-weight: 700; margin: 0; }
.spec-grid dd { font-size: 14.5px; color: var(--color-ink); font-weight: 600; margin: 0; }

.options-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; }
.options-list__category h3 { font-size: 14px; text-transform: uppercase; letter-spacing: .03em; margin-bottom: 8px; }
.options-list__category ul { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.options-list__category li { font-size: 14px; color: var(--color-body); padding-left: 16px; position: relative; }
.options-list__category li::before { content: ''; position: absolute; left: 0; top: 8px; width: 6px; height: 6px; border-radius: 50%; background: var(--color-primary); }

@media (max-width: 900px) {
  .vehicle-gallery__track img { aspect-ratio: 16 / 9; }
  .spec-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .vehicle-gallery__track img { aspect-ratio: 4 / 3; }
  .vehicle-gallery__nav { display: none; }
  .spec-grid { grid-template-columns: 1fr; }
  .vehicle-info__cta { flex-direction: column; }
  .vehicle-info__cta .btn { width: 100%; text-align: center; }
}
