/* Every list page: title, letters, the Country / Sort / Years menus, chips, the brand grid
   (fragments/components/list-page.html, js/components/list-page.js). */

.list-page {
  padding-bottom: 8px;
}

.list-head {
  padding: 8px 0 4px;
}

.list-title {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 4px 0 16px;
  color: var(--text);
  font-size: clamp(1.75rem, 1.2rem + 2vw, 2.5rem);
  line-height: 1.15;
}

.list-title .flag {
  flex-shrink: 0;
  transform: scale(1.6);
  margin: 0 8px 0 6px;
}

.list-intro {
  margin: -8px 0 18px;
  color: var(--text-muted);
}

.list-subtitle {
  margin: 0 0 12px;
  font-size: 1.25rem;
}

.list-top {
  margin: 4px 0 28px;
}

/* Letters: all 27 always on view, in one even row on desktop, two rows on tablets and three of nine on mobile. */
.list-letters {
  display: grid;
  grid-template-columns: repeat(27, minmax(0, 1fr));
  gap: 4px;
  margin: 0 0 12px;
}

.list-letter {
  display: grid;
  place-items: center;
  justify-self: center;
  width: 100%;
  max-width: 36px;
  height: 36px;
  border-radius: 999px;
  color: var(--text);
  font-size: .9375rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color .15s, color .15s;
}

a.list-letter:hover {
  background-color: var(--accent-soft);
  color: var(--link);
}

.list-letter.is-on {
  background-color: var(--accent);
  color: #ffffff;
  font-weight: 600;
}

.list-letter.is-off {
  color: var(--text-muted);
  opacity: .45;
}

@media (max-width: 1023px) {
  .list-letters {
    grid-template-columns: repeat(14, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  .list-letters {
    grid-template-columns: repeat(9, minmax(0, 1fr));
  }

  .list-letter--digits {
    font-size: .8125rem;
    letter-spacing: -.02em;
  }
}

/* Toolbar: the count on the left, the menus on the right. On mobile Sort and Filter share the width. */
.list-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.list-tools__count {
  margin: 0 auto 0 0;
  color: var(--text-muted);
  font-size: .9375rem;
}

.list-tools__count b {
  color: var(--text);
  font-weight: 600;
}

.list-menu {
  position: relative;
}

.list-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px 0 14px;
  border: 1px solid var(--control-border);
  border-radius: 999px;
  background-color: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: .875rem;
  white-space: nowrap;
  cursor: pointer;
  list-style: none;
}

.list-pill::-webkit-details-marker {
  display: none;
}

.list-pill span {
  color: var(--text-muted);
}

.list-pill b {
  font-weight: 600;
}

.list-pill::after {
  content: "";
  width: 7px;
  height: 7px;
  margin: -3px 2px 0 4px;
  border: solid currentColor;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}

.list-pill:hover,
.list-menu[open] > .list-pill {
  border-color: var(--link);
}

.list-pill--filter {
  display: none;
}

.list-menu__panel {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  right: 0;
  width: 300px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background-color: var(--surface);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .28);
}

.list-menu__panel--sort {
  width: 200px;
}

.list-menu__panel--years {
  width: 280px;
  padding: 14px;
}

.list-menu__search {
  width: 100%;
  height: 40px;
  margin: 0 0 6px;
  padding: 0 12px;
  border: 1px solid var(--control-border);
  border-radius: 10px;
  background-color: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: .9375rem;
}

.list-menu__list {
  position: relative;
  max-height: 320px;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.list-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 10px;
  border-radius: 8px;
  color: var(--text);
  font-size: .9375rem;
  text-decoration: none;
}

.list-opt:hover {
  background-color: var(--accent-soft);
  color: var(--link);
}

.list-opt.is-on {
  color: var(--link);
  font-weight: 600;
}

.list-opt.is-on::after {
  content: "✓";
  margin-left: auto;
}

.list-opt__name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-opt__count {
  margin-left: auto;
  color: var(--text-muted);
  font-size: .8125rem;
  font-weight: 400;
}

.list-opt.is-on .list-opt__count {
  display: none;
}

.list-menu__hint {
  margin: 0 0 10px;
  color: var(--text-muted);
  font-size: .8125rem;
}

.list-years {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.list-years > span {
  padding-bottom: 10px;
  color: var(--text-muted);
}

.list-years label {
  display: grid;
  flex: 1;
  gap: 4px;
  color: var(--text-muted);
  font-size: .8125rem;
}

.list-years input {
  width: 100%;
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--control-border);
  border-radius: 10px;
  background-color: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: .9375rem;
}

.list-menu__actions,
.list-sheet__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

.list-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--link);
  font: inherit;
  font-size: .9375rem;
  text-decoration: none;
  cursor: pointer;
}

.list-apply {
  height: 40px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background-color: var(--accent);
  color: #ffffff;
  font: inherit;
  font-size: .9375rem;
  font-weight: 600;
  cursor: pointer;
}

.list-apply:hover {
  background-color: var(--accent-hover);
}

/* A chosen filter, with its × to take it off. */
.list-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.list-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 6px 0 12px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background-color: var(--accent-soft);
  color: var(--link);
  font-size: .875rem;
  font-weight: 500;
  text-decoration: none;
}

.list-chip::after {
  content: "×";
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  font-size: 1rem;
}

/* Mobile filter sheet: a native <dialog> sliding up from the bottom. */
.list-sheet {
  width: 100%;
  max-width: none;
  max-height: 88vh;
  margin: auto 0 0;
  padding: 0;
  border: 0;
  border-radius: 18px 18px 0 0;
  background-color: var(--surface);
  color: var(--text);
}

.list-sheet::backdrop {
  background: rgba(0, 0, 0, .55);
}

.list-sheet__panel {
  display: flex;
  flex-direction: column;
  max-height: 88vh;
}

.list-sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 6px;
}

.list-sheet__head h2 {
  margin: 0;
  font-size: 1.125rem;
}

.list-sheet__close {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--text);
  cursor: pointer;
}

.list-sheet__body {
  overflow-y: auto;
  padding: 0 16px 8px;
}

.list-sheet__body h3 {
  margin: 14px 0 8px;
  font-size: .9375rem;
}

.list-sheet__body .list-menu__list {
  max-height: 34vh;
}

.list-sheet__foot {
  margin: 0;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
}

.list-sheet__foot .list-apply {
  flex: 1;
  height: 48px;
}

@media (max-width: 479px) {
  .list-tools__count {
    flex-basis: 100%;
  }

  .list-menu--wide {
    display: none;
  }

  .list-menu:not(.list-menu--wide),
  .list-pill--filter {
    display: flex;
    flex: 1 1 0;
  }

  .list-tools .list-pill {
    justify-content: center;
    width: 100%;
    height: 44px;
  }

  .list-menu__panel--sort {
    left: 0;
    right: auto;
  }
}

@media (max-width: 359px) {
  .list-pill span {
    display: none;
  }
}

/* The cards: four, three or two per row. */
.list-cards {
  padding-block: 24px 32px;
}

.list-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.list-ad {
  grid-column: 1 / -1;
}

@media (min-width: 768px) {
  .list-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
  }
}

@media (min-width: 1024px) {
  .list-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
  }
}

@media (max-width: 479px) {
  .list-grid .card__title {
    font-size: .9375rem;
  }

  .list-grid .card__meta {
    font-size: .8125rem;
  }

  .list-grid .card__sep {
    display: none;
  }

  .list-grid .card__years {
    flex-basis: 100%;
  }
}

/* A brand's list ends with one outline button to the brand's other pages: its documents (models.html), its brand page
   (brand-docs.html). */
.list-more {
  display: flex;
  justify-content: center;
  padding-block: 8px 40px;
}

.list-more a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 28px;
  border: 1px solid var(--control-border);
  border-radius: 999px;
  color: var(--text);
  font-size: .9375rem;
  font-weight: 500;
  text-decoration: none;
}

.list-more a:hover {
  border-color: var(--link);
  color: var(--link);
}

.list-more .icon {
  width: 18px;
  height: 18px;
}

.list-empty {
  display: grid;
  justify-items: start;
  gap: 8px;
  padding: 32px 0 48px;
  color: var(--text-muted);
}

.list-empty p {
  margin: 0;
}

/* "Car brands by country": a search field and every country, grouped by continent (brands-by-country.html). */
.countries {
  padding-bottom: 56px;
}

.countries__intro {
  margin-top: -6px;
}

.countries__search {
  width: min(100%, 360px);
  height: 44px;
  margin: 0 0 8px;
  padding: 0 14px;
  border: 1px solid var(--control-border);
  border-radius: 999px;
  background-color: var(--surface);
  color: var(--text);
  font: inherit;
}

.countries__group {
  margin-top: 16px;
  padding: 20px 0 4px;
  border-top: 1px solid var(--border);
}

.countries__group h2 {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 10px;
  margin: 0 0 10px;
  font-size: 1.25rem;
}

.countries__group h2 small {
  color: var(--text-muted);
  font-size: .875rem;
  font-weight: 400;
}

.countries__list {
  margin: 0;
  padding: 0;
  columns: 2;
  column-gap: 16px;
  list-style: none;
}

.countries__list li {
  break-inside: avoid;
}

.countries__link {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  margin: 0 -10px;
  padding: 4px 10px;
  border-radius: 8px;
  color: var(--text);
  font-size: .9375rem;
  text-decoration: none;
}

.countries__link:hover {
  background-color: var(--accent-soft);
  color: var(--link);
}

.countries__name {
  flex: 1;
  min-width: 0;
  line-height: 1.25;
}

.countries__count {
  color: var(--text-muted);
  font-size: .875rem;
}

@media (min-width: 600px) {
  .countries__list {
    column-gap: 32px;
  }

  .countries__link {
    gap: 10px;
    min-height: 40px;
    font-size: 1rem;
  }

  .countries__group h2 {
    font-size: 1.25rem;
  }
}

@media (min-width: 1024px) {
  .countries__list {
    columns: 4;
  }
}
