/* Catalog V61: collection-template-only UI. Native facets, pagination and density hooks remain intact. */
html:has([data-aogeo-catalog-ui]) {
  --aogeo-catalog-width: min(calc(100% - 64px), 1440px);
  --aogeo-catalog-ink: #14384d;
  --aogeo-catalog-muted: #536b7d;
  --aogeo-catalog-line: #dce6ed;
  --aogeo-catalog-blue: #126aab;
}

html:has([data-aogeo-catalog-ui]) :is(.apcv57, .acn58) {
  color: var(--aogeo-catalog-ink);
  border-bottom: 1px solid var(--aogeo-catalog-line);
  background: radial-gradient(ellipse at 94% 0%, #e9f3fa, transparent 55%), #fff;
}

html:has([data-aogeo-catalog-ui]) .apcv57::after { display: none; }
html:has([data-aogeo-catalog-ui]) :is(.apcv57__inner, .acn58__inner) {
  width: var(--aogeo-catalog-width);
  padding-block: 24px;
}
html:has([data-aogeo-catalog-ui]) .apcv57__breadcrumb { color: var(--aogeo-catalog-muted); font-size: 13px; }
html:has([data-aogeo-catalog-ui]) .apcv57__breadcrumb a:hover { color: var(--aogeo-catalog-blue); }
html:has([data-aogeo-catalog-ui]) .apcv57__layout {
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 40px;
  padding-block: 16px;
}
html:has([data-aogeo-catalog-ui]) .apcv57__eyebrow {
  margin-bottom: 10px;
  color: var(--aogeo-catalog-blue);
  font-size: 12px;
  letter-spacing: 0.1em;
}
html:has([data-aogeo-catalog-ui]) :is(.apcv57 h1, .acn58__title) {
  max-width: 980px;
  color: var(--aogeo-catalog-ink);
  font-size: clamp(30px, 3.15vw, 44px);
  line-height: 1.13;
  letter-spacing: -0.025em;
}
html:has([data-aogeo-catalog-ui]) :is(.apcv57__lead, .acn58__description) {
  max-width: 82ch;
  margin-top: 16px;
  color: var(--aogeo-catalog-muted);
  font-size: 16px;
  line-height: 1.65;
}
html:has([data-aogeo-catalog-ui]) .acn58__description { margin-bottom: 0; }
html:has([data-aogeo-catalog-ui]) .apcv57__actions { margin-top: 18px; }
html:has([data-aogeo-catalog-ui]) .apcv57__actions a { font-size: 14px; }
html:has([data-aogeo-catalog-ui]) .apcv57__primary { color: var(--color-primary-button-text, #fff); background: var(--aogeo-catalog-blue); }
html:has([data-aogeo-catalog-ui]) .apcv57__secondary {
  color: var(--aogeo-catalog-blue);
  border-color: #c2d5e3;
  background: #fff;
}
html:has([data-aogeo-catalog-ui]) .apcv57__overview {
  padding: 16px;
  border-color: var(--aogeo-catalog-line);
  background: #fff;
  box-shadow: 0 8px 24px rgb(25 61 86 / 4%);
  backdrop-filter: none;
}
html:has([data-aogeo-catalog-ui]) .apcv57__count strong { color: var(--aogeo-catalog-ink); font-size: 34px; }
html:has([data-aogeo-catalog-ui]) :is(.apcv57__count span, .apcv57__overview p) { color: var(--aogeo-catalog-muted); font-size: 13px; }
html:has([data-aogeo-catalog-ui]) .apcv57__criteria { margin-top: 14px; }
html:has([data-aogeo-catalog-ui]) .apcv57__criteria span {
  color: #326486;
  border-color: #dbe7ef;
  background: #f2f7fb;
  font-size: 12px;
  letter-spacing: 0;
}
html:has([data-aogeo-catalog-ui]) .apcv57__categories {
  flex-wrap: wrap;
  gap: 8px;
  overflow: visible;
  padding-top: 18px;
  border-color: var(--aogeo-catalog-line);
  scrollbar-width: thin;
}
html:has([data-aogeo-catalog-ui]) .apcv57__categories > span {
  color: var(--aogeo-catalog-muted);
  font-size: 12px;
  letter-spacing: 0.06em;
}
html:has([data-aogeo-catalog-ui]) .apcv57__categories a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 13px;
  color: #31566f;
  border-color: #d4e2ec;
  background: #fff;
  font-size: 13px;
  line-height: 1.35;
}
html:has([data-aogeo-catalog-ui]) .apcv57__categories a:hover {
  color: #075b98;
  border-color: #8db8d7;
  background: #eef6fc;
}

[data-aogeo-catalog-ui] { display: block; }
[data-aogeo-catalog-ui] .product-grid-container {
  display: block;
  padding-block: 24px 48px;
  background: #f5f8fb;
}
[data-aogeo-catalog-ui] .apf-results__intro { display: none; }
[data-aogeo-catalog-ui] .collection-wrapper {
  width: var(--aogeo-catalog-width);
  max-width: 1440px;
  margin-inline: auto;
}

/* Match the legacy sidebar selector's specificity, then add the catalog scope.
   This narrowly replaces V48/V49 layout rules without touching search or product templates. */
[data-aogeo-catalog-ui] .product-grid-container .collection-wrapper:has(> .facets-block-wrapper--vertical:not(#filters-drawer)) {
  width: var(--aogeo-catalog-width) !important;
  max-width: 1440px !important;

  & .product-grid__item.aogeo-product-card-v35 {
    min-height: 0 !important;
    overflow: hidden;
    border-color: #dae5ed !important;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 3px 16px rgb(25 61 86 / 4%);
    transform: none;
  }

  & .product-grid__item.aogeo-product-card-v35:hover {
    border-color: #91b9d6 !important;
    box-shadow: 0 10px 28px rgb(25 61 86 / 9%);
    transform: none;
  }

  & .aogeo-product-card-v35 > product-card {
    height: auto;
    flex: 1 0 auto;
  }

  & .aogeo-product-card-v35 .product-card__content {
    height: auto;
    padding: 10px 10px 0 !important;
  }

  & .aogeo-product-card-v35 .card-gallery {
    width: 100%;
    aspect-ratio: 4 / 3 !important;
    margin-inline: 0 !important;
    border-radius: 10px;
    background: #f3f7fa;
  }

  & .aogeo-product-card-v35 .card-gallery :is(slideshow-component, slideshow-container, slideshow-slides, slideshow-slide, .product-media-container, .product-media, .product-media__image, img) {
    height: 100% !important;
  }

  & .aogeo-product-card-v35 .card-gallery :is(.product-media-container, .product-media) {
    aspect-ratio: auto !important;
    background: transparent;
  }

  & .aogeo-product-card-v35 .card-gallery img {
    width: 100%;
    padding: 12px;
    box-sizing: border-box;
    object-fit: contain !important;
    object-position: center;
    transform: none;
  }
  & .aogeo-product-card-v35 .product-media__image { transform: none; }

  & .aogeo-product-card-v35 .product-card__content > a.contents .text-block {
    min-height: 0 !important;
    padding: 16px 4px 14px !important;
  }

  & .aogeo-product-card-v35 .product-card__content > a.contents .text-block p {
    display: block;
    overflow: visible;
    max-height: none;
    color: var(--aogeo-catalog-ink);
    font-size: 16px;
    font-weight: 650;
    line-height: 1.45;
    letter-spacing: -0.01em;
    overflow-wrap: anywhere;
    white-space: normal;
    -webkit-line-clamp: unset;
  }

  & .aogeo-product-card-v35 .aogeo-product-card-v35__footer {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    min-height: 0 !important;
    margin-top: auto;
    padding: 12px 14px 14px !important;
    border-top: 1px solid #edf1f5;
    background: #fff;
  }

  & .aogeo-product-card-v35__tags {
    display: flex;
    flex: 0 0 auto;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    overflow: visible;
  }
  & .aogeo-product-card-v35__tags span {
    display: inline-flex;
    max-width: 100%;
    padding: 6px 8px;
    color: #49697f;
    border-radius: 6px;
    background: #f0f5f9;
    font-size: 12px;
    line-height: 1.35;
    overflow-wrap: anywhere;
    white-space: normal;
  }
  & .aogeo-product-card-v35__link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 9px 12px;
    color: var(--aogeo-catalog-blue);
    border: 1px solid #d5e4ef;
    border-radius: 8px;
    background: #f7fbfe;
    font-size: 13px;
    line-height: 1.35;
  }
  & .product-grid[product-grid-view='zoom-out'] .aogeo-product-card-v35__tags { display: none; }
  & .product-grid-view-zoom-out--details { font-size: 12px; }

  @media (min-width: 750px) {
    display: grid;
    grid-template-areas: none !important;
    grid-template-columns: 240px minmax(0, 1fr) !important;
    grid-auto-columns: auto !important;
    column-gap: 24px !important;
    row-gap: 0;

    & > .facets-controls-wrapper { grid-column: 1 / -1 !important; grid-row: 1 !important; margin-bottom: 20px; }
    & > .facets-block-wrapper--vertical:not(#filters-drawer) {
      grid-column: 1 !important;
      grid-row: 2 !important;
      width: 240px !important;
      max-width: 240px !important;
      padding: 0 16px 16px;
      border-radius: 12px;
      box-shadow: none;
    }
    & > #ResultsList.main-collection-grid {
      grid-column: 2 / 3 !important;
      grid-row: 2 !important;
      min-width: 0;
      padding: 0;
    }
    & .main-collection-grid .product-grid[product-grid-view='default'] {
      --product-grid-columns-desktop: repeat(auto-fill, minmax(min(100%, var(--aogeo-catalog-card-min, 250px)), 1fr)) !important;
    }
    & .product-grid:has(> .aogeo-product-card-v35:only-of-type) {
      grid-template-columns: minmax(0, 1fr) !important;
      max-width: 430px;
      margin-inline: 0;
    }
  }

  @media (min-width: 750px) and (max-width: 1149px) {
    grid-template-columns: 210px minmax(0, 1fr) !important;
    column-gap: 20px !important;
    & > .facets-block-wrapper--vertical:not(#filters-drawer) { width: 210px !important; max-width: 210px !important; }
  }

  @media (max-width: 749px) {
    & .aogeo-product-card-v35 .product-card__content { padding: 7px 7px 0 !important; }
    & .aogeo-product-card-v35 .card-gallery img { padding: 8px; }
    & .aogeo-product-card-v35 .product-card__content > a.contents .text-block { padding: 12px 3px !important; }
    & .aogeo-product-card-v35 .product-card__content > a.contents .text-block p { font-size: 14px; line-height: 1.45; }
    & .aogeo-product-card-v35 .aogeo-product-card-v35__footer { gap: 10px; padding: 10px !important; }
    & .aogeo-product-card-v35__tags span { font-size: 12px; padding: 5px 7px; }
    & .aogeo-product-card-v35__link { font-size: 12px; padding-inline: 9px; }
  }
}

/* Inquiry-only catalog: never expose stock-price or quick-purchase affordances. */
[data-aogeo-catalog-ui] .aogeo-product-card-v35 :is(quick-add-component, .quick-add, product-price, .price, [class*='price'], .product-badges__badge.color-custom-badge-sold-out) {
  display: none !important;
}
[data-aogeo-catalog-ui] :is(.facets__label, .facets__pill-label, .sorting-filter__button) { font-size: 14px; }
[data-aogeo-catalog-ui] .facets__inputs-list-item .checkbox { font-size: 13px; }
[data-aogeo-catalog-ui] :is(.facets__pill, .facets__pill-label) { line-height: 1.4; }

html:has([data-aogeo-catalog-ui]) [data-aogeo-catalog-body] {
  width: var(--aogeo-catalog-width);
  margin: 40px auto;
  padding: clamp(22px, 3vw, 40px);
  color: var(--aogeo-catalog-muted);
  border: 1px solid var(--aogeo-catalog-line);
  border-radius: 16px;
  background: #fff;
  font-size: 16px;
  line-height: 1.8;
  overflow-wrap: anywhere;
}
html:has([data-aogeo-catalog-ui]) [data-aogeo-catalog-body] > :first-child { margin-top: 0; }
html:has([data-aogeo-catalog-ui]) [data-aogeo-catalog-body] > :last-child { margin-bottom: 0; }
html:has([data-aogeo-catalog-ui]) [data-aogeo-catalog-body] :is(h2, h3, h4, strong) { color: var(--aogeo-catalog-ink); }
html:has([data-aogeo-catalog-ui]) [data-aogeo-catalog-body] :is(h2, h3) { margin-top: 1.5em; line-height: 1.3; }
html:has([data-aogeo-catalog-ui]) [data-aogeo-catalog-body] h2 { font-size: clamp(23px, 2.1vw, 30px); }
html:has([data-aogeo-catalog-ui]) [data-aogeo-catalog-body] h3 { font-size: 20px; }
html:has([data-aogeo-catalog-ui]) [data-aogeo-catalog-body] a { color: var(--aogeo-catalog-blue); text-underline-offset: 3px; }
html:has([data-aogeo-catalog-ui]) [data-aogeo-catalog-body] table { display: block; max-width: 100%; overflow-x: auto; }
html:has([data-aogeo-catalog-ui]) [data-aogeo-catalog-body] summary { min-height: 44px; padding-block: 12px; cursor: pointer; }
html:has([data-aogeo-catalog-ui]) :is(.apcv57, .acn58, [data-aogeo-catalog-ui], [data-aogeo-catalog-body]) a:focus-visible {
  outline: 3px solid #2b8cd1;
  outline-offset: 3px;
}

@media (max-width: 989px) {
  html:has([data-aogeo-catalog-ui]) { --aogeo-catalog-width: min(calc(100% - 40px), 1440px); }
  html:has([data-aogeo-catalog-ui]) .apcv57__layout { grid-template-columns: 1fr; gap: 0; }
}
@media (max-width: 749px) {
  html:has([data-aogeo-catalog-ui]) { --aogeo-catalog-width: calc(100% - 28px); }
  html:has([data-aogeo-catalog-ui]) :is(.apcv57__inner, .acn58__inner) { padding-block: 20px; }
  html:has([data-aogeo-catalog-ui]) .apcv57__layout { padding-block: 18px; }
  html:has([data-aogeo-catalog-ui]) :is(.apcv57 h1, .acn58__title) { font-size: clamp(27px, 7.3vw, 34px); }
  html:has([data-aogeo-catalog-ui]) :is(.apcv57__lead, .acn58__description) { margin-top: 12px; font-size: 14px; line-height: 1.65; }
  html:has([data-aogeo-catalog-ui]) .apcv57__actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  html:has([data-aogeo-catalog-ui]) .apcv57__actions a { min-width: 0; padding-inline: 10px; font-size: 13px; line-height: 1.35; }
  html:has([data-aogeo-catalog-ui]) .apcv57__categories { flex-wrap: nowrap; overflow-x: auto; margin-inline: -14px; padding-inline: 14px; padding-bottom: 6px; }
  html:has([data-aogeo-catalog-ui]) .apcv57__categories > span { display: none; }
  [data-aogeo-catalog-ui] .product-grid-container { padding-block: 18px 32px; }
  [data-aogeo-catalog-ui] .facets-toggle { min-height: 52px; height: auto; padding: 8px 12px; margin-bottom: 16px; border: 1px solid var(--aogeo-catalog-line); border-radius: 10px; background: #fff; }
  [data-aogeo-catalog-ui] .facets-toggle__button { min-height: 40px; font-size: 14px; }
  html:has([data-aogeo-catalog-ui]) [data-aogeo-catalog-body] { margin-block: 28px; padding: 20px; font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  [data-aogeo-catalog-ui] :is(.aogeo-product-card-v35, .aogeo-product-card-v35 img, .aogeo-product-card-v35__link span) { transition: none; }
}
