/* ==========================================================================
   Røros – Search results page (search.php)
   No Figma frame for the page. Title as on "Handlekorj" (2157:7178), cards as
   «Inspirasjon fra kjøkkenet» on the product page (2153:6154), what each result
   is as the caption in "Search result" (2146:4289).
   Search field: header-search.css. Chips, Card / Dairy product and the popular
   sections' heading with «Alle …»: products.css. Card / Recipe: product-single.css.
   Card / Shop product: shop.css (.shop-card--vertical keeps it vertical on mobile).
   ========================================================================== */

.search-page {
  width: calc(100% - 32px);
  max-width: 1080px;
  margin: 0 auto;
  padding: 48px 0 120px;
  color: var(--roros-color-text-primary);
  font-family: var(--roros-font-family-ui);
}

/* Title, search field and group chips */
.search-page__top {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Title – Heading/H1 with the count beside it in Body/Default secondary */
.search-page__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 16px;
}

.search-page .search-page__title {
  margin: 0;
  color: var(--roros-color-text-primary);
  font-family: var(--roros-font-family-display);
  font-size: var(--roros-font-size-h1);
  font-weight: normal;
  line-height: var(--roros-line-height-h1);
  letter-spacing: 0;
  text-transform: none;
}

.search-page :is(.search-page__count, .search-page__empty p) {
  margin: 0;
  font-family: var(--roros-font-family-ui);
  font-size: var(--roros-font-size-body);
  line-height: var(--roros-line-height-body);
}

.search-page .search-page__count {
  color: var(--roros-color-text-secondary);
}

/* Group chips – the shop's category chips (8px apart), wrapping on mobile
   instead of scrolling sideways */
.search-page__types ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.search-page__types li {
  margin: 0;
}

.search-page__top + .search-grid {
  margin-top: 48px;
}

.search-page nav.pagination {
  margin: 48px 0 0;
}

/* No results: "Ingen treff på «…»" and "Mente du …?" */
.search-page__empty {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 48px;
}

.search-page .search-page__suggestion {
  color: var(--roros-color-text-secondary);
}

.search-page .search-page__term {
  color: var(--roros-color-text-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Cards: the product page's row of four 255px cards (20px apart), wrapping
   instead of scrolling. Cards fill their cell, so a row's cards are equally tall. */
.search-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.search-grid > li {
  display: flex;
  margin: 0;
}

.search-grid > li > * {
  flex: 1;
  min-width: 0;
}

/* What the result is – Figma "Search result" caption: UI/Caption, secondary */
.search-page .card-type {
  display: block;
  font-family: var(--roros-font-family-ui);
  font-size: var(--roros-font-size-caption);
  line-height: var(--roros-line-height-caption);
  color: var(--roros-color-text-secondary);
}

/* In line with the dairy card's title */
.search-page .product-card .card-type {
  padding-inline: 0.5rem;
}

/* Long words («Tjukkmjølkspannacotta») would run out of narrow cards –
   break them, with a hyphen where the browser can */
.search-grid :is(.recipe-title, .product-card__title, .shop-card__title) {
  overflow-wrap: anywhere;
  hyphens: auto;
}

/* Mobile – two cards across, no sideways scrolling */
@media (max-width: 959px) {
  .search-page {
    padding: 24px 0 64px;
  }

  .search-page__top {
    gap: 16px;
  }

  .search-page__top + .search-grid {
    margin-top: 24px;
  }

  .search-page nav.pagination {
    margin-top: 24px;
  }

  .search-page__empty {
    margin-top: 24px;
  }

  .search-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
}
