.catalogue-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.search-panel .searchbar {
  grid-template-columns: minmax(0,.64fr) minmax(0,.8fr) minmax(0,.85fr) minmax(0,2.75fr);
  column-gap: 12px;
  align-items: end;
}
.searchbar .market-field {
  display: grid;
  align-content: end;
  gap: 4px;
  min-width: 0;
  font-size: .86rem;
  font-weight: 650;
}
.market-field select {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding-inline: 10px;
  color: #123c4e;
  background-color: #fff;
  border: 1px solid #a5bdcd;
  border-radius: 7px;
  font: inherit;
}
#results { padding-block-start: clamp(6px,.65vw,12px); }
#results .feed {
  min-width: 0;
  min-height: 0;
  align-self: start;
  max-block-size: var(--catalogue-pane-height,52vh);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-gutter: stable;
  scrollbar-color: #78979f #edf3f4;
  container: catalogue-feed / inline-size;
}
#results .feed:focus-visible { outline: 2px solid #007e78; outline-offset: 2px; }
.feed-navigation {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: .5rem;
  padding-block: .8rem;
}
.feed-navigation:not(:has(a)):has([data-feed-status]:empty) { display: none; }
.feed-navigation [role=status] { color: #47606c; font-size: .9rem; }
.feed-more { padding: .45rem .9rem; color: #075c60; font-weight: 650; }
.feed-more:focus-visible { outline: 2px solid currentColor; }
/* The former 19:10 product frame gains 20% height at the same card width. */
#results [data-feed-cards] .tile > .item-media { aspect-ratio: 19 / 12; flex-shrink: 0; }

/* Give the product column its own surface without changing the grid tracks or the rails. */
#results .feed {
  --feed-inset: 10px;
  box-sizing: border-box;
  border: 1px solid #ccdbe0;
  border-radius: 12px;
  background: #f8fafb;
  padding-inline: var(--feed-inset);
}
#results .feed > [data-feed-cards] { padding-top: var(--feed-inset); }
.feed-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  column-gap: 8px;
  padding: 10px var(--feed-inset);
  margin-inline: calc(-1 * var(--feed-inset));
  border-bottom: 1px solid #d7e3e6;
  background: #fff;
}
.feed-tool {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  box-sizing: border-box;
  padding: 6px 12px;
  border: 1px solid #cbdade;
  border-radius: 8px;
  color: #254650;
  background: #fff;
  font-size: .88rem;
  line-height: 1.25;
  font-weight: 600;
  cursor: pointer;
}
.feed-tool:hover { border-color: #75a1a1; }
.feed-tool:has(:checked) { color: #064e50; border-color: #73aaa6; background: #e8f5f1; }
.feed-tool:focus-within { outline: 2px solid #007772; outline-offset: 2px; }
.feed-tool input { flex: none; width: 1rem; height: 1rem; min-height: 0; padding: 0; margin: 0; accent-color: #086563; }
.feed-filter-error { margin: .6rem 0 0; font-size: .875rem; color: #753814; }
.feed-filter-error:empty { display: none; }
@media (max-width: 580px) {
  #results .feed { --feed-inset: 8px; border-radius: 9px; }
  .feed-tools { padding-block: 6px; }
  .feed-tool { min-height: 44px; padding: 5px 8px; gap: 6px; font-size: .82rem; }
}

.feed-tools { flex-wrap: wrap; gap: 6px 8px; }
@media (min-width: 601px) {
  .feed-tools { justify-content: flex-start; }
  .feed-tool:nth-child(2) { margin-inline-start: auto; }
}
.tile footer .seller-identity {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 7px;
  max-width: 100%;
  min-width: 0;
}
.seller-identity > a { overflow-wrap: anywhere; }
.seller-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border: 1px solid;
  border-radius: 20px;
  font-size: .72rem;
  line-height: 1.4;
  font-weight: 700;
}
.seller-badge--blue { color: #13499c; background: #eaf3ff; border-color: #aac8f0; }
.seller-badge--gold { color: #604008; background: #fff0bf; border-color: #d5ab47; }
.seller-badge-detail { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.tile footer a[data-save-product] {
  gap: 5px;
  padding: 5px 10px;
  border: 1px solid #9873be;
  border-radius: 8px;
  background: #f4edfc;
  color: #58298a;
  font-weight: 700;
  line-height: 1.25;
  text-decoration: none;
}
.tile footer a[data-save-product]:hover { background: #e9dcf7; border-color: #714399; }
.tile footer a[data-save-product]:focus-visible { outline: 2px solid #512281; outline-offset: 2px; }
.tile footer a[data-favorited] { color: #fff; background: #653196; border-color: #653196; }
.tile footer a[data-favorited]:hover { color: #fff; background: #4f237d; }
[data-favorite-star] { font-size: 1.24rem; line-height: 1; }

#results .storefront-rail,
#results .storefront-rail .rail-primary,
#results .storefront-rail .rail-additions {
  row-gap: clamp(24px, 2.2vw, 46px);
}
@media (max-width: 800px) {
  #results .grid-layout { row-gap: 24px; }
}
.tile .listing-kind {
  display: block;
  margin-bottom: .3rem;
  color: #176165;
  font-size: .78rem;
  font-weight: 650;
}

/* Keep the header and search controls together as the document scrolls. */
body:has(.catalogue-search) .mast { position: sticky; top: 0; z-index: 30; }
.catalogue-search .searchbar :is(.market-field,.picker-title,.seller-category-field) { margin-inline: 0; }
.catalogue-search-group {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  align-items: end;
  min-width: 0;
}
.catalogue-search-group .keyword-wrap { grid-column: 1; }
.catalogue-search-group .primary { grid-column: 2; }
.catalogue-search .catalogue-search-group #product-query { border-radius: 7px 0 0 7px; }
.catalogue-search .catalogue-search-group .primary { border-radius: 0 7px 7px 0; }
.catalogue-search :is(#country-options,.cat-popup,.category-matches) { overscroll-behavior-y: auto; }
.catalogue-search { display: contents; }
.catalogue-search .searchbar {
  position: sticky;
  top: var(--catalogue-mast-height,64px);
  z-index: 14;
  padding: 6px var(--inset);
  border-bottom: 1px solid #ccdbe0;
  background: #fff;
}
.catalogue-search > :is(.catalogue-filters,.filterlinks) {
  margin-block: 0;
  padding-inline: var(--inset);
  background: #fff;
}
#results:has(.feed) { scroll-margin-top: calc(var(--catalogue-sticky-height,146px) + 4px); }
@media (max-width: 799px) {
  .catalogue-search .searchbar { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
  .catalogue-search-group .primary { padding-inline: 10px; }

}
@media (max-width: 520px) {
  .catalogue-search .searchbar { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 4px; padding: 4px 8px; }
  .catalogue-search :is(label,.field-label) { font-size: .75rem; }
  .catalogue-search .searchbar :is(.pick,.cat-trigger,select) { min-width: 0; width: 100%; padding-inline: 4px; overflow: hidden; }
  .catalogue-search-group { grid-column: 1 / -1; }
  .catalogue-search-group label { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; }
  #results .grid-layout { --catalogue-areas: "main" "promos"; }
}

/* On a slow first visit the Worker streams the header before the cards.
   Reserve scrollable room until the results section (or retry message) arrives. */
.catalogue-pending {
  display: block;
  min-height: 42vh;
  min-height: 42svh;
  padding: 16px var(--inset);
  color: #49677a;
}
#content:has(> #results) > .catalogue-pending { display: none; }
#results:has(.feed) { padding-inline: 12px; }
#results .grid-layout {
  --side-width: clamp(150px,13.5vw,256px);
  column-gap: clamp(32px,2.5vw,52px);
}
#results .feed > [data-feed-cards] {
  display: grid;
  grid-template-columns: minmax(0,1fr);
  align-items: stretch;
  gap: clamp(10px,1vw,16px);
}
#results [data-feed-cards] > .cards { display: contents; }
#results [data-feed-cards] > :not(.cards) { grid-column: 1 / -1; }
@container catalogue-feed (min-width: 24rem) {
  #results .feed > [data-feed-cards] { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@container catalogue-feed (min-width: 51rem) {
  #results .feed > [data-feed-cards] { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@media (min-width: 1280px) {
  @container catalogue-feed (min-width: 68rem) {
    #results .feed > [data-feed-cards] { grid-template-columns: repeat(4,minmax(0,1fr)); }
  }
}
.catalogue-promotions, .catalogue-promo-track { display: contents; }
.catalogue-promotions > button { display: none; }
@media (min-width: 1280px) {
  #results .grid-layout.left { grid-template-columns: var(--side-width) minmax(0,1fr); }
  #results .grid-layout.right { grid-template-columns: minmax(0,1fr) var(--side-width); }
  #results .grid-layout.left.right { grid-template-columns: var(--side-width) minmax(0,1fr) var(--side-width); }
  /* Let the taller rail size the grid row. Additional posts scroll inside it. */
  #results .grid-layout:is(.left,.right) > .feed {
    contain: size;
    align-self: stretch;
    max-block-size: none;
  }
  #results .storefront-rail {
    align-self: start;
    position: sticky;
    top: min(90px,calc(100vh - var(--rail-height,0px) - 10px));
  }
  #results .storefront-rail [data-rail-end] .trade-card { min-height: 190px; aspect-ratio: 4 / 5; }
}
@media (max-width: 1279px) {
  #results .grid-layout:has(.catalogue-promotions) {
    grid-template-columns: minmax(0,1fr);
    grid-template-areas: var(--catalogue-areas,"promos" "main");
    row-gap: 12px;
  }
  .catalogue-promotions {
    grid-area: promos;
    display: flex;
    gap: 6px;
    align-items: center;
    min-width: 0;
  }
  .catalogue-promotions > button:not([hidden]) {
    display: grid;
    place-items: center;
    flex: none;
    position: static;
    width: 32px;
    height: 44px;
    padding: 0;
    transform: none;
  }
  .catalogue-promo-track {
    display: flex;
    gap: 10px;
    min-width: 0;
    flex: 1;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
  }
  #results .catalogue-promo-track :is(.storefront-rail,.rail-primary,.rail-additions) { display: contents; }
  .catalogue-promo-track :is(.rail-primary,.rail-additions) > * {
    flex: 0 0 clamp(175px,47vw,245px);
    scroll-snap-align: start;
  }
  #results .catalogue-promo-track .trade-card { min-height: 126px; aspect-ratio: 1.85; }
  .catalogue-promo-track .trade-copy { padding: 8px 12px; }
  .catalogue-promo-track .trade-copy strong { font-size: 1.2rem; }
  .catalogue-promo-track .trade-controls button { min-height: 36px; }

}

/* Horizontal shelves can be swiped sideways while vertical gestures move the page. */
main:has(.catalogue-search) :is(.category-shelf,.trade-track,.catalogue-promo-track) {
  overflow-y: hidden;
  overscroll-behavior-y: auto;
}

.catalogue-types { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; padding: 4px 0 8px; }
.catalogue-types a {
  display: inline-flex; align-items: center; min-height: 34px; padding: 4px 12px;
  color: #164653; background: #fff; border: 1px solid #b9cdd2; border-radius: 100px;
  font-size: .88rem; font-weight: 600; text-decoration: none;
}
.catalogue-types a[aria-current="page"] { color: white; background: #10515c; border-color: #10515c; }
.catalogue-types a:hover { border-color: #236974; }
.catalogue-types a:focus-visible { outline-offset: 1px; }
@media (max-width: 799px), (max-height: 700px) {
  main:has(.catalogue-search) .prime-banner .banner-inner { min-height: 90px; padding-block: 8px; }
}

@media (max-width: 1279px) and (max-height: 760px) {
  #results .grid-layout { --catalogue-areas: "main" "promos"; }
}
@media (max-width: 520px) {
  .catalogue-types, #results .feed-tools {
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
  }
  .catalogue-types a, #results .feed-tool { flex: none; white-space: nowrap; }
  main:has(.catalogue-search) .prime-banner .banner-inner {
    display: grid;
    grid-template-columns: minmax(0,1fr) auto;
    align-items: center;
    gap: 5px 8px;
  }
  .prime-banner .banner-copy { grid-column: 1 / -1; max-width: 100%; }
  .prime-banner .banner-contact { justify-self: start; }
  .prime-banner .prime-controls { margin: 0; }
}
