/* =====================================================================
   STOCK PAGE (vehicles.html)
   ===================================================================== */

/* ---------- Page head ---------- */
.shop-head { position: relative; overflow: hidden; padding: calc(var(--nav-h) + clamp(56px, 8vw, 110px)) 0 0; }
.shop-head .photo-bg::after { background: linear-gradient(180deg, rgba(12,13,15,0.75) 0%, rgba(12,13,15,0.5) 45%, rgba(12,13,15,0.96) 100%); }
.shop-head-inner { position: relative; z-index: 3; }
.shop-head .tag { margin-bottom: 18px; }
.shop-head-sub { margin: 18px 0 clamp(36px, 5vw, 64px); font-size: clamp(1rem, 1.3vw, 1.15rem); color: rgba(255,255,255,0.82); max-width: 52ch; }
.shop-head-sub b { font-family: var(--display); font-weight: 800; font-size: 1.4em; color: #fff; }

.type-bar { display: flex; gap: clamp(20px, 3vw, 44px); overflow-x: auto; scrollbar-width: none; border-top: 1px solid var(--line-dark); }
.type-bar::-webkit-scrollbar { display: none; }
.type-btn {
    position: relative; padding: 20px 0 22px; white-space: nowrap;
    font-family: var(--display); font-weight: 700; font-size: clamp(1.3rem, 2.2vw, 1.9rem); text-transform: uppercase;
    color: rgba(255,255,255,0.55); transition: color 0.25s;
}
.type-btn sup { font-family: var(--text); font-weight: 600; font-size: 0.42em; margin-left: 6px; vertical-align: super; color: var(--fog); }
.type-btn::after {
    content: ''; position: absolute; left: 0; right: 0; top: -1px; height: 4px; background: var(--red);
    transform: scaleX(0); transform-origin: left; transition: transform 0.5s var(--ease);
}
.type-btn:hover:not(:disabled), .type-btn.is-active { color: #fff; }
.type-btn.is-active::after { transform: scaleX(1); }
.type-btn:disabled { opacity: 0.3; cursor: default; }

/* ---------- Sticky toolbar ---------- */
.toolbar {
    position: sticky; top: 0; z-index: 50;
    background: rgba(243,243,241,0.97); border-bottom: 1px solid var(--line);
    transition: box-shadow 0.3s, top 0.45s var(--ease);
}
body:has(.nav:not(.is-hidden)) .toolbar { top: 64px; }
@media (max-width: 1100px) { body:has(.nav:not(.is-hidden)) .toolbar { top: 64px; } }
.toolbar.is-stuck { box-shadow: 0 14px 30px -24px rgba(12,13,15,0.5); }
.toolbar-inner { display: flex; align-items: center; gap: 12px; min-height: 72px; }
.toolbar-filters {
    display: none; align-items: center; gap: 10px; height: 46px; padding: 0 16px;
    font-family: var(--display); font-weight: 700; font-size: 1.05rem; letter-spacing: 0.06em; text-transform: uppercase;
    background: var(--ink); color: #fff;
}
.toolbar-filters svg { width: 18px; height: 18px; }
.toolbar-badge { display: grid; place-items: center; min-width: 22px; height: 22px; padding: 0 5px; background: var(--red); font-family: var(--text); font-size: 0.75rem; }
.search { position: relative; flex: 1; max-width: 420px; }
.search svg { position: absolute; left: 14px; top: 50%; width: 18px; height: 18px; margin-top: -9px; color: var(--steel); pointer-events: none; }
.search input {
    width: 100%; height: 46px; padding: 0 14px 0 44px;
    border: 1px solid var(--line); background: #fff; font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.search input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(238,27,36,0.15); }
.seg { display: flex; height: 46px; border: 1px solid var(--line); background: #fff; margin-left: auto; }
.seg-btn {
    padding: 0 16px; font-family: var(--display); font-weight: 700; font-size: 1.02rem; letter-spacing: 0.06em; text-transform: uppercase;
    color: var(--steel); transition: background 0.25s, color 0.25s;
}
.seg-btn + .seg-btn { border-left: 1px solid var(--line); }
.seg-btn:hover { color: var(--ink); }
.seg-btn.is-active { background: var(--ink); color: #fff; }
.deal-toggle {
    height: 46px; padding: 0 16px; border: 1px solid var(--line); background: #fff;
    font-family: var(--display); font-weight: 700; font-size: 1.02rem; letter-spacing: 0.06em; text-transform: uppercase;
    transition: background 0.25s, color 0.25s, border-color 0.25s;
}
.deal-toggle::before { content: ''; display: inline-block; width: 10px; height: 10px; margin-right: 8px; background: var(--sticker); transform: rotate(45deg); vertical-align: 1px; }
.deal-toggle.is-active { background: var(--sticker); border-color: var(--sticker); }
.deal-toggle.is-active::before { background: var(--ink); }
.sort { position: relative; display: flex; align-items: center; gap: 10px; font-size: 0.82rem; color: var(--steel); }
.sort select {
    height: 46px; padding: 0 38px 0 14px; border: 1px solid var(--line); background: #fff; color: var(--ink);
    font-size: 0.92rem; appearance: none; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='%230c0d0f' stroke-width='2.4'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center; background-size: 16px;
}
.sort select:focus { outline: none; border-color: var(--ink); }

/* ---------- Listing layout ---------- */
.listing { padding: 36px 0 clamp(72px, 9vw, 120px); }
.listing-grid { display: grid; grid-template-columns: 270px 1fr; gap: clamp(28px, 3vw, 48px); align-items: start; }

/* Filters sidebar */
.filters { position: sticky; top: 100px; max-height: calc(100vh - 120px); display: flex; flex-direction: column; transition: top 0.45s var(--ease); }
body:has(.nav:not(.is-hidden)) .filters { top: 164px; max-height: calc(100vh - 184px); }
.facet--m { display: none; }
.seg--m { margin: 0; width: 100%; }
.seg--m .seg-btn { flex: 1; }
.facet--m .deal-toggle { width: 100%; }
.facet--m .sort { width: 100%; }
.facet--m .sort select { width: 100%; }
.filters-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.filters-head h2 { font-size: 1.7rem; }
.filters-close { display: none; width: 44px; height: 44px; place-items: center; }
.filters-close svg { width: 22px; height: 22px; }
.filters-body { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; padding-right: 6px; }
.facet { border: 0; border-top: 1px solid var(--line); padding: 2px 0 18px; }
.facet[hidden] { display: none; }
.facet legend {
    display: flex; justify-content: space-between; width: 100%; padding: 18px 0 12px; float: left;
    font-family: var(--display); font-weight: 700; font-size: 1.15rem; letter-spacing: 0.04em; text-transform: uppercase;
}
.facet legend output { font-family: var(--text); font-weight: 600; font-size: 0.78rem; letter-spacing: 0; text-transform: none; color: var(--red); align-self: center; }
.facet > :not(legend) { clear: both; }
.facet:first-child { border-top: 2px solid var(--ink); }
.checks { display: grid; gap: 2px; }
.check {
    display: grid; grid-template-columns: 20px 1fr auto; align-items: center; gap: 12px;
    padding: 7px 8px; margin-inline: -8px; cursor: pointer; font-size: 0.92rem;
    transition: background 0.2s;
}
.check:hover { background: rgba(12,13,15,0.04); }
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check-box { width: 20px; height: 20px; border: 2px solid rgba(12,13,15,0.35); position: relative; transition: border-color 0.2s, background 0.2s; }
.check-box::after {
    content: ''; position: absolute; left: 5px; top: 1px; width: 6px; height: 11px;
    border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg) scale(0); transition: transform 0.25s var(--ease);
}
.check.is-on .check-box, .check input:checked + .check-box { background: var(--red); border-color: var(--red); }
.check.is-on .check-box::after, .check input:checked + .check-box::after { transform: rotate(45deg) scale(1); }
.check input:focus-visible + .check-box { outline: 2px solid var(--red); outline-offset: 2px; }
.check-n { font-size: 0.78rem; color: var(--steel); font-variant-numeric: tabular-nums; }

/* Dual range */
.range { position: relative; height: 28px; margin: 4px 2px 0; }
.range::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 4px; margin-top: -2px; background: var(--paper-2); }
.range-fill { position: absolute; top: 50%; height: 4px; margin-top: -2px; background: var(--red); }
.range input {
    position: absolute; inset: 0; width: 100%; margin: 0; background: none; pointer-events: none;
    -webkit-appearance: none; appearance: none; z-index: 2;
}
.range input::-webkit-slider-thumb {
    -webkit-appearance: none; pointer-events: auto; width: 22px; height: 22px; background: #fff;
    border: 3px solid var(--ink); cursor: grab; transform: rotate(45deg); transition: border-color 0.2s, transform 0.2s;
}
.range input::-moz-range-thumb { pointer-events: auto; width: 16px; height: 16px; background: #fff; border: 3px solid var(--ink); border-radius: 0; cursor: grab; transform: rotate(45deg); }
.range input:active::-webkit-slider-thumb { border-color: var(--red); transform: rotate(45deg) scale(1.15); cursor: grabbing; }
.range input:focus-visible::-webkit-slider-thumb { border-color: var(--red); }
.range input::-webkit-slider-runnable-track { background: none; }
.range input::-moz-range-track { background: none; }
.filters-foot { display: none; }
.filters-scrim { display: none; }

/* Results */
.results-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; min-height: 40px; margin-bottom: 18px; }
.results-count { font-size: 0.95rem; color: var(--steel); }
.results-count b { font-family: var(--display); font-weight: 800; font-size: 1.8rem; color: var(--ink); margin-right: 4px; vertical-align: -2px; }
.active-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.atag {
    display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px 0 12px;
    background: var(--ink); color: #fff; font-size: 0.82rem; font-weight: 500;
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%);
    transition: background 0.2s;
}
.atag svg { width: 12px; height: 12px; }
.atag:hover { background: var(--red); }
.atag-clear { font-size: 0.82rem; font-weight: 600; color: var(--red); padding: 0 6px; text-decoration: underline; text-underline-offset: 3px; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid .skeleton { min-height: 420px; }
.no-results { padding: 64px clamp(24px, 4vw, 56px); background: #fff; border-top: 3px solid var(--red); }
.no-results p { color: var(--steel); margin: 12px 0 24px; max-width: 48ch; }
.no-results-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* Order band */
.order { position: relative; overflow: hidden; padding-block: clamp(80px, 10vw, 140px); }
.order-inner { position: relative; z-index: 3; display: grid; grid-template-columns: 1.1fr 1fr; gap: 32px 64px; align-items: end; }
.order .lede { color: rgba(255,255,255,0.85); margin-bottom: 26px; }
.order-actions { display: flex; flex-wrap: wrap; gap: 12px; }


/* ---------- Responsive ---------- */
@media (max-width: 1240px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 1000px) {
    .listing-grid { grid-template-columns: 1fr; }
    .toolbar-filters { display: inline-flex; }
    .filters {
        position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 300;
        max-height: 88vh; padding: 20px var(--gutter) 0; background: var(--paper);
        transform: translateY(105%); transition: transform 0.55s var(--ease);
        box-shadow: 0 -20px 50px rgba(0,0,0,0.25);
    }
    .filters::before { content: ''; position: absolute; top: 8px; left: 50%; width: 44px; height: 4px; margin-left: -22px; background: var(--paper-2); }
    .filters-open .filters { transform: none; }
    .filters-close { display: grid; }
    .filters-foot {
        display: grid; grid-template-columns: 1fr 1.6fr; gap: 10px;
        padding: 14px 0 calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--paper);
    }
    .filters-scrim { display: block; position: fixed; inset: 0; z-index: 290; background: rgba(12,13,15,0.6); opacity: 0; pointer-events: none; transition: opacity 0.4s; }
    .filters-open .filters-scrim { opacity: 1; pointer-events: auto; }
    body.filters-open { overflow: hidden; }
    .order-inner { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
    .toolbar-inner { gap: 8px; padding-block: 10px; min-height: 0; }
    .toolbar .seg, .toolbar .sort, .toolbar .deal-toggle { display: none; }
    .facet--m { display: block; }
    .facet--m[hidden] { display: none; }
    .search { flex: 1; max-width: none; }
    .toolbar-filters { flex: none; }
    .grid { grid-template-columns: 1fr; gap: 16px; }
    .listing { padding-top: 20px; }
}
@media (min-width: 520px) and (max-width: 760px) { .grid { grid-template-columns: repeat(2, 1fr); } }
