/* ===========================================================================
   FICHA DE VEHÍCULO (vd-*) — rediseño
   Objetivo de la página: que quien llega desde WhatsApp, Instagram o Google vea el auto,
   confíe y escriba. Por eso: galería grande, precio y contacto siempre a la vista
   (panel fijo en escritorio, barra fija en celular), datos claros y ubicación real.
   Identidad: azul de marca, tipografía del sitio, bordes redondeados. Todo con prefijo vd-.
   =========================================================================== */

.vd {
  --vd-ink: #0e1726;
  --vd-text: #243044;
  --vd-muted: #5b6778;
  --vd-line: #e4eaf2;
  --vd-soft: #f4f7fb;
  --vd-blue: #0d77be;
  --vd-blue-dark: #0a63a0;
  --vd-wa: #12874b;         /* verde WhatsApp con contraste AA sobre texto blanco */
  --vd-wa-dark: #0e6f3e;
  --vd-r: 22px;
  --vd-gutter: clamp(16px, 3.2vw, 32px);
  --vd-ease: cubic-bezier(0.22, 1, 0.36, 1);

  padding: 92px 0 0;
  color: var(--vd-text);
}
.vd-outer { min-width: 0; }
.vd-wrap {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 var(--vd-gutter);
}

/* ---------- Encabezado ---------- */
.vd-crumbs {
  display: flex; flex-wrap: wrap; gap: 6px 8px;
  margin: 0 0 14px;
  font-size: 0.86rem; color: var(--vd-muted);
}
.vd-crumbs a { color: inherit; text-decoration: none; }
.vd-crumbs a:hover { color: var(--vd-blue); text-decoration: underline; }
.vd-crumbs [aria-current] { color: var(--vd-ink); font-weight: 600; }

.vd-head { margin: 0 0 22px; }
.vd-title {
  margin: 0;
  font-size: clamp(1.7rem, 1.1rem + 2.4vw, 2.7rem);
  line-height: 1.08;
  letter-spacing: -0.025em;
  font-weight: 800;
  color: var(--vd-ink);
  text-wrap: balance;
}
/* ---------- Estructura: celular = una columna; escritorio = contenido + panel fijo ---------- */
.vd-layout { display: flex; flex-direction: column; gap: 22px; }
.vd-main { display: contents; }               /* en celular el orden lo define `order` */
.vd-gallery { order: 1; }
.vd-panel   { order: 2; }
.vd-section { order: 3; margin-top: 18px; }

@media (min-width: 1024px) {
  .vd-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 44px;
    align-items: start;
  }
  .vd-main { display: block; min-width: 0; }
  .vd-section { margin-top: 52px; }
  .vd-panel { position: sticky; top: 96px; }
}

/* ---------- Galería ---------- */
.vd-stage {
  position: relative;
  border-radius: var(--vd-r);
  overflow: hidden;
  background: #0b1220;
  box-shadow: 0 18px 50px rgba(14, 23, 38, 0.16);
}
.vd-track {
  display: flex;
  margin: 0; padding: 0; list-style: none;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.vd-track::-webkit-scrollbar { display: none; }
.vd-track:focus-visible { outline: 3px solid var(--vd-blue); outline-offset: -3px; }
.vd-slide { flex: 0 0 100%; scroll-snap-align: center; aspect-ratio: 4 / 3; background: #0b1220; }
.vd-slide img { width: 100%; height: 100%; object-fit: cover; display: block; }

.vd-nav {
  position: absolute; top: 50%; z-index: 2;
  width: 48px; height: 48px; margin-top: -24px;
  display: none; place-items: center;
  border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 6px 20px rgba(14, 23, 38, 0.25);
  cursor: pointer; color: var(--vd-ink);
  transition: transform 0.2s var(--vd-ease), opacity 0.2s ease, background-color 0.2s ease;
}
.vd-nav svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.vd-prev { left: 14px; }
.vd-next { right: 14px; }
.vd-nav[disabled] { opacity: 0; pointer-events: none; }
@media (hover: hover) and (pointer: fine) {
  .vd-nav { display: grid; }
  .vd-nav:hover { transform: scale(1.08); background: #fff; }
}

.vd-count, .vd-fs, .vd-warranty {
  position: absolute; z-index: 2;
  padding: 7px 13px; border-radius: 999px;
  background: #fff; color: var(--vd-ink);
  box-shadow: 0 4px 14px rgba(14, 23, 38, 0.22);
  font-size: 0.82rem; font-weight: 700; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.vd-count { left: 14px; bottom: 14px; }
.vd-fs {
  right: 14px; bottom: 14px;
  display: grid; place-items: center;
  width: 40px; height: 40px; padding: 0;             /* solo el ícono */
  border: 0; cursor: pointer; font-family: inherit;
}
.vd-fs svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.vd-warranty { left: 14px; top: 14px; background: var(--vd-blue); color: #fff; }

.vd-thumbs {
  display: none;
  justify-content: center;         /* siempre centradas */
  margin-top: 14px; padding: 4px 0 6px;
}
@media (min-width: 640px) { .vd-thumbs { display: flex; } }
.vd-thumb {
  position: relative;
  flex: 0 0 auto; width: 96px; max-width: 96px; margin: 0 5px;
  aspect-ratio: 4 / 3;
  padding: 0; border: 2px solid transparent; border-radius: 12px;
  overflow: hidden; cursor: pointer; background: var(--vd-soft);
  opacity: 0.72;
  transition: max-width 0.4s var(--vd-ease), margin 0.4s var(--vd-ease), opacity 0.35s ease,
              border-color 0.2s ease, transform 0.3s var(--vd-ease);
}
.vd-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vd-thumb:hover { opacity: 1; }
.vd-thumb.is-active { opacity: 1; border-color: var(--vd-blue); transform: translateY(-2px); }
.vd-thumb:focus-visible { outline: 3px solid var(--vd-blue); outline-offset: 2px; }
/* Las que salen de la ventana se desvanecen y se colapsan (no se acumulan a la izquierda) */
.vd-thumb.is-out {
  max-width: 0; margin: 0; border-width: 0;
  opacity: 0; transform: scale(0.85);
  pointer-events: none;
}
/* Cuadrito "+N": la siguiente foto desenfocada con la cantidad que falta */
.vd-thumb--more { opacity: 1; }
.vd-thumb--more img { filter: blur(6px) brightness(0.72); transform: scale(1.15); }
.vd-thumb--more span {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: #fff; font-size: 1.15rem; font-weight: 800; letter-spacing: -0.01em;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
}
.vd-thumb--more.is-out { margin: 0; }

/* Celular: la galería ocupa todo el ancho de la pantalla */
@media (max-width: 639px) {
  .vd-gallery { margin-inline: calc(var(--vd-gutter) * -1); }
  .vd-stage { border-radius: 0; box-shadow: none; }
}

/* ---------- Panel de compra ---------- */
.vd-panel-card {
  background: #fff;
  border: 1px solid var(--vd-line);
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 16px 44px rgba(14, 23, 38, 0.09);
}
.vd-price-label { margin: 0 0 2px; font-size: 0.86rem; font-weight: 600; color: var(--vd-muted); }
.vd-price {
  margin: 0;
  font-size: clamp(2.1rem, 1.6rem + 1.6vw, 2.7rem);
  line-height: 1.05; letter-spacing: -0.03em; font-weight: 800;
  color: var(--vd-ink); font-variant-numeric: tabular-nums;
}
.vd-price-alt { margin: 8px 0 0; font-size: 0.95rem; color: var(--vd-text); }
.vd-price-note { margin: 8px 0 20px; font-size: 0.88rem; color: var(--vd-muted); }

.vd-cta { display: grid; gap: 10px; }
.vd-cta-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.vd-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 20px;
  border: 1px solid transparent; border-radius: 14px;
  font: inherit; font-size: 1rem; font-weight: 700; line-height: 1.1;
  text-decoration: none; text-align: center; cursor: pointer;
  transition: transform 0.2s var(--vd-ease), box-shadow 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}
.vd-btn svg { width: 22px; height: 22px; flex: none; fill: currentColor; }
.vd-btn--wa,
.vd-btn--primary { background: var(--vd-blue); }   /* el botón de WhatsApp usa el azul de R&CIA */
/* Texto SIEMPRE blanco en los botones de color (también en hover, foco y visitado) */
.vd-btn--wa, .vd-btn--wa:visited, .vd-btn--wa:hover, .vd-btn--wa:focus, .vd-btn--wa:active,
.vd-btn--primary, .vd-btn--primary:visited, .vd-btn--primary:hover, .vd-btn--primary:focus, .vd-btn--primary:active { color: #fff; }
/* Botones blancos: el texto se queda oscuro (sin azul); el hover cambia fondo y borde */
.vd-btn--ghost, .vd-btn--ghost:visited, .vd-btn--ghost:hover, .vd-btn--ghost:focus, .vd-btn--ghost:active,
.vd-icon-btn, .vd-icon-btn:visited, .vd-icon-btn:hover, .vd-icon-btn:focus, .vd-icon-btn:active { color: var(--vd-ink); }
.vd-btn--ghost   { background: #fff; color: var(--vd-ink); border-color: var(--vd-line); min-height: 48px; font-size: 0.9rem; padding: 0 10px; }
.vd-btn:active { transform: scale(0.98); }
@media (hover: hover) and (pointer: fine) {
  .vd-btn--wa:hover,
  .vd-btn--primary:hover { background: var(--vd-blue-dark); box-shadow: 0 10px 24px rgba(13, 119, 190, 0.3); transform: translateY(-1px); }
  .vd-btn--ghost:hover   { border-color: var(--vd-blue); background: var(--vd-soft); }
}
.vd-btn:focus-visible, .vd-icon-btn:focus-visible { outline: 3px solid var(--vd-blue); outline-offset: 3px; }

.vd-icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 14px;
  border: 1px solid var(--vd-line); border-radius: 12px; background: #fff;
  font: inherit; font-size: 0.92rem; font-weight: 600; color: var(--vd-ink);
  text-decoration: none; cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.vd-icon-btn.is-copied { border-color: var(--vd-blue); color: var(--vd-blue); }
.vd-icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@media (hover: hover) and (pointer: fine) { .vd-icon-btn:hover { border-color: var(--vd-blue); background: var(--vd-soft); } }

.vd-assure { list-style: none; margin: 20px 0 0; padding: 18px 0 0; border-top: 1px solid var(--vd-line); display: grid; gap: 10px; }
.vd-assure li { display: flex; align-items: center; gap: 10px; font-size: 0.9rem; color: var(--vd-muted); }
.vd-assure svg { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--vd-blue); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.vd-assure a { color: inherit; text-decoration: none; }
.vd-assure a:hover { color: var(--vd-blue); text-decoration: underline; }

/* ---------- Secciones ---------- */
.vd-h2 {
  margin: 0 0 18px;
  font-size: clamp(1.25rem, 1rem + 0.9vw, 1.6rem);
  line-height: 1.15; letter-spacing: -0.02em; font-weight: 800; color: var(--vd-ink);
}

.vd-specs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0; }
.vd-spec:last-child:nth-child(odd) { grid-column: 1 / -1; }   /* sin tarjeta huérfana */
.vd-spec {
  display: grid; grid-template-columns: 40px 1fr; align-items: center; column-gap: 12px;
  padding: 9px 14px; border-radius: 14px;
  background: var(--vd-soft); border: 1px solid var(--vd-line);
}
/* El ícono es decorativo: va como imagen de fondo para que el <dl> tenga solo <dt>/<dd> (estructura válida) */
.vd-spec[data-icon]::before {
  content: "";
  grid-row: 1 / span 2;
  width: 40px; height: 40px;
  border-radius: 12px; background: #fff center / 20px 20px no-repeat; border: 1px solid var(--vd-line);
}
.vd-spec[data-icon="anio"]::before        { background-image: url("../img/ui/spec-icons/anio.svg"); }
.vd-spec[data-icon="km"]::before          { background-image: url("../img/ui/spec-icons/km.svg"); }
.vd-spec[data-icon="combustible"]::before { background-image: url("../img/ui/spec-icons/combustible.svg"); }
.vd-spec[data-icon="transmision"]::before { background-image: url("../img/ui/spec-icons/transmision.svg"); }
.vd-spec[data-icon="motor"]::before       { background-image: url("../img/ui/spec-icons/motor.svg"); }
.vd-spec[data-icon="traccion"]::before    { background-image: url("../img/ui/spec-icons/traccion.svg"); }
.vd-spec[data-icon="tipo"]::before        { background-image: url("../img/ui/spec-icons/tipo.svg"); }
.vd-spec dt { margin: 0; font-size: 0.76rem; font-weight: 600; color: var(--vd-muted); line-height: 1.2; }
.vd-spec dd { margin: 1px 0 0; font-size: 0.98rem; font-weight: 700; color: var(--vd-ink); line-height: 1.2; overflow-wrap: anywhere; }
.vd-spec:not([data-icon]) { grid-template-columns: 1fr; }
/* Celular: celdas chicas y centradas (ícono, valor y etiqueta apilados) para ocupar poco alto */
@media (max-width: 639px) {
  .vd-specs { gap: 8px; }
  .vd-spec {
    grid-template-columns: 1fr; justify-items: center; text-align: center;
    padding: 12px 8px 11px; row-gap: 0;
  }
  .vd-spec[data-icon]::before { grid-row: auto; width: 24px; height: 24px; border: 0; background-color: transparent; background-size: 22px 22px; margin: 0 0 6px; }
  .vd-spec dd { order: 2; font-size: 0.95rem; }
  .vd-spec dt { order: 3; margin-top: 2px; font-size: 0.72rem; }
}

.vd-prose { max-width: 68ch; font-size: 1.05rem; line-height: 1.7; }
.vd-prose p { margin: 0 0 14px; text-wrap: pretty; }
.vd-prose p:last-child { margin-bottom: 0; }

.vd-equip { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; padding: 0; list-style: none; }
.vd-equip li {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 14px; border-radius: 999px;
  background: var(--vd-soft); border: 1px solid var(--vd-line);
  font-size: 0.92rem; font-weight: 600; color: var(--vd-ink);
}
.vd-equip li::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--vd-blue); }

/* ---------- Ubicación ---------- */
.vd-loc {
  display: grid; grid-template-columns: 1fr;
  border: 1px solid var(--vd-line); border-radius: 24px; overflow: hidden; background: #fff;
  box-shadow: 0 12px 34px rgba(14, 23, 38, 0.07);
}
.vd-map { position: relative; min-height: 260px; background: linear-gradient(135deg, #e9f1fa, #dde8f5); }
.vd-map iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.vd-map-fallback {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  color: var(--vd-blue-dark); font-weight: 700;
}
.vd-map-fallback svg { width: 44px; height: 44px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.vd-loc-info { padding: 26px; display: flex; flex-direction: column; justify-content: center; }
.vd-loc-name { margin: 0 0 4px; font-size: 1.25rem; font-weight: 800; letter-spacing: -0.02em; color: var(--vd-ink); }
.vd-loc-addr { margin: 0 0 12px; font-weight: 600; color: var(--vd-text); }
.vd-loc-note { margin: 0 0 20px; font-size: 0.95rem; line-height: 1.55; color: var(--vd-muted); }
.vd-loc-actions { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 720px) {
  .vd-loc { grid-template-columns: 1.3fr 1fr; }
  .vd-map { min-height: 340px; }
}

/* ---------- Barra de acción fija (celular) ---------- */
.vd-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 9990;
  display: flex; align-items: center; gap: 14px;
  padding: 10px var(--vd-gutter, 16px) calc(10px + env(safe-area-inset-bottom, 0px));
  background: rgba(255, 255, 255, 0.94);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-top: 1px solid var(--vd-line);
  box-shadow: 0 -10px 30px rgba(14, 23, 38, 0.1);
  transform: translateY(110%);
  transition: transform 0.32s var(--vd-ease);
}
.vd-bar.is-on { transform: translateY(0); }
.vd-bar-price { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.vd-bar-price span { font-size: 0.76rem; font-weight: 600; color: var(--vd-muted); }
.vd-bar-price strong { font-size: 1.25rem; font-weight: 800; letter-spacing: -0.02em; color: var(--vd-ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.vd-bar .vd-btn { flex: 1; min-height: 50px; }
@media (min-width: 1024px) { .vd-bar { display: none; } }

/* El botón flotante de WhatsApp sobra: la barra ya trae el contacto */
@media (max-width: 1023px) { .page-ficha .wa-float { display: none; } }

/* ---------- Pantalla completa ---------- */
html.vd-lock { overflow: hidden; }
.vd-lightbox {
  position: fixed; inset: 0;
  width: 100vw; height: 100dvh; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0;
  background: #05090f; color: #fff;
  overflow: hidden;              /* sin scroll vertical dentro de la pantalla completa */
}
.vd-lightbox::backdrop { background: #000; }
.vd-lightbox:not([open]) { display: none; }
.vd-lb-track {
  display: flex; height: 100%;
  margin: 0; padding: 0; list-style: none;
  overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior: contain;
  scrollbar-width: none;
}
.vd-lb-track::-webkit-scrollbar { display: none; }
/* Sin display:grid: en grid el height:100% de la imagen no se resuelve y la foto queda a tamaño natural */
.vd-lb-track li { flex: 0 0 100%; height: 100%; scroll-snap-align: center; overflow: hidden; }
.vd-lb-track img { width: 100%; height: 100%; max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.vd-lb-top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 3;
  display: flex; align-items: center; justify-content: space-between;
  padding: max(14px, env(safe-area-inset-top, 0px)) 16px 14px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.6), transparent);
}
.vd-lb-count { font-size: 0.95rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.vd-lb-close {
  width: 48px; height: 48px; display: grid; place-items: center;
  border: 0; border-radius: 50%; cursor: pointer;
  background: rgba(255, 255, 255, 0.16); color: #fff;
}
.vd-lb-close svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.vd-lb-close:hover { background: rgba(255, 255, 255, 0.28); }
.vd-lightbox .vd-nav { display: none; z-index: 3; }
@media (hover: hover) and (pointer: fine) { .vd-lightbox .vd-nav { display: grid; } }

/* ---------- Movimiento reducido ---------- */
@media (prefers-reduced-motion: reduce) {
  .vd-thumb, .vd-btn, .vd-nav, .vd-bar { transition: none; }
  .vd-thumb.is-active { transform: none; }
}

/* ---------- Interacción con el mouse: nada se selecciona al arrastrar; se puede arrastrar como en el celular ---------- */
.vd-stage, .vd-lightbox { -webkit-user-select: none; user-select: none; }
.vd-stage ::selection, .vd-lightbox ::selection { background: transparent; }
.vd-track img, .vd-lb-track img, .vd-thumb img { -webkit-user-drag: none; user-drag: none; -webkit-touch-callout: none; }
@media (hover: hover) and (pointer: fine) {
  .vd-track, .vd-lb-track { cursor: grab; }
}
.vd-track.is-dragging, .vd-lb-track.is-dragging { scroll-snap-type: none; cursor: grabbing; }
.vd-track.is-dragging img, .vd-lb-track.is-dragging img { pointer-events: none; }
/* El foco inicial va a la galería, no a la ✕: sin anillo en el contenedor */
.vd-lightbox:focus, .vd-lightbox:focus-visible { outline: none; }

/* ---------- Galería con gestos propios (ficha.js agrega .is-live): el rail se mueve con transform ----------
   Sin JS (o si falla) sigue el scroll nativo con snap definido arriba. */
.vd-gallery.is-live .vd-track,
.vd-lightbox.is-live .vd-lb-track {
  overflow: visible;
  scroll-snap-type: none;
  touch-action: pan-y;               /* el navegador se queda con el scroll vertical; el horizontal es de la galería */
  will-change: transform;
}
.vd-lightbox.is-live .vd-lb-track { touch-action: pan-y pinch-zoom; }
