/* Match the first catalogue layout and preserve the same controls on resize. */
#searchFilterCount { display:none; }

.search-results-page #searchDiscoveryTools { display:none; }

@media (max-width:1050px) {
  body.search-results-page #searchDiscoveryTools {
    position:sticky; top:calc(var(--topbar-height,66px) + 8px); z-index:70;
    display:flex; justify-content:flex-end; align-items:center; width:max-content; max-width:100%; margin:0 0 0 auto;
    border-radius:12px; background:#f3f5fa; isolation:isolate; overflow:visible;
  }
  body.search-results-page #searchDiscoveryTools::before {
    content:""; position:absolute; z-index:-1; inset:-8px -5px;
    border:1px solid #e5e0ef; border-radius:17px; background:#f3f5faf5;
    box-shadow:0 4px 16px #34205b0b; pointer-events:none;
  }
  body.search-results-page .rs-toolbar {
    position:static; top:auto; z-index:auto; box-shadow:none;
  }
  body.search-results-page #searchFilterOpen {
    display:inline-flex; align-items:center; justify-content:center;
    width:100%; min-height:44px; margin:0; border-radius:12px;
  }
  body.search-results-page #searchFilterOpen #searchFilterCount:not([hidden]) {
    display:inline-grid; place-items:center; flex:none; min-width:17px;
    height:18px; padding:0 4px; border-radius:5px;
    background:var(--outlo-primary-fill,var(--outlo-action-fill)); color:#fff;
    font-size:11px; line-height:18px; font-weight:550;
  }
}

/* Both views are visible choices, including the one that is not selected. */
body.search-results-page #searchViewToggle {
  gap:8px; padding:0; border:0; border-radius:12px;
  background:transparent; box-shadow:none;
}
body.search-results-page #searchViewToggle .rs-icon-button {
  width:44px; min-width:44px; height:44px; min-height:44px;
  border:1px solid #c6bfdf; border-radius:12px;
  background:#fff; color:#514574; box-shadow:0 1px 3px #30244f0a;
}
body.search-results-page #searchViewToggle .rs-icon-button:hover {
  border-color:#a69acb; background:#f3efff; color:#3e3068;
}
body.search-results-page #searchViewToggle .rs-icon-button[aria-pressed="true"] {
  border-color:transparent; background:var(--outlo-primary-fill,var(--outlo-action-fill)) no-repeat border-box;
  color:#fff; box-shadow:0 2px 6px #4f46e522;
}
body.search-results-page #searchViewToggle .rs-icon-button[aria-pressed="true"]:hover {
  background:var(--outlo-primary-hover,var(--outlo-action-hover)) no-repeat border-box;
}
body.search-results-page #searchViewToggle .rs-icon-button:active {
  background:var(--outlo-primary-pressed,var(--outlo-action-pressed)) no-repeat border-box; color:#fff;
}

@media (max-width:560px) {
  body.search-results-page #resultsMain {
    --rs-mobile-control-column:96px;
    display:grid; grid-template-columns:minmax(0,1fr) var(--rs-mobile-control-column);
    grid-template-rows:auto auto; column-gap:8px; padding-top:16px;
  }
  body.search-results-page #resultsMain>.rs-heading {
    grid-column:1 / -1; grid-row:1; min-width:0; margin-inline:0;
  }
  body.search-results-page #resultsMain>.rs-layout { grid-column:1 / -1; grid-row:2; min-width:0; }
  /* The filter starts beside the type selector and stays sticky through the results. */
  body.search-results-page #resultsMain>#searchDiscoveryTools {
    grid-column:2; grid-row:1 / span 2; align-self:start; justify-self:end;
  }
  body.search-results-page .rs-heading { padding:0; }
  body.search-results-page .rs-heading-row { margin-bottom:12px; }
  body.search-results-page :is(.rs-heading-copy,.rs-heading-copy>div) { width:100%; }
  body.search-results-page .rs-title-line {
    display:grid; grid-template-columns:minmax(0,1fr) var(--rs-mobile-control-column);
    align-items:start; gap:4px 8px; min-height:44px; width:100%;
  }
  /* Keep the live query heading available to assistive technology. */
  body.search-results-page #searchResultsTitle {
    position:absolute; width:1px; height:1px; padding:0; margin:-1px;
    overflow:hidden; clip-path:inset(50%); white-space:nowrap; border:0;
  }
  body.search-results-page .rs-title-line>.rs-type-mobile {
    position:relative; display:block; grid-column:1; grid-row:1; justify-self:start;
    min-width:0; max-width:100%; margin:0;
  }
  body.search-results-page .rs-title-line>.rs-type-mobile::after {
    content:""; position:absolute; top:50%; right:15px; width:8px; height:8px;
    border-right:2px solid #68529e; border-bottom:2px solid #68529e;
    transform:translateY(-70%) rotate(45deg); pointer-events:none;
  }
  body.search-results-page #searchTypeSelect {
    appearance:none; width:auto; max-width:100%; min-width:0; min-height:44px; height:44px;
    padding:0 38px 0 12px; border:1px solid #d5cbea; border-radius:12px;
    background:#f5f1ff; box-shadow:0 1px 2px #30244f05; cursor:pointer;
    color:var(--rs-ink); font-size:20px; font-weight:650; letter-spacing:-.35px;
    text-overflow:ellipsis; scroll-margin-top:calc(var(--topbar-height,66px) + 16px);
  }
  @supports (field-sizing:content) {
    body.search-results-page #searchTypeSelect { field-sizing:content; }
  }
  body.search-results-page #searchTypeSelect:hover {
    border-color:#b7a5da; background:#eee7ff;
  }
  body.search-results-page #searchResultsCount {
    grid-column:1 / -1; grid-row:2; min-width:0; max-width:100%; margin:0; padding:0;
    background:transparent; color:var(--rs-muted); font-size:13px;
    font-weight:500; line-height:1.4; text-align:left; overflow-wrap:anywhere;
  }
  body.search-results-page .rs-search-navigation {
    display:block; padding:0; border:0;
  }
  body.search-results-page .rs-search-navigation>.rs-tabs { display:none; }
  body.search-results-page #searchFilterOpen {
    display:inline-flex; align-items:center; justify-content:center;
    width:var(--rs-mobile-control-column); min-width:var(--rs-mobile-control-column); height:44px; min-height:44px;
    margin:0; padding:6px; gap:4px; border-radius:12px; font-size:13px;
    font-weight:550; white-space:nowrap;
  }
  body.search-results-page #searchFilterOpen [data-rs-icon] { display:inline-flex; }
  body.search-results-page #searchFilterOpen svg { width:16px; height:16px; }
  body.search-results-page #searchFilterOpen #searchFilterCount:not([hidden]) {
    display:inline-grid; place-items:center; flex:none; min-width:17px;
    height:18px; padding:0 4px; border-radius:5px;
    background:var(--outlo-primary-fill,var(--outlo-action-fill)); color:#fff;
    font-size:11px; line-height:18px; font-weight:550;
  }
  body.search-results-page .rs-layout { padding-top:8px; }
  body.search-results-page .rs-toolbar {
    display:grid; grid-template-columns:minmax(0,1fr) var(--rs-mobile-control-column); align-items:center;
    gap:8px; min-height:44px; padding:0; margin:0 0 14px; border:0;
    border-radius:0; background:var(--page-bg,#f3f6fb); box-shadow:none;
    top:calc(var(--topbar-height,66px) + 8px);
  }
  body.search-results-page .rs-toolbar:has(#searchViewToggle[hidden]) {
    grid-template-columns:minmax(0,1fr);
  }
  body.search-results-page .rs-toolbar>.rs-sort {
    grid-column:1; grid-row:1; width:100%; min-width:0; margin:0;
    order:0; flex-basis:auto; border-radius:12px;
  }
  body.search-results-page .rs-sort-icon { display:none; }
  body.search-results-page .rs-sort::after { right:12px; }
  body.search-results-page .rs-sort select {
    width:100%; max-width:100%; min-width:0; height:44px; min-height:44px;
    padding:0 29px 0 11px; border:1px solid var(--rs-line); border-radius:12px;
    background:#fff; color:var(--rs-ink); font-size:16px; font-weight:500;
  }
  body.search-results-page #searchViewToggle {
    grid-column:2; grid-row:1; display:flex; justify-content:center; gap:8px;
    width:var(--rs-mobile-control-column); height:44px; min-height:44px; margin:0; padding:0; border:0;
    border-radius:12px; background:transparent; box-shadow:none;
  }
  body.search-results-page #searchViewToggle .rs-icon-button {
    width:44px; min-width:44px; height:44px; min-height:44px; padding:0;
    border-radius:12px;
  }
  body.search-results-page .rs-toolbar>.rs-active-controls {
    grid-column:1 / -1; grid-row:2; order:0;
  }
  body.search-results-page .rs-active-controls > button { max-width:100%; }
}

@media (forced-colors:active) {
  body.search-results-page #searchViewToggle .rs-icon-button {
    border-color:ButtonText; background:ButtonFace; color:ButtonText; box-shadow:none;
  }
  body.search-results-page #searchViewToggle .rs-icon-button[aria-pressed="true"] {
    border-color:Highlight; background:Highlight; color:HighlightText;
    outline:2px solid Highlight; outline-offset:1px;
  }
  body.search-results-page #searchTypeSelect,
  body.search-results-page #searchResultsCount { border-color:ButtonText; }
  body.search-results-page .rs-title-line>.rs-type-mobile::after {
    border-color:ButtonText;
  }
  body.search-results-page #searchFilterOpen #searchFilterCount:not([hidden]) { background:Highlight; color:HighlightText; }
}
