/* The single brand page: title row, photos, the story beside the facts, then models, map and similar brands. */

.brand-page {
  padding-bottom: 56px;
}

.brand-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.brand-head__title {
  margin: 0;
  color: var(--text);
  font-family: var(--font-heading);
  font-size: clamp(1.75rem, 3.2vw, 2.375rem);
  font-weight: 700;
  line-height: 1.1;
}

.brand-head__actions {
  display: flex;
  flex: none;
  gap: 8px;
}

/* The like heart (like.js, brands, models and blog posts) drawn as a round outlined button: outline when not liked, filled when liked. */
.brand-head__like .heart-brand,
.brand-head__like .heart-model,
.brand-head__like .heart-blog {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: 0;
  border: 1px solid var(--control-border);
  border-radius: 50%;
  background-color: var(--surface);
  font-size: 0;
  cursor: pointer;
}

.brand-head__like .heart-brand:hover,
.brand-head__like .heart-model:hover,
.brand-head__like .heart-blog:hover {
  border-color: var(--link);
}

.brand-head__like .heart-brand svg,
.brand-head__like .heart-brand.liked svg,
.brand-head__like .heart-brand.not-authenticated svg,
.brand-head__like .heart-model svg,
.brand-head__like .heart-model.liked svg,
.brand-head__like .heart-model.not-authenticated svg,
.brand-head__like .heart-blog svg,
.brand-head__like .heart-blog.liked svg,
.brand-head__like .heart-blog.not-authenticated svg {
  width: 20px;
  height: 20px;
  overflow: visible;
  color: transparent;
  stroke: var(--text);
  stroke-width: 44px;
  transform: none;
}

.brand-head__like .heart-brand.liked svg,
.brand-head__like .heart-model.liked svg,
.brand-head__like .heart-blog.liked svg {
  color: var(--danger);
  stroke: var(--danger);
}

.brand-facts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  margin: 8px 0 20px;
  color: var(--text-muted);
}

.brand-facts__country {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--link);
  text-decoration: none;
}

.brand-facts__country:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Photos: one big and two smaller on wide screens, the rest open full screen. 8:3 makes every tile 16:9. */
.mosaic {
  position: relative;
}

.mosaic__track {
  display: grid;
  grid-template-columns: 2fr 1fr;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 8px;
  aspect-ratio: 8 / 3;
}

.mosaic[data-count="1"] .mosaic__track {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
  aspect-ratio: 16 / 9;
}

.mosaic[data-count="2"] .mosaic__track {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  aspect-ratio: 32 / 9;
}

.mosaic__item {
  position: relative;
  display: block;
  min-height: 0;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background-color: var(--surface-2);
}

.mosaic__item:first-child {
  grid-row: 1 / 3;
}

.mosaic[data-count="1"] .mosaic__item:first-child {
  grid-row: auto;
}

.mosaic[data-count="2"] .mosaic__item:nth-child(2) {
  grid-row: 1 / 3;
}

.mosaic__item:nth-child(n + 4) {
  display: none;
}

/* Photos fill their 16:9 tile and are trimmed from the top only, so the watermark in a bottom corner (20px from the
   edge) stays whole. Video posters carry no watermark and stay centred. */
.mosaic__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 100%;
  transition: filter .2s ease, transform .3s ease;
}

.mosaic__item--video .mosaic__img {
  object-position: 50% 50%;
}

.mosaic__play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #ffffff;
}

.mosaic__play .icon {
  box-sizing: content-box;
  width: 18px;
  height: 18px;
  padding: 14px 13px 14px 15px;
  border-radius: 50%;
  background-color: rgba(0, 0, 0, .6);
}

/* The first tile of a blog post that opens with its video: a bigger play button and a label saying what it is. */
.mosaic__item--video:first-child .mosaic__play .icon {
  width: 28px;
  height: 28px;
  padding: 22px 20px 22px 24px;
}

.mosaic__watch {
  position: absolute;
  bottom: 14px;
  left: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px 0 10px;
  border-radius: 999px;
  background-color: rgba(0, 0, 0, .65);
  color: #ffffff;
  font-size: .8125rem;
  font-weight: 600;
}

.mosaic__watch .icon {
  width: 11px;
  height: 11px;
}

.mosaic__more,
.mosaic__counter {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 6px 12px;
  border-radius: 999px;
  background-color: rgba(0, 0, 0, .62);
  color: #ffffff;
  font-size: .8125rem;
  font-weight: 500;
  pointer-events: none;
}

.mosaic__counter {
  display: none;
}

.mosaic__img--blurred {
  filter: blur(16px);
  transform: scale(1.15);
}

/* A locked document: the brand logo whole on a white plate (logos are made for a light background, so white in both
   themes), as high as the mosaic, with the photo count in the "+N photos" pill. */
.mosaic__plate {
  position: relative;
  display: block;
  aspect-ratio: 8 / 3;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background-color: #ffffff;
  color: #5f616a;
}

/* Placed inside the frame rather than in its flow, so the logo's own size never makes the frame taller */
.mosaic__logo {
  position: absolute;
  top: 10%;
  left: 20%;
  width: 60%;
  height: 80%;
  object-fit: contain;
}

.mosaic__plate-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 56px;
  height: 56px;
  transform: translate(-50%, -50%);
}

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

.mosaic__more--locked {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.mosaic__more--locked .icon {
  width: 13px;
  height: 13px;
}

.mosaic__lock {
  position: absolute;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: calc((100% - 8px) / 3);
  height: calc((100% - 8px) / 2);
  padding: 8px;
  border-radius: var(--radius-lg);
  background-color: rgba(17, 18, 20, .45);
  color: #ffffff;
  text-align: center;
  text-decoration: none;
}

.mosaic[data-count="1"] .mosaic__lock {
  width: 100%;
  height: 100%;
}

.mosaic__lock .icon {
  width: 26px;
  height: 26px;
}

.mosaic__lock b {
  font-size: 1rem;
  font-weight: 600;
}

.mosaic__lock-cta {
  color: #b9d2f0;
  font-size: .875rem;
  font-weight: 500;
  text-decoration: none;
}

/* The whole frame opens the subscribe page */
.mosaic__lock-cta::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.mosaic__lock-cta:hover,
.mosaic__lock:hover .mosaic__lock-cta {
  text-decoration: underline;
}

.mosaic__lock-cta:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

.mosaic__lock-login {
  position: relative;
  z-index: 1;
  color: rgba(255, 255, 255, .85);
  font-size: .8125rem;
}

.mosaic__lock-login a {
  color: #ffffff;
  font-weight: 600;
  text-decoration: underline;
}

@media (hover: hover) {
  a.mosaic__item:hover .mosaic__img {
    filter: brightness(1.06);
  }
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  a.mosaic__item:hover .mosaic__img {
    transform: scale(1.03);
  }
}

/* On mobile: one photo at a time, swiped, with a "1 / N" counter. */
@media (max-width: 767px) {
  .mosaic__track,
  .mosaic[data-count="1"] .mosaic__track,
  .mosaic[data-count="2"] .mosaic__track {
    display: flex;
    gap: 0;
    aspect-ratio: 16 / 9;
    overflow-x: auto;
    border-radius: var(--radius-lg);
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }

  .mosaic__track::-webkit-scrollbar {
    display: none;
  }

  .mosaic__item,
  .mosaic__item:nth-child(n + 4) {
    display: block;
    flex: 0 0 100%;
    border-radius: 0;
    scroll-snap-align: start;
  }

  .mosaic--locked .mosaic__track {
    overflow: hidden;
  }

  .mosaic--locked .mosaic__item:not(:first-child) {
    display: none;
  }

  .mosaic__more {
    display: none;
  }

  .mosaic__counter {
    display: block;
  }

  .mosaic__plate {
    aspect-ratio: 16 / 9;
  }

  .mosaic__logo {
    left: 12%;
    width: 76%;
  }

  .mosaic__more--locked {
    display: inline-flex;
  }

  .mosaic__lock {
    width: 100%;
    height: 100%;
  }
}

/* The story with the facts beside it from 1024px; one column, story first, below that. */
.brand-body {
  display: grid;
  gap: 40px;
  margin-top: 32px;
}

.brand-main,
.brand-side {
  min-width: 0;
}

.brand-side {
  display: grid;
  align-content: start;
  gap: 32px;
}

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

.brand-section-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 16px;
}

.brand-section-head .brand-section-title {
  margin: 0;
}

.brand-section-count,
.brand-section-sub {
  color: var(--text-muted);
}

.brand-section-sub {
  margin: -6px 0 14px;
}

.brand-prose {
  max-width: 68ch;
  color: var(--text);
  font-size: 1rem;
  line-height: 1.75;
}

.brand-prose p {
  margin: 0;
}

.brand-prose p + p {
  margin-top: 1em;
}

.brand-prose a {
  color: var(--link);
}

.brand-teaser {
  position: relative;
}

.brand-teaser::after {
  position: absolute;
  inset: auto 0 0;
  height: 3.5rem;
  background: linear-gradient(to bottom, transparent, var(--bg));
  content: "";
  pointer-events: none;
}

.brand-side__title {
  margin: 0 0 10px;
  color: var(--text);
  font-family: var(--font-heading);
  font-size: 1.125rem;
  font-weight: 700;
}

.company-history {
  margin: 0;
  padding: 0;
  list-style: none;
}

.company-history li {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr);
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}

.company-history li:last-child {
  border-bottom: 1px solid var(--border);
}

.company-history__years {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.company-history__years a {
  color: inherit;
  text-decoration: none;
}

.company-history__years a:hover {
  color: var(--link);
  text-decoration: underline;
}

.company-history__company strong {
  display: block;
  color: var(--text);
  font-weight: 600;
}

.company-history__place {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: .875rem;
}

.company-history__place a {
  color: var(--link);
  text-decoration: none;
}

.company-history__place a:hover {
  text-decoration: underline;
}

.brand-details {
  margin: 0;
}

.brand-details > div {
  display: grid;
  gap: 8px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}

.brand-details > div:last-child {
  border-bottom: 1px solid var(--border);
}

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

.brand-details dd {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
}

.brand-details__text {
  color: var(--text);
}

/* No story beside the facts (a brand or model without a description): the facts are a table in the middle of the
   page, one row per item, the label on the left and the value on the right, as on the document page. */
.brand-body--facts .brand-side {
  width: 100%;
  max-width: 720px;
  margin-inline: auto;
}

.brand-body--facts .brand-details > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 52px;
  padding: 8px 0;
}

.brand-body--facts .brand-details dt {
  flex: none;
}

.brand-body--facts .brand-details dd {
  justify-content: flex-end;
  text-align: right;
}

.brand-related {
  display: grid;
  gap: 10px;
}

/* Exotic brands: the company and its contact details. */
.brand-company {
  margin: 0;
}

.brand-company strong {
  display: block;
  color: var(--text);
  font-weight: 600;
}

.brand-company span {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: .875rem;
}

.brand-contact {
  margin: 0;
}

.brand-contact > div {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr);
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}

.brand-contact > div:last-child {
  border-bottom: 1px solid var(--border);
}

.brand-contact dt {
  padding-top: 2px;
  color: var(--text-muted);
  font-size: .875rem;
}

.brand-contact dd {
  display: grid;
  gap: 4px;
  margin: 0;
  color: var(--text);
  overflow-wrap: anywhere;
}

.brand-contact dd a {
  color: var(--link);
  text-decoration: none;
}

.brand-contact dd a:hover {
  text-decoration: underline;
}

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

.brand-contact .brand-contact__social {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.brand-contact__social .round-button {
  width: 40px;
  height: 40px;
  color: var(--text);
}

.brand-contact__social .round-button:hover {
  color: var(--link);
  text-decoration: none;
}

.brand-contact__social .round-button .icon {
  width: 18px;
  height: 18px;
}

/* Models: 2 across on mobile, 3 on tablets, 4 on desktop; the first 12, then "Show all". */
.model-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.model-grid > [hidden] {
  display: none;
}

.model-grid .card__media {
  position: relative;
}

.model-grid .card__title {
  font-size: 1rem;
}

.card__badge {
  position: absolute;
  bottom: 8px;
  left: 8px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  background-color: rgba(0, 0, 0, .65);
  color: #ffffff;
  font-size: .75rem;
  font-weight: 500;
}

.card__badge .icon {
  width: 12px;
  height: 12px;
}

.card--static:hover {
  border-color: var(--border);
  box-shadow: none;
  transform: none;
}

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

.section-more.brand-show-all {
  display: flex;
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.nearby-map {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background-color: var(--surface-2);
}

.nearby-map__hint {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 2;
  padding: 3px 10px;
  border-radius: 999px;
  background-color: rgba(0, 0, 0, .62);
  color: #ffffff;
  font-size: .75rem;
  pointer-events: none;
}

.brand-nearby-more {
  width: 100%;
  margin-top: 14px;
}

@media (min-width: 768px) {
  .brand-page {
    padding-bottom: 72px;
  }

  .model-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
  }

  .brand-related {
    display: flex;
    flex-wrap: wrap;
  }

  .nearby-map {
    aspect-ratio: 16 / 7;
  }

  .brand-nearby-more {
    width: auto;
  }
}

@media (min-width: 1024px) {
  .brand-body {
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 56px;
    margin-top: 40px;
  }

  .brand-body--single,
  .brand-body--facts {
    grid-template-columns: minmax(0, 1fr);
  }

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

  .brand-prose {
    font-size: 1.0625rem;
  }

  .brand-related {
    display: grid;
  }

  .model-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
  }
}

/* Model pages: the key figures of an exotic car as big numbers under the photos (models/model-page.html). */
.key-figures {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-top: 20px;
}

.key-figures__item {
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background-color: var(--surface);
}

.key-figures__value {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-family: var(--font-heading);
  font-size: 1.375rem;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.key-figures__value small {
  margin-left: 3px;
  color: var(--text-muted);
  font-size: .875rem;
  font-weight: 500;
}

.key-figures__item--text .key-figures__value {
  padding-top: 4px;
  font-size: 1.0625rem;
}

.key-figures__value--missing {
  color: var(--text-muted);
  font-weight: 500;
}

.key-figures__label {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: .8125rem;
}

@media (max-width: 1023px) {
  .key-figures {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 479px) {
  .key-figures {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .key-figures__value {
    font-size: 1.1875rem;
  }
}
