/* ==========================================================================
   RTP Auto – Vehicle detail page (/marketplace/cars/{slug})
   Depends on the tokens in site.css; "More from" cards use vehicle-card.css.
   ========================================================================== */

.vdp {
    padding: clamp(1.25rem, 3vw, 2rem) 0 clamp(3rem, 6vw, 5rem);
    background: var(--c-bg);
    color: var(--c-text);
    font-family: var(--f-body);
}

:where(.vdp ul[role="list"], .vdp ol[role="list"]) { list-style: none; margin: 0; padding: 0; }
:where(.vdp dl, .vdp dd) { margin: 0; }

/* The theme removes focus outlines on form controls; put them back here. */
.vdp :is(a, button, input, textarea):focus-visible {
    outline: 3px solid var(--c-brand);
    outline-offset: 2px;
}
.vdp ::selection { background: rgb(43 182 232 / 28%); color: var(--c-ink); }

/* Body links only – cards and buttons keep their own colours. */
:is(.deal__lines, .deal__rating, .vdp__more-head, .vdp__prose) a { color: var(--c-brand-text); text-underline-offset: 3px; }
:is(.deal__lines, .deal__rating, .vdp__more-head, .vdp__prose) a:hover { color: var(--c-ink); }

/* ---------- Breadcrumb & head ---------- */
.vdp__crumbs ol { display: flex; flex-wrap: wrap; gap: .35rem; font-size: .875rem; color: var(--c-muted); }
.vdp__crumbs li + li::before { content: "/"; margin-right: .35rem; color: #a3b1c2; }
.vdp__crumbs a { color: var(--c-muted); text-decoration: none; }
.vdp__crumbs a:hover { color: var(--c-text); text-decoration: underline; }

.vdp__head { margin: 1.25rem 0 clamp(1.25rem, 3vw, 2rem); }

.vdp__meta {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin: 0 0 .5rem;
    color: var(--c-muted);
    font-family: var(--f-display);
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.vdp__meta span + span::before { content: "·"; margin-right: .4rem; }

.vdp__title {
    margin: 0;
    color: var(--c-text);
    font-family: var(--f-display);
    font-size: clamp(1.9rem, 1.2rem + 2.4vw, 3.25rem);
    font-weight: 800;
    letter-spacing: -.035em;
    line-height: 1.02;
    text-wrap: balance;
}
.vdp__trim {
    display: block;
    margin-top: .35rem;
    color: var(--c-muted);
    font-size: .45em;
    font-weight: 600;
    letter-spacing: -.01em;
}

.vdp__sold {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    background: #fff7e6;
    color: #7a4a00;
}
.vdp__sold p { margin: 0; color: inherit; }

/* ---------- Layout ---------- */
.vdp__layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: clamp(1.5rem, 3vw, 2.75rem);
    align-items: start;
}
.vdp__main { min-width: 0; }

/* ---------- Gallery ---------- */
.gallery__stage {
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: var(--radius-lg);
    background: linear-gradient(160deg, #eef2f7, #e0e7f0);
}
.gallery__stage img { width: 100%; height: 100%; object-fit: cover; }

.gallery__count {
    position: absolute;
    right: .9rem;
    bottom: .9rem;
    margin: 0;
    padding: .3rem .7rem;
    border-radius: 999px;
    background: rgb(11 22 38 / 72%);
    color: #fff;
    font-family: var(--f-display);
    font-size: .8rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.gallery__empty {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 2rem;
    color: #a3b1c2;
    text-align: center;
}
.gallery__empty .body-icon { width: min(48%, 340px); height: auto; }
.gallery__empty p { max-width: 34ch; margin: 0; color: var(--c-muted); font-size: 1rem; }

.gallery__thumbs {
    display: flex;
    gap: .6rem;
    margin-top: .75rem;
    overflow-x: auto;
    padding-bottom: .25rem;
    scrollbar-width: thin;
}
.gallery__thumb {
    flex: 0 0 auto;
    width: 104px;
    aspect-ratio: 4 / 3;
    padding: 0;
    overflow: hidden;
    border: 2px solid transparent;
    border-radius: 12px;
    background: var(--c-line);
    cursor: pointer;
    opacity: .7;
    transition: opacity .15s, border-color .15s;
}
.gallery__thumb img { width: 100%; height: 100%; object-fit: cover; }
.gallery__thumb:hover { opacity: 1; }
.gallery__thumb[aria-pressed="true"] { border-color: var(--c-ink); opacity: 1; }

/* ---------- Key facts ---------- */
.vdp__facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    margin-top: 1.25rem;
    border: 1px solid var(--c-line);
    border-radius: var(--radius);
    background: var(--c-surface);
}
.vdp__facts > div { padding: 1rem 1.1rem; }
.vdp__facts > div + div { border-left: 1px solid var(--c-line); }
.vdp__facts dt {
    margin-bottom: .25rem;
    color: var(--c-muted);
    font-family: var(--f-display);
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.vdp__facts dd {
    color: var(--c-text);
    font-family: var(--f-display);
    font-size: 1.05rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* ---------- Sections ---------- */
.vdp__section { margin-top: clamp(2rem, 4vw, 2.75rem); }

.vdp__h2 {
    margin: 0 0 1rem;
    color: var(--c-text);
    font-family: var(--f-display);
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -.02em;
}

.vdp__prose { max-width: 68ch; color: #2c3a4f; font-size: 1.05rem; line-height: 1.65; }
.vdp__muted { max-width: 60ch; margin: 0; color: var(--c-muted); }
.vdp__note { margin: -.5rem 0 1rem; font-size: .9rem; }

.vdp__specs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 2rem;
}
.vdp__specs > div {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: .8rem 0;
    border-bottom: 1px solid var(--c-line);
}
.vdp__specs dt { color: var(--c-muted); }
.vdp__specs dd { color: var(--c-text); font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.vdp__specs dd.is-mono { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: .9rem; letter-spacing: .02em; }
.vdp__specs dd.is-flag { color: var(--c-coral-hover); }

.vdp__features {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: .6rem 1.5rem;
}
.vdp__features li { display: flex; align-items: flex-start; gap: .5rem; color: var(--c-text); }
.vdp__features svg {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-top: .15rem;
    fill: none;
    stroke: var(--c-brand-text);
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ---------- Aside: price, seller, contact ---------- */
.vdp__aside {
    position: sticky;
    top: 88px;
    display: grid;
    gap: 1rem;
}

.deal {
    padding: 1.5rem;
    border: 1px solid var(--c-line);
    border-radius: var(--radius-lg);
    background: var(--c-surface);
}

.deal__price {
    margin: 0;
    color: var(--c-text);
    font-family: var(--f-display);
    font-size: 2.4rem;
    font-weight: 800;
    letter-spacing: -.04em;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}
.deal__sub { margin: .5rem 0 0; color: var(--c-muted); }

.deal__seller { margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--c-line); }
.deal__label {
    margin: 0 0 .2rem;
    color: var(--c-muted);
    font-family: var(--f-display);
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.deal__name { margin: 0; color: var(--c-text); font-family: var(--f-display); font-size: 1.15rem; font-weight: 800; }
.deal__name a { color: var(--c-text); text-decoration: none; }
.deal__name a:hover { text-decoration: underline; }

.deal__rating { display: flex; align-items: center; gap: .35rem; margin: .35rem 0 0; color: var(--c-muted); font-size: .9rem; }
.deal__rating svg { width: 16px; height: 16px; fill: #f5a524; stroke: none; }
.deal__rating strong { color: var(--c-text); }

.deal__lines { display: grid; gap: .6rem; margin-top: 1rem; font-size: .95rem; }
.deal__lines li { display: flex; align-items: flex-start; gap: .6rem; color: var(--c-text); }
.deal__lines svg {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-top: .15rem;
    fill: none;
    stroke: var(--c-muted);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.deal__lines a { overflow-wrap: anywhere; }

/* ---------- More from this seller ---------- */
.vdp__more { margin-top: clamp(3rem, 6vw, 4.5rem); padding-top: clamp(2rem, 4vw, 3rem); border-top: 1px solid var(--c-line); }
.vdp__more-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.vdp__more-link { font-family: var(--f-display); font-size: .9rem; font-weight: 700; }
.vdp__more-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1.25rem; }
.vdp__more-grid > li { display: flex; }

/* ---------- Mobile price bar ---------- */
.vdp__bar { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
    .vdp__layout { grid-template-columns: minmax(0, 1fr); }
    .vdp__aside { position: static; }

    .vdp { padding-bottom: 6rem; }
    .vdp__bar {
        position: fixed;
        inset: auto 0 0;
        z-index: 1020;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        padding: .75rem max(1rem, env(safe-area-inset-right)) calc(.75rem + env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
        border-top: 1px solid var(--c-line);
        background: rgb(255 255 255 / 96%);
        box-shadow: 0 -10px 30px -18px rgb(11 22 38 / 40%);
    }
    .vdp__bar p { margin: 0; }
    .vdp__bar-price { color: var(--c-text); font-family: var(--f-display); font-size: 1.3rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
    .vdp__bar-sub { color: var(--c-muted); font-size: .85rem; }
}

@media (max-width: 575.98px) {
    .vdp__facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .vdp__facts > div + div { border-left: 0; }
    .vdp__facts > div:nth-child(even) { border-left: 1px solid var(--c-line); }
    .vdp__facts > div:nth-child(n + 3) { border-top: 1px solid var(--c-line); }
    .vdp__specs { grid-template-columns: minmax(0, 1fr); }
    .gallery__stage { border-radius: var(--radius); }
    .gallery__thumb { width: 84px; }
}

/* "Apply for financing" under the payment (credit application, /finance/apply/{car}) */
.deal__apply {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-top: .6rem;
    padding: .75rem .9rem;
    border-radius: 18px;
    background: var(--c-coral);
    color: #fff;
    text-decoration: none;
    box-shadow: 0 12px 24px -14px rgb(217 54 62 / 80%);
    transition: background-color .15s, transform .15s var(--ease);
}
.deal__apply:hover { background: var(--c-coral-hover); color: #fff; transform: translateY(-1px); }
.deal__apply:focus-visible { outline: 3px solid var(--c-brand); outline-offset: 2px; }
.deal__apply-icon { display: grid; flex-shrink: 0; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 12px; background: rgb(255 255 255 / 16%); }
.deal__apply svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.deal__apply-text { display: flex; flex-direction: column; min-width: 0; }
.deal__apply-text strong { font-family: var(--f-display); font-size: 1rem; font-weight: 800; }
.deal__apply-text small { color: rgb(255 255 255 / 85%); font-size: .8rem; }
.deal__apply-arrow { margin-left: auto; flex-shrink: 0; transition: transform .15s var(--ease); }
.deal__apply:hover .deal__apply-arrow { transform: translateX(3px); }
@media (prefers-reduced-motion: reduce) {
    .deal__apply, .deal__apply-arrow { transition: none; }
    .deal__apply:hover, .deal__apply:hover .deal__apply-arrow { transform: none; }
}
