/**
 * @file
 * The block of the products viewed by the visitor: a row of the cards that
 * scrolls sideways on narrow screens.
 */

.sm-recent {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border, #e5e5e5);
}

.sm-recent[hidden] {
  display: none;
}

.sm-recent__title {
  margin: 0 0 1rem;
  font-size: 1.5rem;
}

.sm-recent__items {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 140px;
  gap: 1rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 0.5rem;
}

/*
 * Every card takes an eighth of the row on wide screens however many there
 * are, the narrow ones scroll the row.
 */
@media (min-width: 1024px) {
  .sm-recent__items {
    grid-auto-flow: row;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    overflow-x: visible;
  }
}

.sm-recent__item {
  /* The long titles do not widen the column. */
  min-width: 0;
  scroll-snap-align: start;
  font-size: 0.9rem;
}

/* A long title without spaces wraps inside the narrow card. */
.sm-recent__item .sm-card__sku {
  overflow-wrap: anywhere;
}
