:root {
    --c-bg: #f7f8fa;
    --c-surface: #ffffff;
    --c-text: #16202c;
    --c-muted: #5a6877;
    --c-border: #e3e7ed;
    --c-primary: #d62828;
    --c-primary-dark: #a51d1d;
    --c-accent: #0a3d62;
    --radius: 8px;
    --shadow: 0 4px 18px rgba(20, 30, 45, 0.08);

    --container-max: 1200px;
    --container-pad: clamp(16px, 4vw, 32px);
    --section-pad-y: clamp(32px, 6vw, 64px);
    --gap-md: clamp(16px, 2.5vw, 24px);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--c-text);
    background: var(--c-bg);
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
}

html { height: 100%; }
body {
    min-height: 100%;
    display: flex;
    flex-direction: column;
    font-size: clamp(15px, 0.95vw + 13px, 17px);
}
body > main { flex: 1 0 auto; width: 100%; }
.site-footer { flex-shrink: 0; }

h1 { font-size: clamp(26px, 4vw + 8px, 40px); line-height: 1.2; }
h2 { font-size: clamp(22px, 2.2vw + 10px, 30px); line-height: 1.25; }
h3 { font-size: clamp(17px, 0.8vw + 14px, 20px); }
h4 { font-size: 16px; }

a { color: var(--c-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--container-pad);
    width: 100%;
}

/* Header */
.site-header {
    background: var(--c-surface);
    border-bottom: 1px solid var(--c-border);
    position: sticky;
    top: 0;
    z-index: 20;
}
.header-inner {
    display: flex;
    align-items: center;
    gap: clamp(12px, 2vw, 24px);
    padding: 12px var(--container-pad);
    flex-wrap: nowrap;
}
.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: clamp(17px, 1vw + 14px, 21px);
    color: var(--c-text);
    text-decoration: none;
    min-width: 0;
    transition: color 0.15s, opacity 0.15s;
}
.brand:hover,
.brand:focus-visible {
    text-decoration: none;
    color: var(--c-primary);
}
.brand img {
    max-height: 36px;
    transition: opacity 0.15s;
}
.brand:hover img { opacity: 0.85; }
.brand-text {
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.site-nav { flex: 1; }
.site-nav ul {
    display: flex;
    gap: clamp(14px, 2vw, 24px);
    list-style: none;
    margin: 0;
    padding: 0;
    justify-content: center;
    flex-wrap: wrap;
}
.site-nav a {
    color: var(--c-text);
    font-weight: 500;
    text-decoration: none;
    padding: 8px 4px;
    display: inline-block;
}
.site-nav a:hover { color: var(--c-primary); }
.header-phone {
    font-weight: 600;
    color: var(--c-primary);
    text-decoration: none;
    white-space: nowrap;
}

/* Hamburger */
.nav-toggle {
    display: none;
    background: none;
    border: 0;
    width: 44px;
    height: 44px;
    padding: 0;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    position: relative;
}
.nav-toggle span {
    display: block;
    position: absolute;
    left: 10px;
    right: 10px;
    height: 2px;
    background: var(--c-text);
    transition: transform 0.2s, opacity 0.2s, top 0.2s;
}
.nav-toggle span:nth-child(1) { top: 14px; }
.nav-toggle span:nth-child(2) { top: 21px; }
.nav-toggle span:nth-child(3) { top: 28px; }

@media (max-width: 860px) {
    .nav-toggle { display: flex; }
    .header-phone { display: none; }
    .site-nav {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--c-surface);
        border-bottom: 1px solid var(--c-border);
        box-shadow: var(--shadow);
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.25s ease;
        flex: none;
    }
    .site-nav ul {
        flex-direction: column;
        align-items: stretch;
        padding: 8px var(--container-pad) 16px;
        gap: 0;
    }
    .site-nav li { border-bottom: 1px solid var(--c-border); }
    .site-nav li:last-child { border-bottom: 0; }
    .site-nav a {
        padding: 14px 4px;
        display: block;
        font-size: 16px;
    }
    .site-header.nav-open .site-nav { max-height: 80vh; }
    .site-header.nav-open .nav-toggle span:nth-child(1) {
        top: 21px; transform: rotate(45deg);
    }
    .site-header.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
    .site-header.nav-open .nav-toggle span:nth-child(3) {
        top: 21px; transform: rotate(-45deg);
    }
}

/* Hero */
.hero {
    background: linear-gradient(135deg, var(--c-accent) 0%, #0e5290 100%);
    color: #fff;
    padding: clamp(48px, 8vw, 96px) var(--container-pad);
    text-align: center;
}
.hero-inner { max-width: 760px; margin: 0 auto; }
.hero h1 {
    font-size: clamp(28px, 5vw + 10px, 48px);
    margin: 0 0 12px;
    color: #fff;
}
.hero-sub {
    font-size: clamp(15px, 1vw + 13px, 19px);
    opacity: 0.92;
    margin: 0 0 28px;
}
.hero-cta {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 22px;
    border-radius: var(--radius);
    font-weight: 600;
    border: none;
    cursor: pointer;
    text-decoration: none;
    font-size: 15px;
    line-height: 1.2;
    min-height: 44px;
    transition: background 0.15s, transform 0.05s;
    text-align: center;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--c-primary); color: #fff; }
.btn-primary:hover { background: var(--c-primary-dark); }
.btn-ghost {
    background: transparent;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.5);
}
.section .btn-ghost { color: var(--c-text); border-color: var(--c-border); }
.btn-block { display: block; width: 100%; text-align: center; margin-top: 8px; }

/* Sections */
.section {
    padding: var(--section-pad-y) var(--container-pad);
    max-width: var(--container-max);
    margin: 0 auto;
}
.section.narrow { max-width: 820px; }
.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}
.section h1 { margin-top: 0; }
.section h2 { margin: 0; }
.link { font-weight: 500; }

/* Vehicle grid */
.vehicle-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
    gap: var(--gap-md);
}
.vehicle-card {
    background: var(--c-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    color: inherit;
    text-decoration: none;
    transition: transform 0.15s, box-shadow 0.15s;
    display: flex;
    flex-direction: column;
}
.vehicle-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(20, 30, 45, 0.12);
    text-decoration: none;
}
.vehicle-card-image {
    position: relative;
    aspect-ratio: 16 / 10;
    background: #eef1f5;
    overflow: hidden;
}
.vehicle-card-image img { width: 100%; height: 100%; object-fit: cover; }
.badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--c-primary);
    color: #fff;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}
.badge-pending { background: #f3a712; }
.vehicle-card-body { padding: 14px 16px 18px; }
.vehicle-card-title { margin: 0 0 6px; }
.vehicle-card-price {
    font-size: clamp(18px, 1.2vw + 14px, 22px);
    font-weight: 700;
    color: var(--c-primary);
    margin-bottom: 10px;
}
.vehicle-card-specs {
    list-style: none;
    margin: 0 0 8px;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    color: var(--c-muted);
    font-size: 13px;
}
.vehicle-card-specs li {
    display: inline-flex;
    gap: 4px;
    align-items: baseline;
}
.vehicle-card-specs .spec-label {
    color: var(--c-muted);
    opacity: 0.8;
}
.vehicle-card-specs .spec-value {
    color: var(--c-text);
    font-weight: 600;
}
.vehicle-card-vin {
    margin: 2px 0 8px;
    color: var(--c-muted);
    font-family: ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
    font-size: 12px;
    word-break: break-all;
}
.vehicle-vin {
    margin: 2px 0 12px;
    color: var(--c-muted);
    font-family: ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
    font-size: 13px;
    word-break: break-all;
}
.badge-source {
    background: #1e293b;
    text-transform: none;
    letter-spacing: 0.2px;
}
.vehicle-card-blurb {
    margin: 6px 0 0;
    color: var(--c-muted);
    font-size: 13px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Filters */
.filters {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: clamp(12px, 2vw, 18px);
    margin-bottom: 22px;
}
.filters-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    align-items: end;
    margin-bottom: 10px;
}
.filters-row:last-child { margin-bottom: 0; }
.filters-row.search-row {
    grid-template-columns: minmax(200px, 2fr) minmax(150px, 1fr);
}
@media (max-width: 520px) {
    .filters-row.search-row { grid-template-columns: 1fr; }
}
.filters label {
    display: flex;
    flex-direction: column;
    font-size: 13px;
    color: var(--c-muted);
}
.filters label span { margin-bottom: 4px; }
.filters input,
.filters select {
    padding: 10px 12px;
    border: 1px solid var(--c-border);
    border-radius: 6px;
    font-size: 15px;
    background: #fff;
    width: 100%;
    min-height: 42px;
    font-family: inherit;
}
.filters .btn { white-space: nowrap; }
.results-meta {
    color: var(--c-muted);
    margin-bottom: 14px;
    font-size: 14px;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 28px;
    font-size: 14px;
    flex-wrap: wrap;
}
.pagination a {
    padding: 10px 16px;
    border: 1px solid var(--c-border);
    border-radius: 6px;
    background: var(--c-surface);
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

/* Vehicle detail */
.vehicle-detail-grid {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: clamp(20px, 3vw, 32px);
}
@media (max-width: 900px) {
    .vehicle-detail-grid { grid-template-columns: 1fr; }
}

.gallery-main {
    background: #eef1f5;
    border-radius: var(--radius);
    overflow: hidden;
    aspect-ratio: 16 / 10;
}
.gallery-main img { width: 100%; height: 100%; object-fit: cover; }
.gallery-thumbs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 8px;
    margin-top: 10px;
}
.thumb {
    border: 2px solid transparent;
    background: none;
    padding: 0;
    cursor: pointer;
    border-radius: 6px;
    overflow: hidden;
    aspect-ratio: 1;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.active,
.thumb:hover { border-color: var(--c-primary); }

.vehicle-summary {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: clamp(16px, 2.5vw, 24px);
}
.vehicle-summary h1 { margin: 0 0 12px; }
.price-block {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}
.price {
    font-size: clamp(22px, 2vw + 14px, 30px);
    font-weight: 700;
    color: var(--c-primary);
}
.price-block .badge {
    position: static;
    background: var(--c-accent);
}
.spec-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 16px;
    margin: 0 0 22px;
}
.spec-list dt {
    color: var(--c-muted);
    font-size: 13px;
}
.spec-list dd {
    margin: 0 0 6px;
    font-weight: 500;
    font-size: 14px;
}
@media (max-width: 380px) {
    .spec-list { grid-template-columns: 1fr; }
    .spec-list dd { margin-bottom: 10px; }
}

.description,
.inquiry-form {
    background: var(--c-surface);
    border-radius: var(--radius);
    padding: clamp(18px, 3vw, 28px);
    margin-top: 28px;
    box-shadow: var(--shadow);
}
.description h2,
.inquiry-form h2 { margin-top: 0; }
.prose { color: var(--c-text); line-height: 1.65; }
.prose p { margin: 0 0 12px; }

/* Forms */
.contact-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: clamp(20px, 3vw, 32px);
    margin-top: 28px;
}
@media (max-width: 760px) {
    .contact-grid { grid-template-columns: 1fr; }
}
.contact-info { font-size: 15px; }
.contact-info li { margin-bottom: 6px; }
.contact-form,
.inquiry-form form {
    display: grid;
    gap: 12px;
}
.contact-form label,
.inquiry-form label {
    display: flex;
    flex-direction: column;
    font-size: 13px;
    color: var(--c-muted);
}
.contact-form input,
.contact-form textarea,
.inquiry-form input,
.inquiry-form textarea {
    margin-top: 4px;
    padding: 12px;
    border: 1px solid var(--c-border);
    border-radius: 6px;
    font-size: 16px; /* >=16px keeps iOS from auto-zooming on focus */
    font-family: inherit;
    width: 100%;
    min-height: 44px;
}
.contact-form textarea,
.inquiry-form textarea {
    min-height: 120px;
    resize: vertical;
}

/* FAQ */
.faq-list { margin-top: 24px; }
.faq-item {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 14px 18px;
    margin-bottom: 10px;
}
.faq-item summary {
    cursor: pointer;
    font-weight: 600;
    list-style: none;
    padding: 4px 0;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item[open] { box-shadow: var(--shadow); }
.faq-item .prose { margin-top: 10px; }

/* Footer */
.site-footer {
    background: #16202c;
    color: #cbd4dd;
    margin-top: 40px;
    padding: clamp(28px, 4vw, 48px) 0 20px;
}
.site-footer h4 { color: #fff; margin: 0 0 12px; }
.site-footer a { color: #cbd4dd; }
.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
    gap: clamp(20px, 3vw, 32px);
    padding-bottom: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.footer-bottom {
    padding-top: 18px;
    font-size: 13px;
    color: #8a96a3;
    text-align: center;
}
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { margin-bottom: 6px; font-size: 14px; }

/* Flash */
.flash-list { margin: 18px var(--container-pad); }
.section .flash-list,
main > .flash-list { margin-left: 0; margin-right: 0; }
.flash {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 8px;
    font-size: 14px;
}
.flash-success { background: #e8f5ec; color: #1a6c33; border: 1px solid #b8dec5; }
.flash-error   { background: #fdecec; color: #9a1f1f; border: 1px solid #f3c2c2; }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--c-muted);
}

/* Honeypot — hidden from real users, visible to naive bots */
.hp-field {
    position: absolute;
    left: -9999px;
    top: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}

/* Print-friendly fallback for very wide displays */
@media (min-width: 1400px) {
    .vehicle-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}
