/* Homepage ranking sections retain the exported CarCritics visual language. */
.cc-home-section {
  position: relative;
  z-index: 1;
}

.cc-swipe-hint {
  display: none;
}

/* Render the mobile continuation once; CSS preserves five-card desktop rows. */
.cc-home-more,
.cc-home-section .cc-card-grid > .cc-home-card:nth-child(n + 6),
.cc-manufacturer-section .cc-manufacturer-card:nth-child(n + 6) {
  display: none;
}

.cc-section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.cc-section-header h2 {
  margin: 0 0 4px;
  color: var(--dark);
}

.cc-section-header p {
  max-width: 720px;
  margin: 0;
  color: #555;
  font-size: 15px;
  line-height: 1.45;
}

.cc-view-all {
  flex: 0 0 auto;
  padding: 7px 0;
  color: var(--blue);
  font-size: 15px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.cc-card-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.cc-home-card {
  display: flex;
  min-width: 0;
  overflow: hidden;
  flex-direction: column;
  border: 1px solid var(--light);
  border-top: 5px solid #018786;
  border-radius: 5px;
  background: #fff;
  box-shadow: 2px 3px 8px rgb(0 0 0 / 7%);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.cc-card-image {
  position: relative;
  overflow: hidden;
  aspect-ratio: 3 / 2;
  background: #f5f5f5;
}

.cc-card-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cc-card-rank {
  position: absolute;
  top: 7px;
  left: 7px;
  z-index: 1;
  min-width: 33px;
  padding: 5px 7px;
  border: 1px solid rgb(0 0 0 / 10%);
  border-radius: 5px;
  background: var(--green);
  color: var(--dark);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  box-shadow: 1px 2px 5px rgb(0 0 0 / 28%);
}

.cc-card-content {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  flex-direction: column;
  padding: 12px;
}

.cc-card-content h3 {
  min-height: 0;
  margin: 0;
  color: var(--dark);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
}

.cc-card-heading { display: contents; }

/* Keep the generation midway between the actual title and score, including
   cards with wrapped names or a limited-review badge. */
.cc-card-content .cc-generation-meta {
  margin: auto 0;
  padding: 12px 0;
}

.cc-card-content .cc-generation-meta + .cc-card-score-row,
.cc-card-heading + .cc-card-score-row {
  margin-top: 0;
}

.cc-card-score-row {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: auto;
}

.cc-score-tile {
  display: flex;
  width: 50px;
  height: 50px;
  flex: 0 0 50px;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  color: var(--dark);
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 2px 3px 4px 1px rgb(0 0 0 / 22%);
}

.cc-score-tile.green {
  background: var(--green);
}

.cc-score-tile.yellow {
  background: var(--yellow);
}

.cc-score-tile.red {
  background: var(--red);
  color: #fff;
}

.cc-card-score-row > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.cc-card-score-row strong {
  color: var(--dark);
  font-size: 12px;
  line-height: 1.2;
}

.cc-card-review-count {
  color: #555;
  font-size: 12px;
  line-height: 1.25;
}

.cc-reviews-prominent .cc-card-review-count {
  color: var(--dark);
  font-size: 14px;
  font-weight: 700;
}

.cc-limited-sample {
  width: max-content;
  max-width: 100%;
  margin-top: 2px;
  padding: 2px 5px;
  border-radius: 3px;
  background: #fff4d6;
  color: #6d5312;
  font-size: 10px;
  line-height: 1.2;
}

.cc-card-secondary,
.cc-card-range {
  margin: 10px 0 0;
  color: #555;
  font-size: 12px;
  line-height: 1.35;
}

.cc-card-freshness { display:block; margin-top:8px; color:#666; font-size:10px; line-height:1.3; }

.cc-card-range {
  color: var(--dark);
  font-weight: 600;
}

.cc-score-spread {
  position: relative;
  height: 5px;
  margin-top: 7px;
  overflow: hidden;
  border-radius: 5px;
  background: var(--light);
}

.cc-score-spread span {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: inherit;
  background: var(--blue);
}

.cc-score-scale {
  position: relative;
  height: 12px;
  margin-top: 0;
  color: #555;
  font-size: 10px;
  line-height: 1.2;
}

.cc-score-scale span {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
}

.cc-score-scale span:first-child {
  transform: none;
}

.cc-score-scale span:last-child {
  transform: translateX(-100%);
}

@media (hover: hover) {
  .cc-home-card:hover,
  .cc-manufacturer-card:hover {
    box-shadow: 3px 5px 12px rgb(0 0 0 / 16%);
    transform: translateY(-2px);
  }
}

.cc-ranking-empty {
  padding: 18px;
  border: 1px solid var(--light);
  border-left: 4px solid var(--yellow);
  border-radius: 5px;
  background: #fafafa;
  color: #444;
  font-size: 14px;
  line-height: 1.5;
}

.cc-manufacturer-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.cc-manufacturer-card {
  position: relative;
  display: flex;
  min-height: 238px;
  padding: 16px;
  overflow: hidden;
  flex-direction: column;
  border: 1px solid var(--light);
  border-top: 5px solid #018786;
  border-radius: 5px;
  background: #fff;
  box-shadow: 2px 3px 8px rgb(0 0 0 / 7%);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.cc-manufacturer-logo {
  display: flex;
  width: 100%;
  height: 58px;
  margin-bottom: 14px;
  padding-right: 28px;
  align-items: center;
  justify-content: flex-start;
}

.cc-manufacturer-logo img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 58px;
  object-fit: contain;
  object-position: left center;
}

.cc-manufacturer-card h3 {
  margin: 0 0 14px;
  padding-right: 28px;
  font-size: 18px;
  font-weight: 600;
}

.cc-manufacturer-card > strong {
  color: var(--dark);
  font-size: 34px;
  line-height: 1;
}

.cc-manufacturer-card > span:not(.cc-manufacturer-rank) {
  margin-top: 4px;
  color: #555;
  font-size: 12px;
}

.cc-manufacturer-card p {
  margin: auto 0 0;
  padding-top: 13px;
  color: #555;
  font-size: 12px;
  line-height: 1.4;
}

.cc-manufacturer-rank {
  position: absolute;
  top: 14px;
  right: 14px;
  color: var(--blue);
  font-weight: 700;
}

.cc-year-switcher {
  display: flex;
  gap: 7px;
  margin: -3px 0 16px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.cc-year-switcher button,
.cc-year-switcher select,
.cc-ranking-pagination button {
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid #bbb;
  border-radius: 5px;
  background: #fff;
  color: var(--dark);
  font: inherit;
}

.cc-year-switcher select {
  min-width: 116px;
  cursor: pointer;
}

.cc-year-switcher button.active,
.cc-year-switcher button:hover,
.cc-ranking-pagination button:hover:not(:disabled) {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.cc-ranking-page {
  padding-bottom: 20px;
}

.cc-ranking-page .cc-section-header {
  margin-bottom: 22px;
}

.cc-ranking-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 7px;
  padding: 25px 0 5px;
}

.cc-ranking-pagination a,
.cc-ranking-pagination > span {
  display: inline-flex;
  min-width: 38px;
  min-height: 38px;
  padding: 8px 12px;
  align-items: center;
  justify-content: center;
  border: 1px solid #bbb;
  border-radius: 5px;
  background: #fff;
  color: var(--dark);
}

.cc-ranking-pagination [aria-current="page"] {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
  cursor: default;
}

.cc-ranking-pagination button:disabled,
.cc-ranking-pagination .disabled {
  cursor: default;
  opacity: 0.45;
}

.cc-ranking-sort {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin: -5px 0 16px;
}

.cc-ranking-sort > span {
  font-weight: 700;
}

.cc-ranking-sort a {
  padding: 7px 10px;
  border: 1px solid #bbb;
  border-radius: 5px;
  background: #fff;
  color: var(--blue);
  font-size: 13px;
  font-weight: 600;
}

.cc-ranking-sort a[aria-current="true"] {
  border-color: #018786;
  background: #eaf8f4;
  color: var(--dark);
}

.cc-manufacturer-grid-all {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.cc-ranking-page .cc-manufacturer-grid-all .cc-manufacturer-card {
  display: grid;
  grid-template-columns: minmax(90px, 0.9fr) minmax(0, 1.4fr);
  grid-template-rows: auto auto auto;
  gap: 2px 12px;
  min-height: 0;
  padding: 15px 14px 12px;
}

.cc-ranking-page .cc-manufacturer-grid-all .cc-manufacturer-logo {
  grid-column: 1;
  grid-row: 1;
  height: 58px;
  margin: 0;
  padding: 0 20px 0 0;
}

.cc-ranking-page .cc-manufacturer-grid-all .cc-manufacturer-card h3 {
  grid-column: 1;
  grid-row: 2;
  margin: 0;
  padding: 0;
  align-self: end;
}

.cc-ranking-page .cc-manufacturer-grid-all .cc-manufacturer-card > strong {
  grid-column: 2;
  grid-row: 1;
  align-self: end;
  font-size: 34px;
}

.cc-ranking-page .cc-manufacturer-grid-all .cc-manufacturer-card > span:not(.cc-manufacturer-rank) {
  grid-column: 2;
  grid-row: 2;
  align-self: start;
  margin: 0;
}

.cc-ranking-page .cc-manufacturer-grid-all .cc-manufacturer-card p {
  grid-column: 1 / -1;
  grid-row: 3;
  margin: 10px 0 0;
  padding-top: 6px;
  border-top: 2px solid var(--dark);
}

.cc-ranking-page .cc-manufacturer-grid-all .cc-manufacturer-rank {
  z-index: 1;
}

.cc-year-link-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.cc-year-link-grid a {
  padding: 18px 14px;
  border: 1px solid var(--light);
  border-top: 5px solid #018786;
  border-radius: 5px;
  background: #fff;
  color: var(--blue);
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  box-shadow: 2px 3px 8px rgb(0 0 0 / 7%);
}

@media screen and (max-width: 1000px) {
  .cc-card-grid,
  .cc-manufacturer-grid,
  .cc-manufacturer-grid-all,
  .cc-year-link-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

}

@media screen and (max-width: 700px) {
  .cc-home-section .cc-card-grid > .cc-home-card:nth-child(n + 6),
  .cc-manufacturer-section .cc-manufacturer-card:nth-child(n + 6) {
    display: flex;
  }

  .cc-home-more {
    display: flex;
    align-self: center;
    align-items: center;
    justify-self: start;
    min-height: 44px;
    padding: 10px 8px;
    color: var(--blue);
    font-size: 14px;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
    white-space: nowrap;
    scroll-snap-align: end;
  }

  .cc-home-main .filter {
    margin-bottom: 14px;
  }

  .cc-swipe-hint {
    display: block;
    margin: 8px 0 2px;
    color: #555;
    font-size: 12px;
    text-align: right;
  }

  .cc-section-header {
    align-items: flex-start;
    gap: 8px;
  }

  .cc-section-header p {
    font-size: 13px;
  }

  .cc-view-all {
    padding-top: 2px;
    font-size: 13px;
    white-space: nowrap;
  }

  .cc-card-grid,
  .cc-manufacturer-grid {
    grid-template-columns: none;
    grid-auto-columns: minmax(245px, 82vw);
    grid-auto-flow: column;
    overflow-x: auto;
    padding: 2px 2px 12px;
    scroll-snap-type: x mandatory;
    scroll-padding-left: 2px;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
  }

  .cc-home-card,
  .cc-manufacturer-card {
    scroll-snap-align: start;
  }

  /* Two complete car cards and half of the next keep the swipe affordance
     visible at every phone width. Manufacturers and full ranking lists keep
     their existing layout. */
  .cc-home-section .cc-card-grid {
    grid-auto-columns: calc((100% - 20px) / 2.5);
  }

  .cc-home-section .cc-home-card { border-top-width: 4px; }
  .cc-home-section .cc-card-content { padding: 8px; }
  .cc-home-section .cc-card-content h3 { font-size: 13px; overflow-wrap: anywhere; }
  .cc-home-section .cc-card-content .cc-generation-meta { padding: 8px 0; font-size: 12px; }
  .cc-home-section .cc-card-score-row { flex-wrap: wrap; gap: 6px; }
  .cc-home-section .cc-card-score-row > div { flex: 1 1 70px; }
  .cc-home-section .cc-score-tile {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
    font-size: 17px;
  }
  .cc-home-section .cc-card-review-count { font-size: 11px; }
  .cc-home-section .cc-card-freshness { margin-top: 6px; }

  .cc-card-content h3 {
    min-height: auto;
  }

  .cc-manufacturer-grid-all,
  .cc-year-link-grid {
    grid-template-columns: 1fr;
  }

  .cc-ranking-grid {
    display: grid;
    grid-template-columns: 1fr;
    grid-auto-flow: row;
    overflow: visible;
  }

  .cc-ranking-page .cc-manufacturer-grid-all {
    grid-template-columns: 1fr;
    grid-auto-columns: auto;
    grid-auto-flow: row;
    overflow: visible;
    padding: 0;
    scroll-padding-left: 0;
    scroll-snap-type: none;
  }

  .cc-ranking-page .cc-manufacturer-grid-all .cc-manufacturer-card {
    display: grid;
    grid-template-columns: minmax(105px, 0.9fr) minmax(140px, 1.4fr);
    grid-template-rows: auto auto auto;
    gap: 2px 16px;
    width: 100%;
    max-width: 100%;
    min-height: 0;
    padding: 15px 16px 12px;
    scroll-snap-align: none;
  }

  .cc-ranking-page .cc-manufacturer-grid-all .cc-manufacturer-logo {
    grid-column: 1;
    grid-row: 1;
    height: 58px;
    margin: 0;
    padding: 0 24px 0 0;
  }

  .cc-ranking-page .cc-manufacturer-grid-all .cc-manufacturer-card h3 {
    grid-column: 1;
    grid-row: 2;
    margin: 0;
    padding: 0;
    align-self: end;
  }

  .cc-ranking-page .cc-manufacturer-grid-all .cc-manufacturer-card > strong {
    grid-column: 2;
    grid-row: 1;
    align-self: end;
    font-size: 34px;
  }

  .cc-ranking-page .cc-manufacturer-grid-all .cc-manufacturer-card > span:not(.cc-manufacturer-rank) {
    grid-column: 2;
    grid-row: 2;
    align-self: start;
    margin: 0;
  }

  .cc-ranking-page .cc-manufacturer-grid-all .cc-manufacturer-card p {
    grid-column: 1 / -1;
    grid-row: 3;
    margin: 10px 0 0;
    padding-top: 6px;
    border-top: 2px solid var(--dark);
  }

  .cc-ranking-grid .cc-home-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-content: start;
    gap: 6px 8px;
    padding-bottom: 8px;
    width: 100%;
    max-width: 100%;
  }

  .cc-ranking-grid .cc-card-image {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 75%;
    justify-self: center;
    margin-top: 0;
    height: auto;
    min-height: 0;
    aspect-ratio: 3 / 2;
  }

  .cc-ranking-grid .cc-card-content {
    display: contents;
  }

  .cc-ranking-grid .cc-card-heading {
    display: flex;
    grid-column: 1 / -1;
    grid-row: 1;
    margin: 6px 8px 0;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 3px 10px;
  }

  .cc-ranking-grid .cc-card-heading h3 { font-size: 14px; }
  .cc-ranking-grid .cc-generation-meta { margin: 0; padding: 0; font-size: 12px; }
  .cc-ranking-grid .cc-card-score-row { grid-column: 1; grid-row: 3; margin: 0 0 0 8px; gap: 8px; }
  .cc-ranking-grid .cc-score-tile { width: 44px; height: 44px; flex-basis: 44px; font-size: 18px; }
  .cc-ranking-grid .cc-card-review-count { font-size: 11px; }
  .cc-ranking-grid .cc-card-freshness {
    grid-column: 2;
    grid-row: 3;
    align-self: end;
    margin: 0 8px 0 0;
    padding-bottom: 2px;
    font-size: 9px;
    white-space: nowrap;
  }

  .cc-ranking-grid .cc-card-secondary,
  .cc-ranking-grid .cc-card-range,
  .cc-ranking-grid .cc-score-range { grid-column: 1 / -1; margin: 0 8px; }

  .cc-year-switcher button,
  .cc-year-switcher select {
    flex: 0 0 auto;
  }
}

@media screen and (max-width: 360px) {
  .cc-ranking-grid .cc-card-score-row { grid-column: 1 / -1; }
  .cc-ranking-grid .cc-card-freshness { grid-column: 1 / -1; grid-row: auto; justify-self: end; }
}
