/*
  public/CSS/PAGES/products/catalog.css
  The catalog section of the products page: the category tabs, one panel per
  category and the product cards. Linked by views/PAGES/products/sections/catalog.ejs.
*/

.featured + .catalog {
  padding-top: clamp(16px, 3vw, 40px);
}

.catalog-heading {
  margin-bottom: 24px;
  font-size: clamp(1.5rem, 2.4vw, 1.9rem);
}

/* ---------- The category tabs: one tile per category ---------- */

.category-tabs {
  margin-bottom: clamp(28px, 4vw, 44px);
}

.category-tab-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 10px;
}

.category-tab {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 100%;
  padding: 14px 18px;
  border: 1.5px solid var(--category-tab-border);
  border-radius: 14px;
  background: var(--category-tab-background);
  text-decoration: none;
  transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease), color 0.2s var(--ease);
}

.category-tab:hover {
  border-color: var(--control-hover-border);
  color: var(--body-text);
}

.category-tab .icon-tile {
  width: 44px;
  height: 44px;
}

.category-tab .icon-tile .icon {
  width: 22px;
  height: 22px;
}

.category-tab-text {
  display: grid;
  line-height: 1.3;
}

.category-tab-title {
  font-weight: 650;
}

.category-tab-count {
  color: var(--category-tab-count-text);
  font-size: 0.9rem;
}

/* The open tab (set by category-tabs.js). */
.category-tab[aria-selected="true"] {
  border-color: var(--category-tab-selected-background);
  background: var(--category-tab-selected-background);
  color: var(--category-tab-selected-text);
}

.category-tab[aria-selected="true"] .icon-tile {
  background: var(--dark-icon-tile-background);
  color: var(--dark-icon-tile-icon);
}

.category-tab[aria-selected="true"] .category-tab-count {
  color: var(--category-tab-selected-count-text);
}

/* Phones: the tabs become one row that scrolls sideways. */
@media (max-width: 639px) {
  .category-tab-list {
    display: flex;
    gap: 8px;
    margin-inline: calc(var(--gutter) * -1);
    padding: 2px var(--gutter) 8px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
  }

  .category-tab-list li {
    flex: 0 0 auto;
    scroll-snap-align: start;
  }

  .category-tab {
    padding: 10px 14px 10px 10px;
  }

  .category-tab .icon-tile {
    width: 36px;
    height: 36px;
  }
}

/* ---------- One category ---------- */

.category-panel + .category-panel {
  margin-top: clamp(48px, 6vw, 72px);
}

/* With the tabs, only one panel is shown, so no space is kept between them. */
.has-tabs .category-panel + .category-panel {
  margin-top: 0;
}

.category-panel-heading {
  margin-bottom: 28px;
}

.category-panel-heading h3 {
  margin-bottom: 10px;
  font-size: clamp(1.7rem, 3vw, 2.2rem);
}

.category-panel-heading .lead {
  max-width: 62ch;
}

/* ---------- Product cards ---------- */

.product-grid {
  display: grid;
  gap: 16px;
}

@media (min-width: 760px) {
  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.product-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: clamp(24px, 3vw, 34px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-panel);
  background: var(--card-background);
  scroll-margin-top: calc(var(--header-height) + 24px);
  transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

/* The product opened from the featured banner. */
.product-card:target {
  border-color: var(--card-target-border);
  box-shadow: 0 0 0 3px var(--card-target-ring);
}

.product-card h4 {
  margin-top: 6px;
  font-family: var(--font-heading);
  font-size: clamp(1.3rem, 2vw, 1.5rem);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.product-card-summary {
  color: var(--muted-text);
}

.product-includes {
  margin-top: 6px;
  font-size: 0.97rem;
}

.product-card-link {
  align-self: flex-start;
  margin-top: auto;
  padding-top: 12px;
}
