/* Vehicle-detail parity layer. Loaded by the central public CSS entrypoint. */
.parity-detail {
  --detail-orange: var(--parity-orange, #ee5a30);
  --detail-green: var(--parity-green, #237a57);
  --detail-green-soft: var(--parity-green-soft, #e9f5ef);
  --detail-ink: var(--parity-ink, #1b1d22);
  --detail-muted: var(--parity-muted, #68717d);
  --detail-line: var(--parity-line, #dedbd4);
  font-family: var(--font-sans, var(--font, Inter, Arial, sans-serif));
  font-weight: 400;
}

/* CMS flex ordering must not lift the un-managed tabs above the gallery. */
.parity-detail > .breadcrumbs { order: 0; }
.parity-detail > .sold-banner { order: 5; }
.parity-detail > .detail-tabs { order: 25; }
.parity-detail > .vehicle-mobile-actions,
.parity-detail > dialog,
.parity-detail > script { order: 1000; }

.parity-detail .breadcrumbs { padding-block: 18px; }
.parity-detail .detail-hero {
  grid-template-columns: minmax(0, 1.38fr) minmax(390px, .62fr);
  gap: 24px;
  align-items: start;
}

/* Only attributable seller/dealer media becomes an interactive gallery. */
.parity-detail .reference-gallery { min-width: 0; }
.parity-detail .authentic-media-gallery {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(170px, .72fr);
  gap: 10px;
}
.parity-detail .authentic-media-gallery button {
  border: 0;
  padding: 0;
  background: #e9e5df;
  overflow: hidden;
}
.parity-detail .authentic-media-gallery :is(picture, img, video) {
  display: block;
  width: 100%;
  height: 100%;
}
.parity-detail .authentic-media-gallery :is(img, video) { object-fit: cover; }
.parity-detail .gallery-main {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: 14px;
}
.parity-detail .gallery-main > small {
  position: absolute;
  left: 12px;
  bottom: 12px;
  padding: 6px 9px;
  border-radius: 7px;
  background: rgba(24, 27, 31, .86);
  color: #fff;
  font-size: .72rem;
  font-weight: 650;
}
.parity-detail .gallery-side {
  display: grid;
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.parity-detail .gallery-side > button { position: relative; border-radius: 10px; }
.parity-detail .gallery-side > button > small {
  position: absolute;
  left: 8px;
  bottom: 8px;
  max-width: calc(100% - 16px);
  overflow: hidden;
  padding: 5px 7px;
  border-radius: 6px;
  background: rgba(24, 27, 31, .86);
  color: #fff;
  font-size: .65rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.parity-detail .gallery-strip { display: none; }
.parity-detail .media-provenance {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--detail-line);
  border-radius: 12px;
  background: var(--detail-line);
  gap: 1px;
}
.parity-detail .media-provenance > span {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 3px;
  padding: 12px;
  background: #fff;
  color: var(--detail-muted);
  font-size: .7rem;
  line-height: 1.4;
}
.parity-detail .media-provenance b {
  color: var(--detail-ink);
  font-size: .75rem;
  font-weight: 650;
}
.parity-detail .media-provenance .verified b { color: var(--detail-green); }
.parity-detail .gallery-meta {
  grid-column: 1 / -1;
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--detail-muted);
  font-size: .72rem;
}
.parity-detail .gallery-meta button,
.parity-detail .request-actual-photos {
  min-height: 38px;
  border: 1px solid var(--detail-orange);
  border-radius: 9px;
  background: #fff;
  padding: 0 13px;
  color: var(--detail-orange);
  font-size: .75rem;
  font-weight: 700;
}

/* Honest empty state: illustrations are never presented as seller evidence. */
.parity-detail .authentic-media-empty {
  overflow: hidden;
  border: 1px solid var(--detail-line);
  border-radius: 16px;
  background: #fff;
}
.parity-detail .illustration-gallery-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--detail-line);
}
.parity-detail .illustration-gallery-head > div { display: grid; gap: 3px; }
.parity-detail .illustration-gallery-head b { font-size: .95rem; font-weight: 650; }
.parity-detail .illustration-gallery-head span { color: var(--detail-muted); font-size: .78rem; }
.parity-detail .illustration-gallery-head small {
  flex: 0 0 auto;
  border-radius: 999px;
  background: #f1eee8;
  padding: 7px 10px;
  color: var(--detail-muted);
  font-weight: 650;
}
.parity-detail .single-illustration,
.parity-detail .gallery-unavailable {
  position: relative;
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #ece9e3;
}
.parity-detail .single-illustration :is(picture, img),
.parity-detail .gallery-unavailable :is(picture, img) {
  display: block;
  width: 100%;
  height: 100%;
}
.parity-detail .single-illustration img,
.parity-detail .gallery-unavailable img { object-fit: contain; }
.parity-detail .single-illustration > span,
.parity-detail .gallery-unavailable > span {
  position: absolute;
  right: 12px;
  bottom: 12px;
  border-radius: 8px;
  background: rgba(24, 27, 31, .86);
  padding: 7px 10px;
  color: #fff;
  font-size: .72rem;
  font-weight: 650;
}
.parity-detail .request-actual-photos { margin: 14px 18px 0; }
.parity-detail .media-privacy-note {
  display: grid;
  gap: 3px;
  margin-top: 14px;
  padding: 14px 18px;
  border-top: 1px solid var(--detail-line);
  color: var(--detail-muted);
  font-size: .75rem;
}
.parity-detail .media-privacy-note b { color: var(--detail-ink); font-weight: 650; }

/* Conversion summary follows the reference hierarchy: two main actions, then utilities. */
.parity-detail .vehicle-summary {
  top: 82px;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 12px 35px rgba(27, 29, 34, .08);
}
.parity-detail .summary-badges :is(a, span) {
  padding: 6px 8px;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}
.parity-detail .vehicle-summary h1 {
  margin: 18px 0;
  font-family: var(--font, var(--font-geist-sans, "Geist", Arial, sans-serif));
  font-size: clamp(1.8rem, 2.7vw, 2.65rem);
  font-weight: 600;
  letter-spacing: -.04em;
}
.parity-detail .vehicle-summary h1 small { font-weight: 450; }
.parity-detail .summary-price b { font-size: 2rem; font-weight: 650; letter-spacing: -.03em; }
.parity-detail .summary-price em { font-weight: 600; }
.parity-detail .summary-facts b,
.parity-detail .seller-confidence b { font-weight: 600; }
.parity-detail .detail-primary-actions {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 10px;
  margin-top: 2px;
}
.parity-detail .detail-primary-actions :is(.primary-action, .secondary-action) {
  min-height: 50px;
  margin: 0;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: .88rem;
  font-weight: 700;
}
.parity-detail .summary-minor {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin-top: 14px;
  border-top: 1px solid var(--detail-line);
}
.parity-detail .summary-minor button[data-message-seller] { display: none; }
.parity-detail .summary-minor button {
  min-height: 42px;
  padding: 7px 4px;
  color: var(--detail-muted);
  font-size: .68rem;
  font-weight: 550;
}
.parity-detail .summary-minor button small { display: block; font-size: .56rem; font-weight: 450; }
.parity-detail .detail-reserve-action {
  width: 100%;
  min-height: 38px;
  margin-top: 10px;
  border: 1px solid var(--detail-line);
  border-radius: 9px;
  background: #faf9f6;
  color: var(--detail-muted);
  font-size: .7rem;
  font-weight: 600;
}
.parity-detail .detail-reserve-action b { color: var(--detail-ink); font-weight: 650; }
.parity-detail .detail-anchor-alias {
  position: absolute;
  width: 1px;
  height: 1px;
  margin-top: -90px;
  overflow: hidden;
}
.parity-detail .inspection-pending .passport-summary {
  grid-template-columns: minmax(0, 1fr);
  margin-bottom: 0;
}
.parity-detail .inspection-pending .passport-summary > span {
  border-color: var(--detail-line);
  background: #f5f3ee;
}
.parity-detail .inspection-pending .passport-summary > span:nth-child(n + 2),
.parity-detail .inspection-pending .passport-grid { display: none; }
.parity-detail .inspection-pending .passport-summary small { color: var(--detail-muted); }

/* Compact reference tabs, not a row of large pills. */
.parity-detail .detail-tabs {
  top: 72px;
  z-index: 45;
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 0;
  margin-top: 22px;
  padding: 0 10px;
  border: 1px solid var(--detail-line);
  border-radius: 13px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 8px 24px rgba(27, 29, 34, .05);
  backdrop-filter: blur(12px);
}
.parity-detail .detail-tabs a {
  position: relative;
  min-height: 54px;
  display: inline-flex;
  align-items: center;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0 14px;
  color: var(--detail-muted);
  font-size: .79rem;
  font-weight: 600;
}
.parity-detail .detail-tabs a::after {
  content: "";
  position: absolute;
  right: 14px;
  bottom: 0;
  left: 14px;
  height: 2px;
  background: transparent;
}
.parity-detail .detail-tabs a:hover,
.parity-detail .detail-tabs a:focus-visible,
.parity-detail .detail-tabs a.active { color: var(--detail-ink); }
.parity-detail .detail-tabs a:hover::after,
.parity-detail .detail-tabs a:focus-visible::after,
.parity-detail .detail-tabs a.active::after { background: var(--detail-orange); }

/* Long evidence content is divided into calm, readable cards. */
.parity-detail .detail-section {
  margin-top: 18px;
  padding: clamp(24px, 3vw, 36px);
  border: 1px solid var(--detail-line);
  border-radius: 16px;
  background: #fff;
}
.parity-detail .detail-section > header { max-width: 780px; }
.parity-detail .detail-section > header > span {
  font-size: .69rem;
  font-weight: 750;
  letter-spacing: .12em;
}
.parity-detail .detail-section > header h2 {
  margin: 5px 0 7px;
  font-size: clamp(1.45rem, 2.4vw, 2rem);
  font-weight: 600;
  line-height: 1.13;
  letter-spacing: -.035em;
}
.parity-detail .detail-section > header > p {
  margin: 0 0 22px;
  color: var(--detail-muted);
  font-size: .92rem;
  line-height: 1.55;
}
.parity-detail :is(.highlight-grid, .passport-grid, .passport-summary, .ownership-grid, .spec-grid, .seller-grid) b,
.parity-detail details summary,
.parity-detail .cost-layout label { font-weight: 600; }
.parity-detail :is(.highlight-grid, .passport-grid, .passport-summary, .ownership-grid, .spec-grid, .seller-grid) :is(p, span) {
  line-height: 1.5;
}

/* Related inventory is a restrained four-card rail on detail pages only. */
.parity-detail .detail-related-section { padding-block: 44px; }
.parity-detail .detail-related-section .home-section-head h2 {
  font-size: clamp(1.6rem, 3vw, 2.35rem);
  font-weight: 600;
  letter-spacing: -.035em;
}
.parity-detail .detail-related-section .home-car-rail {
  grid-auto-flow: row;
  grid-auto-columns: auto;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: visible;
}
.parity-detail .detail-related-section .parity-card-content { padding: 14px; }
.parity-detail .detail-related-section .parity-card-content h3 { font-size: 1rem; font-weight: 600; }
.parity-detail .detail-related-section .card-price-block > strong { font-size: 1.35rem; font-weight: 650; }
.parity-detail .detail-related-section .home-card-price > .card-emi { display: none; }
.parity-detail .detail-related-section .card-price-block > small,
.parity-detail .detail-related-section .card-price-block > span,
.parity-detail .detail-related-section .card-location small { display: none; }
.parity-detail .detail-related-section .parity-card-content .card-facts { margin-block: 10px; padding-block: 9px; }
.parity-detail .detail-related-section .parity-card-content .card-facts span:nth-child(n + 2) { display: none; }
.parity-detail .detail-related-section .parity-card-content .card-location { display: none; }
.parity-detail .detail-related-section :is(.compare-button, .save-button) { display: none; }
.parity-detail .detail-related-section .card-image-count { display: none; }
.parity-detail .detail-related-section .card-cta { font-weight: 650; }

/* Fullscreen viewer keeps close and navigation controls visible at every size. */
.reference-gallery-dialog {
  width: min(1180px, calc(100% - 28px));
  height: min(860px, calc(100% - 28px));
  max-width: none;
  max-height: none;
  overflow: hidden;
  padding: 58px 66px 72px;
  border-radius: 16px;
  background: #101214;
}
.reference-gallery-dialog > header { top: 12px; left: 18px; right: 12px; }
.reference-gallery-dialog > header > span {
  color: #fff;
  font-size: .75rem;
  font-weight: 650;
  letter-spacing: .02em;
  text-transform: none;
}
.reference-gallery-dialog .gallery-zoom-controls {
  margin-left: auto;
  display: flex;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 999px;
  background: rgba(17,19,22,.76);
}
.reference-gallery-dialog .gallery-zoom-controls button {
  min-width: 40px;
  height: 38px;
  border: 0;
  border-right: 1px solid rgba(255,255,255,.2);
  background: transparent;
  color: #fff;
  font-size: .75rem;
  font-weight: 700;
}
.reference-gallery-dialog .gallery-zoom-controls button:last-child { border-right: 0; }
.reference-gallery-dialog figure picture { transition: transform 180ms ease; transform-origin: center; }
.reference-gallery-dialog .dialog-close {
  position: static;
  width: auto;
  min-width: 84px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 999px;
  background: #fff;
  padding: 0 13px;
  font-size: 1.35rem;
}
.reference-gallery-dialog .dialog-close small { font-size: .72rem; font-weight: 650; }
.reference-gallery-dialog figure :is(picture, video) {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
}
.reference-gallery-dialog figure :is(img, video) {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.reference-gallery-dialog figcaption {
  position: absolute;
  left: 50%;
  bottom: 21px;
  max-width: calc(100% - 210px);
  transform: translateX(-50%);
  overflow: hidden;
  color: #d7dadd;
  font-size: .78rem;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.reference-gallery-dialog :is(.gallery-prev, .gallery-next) {
  top: 50%;
  width: 48px;
  height: 48px;
  margin-top: -24px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 8px 25px rgba(0, 0, 0, .28);
}
.reference-gallery-dialog .gallery-count {
  bottom: 20px;
  color: #fff;
  font-size: .75rem;
  font-weight: 650;
}

@media (max-width: 1180px) {
  .parity-detail .detail-hero { grid-template-columns: 1fr; }
  .parity-detail .vehicle-summary { position: static; }
  .parity-detail .detail-related-section .home-car-rail { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .parity-detail .media-provenance { grid-template-columns: 1fr 1fr; }
  .parity-detail .detail-related-section .home-car-rail { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 650px) {
  .parity-detail { padding-bottom: calc(86px + env(safe-area-inset-bottom)); }
  .parity-detail .breadcrumbs { width: calc(100% - 24px); padding-block: 12px; }
  .parity-detail .detail-hero { width: 100%; gap: 12px; }
  .parity-detail .reference-gallery { border-inline: 0; border-radius: 0; }
  .parity-detail .authentic-media-gallery { display: block; }
  .parity-detail .gallery-main { width: 100%; border-radius: 0; }
  .parity-detail .gallery-side { display: none; }
  .parity-detail .gallery-strip {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 9px 12px 2px;
    scroll-snap-type: x mandatory;
  }
  .parity-detail .gallery-strip > button {
    position: relative;
    flex: 0 0 88px;
    aspect-ratio: 4 / 3;
    border-radius: 8px;
    scroll-snap-align: start;
  }
  .parity-detail .gallery-strip > button > small {
    position: absolute;
    right: 3px;
    bottom: 3px;
    left: 3px;
    overflow: hidden;
    border-radius: 4px;
    background: rgba(24, 27, 31, .82);
    padding: 2px 4px;
    color: #fff;
    font-size: .52rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .parity-detail .gallery-strip > button > span { display: none; }
  .parity-detail .media-provenance {
    grid-template-columns: 1fr 1fr;
    margin: 10px 12px 0;
  }
  .parity-detail .media-provenance > span { padding: 10px; font-size: .65rem; }
  .parity-detail .gallery-meta { padding: 7px 12px 12px; align-items: flex-start; }
  .parity-detail .gallery-meta > span { display: none; }
  .parity-detail .illustration-gallery-head { align-items: flex-start; padding: 14px 12px; }
  .parity-detail .illustration-gallery-head span { font-size: .72rem; }
  .parity-detail .single-illustration,
  .parity-detail .gallery-unavailable { aspect-ratio: 4 / 3; }
  .parity-detail .request-actual-photos { width: calc(100% - 24px); margin: 12px; }
  .parity-detail .media-privacy-note { margin-top: 0; padding: 12px; }
  .parity-detail .vehicle-summary { margin-inline: 12px; padding: 19px; }
  .parity-detail .vehicle-summary h1 { font-size: 1.75rem; }
  .parity-detail .summary-price b { font-size: 1.7rem; }
  .parity-detail .detail-primary-actions { grid-template-columns: 1fr 1fr; }
  .parity-detail .detail-primary-actions :is(.primary-action, .secondary-action) { font-size: .78rem; }
  .parity-detail .detail-tabs {
    top: 54px;
    width: 100%;
    min-height: 50px;
    margin-top: 12px;
    border-inline: 0;
    border-radius: 0;
    padding: 0 8px;
  }
  .parity-detail .detail-tabs a { min-height: 48px; padding-inline: 11px; font-size: .72rem; }
  .parity-detail .detail-tabs a::after { right: 11px; left: 11px; }
  .parity-detail .detail-section {
    width: calc(100% - 24px);
    margin-top: 12px;
    padding: 20px 16px;
    border-radius: 13px;
  }
  .parity-detail .detail-section > header h2 { font-size: 1.45rem; }
  .parity-detail .detail-related-section { width: 100%; padding: 34px 12px; }
  .parity-detail .detail-related-section .home-car-rail {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: min(82vw, 305px);
    grid-template-columns: none;
    overflow-x: auto;
    padding-right: 12px;
    scroll-snap-type: x mandatory;
  }
  .parity-detail .detail-related-section .home-section-head { align-items: flex-start; flex-direction: column; gap: 8px; }
  .parity-detail .detail-related-section .home-section-head > a { margin-top: 0; }
  .parity-detail .vehicle-mobile-actions {
    bottom: calc(68px + env(safe-area-inset-bottom));
    min-height: 68px;
    display: grid;
    grid-template-columns: minmax(84px, 1fr) 48px minmax(126px, 1.25fr);
    gap: 8px;
    padding: 9px 10px;
  }
  .parity-detail .vehicle-mobile-actions > div { min-width: 0; }
  .parity-detail .vehicle-mobile-actions > div small { max-width: 120px; color: var(--detail-muted); font-size: .62rem; }
  .parity-detail .vehicle-mobile-actions > div b { font-size: .9rem; font-weight: 650; }
  .parity-detail .vehicle-mobile-actions :is(a, button) {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    padding: 0 11px;
    font-size: .72rem;
    font-weight: 700;
  }
  .parity-detail .mobile-whatsapp-action {
    width: 48px;
    padding: 0;
    border: 1px solid #238636;
    background: #eaf7ef;
    color: #176c2b;
    font-size: 1.1rem;
  }
  .reference-gallery-dialog {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    padding: max(58px, env(safe-area-inset-top)) 10px 82px;
    border-radius: 0;
  }
  .reference-gallery-dialog > header {
    top: max(10px, env(safe-area-inset-top));
    right: 10px;
    left: 12px;
    min-width: 0;
    gap: 8px;
  }
  .reference-gallery-dialog > header > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .reference-gallery-dialog .gallery-zoom-controls,
  .reference-gallery-dialog .dialog-close { flex: 0 0 auto; }
  .reference-gallery-dialog .gallery-zoom-controls button { min-width: 36px; height: 36px; }
  .reference-gallery-dialog .dialog-close { min-width: 78px; height: 38px; }
  .reference-gallery-dialog :is(.gallery-prev, .gallery-next) {
    top: 50%;
    bottom: auto;
    width: 44px;
    height: 44px;
  }
  .reference-gallery-dialog .gallery-prev { left: 8px; }
  .reference-gallery-dialog .gallery-next { right: 8px; }
  .reference-gallery-dialog figcaption { bottom: 49px; max-width: calc(100% - 32px); font-size: .7rem; }
  .reference-gallery-dialog .gallery-count { bottom: 21px; }
}

@media (max-width: 390px) {
  .parity-detail .vehicle-mobile-actions { grid-template-columns: 78px 46px minmax(0, 1fr); }
  .parity-detail .vehicle-mobile-actions > div small { display: none; }
  .parity-detail .vehicle-mobile-actions :is(a, button) { padding-inline: 7px; font-size: .66rem; }
}

@media (max-width: 480px) {
  .parity-detail .media-provenance { grid-template-columns: 1fr; }
}

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