/* ttf-brand-layer 1.0.1: mu-plugins/ttf-nav/assets/cars-links.css */
/*
 * TTF Nav: the cars linked from category and make pages (Hub Run Sheet H4.4).
 *
 * "Popular cars in {category}" in the category header (header.php's slot, filled by cars-links.php): a row
 * like "Top brands" (hub-header.css) of split chips, the car's name linking its generation page and the count
 * beside it linking the category narrowed to the car. The make page's generations by model (cars-page.php):
 * cars.css plus the model grid. "Shop by car" on a search that names a car (cars-search.php): the strip's chips,
 * one link each. cars-links.php, cars-page.php and cars-search.php enqueue this file where one of them shows.
 * Class prefixes ttf-hh (the strip), ttf-car (the make page) and ttf-cs (the search).
 */

/* "Popular cars in {category}". */
.ttf-hh__cars {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem .9rem;
    margin-top: .9rem;
}
.ttf-hh__car-list { display: flex; flex-wrap: wrap; gap: .45rem; margin: 0; padding: 0; list-style: none; }
.ttf-hh__car-list > li { margin: 0; padding: 0; }
.ttf-hh__car {
    display: inline-flex;
    align-items: stretch;
    border-radius: 999px;
    background: var(--color-info-light, #F1F3F5);
    font-size: .8125rem;
    line-height: 1.2;
    white-space: nowrap;
}
.ttf-hh__car > a {
    display: inline-flex;
    align-items: center;
    padding: .4rem .6rem;
    color: var(--color-text-primary, #212529);
    text-decoration: none;
    transition: background-color .15s ease, color .15s ease;
}
.ttf-hh__car > .ttf-hh__car-name { padding-left: .85rem; font-weight: 600; border-radius: 999px 0 0 999px; }
.ttf-hh__car > .ttf-hh__car-n {
    padding-right: .85rem;
    border-left: 1px solid var(--color-info-dark, #DEE2E6);
    border-radius: 0 999px 999px 0;
    color: var(--color-text-description, #868E96);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}
.ttf-hh__car > a:hover,
.ttf-hh__car > a:focus-visible {
    background: var(--color-primary-lighter, #FFF1EC);
    color: var(--color-primary, #FF2A00);
}

/* A search that names a car: "Shop by car" and a chip per car (its name, then its count), above the filter bar. */
.ttf-cs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem .9rem;
    margin: 0 0 1rem;
}
.ttf-cs__label {
    font-size: .9375rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--color-text-primary, #212529);
}
.ttf-cs__list { display: flex; flex-wrap: wrap; gap: .45rem; margin: 0; padding: 0; list-style: none; }
.ttf-cs__list > li { margin: 0; padding: 0; }
.ttf-cs__car {
    display: inline-flex;
    align-items: stretch;
    border-radius: 999px;
    background: var(--color-info-light, #F1F3F5);
    color: var(--color-text-primary, #212529);
    font-size: .8125rem;
    line-height: 1.2;
    white-space: nowrap;
    text-decoration: none;
    transition: background-color .15s ease, color .15s ease;
}
.ttf-cs__car > span { display: inline-flex; align-items: center; padding: .4rem .6rem; }
.ttf-cs__car > .ttf-cs__name { padding-left: .85rem; font-weight: 600; }
.ttf-cs__car > .ttf-cs__name:last-child { padding-right: .85rem; }
.ttf-cs__car > .ttf-cs__n {
    padding-right: .85rem;
    border-left: 1px solid var(--color-info-dark, #DEE2E6);
    color: var(--color-text-description, #868E96);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}
.ttf-cs__car:hover,
.ttf-cs__car:focus-visible {
    background: var(--color-primary-lighter, #FFF1EC);
    color: var(--color-primary, #FF2A00);
}
.ttf-cs__car:hover > .ttf-cs__n,
.ttf-cs__car:focus-visible > .ttf-cs__n { color: inherit; }
/* A car chosen in the header (html.ttf-has-car: picker.php's head script before the first paint, then picker.js) leads
   the page: no second car beside it (owner, 23 Oct: with a car chosen, the chips made the phone view busy). */
.ttf-has-car .ttf-cs { display: none; }

/* The make page: its generations by model. */
.ttf-car__models {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem 1.5rem;
}
.ttf-car .ttf-car__model-title {
    --ttf-h3: .9375rem; /* ttf-page-zoom.php sizes every h3 through this property, with !important */
    margin: 0 0 .4rem;
    font-size: .9375rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--color-text-primary, #212529);
}
.ttf-car__models .ttf-car__gens { flex-direction: column; flex-wrap: nowrap; gap: .3rem; font-size: .875rem; }
/* The part count after the years (owner, 16 Oct): "2011–2019 · 240 parts". */
.ttf-car__n + .ttf-car__parts::before { content: "\00b7\00a0"; }

/*
 * Phones: the strip's chips scroll sideways in one row. The row is the containing block of the screen-reader labels
 * in its count links (position: absolute): without it they sat at their place in the row, far past the screen's
 * edge, outside the row's clipping, and made the whole page wider (5,038 px on Suspension).
 */
@media (max-width: 767.98px) {
    .ttf-hh__cars { flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: .5rem; }
    .ttf-hh__car-list { position: relative; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
    .ttf-hh__car-list::-webkit-scrollbar { display: none; }
    .ttf-car__models { grid-template-columns: 1fr; gap: .9rem; }
    /* The search's chips: one row under the label that scrolls sideways when the cars are wider than the screen; a
       finger-sized chip (about 40 px high). */
    .ttf-cs__list { min-width: 0; max-width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
    .ttf-cs__list::-webkit-scrollbar { display: none; }
    .ttf-cs__car { min-height: 2.75rem; font-size: .9375rem; }
    .ttf-cs__car > span { padding-top: 0; padding-bottom: 0; }
    /* Several cars scroll; one car fits the screen, its name cut short ("…") only where it would not fit. */
    .ttf-cs__list > li { flex: 0 0 auto; }
    .ttf-cs__list > li:only-child { flex: 0 1 auto; min-width: 0; }
    .ttf-cs__list > li:only-child > .ttf-cs__car { max-width: 100%; }
    .ttf-cs__list > li:only-child .ttf-cs__name { display: block; align-self: center; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
}
