/* Manufacturer directory and detail share the same section hero. */
html:has(link.ap-journal-brand-surface) main#main-content .content-block__head {
  display: block;
  background: transparent;
  padding-inline: 0;
}

html:has(link.ap-journal-brand-surface) body
main#main-content > .container > .content-block__head > #h1_block:has(> h1#pagetitle) {
  box-sizing: border-box;
  background: var(--ds-lilac);
  padding: var(--ds-s-32) !important;
  border-radius: var(--ds-r-panel) !important;
}

html:has(link.ap-journal-brand-surface) main#main-content .content-block__head > .ap-breadcrumb {
  margin-block-end: var(--ds-s-16);
}

@media (max-width: 820px) {
  html:has(link.ap-journal-brand-surface) body
  main#main-content > .container > .content-block__head > #h1_block:has(> h1#pagetitle) {
    padding: var(--ds-s-20) !important;
  }
}

/* The list hero supplies the heading style. Keep Acer's logo and native CTA,
   with no separate colored surface around this supporting row. */
html:has(link.ap-journal-brand-detail) main#main-content .brand-page > .brand-page__top {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
}

/* Match the specificity of V3's wave-A and palette compatibility rules. */
html.ap-wave-a-v1:has(link.ap-journal-brand-detail) body
#main-content:has(.andpro-brand-page):not(:has(.catalog-filter))
:is(.content-block__head, .brand-page > .brand-page__top:not(#ap-v3)) {
  background-color: transparent !important;
}

html:has(link.ap-journal-brand-detail) main#main-content .brand-page__top > .brand-page__logo {
  background: transparent;
  border: 0;
  box-shadow: none;
  margin-inline-start: 0;
  padding: 0;
}

main#main-content .ap-brands-directory-content .ap-brands-az__link {
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
}

main#main-content .ap-brands-directory-content .ap-brands-directory__intro {
  padding: var(--ds-s-16) var(--ds-s-24);
  border-radius: var(--ds-r-field);
}

main#main-content .ap-brands-directory-content .ap-brands-directory__lead {
  margin: 0;
}

main#main-content .ap-brands-directory-content .sert-item__no-logo {
  box-sizing: border-box;
  display: grid;
  place-items: center;
  inline-size: 100%;
  min-block-size: var(--ds-s-40);
  padding: var(--ds-s-4) var(--ds-s-8);
  border-radius: var(--ds-r-field);
  background: var(--ds-lilac);
  color: var(--ds-muted);
  font-size: var(--ds-fs-13);
  text-align: center;
}

/* The directory already allocates a logo row. Use the available width and
   preserve the source aspect ratio and the row shared by the cards. */
html:has(link.ap-journal-brand-directory) .ap-brands-directory .sert-item__img {
  width: 100% !important;
  max-width: 100% !important;
  height: 52px !important;
  max-height: 52px !important;
  object-fit: contain !important;
  object-position: left center;
}

/* "Global" also covers missing origin data. Keep that group in the filter.
   AND-Systems is the sole entry with the internal model marker. */
html:has(link.ap-journal-brand-directory)
.ap-brands-directory .sert-item[data-origin]:not([data-origin="russian"]) > a::after {
  content: none !important;
}

@media (max-width: 767px) {
  html:has(link.ap-journal-brand-directory)
  body:has(> #andpro-consent:not([hidden], .andpro-consent--inline)) {
    padding-bottom: 0 !important;
  }

  html.ap-wave-a-v1:has(link.ap-journal-brand-directory) body
  > #andpro-consent:not([hidden], .andpro-consent--inline) {
    position: sticky !important;
    inset: auto 0 0 !important;
  }

  html:has(link.ap-journal-brand-directory) footer.ds-footer
  .nwfooter-bottom__row > a.nwfooter-bottom__link {
    padding-inline-start: 0 !important;
    margin-inline-start: 0 !important;
  }
}

/* Tighten the visible artwork for these three approved files with padded canvases. */
@media (min-width: 360px) {
  html:has(link.ap-journal-brand-directory) .ap-brands-directory .sert-item__img:is(
      [src$='/local/templates/new/img/brand-logo-65f11255e19f19ff.png'],
      [src$='/local/templates/new/img/brand-logo-3acef25d717f25ad.png'],
      [src$='/local/templates/new/img/brand-logo-cc2f342f95a44e58.webp']
  ) {
    object-fit: cover !important;
    object-position: center;
  }
}

/* Brand detail pages use the same footer and cookie banner geometry as the directory. */
html.ap-wave-a-v1:has(link.ap-journal-brand-detail)
body:has(> #andpro-consent:not([hidden], .andpro-consent--inline)) {
  padding-bottom: 0 !important;
}

html.ap-wave-a-v1:has(link.ap-journal-brand-detail)
body > #andpro-consent:not([hidden], .andpro-consent--inline) {
  position: sticky !important;
  inset: auto 0 0 !important;
}

@media (max-width: 767px) {
  html:has(link.ap-journal-brand-detail) footer.ds-footer
  .nwfooter-bottom__row > a.nwfooter-bottom__link {
    padding-inline-start: 0 !important;
    margin-inline-start: 0 !important;
  }
}
