/* ============================================================
   Brand model links above the model page footer (VEH-210)
   Mockups: design/Model page + other brand models — {desktop 1280,phone 390}
   ============================================================ */

.brand-models {
    padding: 48px 0 56px;
    background: var(--color-bg);
    border-top: 1px solid var(--color-border);
}

.brand-models-container {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.brand-models-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--spacing-md);
}

.brand-models-heading {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.brand-models-title {
    margin: 0;
    font-size: 28px;
    line-height: 1.2;
}

.brand-models-sorted {
    margin: 0;
    font-size: var(--font-size-base);
    line-height: 1.5;
    color: var(--text-secondary);
}

.brand-models-all-link {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    white-space: nowrap;
}

.brand-models-all-link:hover {
    color: var(--accent-dark);
}

.brand-models-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--spacing-sm);
    margin: 0;
    padding: 0;
    list-style: none;
}

.brand-models-grid > li {
    display: flex;
    min-width: 0;
}

/* Card: photo on the left, three text lines on the right */
.bm-card {
    display: flex;
    flex-grow: 1;
    align-items: center;
    gap: 14px;
    min-width: 0;
    padding: 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-bg);
    box-shadow: var(--shadow-sm);
    color: var(--text-primary);
    text-decoration: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

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

.bm-card:focus-visible,
.brand-models-all-link:focus-visible,
.brand-models-button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.bm-card-photo {
    display: block;
    flex-shrink: 0;
    width: 133px;
    height: 83px;
    border-radius: var(--radius-md);
    object-fit: cover;
    background: var(--color-surface);
}

/* No photo yet: the brand gradient of a model card without one (home.css, budget.css) */
.bm-card-photo-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    background: linear-gradient(135deg, var(--accent-dark) 0%, var(--accent-light) 100%);
    color: #FFFFFF;
    font-family: 'Roboto Flex', var(--font-primary);
    font-weight: 800;
    font-variation-settings: 'wght' 800, 'wdth' 84;
    font-size: 18px;
    line-height: 1.05;
    text-align: center;
    overflow-wrap: anywhere;
}

.bm-card-body {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    gap: 2px;
    min-width: 0;
}

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

.bm-card-meta {
    font-size: var(--font-size-sm);
    line-height: 1.4;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bm-card-count {
    font-variant-numeric: tabular-nums;
}

/* Last grid cell: the brand page */
.bm-card-all {
    border-color: color-mix(in srgb, var(--accent) 25%, transparent);
    background: color-mix(in srgb, var(--accent) 5%, var(--color-bg));
    box-shadow: none;
}

.bm-card-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
}

.bm-card-logo img {
    display: block;
    width: 56px;
    height: 56px;
    object-fit: contain;
    /* Some logos (Mercedes) are on an opaque white square; let the card tint through */
    mix-blend-mode: multiply;
}

.bm-card-all-title {
    font-size: var(--font-size-lg);
    font-weight: 700;
    line-height: 1.25;
}

.bm-card-cta {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--accent);
}

/* Phone only: replaces the header link and the last grid cell */
.brand-models-button {
    display: none;
}

@media (max-width: 1024px) {
    .brand-models-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .brand-models {
        padding: 32px 0 40px;
    }

    .brand-models-container {
        gap: var(--spacing-sm);
    }

    .brand-models-title {
        font-size: 26px;
    }

    .brand-models-sorted {
        font-size: 15px;
    }

    .brand-models-all-link,
    .brand-models-grid > .bm-all-item {
        display: none;
    }

    .brand-models-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: var(--spacing-xs);
    }

    .bm-card {
        box-shadow: none;
    }

    .bm-card-photo {
        width: 96px;
        height: 60px;
    }

    .bm-card-photo-empty {
        font-size: 15px;
    }

    .bm-card-name {
        font-size: 21px;
    }

    .brand-models-button {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        min-height: 52px;
        border: 1px solid var(--accent);
        border-radius: var(--radius-lg);
        color: var(--accent);
        font-size: var(--font-size-base);
        font-weight: 600;
        text-decoration: none;
    }

    .brand-models-button img {
        display: block;
        width: 28px;
        height: 28px;
        object-fit: contain;
    }
}
