/* Shared page parts: sections, cards and card rows. Colours come from tokens.css. */

.page-section {
  margin-top: 48px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.section-title {
  margin: 0;
  color: var(--text);
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
}

/* "See all" is an outlined button, so it reads as an action at a glance. Phones show only "See all". */
/* How many there are, after a section title ("Brands 461"). */
.sr-count {
  margin-left: 4px;
  color: var(--text-muted);
  font-size: .9em;
  font-weight: 500;
}

.section-link {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--control-border);
  border-radius: 999px;
  color: var(--text);
  font-size: .875rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.section-link:hover {
  border-color: var(--link);
  color: var(--link);
}

.section-link__more {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (min-width: 768px) {
  .section-link__more {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip-path: none;
  }
}

/* Four cards: a swipe row on phones, two across on tablets, one row on desktop. */
.card-row {
  display: flex;
  gap: 12px;
  margin-inline: -16px;
  padding: 0 16px 4px;
  overflow-x: auto;
  scroll-padding-inline: 16px;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.card-row::-webkit-scrollbar {
  display: none;
}

.card-row > * {
  flex: 0 0 72%;
  scroll-snap-align: start;
}

/* The way onward where reading ends: a button after a list. */
.section-more {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 46px;
  margin-top: 24px;
  border: 1px solid var(--control-border);
  border-radius: 999px;
  color: var(--text);
  font-size: .9375rem;
  font-weight: 500;
  text-decoration: none;
}

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

@media (min-width: 768px) {
  .page-section {
    margin-top: 64px;
  }

  .section-more {
    width: fit-content;
    margin-inline: auto;
    padding: 0 28px;
  }
}

/* On wide screens the whole section and its heading button are in view together, so the end button would repeat it. */
@media (min-width: 1024px) {
  .section-more {
    display: none;
  }

  .section-title {
    font-size: 1.375rem;
  }

  .card-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    margin-inline: 0;
    padding: 0;
    overflow: visible;
  }
}

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

/* The title link covers the whole card, so one tap anywhere opens it; the heart sits above that layer. */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background-color: var(--surface);
}

.card:has(.card__link:focus-visible) {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.card__media {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background-color: var(--surface-2);
}

.card__media--portrait {
  aspect-ratio: 3 / 4;
}

/* Photos fill the frame and are trimmed from the top only, so the watermark in a bottom corner (20px from the edge)
   stays whole. Document scans keep their middle. */
.card__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 100%;
}

.card__media--portrait .card__img {
  object-position: 50% 50%;
}

/* A brand with documents says how many, in grey with a blue icon: information, not a link of its own. */
.card__docs {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: .8125rem;
}

.card__docs .icon {
  flex: none;
  width: 14px;
  height: 14px;
  color: var(--link);
}

/* A brand or model without a photo: a calm car outline instead of an "image not available" picture. */
.card__empty {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: var(--text-muted);
}

.card__empty .icon {
  width: 44px;
  height: 44px;
  opacity: .55;
}

/* Brand logo pictures are 4:3 with their own background, so their frame is 4:3 too and they fill it almost uncut. */
.card__media--logo {
  aspect-ratio: 4 / 3;
}

/* A motorshow poster or logo, whole: on white in the light theme and black in the dark theme, so it stands out. */
.card__media--poster {
  aspect-ratio: 4 / 3;
  background: var(--poster-bg);
}

.card__media--poster .card__img {
  object-fit: contain;
  object-position: 50% 50%;
}

/* Hover: the card lifts a little, its photo zooms gently and its title turns blue. Keyboard focus shows the same.
   Movement only for visitors who allow animation; hover only on devices that really hover, so phones never stick. */
.card {
  transition: border-color .25s ease, box-shadow .25s ease, transform .25s ease;
}

.card__title {
  transition: color .2s ease;
}

.card:has(.card__link:focus-visible) {
  border-color: var(--control-border);
  box-shadow: var(--shadow-hover);
}

.card:has(.card__link:focus-visible) .card__title {
  color: var(--link);
}

@media (hover: hover) {
  .card:hover {
    border-color: var(--control-border);
    box-shadow: var(--shadow-hover);
  }

  .card:hover .card__title {
    color: var(--link);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .card__img {
    transition: transform .35s ease;
  }

  .card:has(.card__link:focus-visible) {
    transform: translateY(-3px);
  }

  .card:has(.card__link:focus-visible) .card__img {
    transform: scale(1.05);
  }
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .card:hover {
    transform: translateY(-3px);
  }

  .card:hover .card__img {
    transform: scale(1.05);
  }
}

/* A model a viewer may not open yet (brand pages, model group pages): a small blurred photo and a lock, as the
   paywall shows it. After the hover rules, so a locked photo stays blurred and does not zoom. */
.card__img--blurred,
.card:hover .card__img--blurred {
  filter: blur(10px);
  transform: scale(1.15);
}

.card__lock {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.card__lock .icon {
  box-sizing: content-box;
  width: 16px;
  height: 16px;
  padding: 9px;
  border-radius: 50%;
  background-color: rgba(0, 0, 0, .55);
  color: #ffffff;
}

.card__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px 14px;
}

.card__title {
  margin: 0;
  color: var(--text);
  font-family: var(--font-heading);
  font-size: 1.0625rem;
  font-weight: 500;
  line-height: 1.3;
}

.card__link {
  color: inherit;
  text-decoration: none;
}

.card__link::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
}

.card__link:focus-visible {
  outline: none;
}

.card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 6px;
  margin: 0;
  color: var(--text-muted);
  font-size: .875rem;
}

.card__meta .flag {
  flex-shrink: 0;
}

.card__country {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card__action {
  margin: 0;
  color: var(--link);
  font-size: .875rem;
  font-weight: 500;
}

.card__like {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
}

.card__like .heart-brand,
.card__like .heart-model,
.card__like .heart-blog {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin: 0;
  border-radius: 50%;
  background-color: rgba(0, 0, 0, .45);
  font-size: 18px;
}

.card__like .heart-brand svg,
.card__like .heart-model svg,
.card__like .heart-blog svg {
  color: #ffffff;
}

.card__like .heart-brand.liked svg,
.card__like .heart-model.liked svg,
.card__like .heart-blog.liked svg {
  color: #ff5a5a;
  transform: none;
}

/* A round outlined button for page actions next to a title (Share, like). 44px, so it is easy to hit on mobile. */
.round-button {
  display: grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--control-border);
  border-radius: 50%;
  background-color: var(--surface);
  color: var(--text);
  font-size: 0;
  cursor: pointer;
}

.round-button:hover {
  border-color: var(--link);
  color: var(--link);
}

.round-button .icon {
  width: 20px;
  height: 20px;
}

.share {
  position: relative;
}

.share__menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  min-width: 210px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background-color: var(--surface);
  box-shadow: var(--shadow-hover);
}

.share__menu[hidden] {
  display: none;
}

.share__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: .875rem;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.share__item:hover,
.share__item:focus-visible {
  background-color: var(--surface-2);
}

.share__item .icon {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
}

.share__rule {
  margin: 6px 4px;
  border: 0;
  border-top: 1px solid var(--border);
}

/* A calm outlined link pill: Concept cars, Documents, More brands nearby, Quizzes. */
.pill-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--control-border);
  border-radius: 999px;
  background-color: var(--surface);
  color: var(--text);
  font-size: .9375rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.pill-link:hover {
  border-color: var(--link);
  color: var(--link);
}

.pill-link .icon {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
}

/* A page's one main action as a blue pill: Start the quiz, Check answer, Guess. */
.pill-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 28px;
  border: 0;
  border-radius: 999px;
  background-color: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.pill-primary:hover {
  background-color: var(--accent-hover);
  color: #fff;
}

.pill-primary:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.pill-primary:disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* Long texts on brand and model pages: about ten lines, then "Continue reading" (read-more.js). */
.read-more__content {
  max-height: 20em;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, #000 70%, transparent);
  mask-image: linear-gradient(to bottom, #000 70%, transparent);
}

.read-more.is-open .read-more__content {
  max-height: none;
  -webkit-mask-image: none;
  mask-image: none;
}

.read-more__toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  margin-top: 12px;
  padding: 0 16px;
  border: 1px solid var(--control-border);
  border-radius: 999px;
  background-color: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: .9375rem;
  font-weight: 500;
  cursor: pointer;
}

.read-more__toggle:hover {
  border-color: var(--link);
  color: var(--link);
}

.read-more__toggle .icon {
  width: 18px;
  height: 18px;
}

.read-more.is-open .read-more__toggle {
  display: none;
}

/* A slim banner that points somewhere else on the site: an icon, a title and a short line, then links. */
.promo-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background-color: var(--surface);
}

.promo-banner__icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background-color: var(--accent-soft);
  color: var(--link);
}

.promo-banner__icon .icon {
  width: 24px;
  height: 24px;
}

.promo-banner__text {
  flex: 1 1 calc(100% - 64px);
  min-width: 0;
}

.promo-banner__title {
  margin: 0;
  color: var(--text);
  font-family: var(--font-heading);
  font-size: 1.0625rem;
  font-weight: 600;
}

.promo-banner__sub {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: .875rem;
}

.promo-banner__links {
  display: flex;
  flex: 1 1 100%;
  gap: 10px;
}

.promo-banner__links .pill-link {
  flex: 1;
}

@media (min-width: 768px) {
  .promo-banner {
    flex-wrap: nowrap;
  }

  .promo-banner__text {
    flex: 1;
  }

  .promo-banner__links {
    flex: none;
  }
}

/* A small outlined link chip: people, types and tags. */
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--control-border);
  border-radius: 999px;
  background-color: var(--surface);
  color: var(--text);
  font-size: .875rem;
  text-decoration: none;
}

.chip:hover {
  border-color: var(--link);
  color: var(--link);
}

/* Where the free part of a page ends (fragments/components/paywall/subscribe-card.html). */
.subscribe-card {
  max-width: 68ch;
  margin: 12px auto 0;
  padding: 28px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background-color: var(--surface);
  color: var(--text);
  text-align: center;
}

.subscribe-card__lock {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background-color: var(--accent-soft);
  color: var(--link);
}

.subscribe-card__lock .icon {
  width: 20px;
  height: 20px;
}

.subscribe-card__title {
  max-width: 26ch;
  margin: 0 auto 6px;
  color: var(--text);
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
}

.subscribe-card__lead,
.subscribe-card__price {
  margin: 0 0 14px;
  color: var(--text-muted);
}

.subscribe-card__price b {
  color: var(--text);
}

.subscribe-card__list {
  display: grid;
  gap: 8px;
  width: fit-content;
  margin: 0 auto 16px;
  padding: 0;
  list-style: none;
  text-align: left;
}

.subscribe-card__list li {
  display: flex;
  gap: 10px;
}

.subscribe-card__list .icon {
  flex: none;
  width: 16px;
  height: 16px;
  margin-top: 4px;
  color: var(--link);
}

.subscribe-card__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 46px;
  padding: 0 28px;
  border-radius: 999px;
  background-color: var(--accent);
  color: #ffffff;
  font-weight: 600;
  text-decoration: none;
}

.subscribe-card__cta:hover {
  background-color: var(--accent-hover);
  color: #ffffff;
}

.subscribe-card__login {
  margin: 12px 0 0;
  color: var(--text-muted);
  font-size: .875rem;
}

.subscribe-card__login a {
  color: var(--link);
}

@media (max-width: 767px) {
  .subscribe-card {
    padding: 24px 16px;
  }

  .subscribe-card__cta {
    width: 100%;
  }
}

/* The Share button on pages whose title row is not rebuilt yet. */
.share-row {
  display: flex;
  justify-content: center;
  margin: 12px 0;
}

/* Tabs: an underlined row of links, so each tab has its own address (search results, favourites lists). */
.sr-tabs {
  display: flex;
  gap: 4px;
  margin: 0 0 8px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  scrollbar-width: none;
}

.sr-tab {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 8px;
  margin-bottom: -1px;
  padding: 10px 14px;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-weight: 500;
  text-decoration: none;
}

.sr-tab:hover {
  color: var(--text);
}

.sr-tab span {
  padding: 1px 8px;
  border-radius: 999px;
  background-color: var(--surface-2);
  color: var(--text-muted);
  font-size: .75rem;
}

.sr-tab.is-active {
  border-bottom-color: var(--accent);
  color: var(--text);
}

/* The tabs' underline already separates them from the toolbar below. */
.sr-tabs + .list-tools {
  border-top: 0;
  padding-top: 8px;
}
