/* Vehicle detail page. */

.detail { display: grid; gap: var(--s-6); grid-template-columns: minmax(0, 1fr); grid-template-areas: "gallery" "head" "aside" "body"; padding-bottom: var(--s-8); }
.detail__head { grid-area: head; }
.gallery { grid-area: gallery; min-width: 0; }
.detail__aside { grid-area: aside; display: grid; gap: var(--s-4); align-content: start; min-width: 0; }
.detail__body { grid-area: body; min-width: 0; display: grid; gap: var(--s-4); }
@media (min-width: 64rem) {
  .detail { grid-template-columns: minmax(0, 1fr) 22.5rem; grid-template-areas: "head aside" "gallery aside" "body aside"; column-gap: var(--s-8); align-items: start; }
  .detail__aside { grid-row: 1 / span 3; position: sticky; top: calc(var(--header-h) + var(--s-4)); align-self: start; }
}

.detail__badges { display: flex; flex-wrap: wrap; gap: var(--s-2); margin: 0 0 var(--s-3); }
@media (min-width: 64rem) { .detail__head { padding-top: var(--s-2); } }
.detail__head h1 { font-size: var(--fs-h1); }
.detail__tagline { margin: var(--s-2) 0 0; font-size: var(--fs-lg); color: var(--ink-500); }
.detail__meta { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-5); margin: var(--s-3) 0 0; color: var(--ink-500); font-size: var(--fs-sm); }
.detail__meta span { display: inline-flex; align-items: center; gap: 0.35rem; }

/* Gallery. A dark "showroom floor" stage behind the photo — not the page's light grey surface — is what
   makes a listing photo read as deliberately presented rather than just dropped into a form field. */
.gallery__stage { position: relative; border-radius: var(--r-lg); overflow: hidden; background: radial-gradient(circle at 50% 42%, var(--navy-800), var(--navy-950) 115%); }
.gallery__track { list-style: none; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
.gallery__track::-webkit-scrollbar { display: none; }
.gallery__slide { flex: 0 0 100%; scroll-snap-align: center; aspect-ratio: 4 / 3; padding: clamp(0.75rem, 3vw, 2rem); }
@media (min-width: 64rem) { .gallery__slide { aspect-ratio: 3 / 2; } }
/* contain, not cover: a seller's real photo is whatever aspect ratio their phone took it in — never
   cropping it is the more honest, more premium choice, and the dark stage frames it either way. */
.gallery__slide img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 18px 28px rgba(0, 0, 0, 0.35)); }
.gallery__count { position: absolute; left: var(--s-4); bottom: var(--s-4); display: inline-flex; align-items: center; gap: 0.4rem; margin: 0; padding: 0.25rem 0.75rem; border-radius: var(--r-pill); background: rgba(6, 18, 36, 0.78); color: #fff; font-size: var(--fs-sm); font-weight: 600; font-variant-numeric: tabular-nums; }
.gallery__nav,
.gallery__expand { position: absolute; display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.94); color: var(--navy-900); cursor: pointer; box-shadow: var(--shadow-2); transition: background-color 0.15s var(--ease), transform 0.15s var(--ease); }
.gallery__nav:hover,
.gallery__expand:hover { background: #fff; }
.gallery__nav[hidden],
.gallery__expand[hidden] { display: none; }
.gallery__nav--prev { left: var(--s-3); top: 50%; transform: translateY(-50%); }
.gallery__nav--next { right: var(--s-3); top: 50%; transform: translateY(-50%); }
.gallery__expand { right: var(--s-3); bottom: var(--s-3); width: 2.5rem; height: 2.5rem; }
@media (hover: none) { .gallery__nav { display: none !important; } }
.gallery__thumbs { list-style: none; display: flex; gap: var(--s-2); margin-top: var(--s-3); overflow-x: auto; padding-bottom: var(--s-1); scrollbar-width: thin; }
.gallery__thumbs a { display: block; width: 5.5rem; aspect-ratio: 4 / 3; border-radius: var(--r-sm); overflow: hidden; border: 2px solid transparent; opacity: 0.72; transition: opacity 0.15s var(--ease), border-color 0.15s var(--ease); }
.gallery__thumbs a:hover { opacity: 1; }
.gallery__thumbs a[aria-current="true"] { opacity: 1; border-color: var(--blue-600); }
.gallery__thumbs img { width: 100%; height: 100%; object-fit: cover; }
.gallery__empty { display: grid; place-items: center; gap: var(--s-2); aspect-ratio: 4 / 3; background: radial-gradient(circle at 50% 42%, var(--navy-800), var(--navy-950) 115%); border-radius: var(--r-lg); color: rgba(255, 255, 255, 0.6); text-align: center; }
.gallery__empty .icon { width: 2.5rem; height: 2.5rem; }
@media (min-width: 64rem) { .gallery__thumbs a { width: 6.5rem; } }

/* Lightbox (progressive enhancement) */
.lightbox { padding: 0; border: 0; width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; background: rgba(6, 18, 36, 0.96); color: #fff; }
.lightbox::backdrop { background: rgba(6, 18, 36, 0.96); }
.lightbox__inner { display: grid; grid-template-rows: auto 1fr; height: 100%; }
.lightbox__bar { display: flex; align-items: center; justify-content: space-between; padding: var(--s-3) var(--gutter); font-weight: 600; font-variant-numeric: tabular-nums; }
.lightbox__stage { position: relative; display: grid; place-items: center; padding: 0 var(--s-4) var(--s-6); min-height: 0; }
.lightbox__stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: var(--r-md); }
.lightbox .gallery__nav { background: rgba(255, 255, 255, 0.14); color: #fff; box-shadow: none; }
.lightbox .gallery__nav:hover { background: rgba(255, 255, 255, 0.26); }
.lightbox__close { display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.14); color: #fff; cursor: pointer; }
.lightbox__close:hover { background: rgba(255, 255, 255, 0.26); }

/* Buy box, seller, safety */
.buybox,
.sellerbox,
.safetybox { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s-5); box-shadow: var(--shadow-1); }
.buybox { display: grid; gap: var(--s-4); box-shadow: var(--shadow-2); }
.buybox__price { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s-1) var(--s-3); margin: 0; }
.price--xl { font-family: var(--font-brand); font-size: clamp(2.125rem, 1.6rem + 1.6vw, 2.625rem); font-weight: 800; letter-spacing: -0.03em; }
.buybox__drop { margin: calc(-1 * var(--s-2)) 0 0; display: flex; gap: var(--s-2); align-items: baseline; }
.buybox__actions { list-style: none; display: flex; flex-wrap: wrap; gap: var(--s-2); }
.buybox__actions li { flex: 1 1 5.5rem; min-width: 0; }
.buybox__actions .btn { width: 100%; padding-inline: 0.5rem; }
.buybox__note { display: flex; gap: var(--s-2); align-items: flex-start; margin: 0; font-size: var(--fs-xs); color: var(--ink-500); }
.buybox__note .icon { margin-top: 0.15rem; }
.buybox__report { display: flex; align-items: center; gap: var(--s-2); margin-top: var(--s-3); font-size: var(--fs-xs); color: var(--ink-500); }
.buybox__report:hover { color: var(--red-700); }
.buybox__report .icon { width: 0.875rem; height: 0.875rem; }
.buybox__sold { display: flex; gap: var(--s-2); align-items: center; margin: 0; padding: var(--s-3) var(--s-4); background: var(--ink-900); color: #fff; border-radius: var(--r-md); font-weight: 600; }
.sellerbox { display: grid; gap: var(--s-3); }
.sellerbox__title { font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-500); }
.sellerbox__row { display: flex; gap: var(--s-3); align-items: center; }
.sellerbox__avatar { display: grid; place-items: center; width: 3rem; height: 3rem; flex: none; border-radius: var(--r-md); background: var(--blue-50); color: var(--blue-600); }
.sellerbox__name { margin: 0; font-weight: 680; letter-spacing: -0.01em; }
.sellerbox__sub { margin: 0.125rem 0 0; font-size: var(--fs-sm); color: var(--ink-500); }
.sellerbox__place { display: flex; align-items: center; gap: var(--s-2); margin: 0; font-size: var(--fs-sm); color: var(--ink-500); }
.safetybox { background: var(--blue-50); border-color: #cfe0fa; box-shadow: none; }
.safetybox h2 { display: flex; align-items: center; gap: var(--s-2); font-size: var(--fs-md); margin-bottom: var(--s-2); color: var(--navy-800); }
.safetybox p { margin: 0; font-size: var(--fs-sm); color: var(--ink-700); }

/* Key facts */
.keyfacts dl { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s-3); margin: 0; }
.keyfact { display: flex; flex-direction: column; gap: 0.25rem; padding: var(--s-4); background: var(--surface); border-radius: var(--r-md); min-width: 0; }
.keyfact dt { display: flex; align-items: center; gap: var(--s-2); font-size: var(--fs-xs); font-weight: 600; color: var(--ink-500); }
.keyfact dt .icon { color: var(--blue-600); }
.keyfact dd { margin: 0; font-size: 1.0625rem; font-weight: 700; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; line-height: 1.3; }
@media (min-width: 40rem) { .keyfacts dl { grid-template-columns: repeat(3, 1fr); } }

/* Content sections */
.dsec { padding-top: var(--s-6); border-top: 1px solid var(--line); }
.detail__body > .keyfacts + .dsec { margin-top: var(--s-2); }
.dsec h2 { font-size: 1.375rem; margin-bottom: var(--s-4); }
.dsec__group { font-size: var(--fs-sm); font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-500); margin: var(--s-4) 0 var(--s-2); }
.dsec__note { display: flex; gap: var(--s-2); align-items: flex-start; font-size: var(--fs-sm); color: var(--ink-500); margin-bottom: var(--s-4); }
.dsec__note .icon { margin-top: 0.2rem; }
.dsec__loc { display: flex; gap: var(--s-3); margin: 0; }
.featurelist { list-style: none; display: grid; gap: var(--s-2) var(--s-6); grid-template-columns: 1fr; }
.featurelist li { display: flex; align-items: flex-start; gap: var(--s-2); }
.featurelist .icon { color: var(--green-700); margin-top: 0.15rem; }
@media (min-width: 40rem) { .featurelist { grid-template-columns: repeat(2, 1fr); } }
.spectable { display: grid; grid-template-columns: 1fr; margin: 0; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.spectable > div { display: flex; justify-content: space-between; gap: var(--s-4); padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--line); }
.spectable > div:nth-child(even) { background: var(--surface); }
.spectable > div:last-child { border-bottom: 0; }
.spectable dt { color: var(--ink-500); }
.spectable dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
@media (min-width: 48rem) {
  .spectable { grid-template-columns: 1fr 1fr; }
  .spectable > div { border-right: 1px solid var(--line); }
  .spectable > div:nth-child(even) { background: none; border-right: 0; }
  .spectable > div:nth-child(4n+3),
  .spectable > div:nth-child(4n+4) { background: var(--surface); }
  .spectable > div:nth-last-child(-n+2):nth-child(odd),
  .spectable > div:last-child { border-bottom: 0; }
}
.callout { display: flex; gap: var(--s-4); padding: var(--s-5); background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--r-md); }
.callout__icon { display: grid; place-items: center; width: 2.5rem; height: 2.5rem; flex: none; border-radius: var(--r-sm); background: #fff; color: var(--ink-500); }
.callout__title { margin: 0 0 var(--s-1); font-weight: 680; }
.callout p:last-child { margin: 0; font-size: var(--fs-sm); color: var(--ink-500); }
.pricehistory { list-style: none; display: grid; gap: var(--s-2); max-width: 22rem; }
.pricehistory li { display: flex; justify-content: space-between; gap: var(--s-4); padding: var(--s-2) 0; border-bottom: 1px solid var(--line); }
.pricehistory li:first-child .num { font-weight: 650; }
.similar { margin-top: var(--s-8); }

/* Mobile action bar */
.stickybar { position: fixed; inset: auto 0 0 0; z-index: 50; display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); padding: var(--s-3) var(--gutter) calc(var(--s-3) + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -8px 20px -12px rgba(11, 31, 58, 0.3); }
.stickybar__price { display: flex; flex-direction: column; line-height: 1.2; }
.stickybar .price { font-size: 1.25rem; }
:root:has(.stickybar) { scroll-padding-bottom: 5rem; }
.page-detail { padding-bottom: 4.5rem; }
@media (min-width: 64rem) { .stickybar { display: none; } .page-detail { padding-bottom: 0; } :root:has(.stickybar) { scroll-padding-bottom: 0; } }
