/* Vehicle catalog */

/* Hero */
.hero { position: relative; color: #fff; background: radial-gradient(1100px 620px at 82% 0%, #2f6cc0 0%, transparent 62%), linear-gradient(170deg, var(--blue-deep), var(--navy) 62%, var(--ink)); overflow: hidden; isolation: isolate; }
.hero__route { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; }
.hero__in { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: clamp(20px, 4vw, 70px); align-items: center; padding-block: clamp(34px, 5vw, 62px) clamp(66px, 9vw, 120px); }
.hero__eyebrow { display: inline-flex; align-items: center; gap: 10px; color: var(--sun); margin-bottom: 18px; }
.pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--leaf); box-shadow: 0 0 0 0 rgba(147, 194, 64, .7); animation: pulse 2.2s infinite; }
@keyframes pulse { to { box-shadow: 0 0 0 12px rgba(147, 194, 64, 0); } }
.hero h1 { font-size: clamp(38px, 5.6vw, 80px); }
.hero h1 em { font-style: normal; color: var(--sun); }
.hero__count { font-variant-numeric: tabular-nums; }
.hero__lede { max-width: 60ch; margin-top: 18px; font-size: clamp(16px, 1.25vw, 18px); color: rgba(255, 255, 255, .82); }
.hero__sweep { position: absolute; left: 0; right: 0; bottom: -1px; }

.dest { margin-top: 26px; }
.dest__label { display: block; margin-bottom: 10px; font: 500 13px/1 var(--font-mono); letter-spacing: .05em; text-transform: uppercase; color: rgba(255, 255, 255, .7); }
.dest__row { display: flex; flex-wrap: wrap; gap: 8px; }
.destpill { display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 14px 0 6px; border-radius: 999px; background: rgba(255, 255, 255, .1); color: #fff; font-weight: 600; font-size: 14.5px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16); transition: background .2s, transform .2s var(--ease), color .2s; }
.destpill img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.destpill:hover { background: rgba(255, 255, 255, .2); transform: translateY(-2px); }
.destpill[aria-checked="true"] { background: #fff; color: var(--navy); box-shadow: 0 10px 24px -10px rgba(0, 0, 0, .6); }

/* Postcard stack of latest arrivals */
.hero__stack { position: relative; height: clamp(300px, 30vw, 420px); }
.postcard { position: absolute; width: 74%; aspect-ratio: 4 / 3; padding: 9px 9px 42px; border-radius: 10px; background: var(--paper); color: var(--navy); box-shadow: var(--shadow-lg); text-align: left; transition: transform .45s var(--ease), z-index 0s .1s; animation: dealin .8s var(--ease) both; }
.postcard img { width: 100%; height: 100%; object-fit: cover; border-radius: 5px; background: var(--cream-2); }
.postcard span { position: absolute; left: 13px; right: 13px; bottom: 11px; display: flex; justify-content: space-between; gap: 10px; font-weight: 700; font-size: 14.5px; white-space: nowrap; }
.postcard span b { color: var(--blue); }
.postcard span i { font-style: normal; overflow: hidden; text-overflow: ellipsis; }
.postcard:nth-child(1) { right: 22%; top: 8%; transform: rotate(-7deg); --r: -7deg; animation-delay: .05s; }
.postcard:nth-child(2) { right: 0; top: 0; transform: rotate(5deg); --r: 5deg; animation-delay: .15s; }
.postcard:nth-child(3) { right: 11%; top: 20%; transform: rotate(-1.5deg); --r: -1.5deg; animation-delay: .25s; }
.postcard:hover { transform: rotate(0) translateY(-10px) scale(1.03); z-index: 5; }
@keyframes dealin { from { opacity: 0; transform: translateY(60px) rotate(14deg); } to { opacity: 1; transform: rotate(var(--r)); } }

/* Command bar */
.bar { position: sticky; top: calc(var(--header-h) + 10px); z-index: 40; margin-top: -40px; }
.bar__in { display: flex; gap: 8px; align-items: stretch; }
.bar__in > * { min-height: 58px; background: #fff; box-shadow: var(--shadow); border-radius: 16px; }
.bar__search { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 0 18px; cursor: text; }
.bar__search svg { width: 21px; height: 21px; color: var(--blue); flex: none; }
.bar__search input { flex: 1; min-width: 0; height: 58px; border: 0; outline: 0; background: none; font-size: 17px; font-weight: 500; }
.bar__search:focus-within { box-shadow: 0 0 0 3px var(--sun), var(--shadow); }
.bar__search kbd { padding: 2px 8px; border-radius: 6px; background: var(--cream); color: var(--muted); font: 500 13px var(--font-mono); }
.bar__dest { position: relative; }
.bar__destbtn { height: 100%; display: flex; align-items: center; gap: 10px; padding: 0 16px 0 12px; font-weight: 700; color: var(--navy); white-space: nowrap; }
.bar__destbtn img { width: 30px; height: 30px; border-radius: 50%; }
.bar__destbtn svg { width: 16px; height: 16px; color: var(--muted); }
.popover { position: absolute; top: calc(100% + 8px); right: 0; width: 290px; max-height: 70vh; overflow: auto; padding: 8px; border-radius: 16px; background: #fff; box-shadow: var(--shadow-lg); }
.popover button { width: 100%; display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 10px; text-align: left; }
.popover button:hover, .popover button[aria-checked="true"] { background: var(--cream); }
.popover img { width: 28px; height: 28px; border-radius: 50%; }
.popover b { display: block; line-height: 1.2; }
.popover small { color: var(--muted); }
.bar__sort { position: relative; display: flex; align-items: center; }
.bar__sort select { appearance: none; height: 100%; padding: 0 40px 0 16px; border: 0; background: none; border-radius: 16px; font-weight: 700; color: var(--navy); cursor: pointer; }
.bar__sort svg { position: absolute; right: 14px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.bar__garage { display: flex; align-items: center; gap: 9px; padding: 0 18px; font-weight: 700; color: var(--navy); white-space: nowrap; transition: color .2s; }
.bar__garage svg { width: 20px; height: 20px; color: var(--coral); }
.bar__garage b { min-width: 22px; height: 22px; padding: 0 6px; display: inline-grid; place-items: center; border-radius: 999px; background: var(--coral); color: #fff; font-size: 13px; }
.bar__garage.bump svg { animation: bump .45s var(--ease); }
@keyframes bump { 40% { transform: scale(1.45); } }

/* Type rail */
.rail { margin-top: 24px; }
.rail__track { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 12px; scrollbar-width: none; scroll-snap-type: x proximity; }
.rail__track::-webkit-scrollbar { display: none; }
.railitem { flex: none; scroll-snap-align: start; display: flex; align-items: center; gap: 10px; padding: 5px 16px 5px 5px; border-radius: 999px; background: #fff; box-shadow: var(--shadow-sm); font-weight: 700; color: var(--navy); transition: transform .2s var(--ease), background .2s, color .2s; }
.railitem img, .railitem__all { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; background: var(--cream-2); }
.railitem__all { display: grid; place-items: center; background: var(--blue); color: #fff; font-size: 13px; font-weight: 800; }
.railitem small { color: var(--muted); font-weight: 600; font-size: 13px; }
.railitem:hover { transform: translateY(-2px); }
.railitem[aria-pressed="true"] { background: var(--blue); color: #fff; }
.railitem[aria-pressed="true"] small { color: rgba(255, 255, 255, .78); }

/* Layout */
.layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: clamp(20px, 2.4vw, 36px); align-items: start; padding-top: 14px; padding-bottom: 80px; }

/* Filters */
.filters-scrim { display: none; }
.filters { position: sticky; top: calc(var(--header-h) + 84px); max-height: calc(100vh - var(--header-h) - 100px); overflow-y: auto; padding: 6px 16px 16px; border-radius: var(--radius); background: #fff; box-shadow: var(--shadow-sm); scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.filters__head { display: flex; align-items: center; justify-content: space-between; padding: 10px 0 2px; }
.filters__head h2 { font-size: 22px; }
.filters__close, .filters__foot { display: none; }
.filters__quick { padding: 10px 0 12px; border-bottom: 1px solid var(--line); }
.toggle { display: flex; align-items: center; gap: 10px; font-weight: 600; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; }
.toggle__ui { flex: none; width: 42px; height: 24px; padding: 3px; border-radius: 999px; background: #cfd6e0; transition: background .2s; }
.toggle__ui::after { content: ''; display: block; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .25s var(--ease); }
.toggle input:checked + .toggle__ui { background: var(--leaf); }
.toggle input:checked + .toggle__ui::after { transform: translateX(18px); }
.toggle input:focus-visible + .toggle__ui { outline: 3px solid var(--sun); outline-offset: 2px; }
.toggle small { color: var(--muted); font-weight: 500; }

.fgroup { border-bottom: 1px solid var(--line); }
.fgroup:last-child { border-bottom: 0; }
.fgroup > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 13px 0; font-weight: 700; color: var(--navy); cursor: pointer; }
.fgroup > summary::-webkit-details-marker { display: none; }
.fgroup > summary svg { width: 17px; height: 17px; color: var(--muted); transition: transform .2s; }
.fgroup[open] > summary svg { transform: rotate(180deg); }
.fgroup > summary b { margin-left: auto; min-width: 21px; height: 21px; padding: 0 6px; display: inline-grid; place-items: center; border-radius: 999px; background: var(--blue); color: #fff; font-size: 12.5px; }
.fbody { padding-bottom: 14px; }
.fsearch { width: 100%; height: 36px; margin-bottom: 8px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--cream); font-size: 14.5px; }
.flist { display: grid; gap: 1px; max-height: 238px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.fopt { display: flex; align-items: center; gap: 9px; min-height: 33px; padding: 3px 8px 3px 4px; border-radius: 8px; cursor: pointer; font-size: 15px; }
.fopt:hover { background: var(--cream); }
.fopt input { position: absolute; opacity: 0; }
.fopt__box { flex: none; width: 19px; height: 19px; display: grid; place-items: center; border-radius: 6px; box-shadow: inset 0 0 0 1.5px #b9c3d1; color: #fff; transition: background .15s; }
.fopt__box svg { width: 13px; height: 13px; opacity: 0; }
.fopt input:checked + .fopt__box { background: var(--blue); box-shadow: none; }
.fopt input:checked + .fopt__box svg { opacity: 1; }
.fopt input:focus-visible + .fopt__box { outline: 3px solid var(--sun); outline-offset: 1px; }
.fopt__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fopt__n { color: var(--muted); font-size: 13.5px; font-variant-numeric: tabular-nums; }
.fopt.is-zero { opacity: .42; }

.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 4px; }
.sw { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 9px; font-size: 14px; text-align: left; }
.sw:hover { background: var(--cream); }
.sw[aria-pressed="true"] { background: var(--cream-2); font-weight: 700; }
.sw i { flex: none; width: 22px; height: 22px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(7, 47, 104, .22); }
.sw small { margin-left: auto; color: var(--muted); }
.sw.is-zero { opacity: .42; }

.yearchips { display: flex; flex-wrap: wrap; gap: 5px; max-height: 196px; overflow-y: auto; }
.yc { padding: 4px 9px; border-radius: 8px; background: var(--cream); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; transition: background .15s, color .15s; }
.yc:hover { background: var(--cream-2); }
.yc[aria-pressed="true"] { background: var(--blue); color: #fff; }
.yc.is-zero { opacity: .42; }
.fgroup[data-set="filteryear"] .price__range { margin-top: 6px; }
.yearpick { margin-top: 12px; font-size: 14px; font-weight: 600; color: var(--blue); text-decoration: underline; }
.yearchoice { margin-top: 10px; }

/* Price histogram + dual slider */
.price__hist { display: flex; align-items: flex-end; gap: 2px; height: 58px; }
.price__hist i { flex: 1; min-height: 2px; border-radius: 3px 3px 0 0; background: var(--line); transition: height .3s var(--ease), background .2s; }
.price__hist i.on { background: var(--blue); }
.price__range { position: relative; height: 26px; margin-top: -2px; }
.price__range::before { content: ''; position: absolute; left: 0; right: 0; top: 11px; height: 4px; border-radius: 4px; background: var(--line); }
.price__fill { position: absolute; top: 11px; height: 4px; border-radius: 4px; background: var(--blue); }
.price__range input { position: absolute; inset: 0; width: 100%; margin: 0; appearance: none; background: none; pointer-events: none; }
.price__range input::-webkit-slider-thumb { appearance: none; pointer-events: auto; width: 24px; height: 24px; border-radius: 50%; background: #fff; border: 4px solid var(--blue); box-shadow: var(--shadow-sm); cursor: grab; }
.price__range input::-moz-range-thumb { pointer-events: auto; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 4px solid var(--blue); cursor: grab; }
.price__vals { display: flex; justify-content: space-between; margin-top: 6px; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }

/* Results header */
.results__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.results__count { font: 800 clamp(22px, 2vw, 28px)/1.1 var(--font-display); letter-spacing: -.02em; color: var(--navy); margin-bottom: 4px; }
.results__terms { margin-right: 14px; color: var(--blue); font-size: 14.5px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(37, 92, 170, .35); }
.results__terms:hover { text-decoration-color: currentColor; }
.results__tools { display: flex; align-items: center; gap: 8px; flex: none; }
.density { display: flex; padding: 3px; border-radius: 12px; background: var(--cream-2); }
.density button { width: 36px; height: 34px; display: grid; place-items: center; border-radius: 9px; color: var(--muted); }
.density svg { width: 17px; height: 17px; }
.density button[aria-pressed="true"] { background: #fff; color: var(--blue); box-shadow: var(--shadow-sm); }
.chipbtn { display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 15px; border-radius: 12px; background: #fff; box-shadow: var(--shadow-sm); font-weight: 700; color: var(--navy); transition: transform .2s var(--ease); }
.chipbtn:hover { transform: translateY(-1px); }
.chipbtn svg { width: 17px; height: 17px; }

.applied { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.applied:empty { display: none; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 33px; padding: 0 8px 0 13px; border-radius: 999px; background: var(--navy); color: #fff; font-size: 14px; font-weight: 600; }
.pill svg { width: 14px; height: 14px; opacity: .75; }
.pill:hover svg { opacity: 1; }
.pill--clear { background: none; color: var(--blue); padding: 0 8px; text-decoration: underline; text-underline-offset: 3px; }

/* Grid + cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); gap: clamp(14px, 1.6vw, 22px); }
.grid.is-dense { grid-template-columns: repeat(auto-fill, minmax(min(100%, 208px), 1fr)); gap: 12px; }
.card { position: relative; display: flex; flex-direction: column; border-radius: var(--radius); background: #fff; box-shadow: var(--shadow-sm); overflow: hidden; transition: transform .3s var(--ease), box-shadow .3s var(--ease); animation: rise .55s var(--ease) both; animation-delay: calc(var(--i, 0) * 34ms); }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }
.card:hover { transform: translateY(-5px); box-shadow: var(--shadow); }
.card__media { position: relative; display: block; aspect-ratio: 4 / 3; overflow: hidden; background: linear-gradient(110deg, var(--cream-2) 30%, var(--cream) 50%, var(--cream-2) 70%) 0 0 / 220% 100%; animation: shimmer 1.5s linear infinite; }
.card__media.is-loaded { animation: none; background: var(--cream-2); }
@keyframes shimmer { to { background-position: -220% 0; } }
.card__media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: opacity .45s, transform .9s var(--ease); }
.card:hover .card__media > img:first-child { transform: scale(1.045); }
.card__media .slide { opacity: 0; }
.card__media .slide.is-on { opacity: 1; }
.card__ph { position: absolute; inset: 0; display: grid; place-items: center; gap: 4px; align-content: center; background: var(--navy); color: rgba(255, 255, 255, .85); font-weight: 600; font-size: 14.5px; }
.card__ph span { width: 58%; aspect-ratio: 1600 / 1560; background: rgba(255, 255, 255, .85); -webkit-mask: url(logo-full.png) center / contain no-repeat; mask: url(logo-full.png) center / contain no-repeat; }
.card__segs { position: absolute; left: 10px; right: 10px; bottom: 8px; display: flex; gap: 3px; opacity: 0; transition: opacity .2s; }
.card__segs.is-on { opacity: 1; }
.card__segs i { flex: 1; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .45); }
.card__segs i.is-on { background: #fff; }
.card__badges { position: absolute; left: 10px; top: 10px; display: flex; flex-wrap: wrap; gap: 5px; max-width: calc(100% - 96px); pointer-events: none; }
.badge { padding: 4px 9px; border-radius: 8px; background: rgba(5, 31, 71, .82); color: #fff; font-size: 12.5px; font-weight: 700; backdrop-filter: blur(6px); }
.badge--new { background: var(--sun); color: var(--ink); }
.badge--ok { background: var(--leaf); color: var(--ink); }
.card__acts { position: absolute; right: 8px; top: 8px; display: flex; gap: 5px; }
.round { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: rgba(255, 255, 255, .94); color: var(--navy); box-shadow: var(--shadow-sm); transition: transform .2s var(--ease), color .2s, background .2s; }
.round svg { width: 19px; height: 19px; }
.round:hover { transform: scale(1.1); }
.round[data-act="wish"] { color: #9aa7b8; }
.round[data-act="wish"]:hover { color: var(--coral); }
.round[data-act="wish"][aria-pressed="true"] { color: var(--coral); }
.round[data-act="cmp"][aria-pressed="true"] { background: var(--blue); color: #fff; }
.card__body { flex: 1; display: flex; flex-direction: column; gap: 5px; padding: 13px 15px 14px; }
.card__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card__year { font: 500 14px/1 var(--font-mono); color: var(--blue); }
.dots { display: inline-flex; }
.dots i { width: 15px; height: 15px; margin-left: -4px; border-radius: 50%; box-shadow: 0 0 0 2px #fff, inset 0 0 0 1px rgba(7, 47, 104, .22); }
.card__title { font: 800 18.5px/1.15 var(--font-display); letter-spacing: -.015em; color: var(--navy); text-decoration: none; }
.card__title::after { content: ''; position: absolute; inset: 0; z-index: 0; }
.card__acts, .card__badges { z-index: 2; }
.card__meta { font: 400 12.5px/1.45 var(--font-mono); color: var(--muted); overflow-wrap: anywhere; }
.card__foot { margin-top: auto; padding-top: 8px; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.card__price { font: 800 21px/1.1 var(--font-display); letter-spacing: -.02em; color: var(--blue-deep); font-variant-numeric: tabular-nums; }
.card__price.is-text { font-size: 16px; color: var(--muted); }
.card__loc { color: var(--muted); font-size: 13.5px; text-align: right; }
.grid.is-dense .card__body { padding: 10px 11px 11px; }
.grid.is-dense .card__title { font-size: 15.5px; }
.grid.is-dense .card__price { font-size: 17px; }
.grid.is-dense .card__meta, .grid.is-dense .card__loc { display: none; }
.grid.is-dense .round { width: 32px; height: 32px; }

/* Loading message shown above the skeleton cards while the inventory loads */
.loading { display: grid; justify-items: center; gap: 8px; padding: 24px 16px 14px; text-align: center; }
.loading[hidden] { display: none; }
.loading__mark { width: 64px; height: 64px; object-fit: contain; animation: loadbob 1.2s ease-in-out infinite; }
.loading__text { font: 800 clamp(19px, 2.2vw, 24px)/1.15 var(--font-display); letter-spacing: -.02em; color: var(--navy); }
.loading__sub { color: var(--muted); font-size: 14.5px; max-width: 44ch; }
.loading__bar { position: relative; width: min(220px, 60%); height: 4px; margin-top: 6px; border-radius: 4px; overflow: hidden; background: var(--cream-2); }
.loading__bar i { position: absolute; top: 0; bottom: 0; left: -40%; width: 40%; border-radius: 4px; background: var(--sun, #f5a623); animation: loadslide 1.3s ease-in-out infinite; }
@keyframes loadbob { 50% { transform: translateY(-7px) rotate(6deg); } }
@keyframes loadslide { to { left: 100%; } }
@media (prefers-reduced-motion: reduce) { .loading__mark, .loading__bar i { animation: none; } .loading__bar i { left: 30%; } }
.skeleton { pointer-events: none; }
.skeleton .card__body i { display: block; height: 13px; margin-top: 4px; border-radius: 6px; background: var(--cream-2); }
.skeleton .card__body i:nth-child(2) { width: 62%; }
.sentinel { height: 1px; }
.empty { display: grid; justify-items: center; gap: 12px; padding: 64px 20px; border-radius: var(--radius); background: #fff; text-align: center; }
.empty[hidden] { display: none; }
.empty p { color: var(--muted); max-width: 46ch; }

/* Compare tray */
.tray { position: fixed; left: 50%; bottom: 18px; z-index: 45; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; max-width: calc(100vw - 24px); padding: 8px 10px; border-radius: 999px; background: var(--ink); color: #fff; box-shadow: var(--shadow-lg); animation: rise .35s var(--ease); }
.tray[hidden] { display: none; }
.tray__items { display: flex; gap: 5px; }
.tray__items img { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 2px #fff; }
.tray__slot { width: 46px; height: 46px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .3); }

/* Floating buttons */
.fab { position: fixed; left: 50%; bottom: 18px; z-index: 44; transform: translateX(-50%); display: none; align-items: center; gap: 8px; height: 50px; padding: 0 22px; border-radius: 999px; background: var(--blue); color: #fff; font-weight: 700; box-shadow: var(--shadow-lg); }
.fab svg { width: 19px; height: 19px; }
.fab b { min-width: 22px; height: 22px; display: inline-grid; place-items: center; border-radius: 999px; background: var(--sun); color: var(--ink); font-size: 13px; }
.fab b[hidden] { display: none; }
.totop { position: fixed; right: 18px; bottom: 18px; z-index: 44; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; background: var(--navy); color: #fff; box-shadow: var(--shadow); }
.totop[hidden] { display: none; }
.totop svg { width: 22px; height: 22px; transform: rotate(180deg); }

/* Dialogs */
dialog { border: 0; padding: 0; color: var(--text); }
dialog::backdrop { background: rgba(5, 31, 71, .62); backdrop-filter: blur(5px); }

.detail { position: fixed; inset: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; background: var(--ink); color: #fff; overflow: hidden; }
.detail[open] { display: grid; grid-template-columns: minmax(0, 1fr) 430px; grid-template-rows: minmax(0, 1fr); }
.stage { position: relative; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-width: 0; min-height: 0; }
.stage__top { display: flex; align-items: center; gap: 8px; padding: 12px 14px; }
.stage__nav { display: flex; align-items: center; gap: 4px; white-space: nowrap; font: 500 13.5px var(--font-mono); color: rgba(255, 255, 255, .7); }
.stage__close { display: none; flex: none; background: rgba(255, 255, 255, .14); }
.stage__count { margin-left: auto; font: 500 13.5px var(--font-mono); color: rgba(255, 255, 255, .78); text-align: right; }
.stage__view { position: relative; min-height: 0; overflow: hidden; display: grid; place-items: center; touch-action: pan-y; }
.stage__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; transition: transform .3s var(--ease), opacity .25s; cursor: zoom-in; user-select: none; -webkit-user-drag: none; }
.stage__view.is-zoom .stage__img { cursor: zoom-out; transform: scale(2.4); transition: opacity .25s; }
.stage__video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.stage__arrow { position: absolute; top: 50%; translate: 0 -50%; width: 52px; height: 52px; display: grid; place-items: center; border-radius: 50%; background: rgba(255, 255, 255, .14); color: #fff; backdrop-filter: blur(8px); transition: background .2s, transform .2s var(--ease); z-index: 2; }
.stage__arrow:hover { background: rgba(255, 255, 255, .28); transform: scale(1.08); }
.stage__arrow svg { width: 24px; height: 24px; }
.stage__arrow--l { left: 14px; }
.stage__arrow--r { right: 14px; }
.stage__openvid { position: absolute; right: 14px; bottom: 14px; z-index: 2; }
.strip { display: flex; gap: 6px; overflow-x: auto; padding: 10px 14px 12px; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .25) transparent; }
.strip button { position: relative; flex: none; width: 92px; height: 66px; border-radius: 8px; overflow: hidden; opacity: .6; transition: opacity .2s, box-shadow .2s; }
.strip button:hover { opacity: .9; }
.strip button[aria-current="true"] { opacity: 1; box-shadow: 0 0 0 2px var(--sun); }
.strip img { width: 100%; height: 100%; object-fit: cover; }
/* Photos / Inspection switch above the strip */
#stripLabel button { margin-right: 16px; padding: 4px 0; border: 0; background: none; font: inherit; letter-spacing: inherit; text-transform: inherit; color: rgba(255, 255, 255, .6); cursor: pointer; }
#stripLabel button[aria-pressed="true"] { color: #fff; box-shadow: inset 0 -2px 0 var(--sun); }
.strip svg { position: absolute; inset: 0; margin: auto; width: 26px; height: 26px; color: #fff; filter: drop-shadow(0 1px 3px #000); }

.panel { display: flex; flex-direction: column; gap: 16px; padding: 22px 24px 28px; background: var(--paper); color: var(--text); overflow-y: auto; }
.panel__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.panel__year { font: 500 14.5px/1 var(--font-mono); color: var(--blue); margin-bottom: 8px; }
.panel h2 { font-size: clamp(26px, 2.2vw, 33px); color: var(--navy); }
.panel__details { margin-top: 8px; color: var(--muted); }
.results__note { color: var(--blue); font-size: 14.5px; font-weight: 600; }
.panel__close { flex: none; background: var(--cream); color: var(--navy); }
.panel__close:hover { background: var(--cream-2); }
.panel__badges { display: flex; flex-wrap: wrap; gap: 5px; }
.panel__badges .badge { backdrop-filter: none; }
.pricebox { padding: 15px 16px; border-radius: 16px; background: linear-gradient(150deg, var(--blue), var(--blue-deep)); color: #fff; }
.pricebox__row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pricebox__price { font: 800 clamp(30px, 2.6vw, 38px)/1.1 var(--font-display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.pricebox__price.is-text { font-size: 23px; }
.pricebox__dest { position: relative; display: flex; align-items: center; }
.pricebox__dest select { appearance: none; max-width: 150px; height: 36px; padding: 0 28px 0 12px; border: 0; border-radius: 10px; background: rgba(255, 255, 255, .16); color: #fff; font-size: 14px; font-weight: 700; cursor: pointer; }
.pricebox__dest select option { color: var(--text); }
.pricebox__dest svg { position: absolute; right: 8px; width: 14px; height: 14px; pointer-events: none; }
.pricebox__links { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; font-size: 14px; }
.pricebox__links button { color: #fff; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(255, 255, 255, .5); }
.panel__cta { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.panel__cta .btn--sun { grid-column: 1 / -1; min-height: 54px; font-size: 17px; }
.panel__cta .btn--line { padding: 0 8px; font-size: 14.5px; min-height: 44px; gap: 6px; }
.panel__cta .btn--line[aria-pressed="true"] { color: var(--coral); box-shadow: inset 0 0 0 1.5px var(--coral); }
.panel__cta .btn--line[data-cmp][aria-pressed="true"] { color: var(--blue); box-shadow: inset 0 0 0 1.5px var(--blue); }
.specs { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin: 0; border-radius: 14px; overflow: hidden; background: var(--line); box-shadow: 0 0 0 1px var(--line); }
.specs div { padding: 9px 12px; background: #fff; min-width: 0; }
.specs .wide { grid-column: 1 / -1; }
.specs dt { color: var(--muted); font-size: 13px; }
.specs dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.specs dd.mono { font: 500 14px var(--font-mono); }
.panel__drive { color: var(--muted); font-size: 14.5px; }
.similar h3 { font-size: 19px; color: var(--navy); margin-bottom: 9px; }
.similar__row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.similar a { display: block; text-decoration: none; font-size: 13.5px; font-weight: 600; line-height: 1.25; color: var(--navy); }
.similar img { aspect-ratio: 4 / 3; width: 100%; object-fit: cover; border-radius: 9px; margin-bottom: 5px; background: var(--cream-2); transition: transform .25s var(--ease); }
.similar a:hover img { transform: scale(1.04); }
.similar b { display: block; color: var(--blue-deep); }

.sheet { position: fixed; inset: 0 0 0 auto; width: min(440px, 100vw); height: 100dvh; max-height: none; margin: 0; background: var(--paper); box-shadow: var(--shadow-lg); }
.sheet[open] { display: flex; flex-direction: column; animation: slidein .32s var(--ease); }
@keyframes slidein { from { transform: translateX(100%); } }
.sheet__head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 8px; }
.sheet__head h2 { font-size: 26px; color: var(--navy); }
.sheet__head .iconbtn { background: var(--cream); color: var(--navy); }
.tabs { display: flex; gap: 4px; margin: 6px 20px 12px; padding: 4px; border-radius: 12px; background: var(--cream-2); }
.tabs button { flex: 1; height: 38px; border-radius: 9px; font-weight: 700; color: var(--muted); }
.tabs button[aria-selected="true"] { background: #fff; color: var(--navy); box-shadow: var(--shadow-sm); }
.sheet__list { flex: 1; overflow-y: auto; padding: 0 20px; display: grid; gap: 8px; align-content: start; }
.mini { position: relative; display: grid; grid-template-columns: 104px 1fr auto; gap: 12px; align-items: center; padding: 6px; border-radius: 13px; background: #fff; box-shadow: var(--shadow-sm); text-align: left; text-decoration: none; }
.mini img { width: 104px; height: 78px; border-radius: 9px; object-fit: cover; background: var(--cream-2); }
.mini b { display: block; color: var(--navy); line-height: 1.2; }
.mini small { color: var(--muted); }
.mini span { color: var(--blue-deep); font-weight: 700; }
.mini .iconbtn { width: 34px; height: 34px; color: var(--muted); }
.mini .iconbtn:hover { background: var(--cream); color: var(--coral); }
.sheet__foot { display: flex; gap: 8px; padding: 14px 20px 18px; }
.sheet__foot .btn { flex: 1; }
.sheet__empty { padding: 40px 12px; text-align: center; color: var(--muted); }

.modal { width: min(680px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); margin: auto; border-radius: 20px; background: var(--paper); box-shadow: var(--shadow-lg); overflow: hidden; }
.modal[open] { display: flex; flex-direction: column; animation: rise .3s var(--ease); }
.modal--wide { width: min(1080px, calc(100vw - 24px)); }
.modal__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; background: var(--blue); color: #fff; }
.modal__head h2 { font-size: 22px; }
.modal__body { padding: 18px 22px 22px; overflow-y: auto; }
.modal__body ul { padding-left: 20px; margin: 8px 0 16px; }
.modal__body li { margin-bottom: 3px; }
.modal__body b { color: var(--navy); }

/* Stock map */
.stockmap { height: min(62vh, 520px); min-height: 320px; border-radius: 16px; overflow: hidden; background: var(--cream-2); }
.stockmap__note { margin: 10px 2px 0; color: var(--muted); font-size: 14px; }

/* Shared comparison link */
.cmp__share { margin: 16px 0 0; text-align: right; }

/* Spec sheet download button in the vehicle panel */
.panel__print { display: block; margin: 12px auto 0; background: none; border: 0; font-size: 14px; font-weight: 600; color: var(--blue); text-decoration: underline; cursor: pointer; }

.cmp { width: 100%; border-collapse: collapse; }
.cmp th { width: 130px; padding: 9px 10px 9px 0; color: var(--muted); font-size: 14px; font-weight: 500; text-align: left; vertical-align: top; }
.cmp td { padding: 9px 10px; border-left: 1px solid var(--line); vertical-align: top; font-weight: 600; min-width: 170px; overflow-wrap: anywhere; }
.cmp tr + tr > * { border-top: 1px solid var(--line); }
.cmp img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; margin-bottom: 8px; }
.cmp a { color: var(--navy); font: 800 17px/1.15 var(--font-display); text-decoration: none; }
.cmp .best { color: var(--blue-deep); font: 800 20px var(--font-display); }
.cmp__scroll { overflow-x: auto; }

/* View-transition: card photo grows into the gallery */
::view-transition-group(kb-car) { animation-duration: .42s; animation-timing-function: var(--ease); }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .28s; }

/* Responsive */
@media (max-width: 1240px) {
  .detail[open] { grid-template-columns: minmax(0, 1fr) 380px; }
  .bar__garage span { display: none; }
}
@media (max-width: 1020px) {
  .hero__in { grid-template-columns: 1fr; }
  .hero__stack { display: none; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .bar__search kbd { display: none; }
  .filters { position: fixed; inset: auto 0 0 0; z-index: 70; max-height: 86dvh; padding-bottom: 0; border-radius: 22px 22px 0 0; box-shadow: var(--shadow-lg); transform: translateY(105%); visibility: hidden; transition: transform .32s var(--ease), visibility .32s; }
  .filters.is-open { transform: none; visibility: visible; }
  .filters__close { display: inline-grid; color: var(--navy); }
  .filters__foot { display: block; position: sticky; bottom: 0; margin: 0 -16px; padding: 10px 16px 14px; background: #fff; box-shadow: 0 -8px 16px -12px rgba(7, 47, 104, .35); }
  .filters__foot .btn { width: 100%; }
  .filters-scrim { display: block; position: fixed; inset: 0; z-index: 65; background: rgba(5, 31, 71, .55); opacity: 0; pointer-events: none; transition: opacity .3s; }
  .filters-scrim.is-on { opacity: 1; pointer-events: auto; }
  .fab { display: inline-flex; }
  .tray { bottom: 78px; }
  .detail[open] { display: block; overflow-y: auto; }
  .stage { grid-template-rows: auto auto auto; position: sticky; top: 0; z-index: 3; background: var(--ink); }
  .stage__view { aspect-ratio: 4 / 3; max-height: 52dvh; width: 100%; }
  .stage__close { display: inline-grid; }
  .strip { padding-block: 6px 8px; }
  .strip button { width: 68px; height: 50px; }
  .panel { overflow: visible; position: relative; z-index: 4; }
  .panel__close { display: none; }
}
@media (max-width: 640px) {
  .bar { position: relative; top: auto; margin-top: -30px; }
  .bar__in { flex-wrap: wrap; gap: 6px; }
  .bar__in > * { min-height: 48px; border-radius: 13px; }
  .bar__search { flex: 1 0 100%; order: -1; padding: 0 14px; }
  .bar__search input { height: 48px; font-size: 16px; }
  .bar__dest { flex: none; }
  .bar__destbtn span { display: none; }
  .bar__sort { flex: 1; min-width: 0; }
  .bar__sort select { width: 100%; }
  .bar__garage { padding: 0 13px; }
  .popover { right: auto; left: 0; }
  .results__head { flex-direction: column; gap: 8px; }
  .results__tools { width: 100%; justify-content: space-between; }
  .grid.is-dense { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stage__arrow { width: 44px; height: 44px; }
  .panel { padding: 18px 16px 90px; }
  .mini { grid-template-columns: 84px 1fr auto; }
  .mini img { width: 84px; height: 64px; }
  /* Photo header: navigation and close on one row, the photo counter on its own line below */
  .stage__top { flex-wrap: wrap; row-gap: 8px; padding: 10px 12px; }
  .stage__nav { font-size: 12.5px; }
  .stage__close { margin-left: auto; }
  .stage__count { order: 3; flex-basis: 100%; margin-left: 0; text-align: left; font-size: 12.5px; }
}
