/* Budget-first homepage (VEH-251). Values follow the desktop 1280 / tablet 834 / phone 390
   mockups in design/; breakpoints: ≥1100px desktop, 600–1099px tablet, <600px phone. */

.budget-wrap {
    /* 1400px like the header (testing feedback 03.11); the paddings stay the 1280 mockup's */
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 64px;
    box-sizing: border-box;
}

[data-budget-more][hidden],
[data-budget-exhausted][hidden],
.budget-btn[hidden],
.bcard[hidden] {
    display: none;
}

/* ---- Hero: the budget question and the slider ---- */

.budget-hero {
    padding: 48px 0 44px;
    background: linear-gradient(135deg, var(--color-surface) 0%, var(--color-bg) 100%);
}

.budget-hero-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
}

.budget-lead {
    margin: 0;
    max-width: 720px;
    font-size: 16px;
    line-height: 1.45;
    font-weight: 500;
    color: var(--text-secondary);
    text-wrap: balance;
}

.budget-cta {
    margin: 0;
    font-size: 58px;
    line-height: 1.1;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--text-primary);
    text-wrap: balance;
}

.budget-amount {
    font-family: 'Roboto Flex', var(--font-primary);
    font-weight: 800;
    font-variation-settings: 'wght' 800, 'wdth' 100;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.budget-slider {
    --inset: 14px;
    --stops: 20;
    width: 640px;
    max-width: 100%;
    margin-top: 18px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.budget-track {
    position: relative;
    height: 56px;
}

.budget-rail {
    position: absolute;
    left: var(--inset);
    right: var(--inset);
    top: 25px;
    height: 6px;
    border-radius: 3px;
    background: rgba(28, 105, 212, 0.16);
}

/* Only the chosen window (previous stop, stop] is lit. */
.budget-band {
    position: absolute;
    top: 24px;
    left: calc(var(--inset) + (100% - 2 * var(--inset)) * var(--t) / var(--stops));
    width: calc((100% - 2 * var(--inset)) / var(--stops));
    height: 8px;
    border-radius: 4px;
    background: var(--accent);
    transition: left 120ms ease;
}

.budget-tick {
    position: absolute;
    top: 37px;
    left: calc(var(--inset) + (100% - 2 * var(--inset)) * var(--t) / var(--stops));
    width: 1px;
    height: 6px;
    margin-left: -0.5px;
    background: rgba(28, 105, 212, 0.35);
}

.budget-tick.is-on {
    background: var(--accent-dark);
}

.budget-range {
    -webkit-appearance: none;
    appearance: none;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 56px;
    margin: 0;
    background: transparent;
    cursor: pointer;
    touch-action: none;
}

.budget-range:focus { outline: none; }
.budget-range::-webkit-slider-runnable-track { height: 56px; background: transparent; }
.budget-range::-moz-range-track { height: 56px; background: transparent; }
.budget-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 28px;
    height: 28px;
    margin-top: 14px;
    border-radius: 50%;
    background: #FFFFFF;
    border: 2px solid var(--accent);
    box-shadow: 0 2px 8px rgba(14, 76, 146, 0.25);
    cursor: grab;
}
.budget-range::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #FFFFFF;
    border: 2px solid var(--accent);
    box-shadow: 0 2px 8px rgba(14, 76, 146, 0.25);
    cursor: grab;
}
.budget-range:active::-webkit-slider-thumb { cursor: grabbing; transform: scale(1.08); }
.budget-range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 5px rgba(28, 105, 212, 0.3), 0 2px 8px rgba(14, 76, 146, 0.25); }
.budget-range:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 5px rgba(28, 105, 212, 0.3); }

.budget-labels {
    position: relative;
    height: 44px;
}

.budget-label {
    position: absolute;
    top: 0;
    left: calc(var(--inset) + (100% - 2 * var(--inset)) * var(--t) / var(--stops));
    transform: translateX(-50%);
    min-width: 44px;
    height: 44px;
    padding: 0 4px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    color: #6B6B6B;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* The site-wide button:hover (main.css) lifts with a transform — here it would replace the
   centring translateX, so the label jumps half its width out from under the pointer and back.
   Hover only colours the amount. */
.budget-label {
    transition: color 150ms ease;
}
.budget-label:hover,
.budget-label:active {
    transform: translateX(-50%);
    box-shadow: none;
    color: var(--accent-dark);
}

/* No lift or shadow on the homepage's own buttons either (the mockups have none). */
.budget-step,
.budget-btn {
    transition: none;
}
.budget-step:hover,
.budget-step:active,
.budget-btn:hover,
.budget-btn:active {
    transform: none;
    box-shadow: none;
}

.budget-label.is-current { font-weight: 700; color: var(--accent-dark); }
.budget-label.is-floor { font-weight: 700; color: var(--text-primary); }

/* − / + for an exact step: phone only. */
.budget-steps {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 4px;
}

.budget-step {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 50%;
    border: 1.5px solid var(--accent);
    background: #FFFFFF;
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
}

.budget-step svg {
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    fill: none;
}

.budget-step:disabled {
    border-color: rgba(28, 105, 212, 0.3);
    color: rgba(28, 105, 212, 0.3);
    cursor: default;
}

.budget-step-window {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent-dark);
    font-variant-numeric: tabular-nums;
}

/* Phone tagline row under the header (header.ejs); wider screens show it inside the header. */
.header-tagline-row { display: none; }

/* ---- Results: the cards for the chosen budget ---- */

.budget-results {
    padding: 40px 0 32px;
    background: linear-gradient(135deg, #F5F7FA 0%, #C3CFE2 100%);
}

.budget-results-inner {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.budget-summary {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    font-size: 15px;
    color: var(--text-secondary);
}

.budget-summary strong { color: var(--text-primary); }

.budget-sorted {
    font-size: 13px;
    white-space: nowrap;
}

.budget-grid {
    --budget-first: 9;
    --budget-step: 9;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 48px;
    transition: opacity 200ms ease, transform 200ms ease;
}

.budget-grid.is-pending { opacity: 0.45; }

.budget-grid.is-fading {
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 140ms ease, transform 140ms ease;
}

/* Without JS the first page of the default stop is what the visitor gets. */
.budget-grid:not(.is-live) > .bcard:nth-child(n + 10) { display: none; }

.bcard {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    overflow: hidden;
    background: #FFFFFF;
    color: inherit;
    text-decoration: none;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

.bcard:hover {
    border-color: color-mix(in srgb, var(--accent) 55%, transparent);
    box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 14%, transparent);
}

.bcard-photo {
    position: relative;
    display: block;
    aspect-ratio: 8 / 5;
    background: #F4F4F4;
    overflow: hidden;
}

.bcard-photo img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* No photo yet: the same brand gradient as a model card without one. */
.bcard-photo--none {
    background: linear-gradient(135deg, var(--accent-dark) 0%, var(--accent-light) 100%);
}

.bcard-caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    box-sizing: border-box;
    padding: 18px 18px 12px;
    background: linear-gradient(180deg, rgba(12, 16, 24, 0) 0%, rgba(12, 16, 24, 0.32) 40%, rgba(12, 16, 24, 0.6) 100%);
    display: flex;
    align-items: baseline;
    gap: 8px;
    color: #FFFFFF;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}

.bcard-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: 'Roboto Flex', var(--font-primary);
    font-size: 22px;
    font-weight: 700;
    font-variation-settings: 'wght' 700, 'wdth' 84;
    line-height: 1.15;
    letter-spacing: -0.005em;
}

.bcard-code {
    /* Lifted onto the middle of the title's capitals. */
    position: relative;
    top: -3px;
    flex-shrink: 0;
    font-size: 12px;
    line-height: 1;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 4px;
    padding: 3px 6px;
    text-shadow: none;
}

.bcard-years {
    flex-shrink: 0;
    margin-left: auto;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.92);
    font-variant-numeric: tabular-nums;
}

.bcard-body {
    padding: 16px 18px 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bcard-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.bcard-bars {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}

.bcard-bars i {
    width: 10px;
    height: 4px;
    border-radius: 2px;
    background: rgba(28, 105, 212, 0.18);
}

/* Three marks for the tier: cheapest lights one, the middle two, the top all three. */
.bcard-bars i:first-child,
.bcard-bars[data-tier="1"] i:nth-child(2),
.bcard-bars[data-tier="2"] i { background: #1C69D4; }

.bcard-hint {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.bcard-offers {
    margin-left: auto;
    font-size: 13px;
    color: #5A5A5A;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.bcard-price {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.budget-more {
    align-self: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.budget-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    box-sizing: border-box;
    padding: 0 28px;
    border: 1px solid var(--text-primary);
    border-radius: 999px;
    background: #FFFFFF;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
}

.budget-btn span[aria-hidden] { font-size: 17px; }

/* "↑ Budget" back to the slider: phone only. */
.budget-btn--back {
    display: none;
    gap: 8px;
    padding: 0 20px;
    border-color: var(--accent);
    color: var(--accent-dark);
}

.budget-btn--outline {
    padding: 0 24px;
    border-color: var(--accent);
    color: var(--accent-dark);
}

.budget-btn--solid {
    padding: 0 24px;
    border-color: var(--accent);
    background: var(--accent);
    color: #FFFFFF;
}

.budget-exhausted {
    align-self: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
}

.budget-exhausted-text {
    font-size: 15px;
    color: var(--text-secondary);
}

.budget-exhausted-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

/* ---- Brands, close to the footer ---- */

.budget-brands {
    padding: 36px 0 48px;
    background: var(--color-surface);
}

.budget-brands-title {
    margin: 0 0 14px;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.budget-brands-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0 40px;
}

.budget-brand {
    display: flex;
    align-items: baseline;
    gap: 12px;
    min-height: 52px;
    box-sizing: border-box;
    padding: 14px 0 12px;
    border-top: 1px solid #E0E0E0;
    color: inherit;
    text-decoration: none;
}

.budget-brand-edge {
    width: 3px;
    align-self: stretch;
    margin: 3px 0 4px;
    border-radius: 2px;
    background: var(--accent);
}

.budget-brand-name {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.budget-brand-models {
    margin-left: auto;
    font-size: 14px;
    color: var(--text-secondary);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.budget-brand-models strong {
    font-size: 15px;
    color: var(--text-primary);
}

.budget-brand-arrow {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent-dark);
}

.budget-brand:hover .budget-brand-name { color: var(--accent-dark); }

/* ---- Tablet and phone: the same card, larger functional text ---- */
@media (max-width: 1099px) {
    .budget-wrap { padding: 0 32px; }
    .budget-hero { padding: 40px 0 44px; }
    .budget-lead { max-width: 600px; font-size: 15px; }
    .budget-cta { font-size: 39px; }
    .budget-slider { width: 600px; }
    .budget-label { font-size: 13px; }

    .budget-summary { font-size: 17px; }
    .budget-grid {
        --budget-first: 8;
        --budget-step: 6;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 24px;
    }
    .budget-grid:not(.is-live) > .bcard:nth-child(n + 9) { display: none; }

    /* Card: tier mark and count move onto the photo, only the price stays under it. The mark
       keeps its place in the markup (desktop shows it under the photo) and is lifted over the
       photo's foot: the price row is a fixed 46px, the caption leaves the mark a 22px slot. */
    .bcard { position: relative; }
    .bcard-photo { aspect-ratio: auto; height: 176px; }
    .bcard-caption {
        padding: 18px 14px 32px;
        background: linear-gradient(180deg, rgba(12, 16, 24, 0) 0%, rgba(12, 16, 24, 0.4) 30%, rgba(12, 16, 24, 0.75) 100%);
    }
    .bcard-code { font-size: 13px; }
    .bcard-years { font-size: 15px; color: rgba(255, 255, 255, 0.95); }
    .bcard-body { padding: 1px 14px; gap: 0; min-height: 46px; justify-content: center; }
    .bcard-meta {
        position: absolute;
        left: 14px;
        right: 14px;
        bottom: 56px;
        color: #FFFFFF;
        text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
    }
    .bcard-bars i { background: rgba(255, 255, 255, 0.35); }
    .bcard-bars i:first-child,
    .bcard-bars[data-tier="1"] i:nth-child(2),
    .bcard-bars[data-tier="2"] i { background: #FFFFFF; }
    .bcard-hint { font-size: 15px; color: #FFFFFF; }
    .bcard-offers { font-size: 14px; color: rgba(255, 255, 255, 0.92); }
    .bcard-price { font-size: 20px; line-height: 1.2; }

    .budget-btn,
    .budget-btn span[aria-hidden],
    .budget-exhausted-text { font-size: 17px; }

    .budget-brands-title { font-size: 22px; }
    .budget-brand-name { font-size: 18px; }
    .budget-brand-models { font-size: 16px; }
    .budget-brand-models strong { font-size: 17px; }
    .budget-brands-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---- Phone ---- */
@media (max-width: 599px) {
    .budget-wrap { padding: 0 16px; }

    /* Only the logo row is pinned; the tagline scrolls away under it. */
    .header-tagline-row {
        display: block;
        padding: 2px 16px 0;
        background: var(--color-bg);
        font-size: 12px;
        line-height: 1.4;
        color: var(--text-secondary);
    }

    /* The budget picker sits ~50px higher: tighter hero, no amount labels under the track. */
    .budget-hero { padding: 16px 0 28px; }
    .budget-lead {
        max-width: 358px;
        font-family: 'Roboto Flex', var(--font-primary);
        font-size: 13px;
        line-height: 1.4;
        font-variation-settings: 'wght' 500, 'wdth' 84;
    }
    .budget-cta { font-size: 30px; letter-spacing: -0.02em; }
    .budget-slider { --inset: 16px; width: 100%; margin-top: 4px; }
    .budget-labels { display: none; }
    .budget-steps { display: flex; }
    .budget-step-window { font-size: 17px; }

    .budget-results { padding: 28px 0; }
    .budget-summary-text { display: flex; flex-direction: column; gap: 2px; }
    .budget-summary-text > span { white-space: nowrap; font-variant-numeric: tabular-nums; }
    .budget-sorted { display: none; }

    .budget-grid {
        --budget-first: 6;
        --budget-step: 3;
        grid-template-columns: minmax(0, 1fr);
        gap: 12px;
    }
    .budget-grid:not(.is-live) > .bcard:nth-child(n + 7) { display: none; }

    /* ~216px a card, about three to a screen. */
    .bcard-photo { height: 168px; }

    .budget-btn--back { display: flex; padding: 0 18px; }
    .budget-more .budget-btn:not(.budget-btn--back) { padding: 0 22px; }

    .budget-brands { padding: 36px 0 48px; }
    .budget-brands-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
    .budget-band,
    .budget-grid,
    .budget-grid.is-fading,
    .bcard { transition: none; }
    .budget-range:active::-webkit-slider-thumb { transform: none; }
}
