/* Vehicle photography: preserve the complete photo and make every angle accessible. */
.detail-gallery.vehicle-gallery {
  display: block;
  min-width: 0;
  color: #202a34;
}

.vehicle-gallery__heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.vehicle-gallery__eyebrow {
  margin: 0 0 7px;
  color: #68737e;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.vehicle-gallery__heading h2 {
  margin: 0;
  color: #202a34;
  font-family: var(--sans);
  font-size: clamp(22px, 2.3vw, 30px);
  font-weight: 700;
  letter-spacing: -.035em;
  line-height: 1.2;
}

.vehicle-gallery__total {
  margin: 0 0 2px;
  color: #68737e;
  font-size: 13px;
  white-space: nowrap;
}

.vehicle-gallery__stage {
  position: relative;
  isolation: isolate;
  height: min(52vw, 560px);
  min-height: 300px;
  overflow: hidden;
  border: 1px solid #e1e5e9;
  border-radius: 14px;
  background: #eef1f4;
}

.vehicle-gallery__open {
  display: block;
  width: 100%;
  height: 100%;
  cursor: zoom-in;
}

.vehicle-gallery__open,
.vehicle-viewer [data-viewer-image] {
  touch-action: pan-y pinch-zoom;
}

.vehicle-gallery__open > img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
}

.vehicle-gallery__open:focus-visible {
  outline: 3px solid #c70b20;
  outline-offset: -5px;
}

.vehicle-gallery[data-gallery-state="error"] [data-gallery-main],
.vehicle-viewer[data-viewer-state="error"] [data-viewer-image] {
  visibility: hidden;
}

.vehicle-gallery__empty {
  display: grid;
  min-height: 280px;
  place-content: center;
  justify-items: center;
  gap: 16px;
  padding: 32px;
  border: 1px solid #e1e5e9;
  border-radius: 14px;
  background: #eef1f4;
  color: #68737e;
  text-align: center;
}

.vehicle-gallery__empty > .bi { color: #87939f; font-size: 40px; }
.vehicle-gallery__empty > p { margin: 0; font-size: 16px; font-weight: 550; line-height: 1.5; }

.vehicle-gallery__badge {
  position: absolute;
  z-index: 2;
  top: 18px;
  left: 18px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 34px;
  padding: 8px 12px;
  border: 1px solid rgb(255 255 255 / 16%);
  border-radius: 7px;
  background: rgb(24 32 40 / 82%);
  color: #fff;
  font-size: 12px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  pointer-events: none;
}

.vehicle-gallery__badge .bi { font-size: 15px; }

.vehicle-gallery__arrow,
.vehicle-gallery__expand,
.vehicle-viewer__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 1px solid rgb(32 42 52 / 10%);
  border-radius: 8px;
  background: rgb(255 255 255 / 96%);
  color: #202a34;
  box-shadow: 0 2px 8px rgb(20 30 40 / 8%);
  font-size: 13px;
  font-weight: 650;
  line-height: 1;
  cursor: pointer;
  transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

.vehicle-gallery__arrow {
  position: absolute;
  z-index: 3;
  top: 50%;
  width: 46px;
  height: 46px;
  transform: translateY(-50%);
}

.vehicle-gallery__arrow--prev { left: 18px; }
.vehicle-gallery__arrow--next { right: 18px; }
.vehicle-gallery__arrow .bi { font-size: 20px; }

.vehicle-gallery__expand {
  position: absolute;
  z-index: 3;
  right: 18px;
  bottom: 18px;
  padding: 0 14px;
}

.vehicle-gallery__expand .bi { font-size: 17px; }

.vehicle-gallery__arrow:hover,
.vehicle-gallery__expand:hover,
.vehicle-viewer__close:hover {
  border-color: #c70b20;
  background: #fff;
  color: #c70b20;
}

.vehicle-gallery__arrow:disabled {
  cursor: default;
  opacity: .4;
}

.vehicle-gallery__thumbs {
  display: flex;
  align-items: stretch;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
  margin-top: 14px;
  padding: 3px 2px 9px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-color: #bdc5cd transparent;
  scrollbar-width: thin;
  scroll-snap-type: x proximity;
}

.vehicle-gallery__thumb {
  position: relative;
  display: block;
  flex: 0 0 118px;
  width: 118px;
  height: 88px;
  padding: 3px;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 9px;
  background: #f0f2f5;
  scroll-snap-align: start;
  transition: border-color 160ms ease, background-color 160ms ease;
}

.vehicle-gallery__thumb > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
}

.vehicle-gallery__thumb > span {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: grid;
  place-items: center;
  min-width: 22px;
  height: 20px;
  padding-inline: 4px;
  border-radius: 4px;
  background: rgb(24 32 40 / 76%);
  color: #fff;
  font-size: 10px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.vehicle-gallery__thumb:hover { border-color: #a6b0ba; }
.vehicle-gallery__thumb.is-active { border-color: #c70b20; background: #fff; }
.vehicle-gallery__thumb.is-active > span { background: #c70b20; }
.vehicle-gallery__thumb:focus-visible { outline-offset: 0; }

.vehicle-gallery__hint {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 3px 0 0;
  color: #68737e;
  font-size: 12px;
  line-height: 1.6;
}

.vehicle-gallery__error,
.vehicle-viewer__error {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 50%;
  width: min(400px, calc(100% - 120px));
  margin: 0;
  padding: 20px;
  border: 1px solid #dce1e6;
  border-radius: 10px;
  background: #fff;
  color: #465461;
  font-size: 14px;
  line-height: 1.6;
  text-align: center;
  transform: translate(-50%, -50%);
}

body.gallery-viewer-open { overflow: hidden; }

dialog.vehicle-viewer {
  width: min(1440px, calc(100vw - 48px));
  max-width: none;
  height: min(980px, calc(100vh - 48px));
  height: min(980px, calc(100dvh - 48px));
  max-height: none;
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid #36404a;
  border-radius: 14px;
  background: #151c23;
  color: #fff;
  box-shadow: 0 20px 80px rgb(0 0 0 / 35%);
}

dialog.vehicle-viewer[open] { display: flex; flex-direction: column; }
dialog.vehicle-viewer:not([open]) { display: none; }
dialog.vehicle-viewer::backdrop { background: rgb(10 15 20 / 87%); }

.vehicle-gallery[data-gallery-state="loading"] [data-gallery-main],
.vehicle-viewer[data-viewer-state="loading"] [data-viewer-image] { visibility: hidden; }
.vehicle-gallery__loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 12px 18px;
  border-radius: 8px;
  background: #202a34;
  color: #fff;
  font-size: 13px;
  pointer-events: none;
}

.vehicle-viewer__header {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-width: 0;
  padding: 18px 24px;
  border-bottom: 1px solid rgb(255 255 255 / 10%);
}

.vehicle-viewer__header > div { flex: 1; min-width: 0; }
.vehicle-viewer__eyebrow {
  display: block;
  margin-bottom: 6px;
  color: #a8b3bf;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: .1em;
  line-height: 1.4;
  text-transform: uppercase;
}
.vehicle-viewer__header h2,
.vehicle-viewer__title {
  margin: 0;
  color: #fff;
  font-family: var(--sans);
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -.015em;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.vehicle-viewer__header p,
.vehicle-viewer__counter {
  margin: 5px 0 0;
  color: #b8c1ca;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
}

.vehicle-viewer__counter { flex-shrink: 0; white-space: nowrap; }

.vehicle-viewer__close {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-color: #49545f;
  background: #252f39;
  color: #fff;
  box-shadow: none;
}

.vehicle-viewer__close .bi { font-size: 24px; }

.vehicle-viewer__stage {
  position: relative;
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  align-items: center;
  justify-content: center;
  padding: 16px 76px;
  overflow: hidden;
}

.vehicle-viewer__stage > img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.vehicle-viewer__stage .vehicle-gallery__arrow {
  border-color: #53616d;
  background: rgb(37 47 57 / 94%);
  color: #fff;
  box-shadow: none;
}

.vehicle-viewer__stage .vehicle-gallery__arrow:hover {
  border-color: #fff;
  background: #fff;
  color: #202a34;
}

.vehicle-viewer__footer {
  flex: 0 0 auto;
  margin: 0;
  padding: 15px 24px;
  border-top: 1px solid rgb(255 255 255 / 10%);
  color: #b8c1ca;
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.vehicle-viewer__footer p { margin: 0; }
.vehicle-gallery [hidden], .vehicle-viewer [hidden], .vehicle-viewer[hidden] { display: none !important; }

@media (max-width: 760px) {
  .vehicle-gallery__heading { margin-bottom: 16px; }
  .vehicle-gallery__stage { height: min(64vw, 480px); min-height: 230px; }
  .vehicle-gallery__thumb { flex-basis: 102px; width: 102px; height: 76px; }
  dialog.vehicle-viewer { width: 100%; height: 100vh; height: 100dvh; border: 0; border-radius: 0; }
  .vehicle-viewer__header { gap: 14px; padding: max(14px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 14px max(16px, env(safe-area-inset-left)); }
  .vehicle-viewer__header h2, .vehicle-viewer__title { font-size: 15px; }
  .vehicle-viewer__stage { padding: 8px; }
  .vehicle-viewer__stage .vehicle-gallery__arrow { top: auto; bottom: 16px; transform: none; }
  .vehicle-viewer__footer { padding: 12px 18px max(16px, env(safe-area-inset-bottom)); font-size: 11px; }
}

@media (max-width: 480px) {
  .vehicle-gallery__heading { gap: 12px; }
  .vehicle-gallery__eyebrow { font-size: 10px; }
  .vehicle-gallery__total { font-size: 12px; }
  .vehicle-gallery__stage { height: 70vw; min-height: 218px; max-height: 330px; border-radius: 10px; }
  .vehicle-gallery__badge { top: 10px; left: 10px; min-height: 30px; padding: 7px 9px; font-size: 11px; }
  .vehicle-gallery__arrow { width: 44px; height: 44px; }
  .vehicle-gallery__arrow--prev { left: 10px; }
  .vehicle-gallery__arrow--next { right: 10px; }
  .vehicle-gallery__expand { right: 10px; bottom: 10px; min-height: 44px; padding: 0 11px; font-size: 12px; }
  .vehicle-gallery__thumbs { gap: 7px; margin-top: 10px; }
  .vehicle-gallery__thumb { flex-basis: 88px; width: 88px; height: 68px; padding: 2px; border-radius: 7px; }
  .vehicle-gallery__hint { font-size: 11px; }
  .vehicle-gallery__error, .vehicle-viewer__error { width: calc(100% - 112px); padding: 12px; font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .vehicle-gallery *, .vehicle-viewer * { scroll-behavior: auto !important; transition: none !important; }
}
