/* Products page composition layer */

.hero {
  min-height: clamp(170px, 30vh, 250px);
}

.grid-section {
  padding-block: 0 var(--sf-space-8);
}

.filters-box {
  width: min(100%, var(--sf-container-max));
  margin: 0 auto var(--sf-space-5);
  padding-inline: var(--sf-space-4);
}

.filters-toggle {
  width: 100%;
  justify-content: space-between;
}

.filters-panel {
  margin-top: var(--sf-space-3);
  padding: var(--sf-space-4);
  border: 1px solid var(--sf-border-subtle);
  border-radius: var(--sf-radius-lg);
  background: color-mix(in srgb, var(--theme-section-bg) 94%, transparent);
  box-shadow: var(--sf-shadow-soft);
  display: grid;
  gap: var(--sf-space-3);
}

.filters-panel[aria-hidden="true"] {
  display: none;
}

.filter-group {
  border: 1px solid color-mix(in srgb, var(--theme-border) 75%, transparent);
  border-radius: var(--sf-radius-md);
  background: var(--theme-card-bg);
}

.filter-label {
  width: 100%;
  justify-content: space-between;
  border: none;
  border-radius: var(--sf-radius-md);
  box-shadow: none;
}

.filter-options {
  display: none;
  padding: var(--sf-space-3);
  gap: var(--sf-space-2);
  flex-wrap: wrap;
}

.filter-options.open {
  display: flex;
}

.filter-option {
  border: 1px solid var(--theme-secondary-btn-border);
  background: var(--theme-secondary-btn-bg);
  color: var(--theme-secondary-btn-text);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.9rem;
  cursor: pointer;
}

.filter-option.active {
  border-color: var(--theme-primary-btn-border);
  background: color-mix(in srgb, var(--theme-primary-btn-bg) 14%, var(--theme-card-bg));
  color: var(--theme-nav-active);
}

.filters-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sf-space-3);
}

.filters-summary {
  color: var(--theme-text-muted);
  font-size: 0.9rem;
}

.product-card {
  display: grid;
  grid-template-rows: 170px auto;
  height: auto;
}

.products-grid {
  grid-template-columns: repeat(auto-fill, minmax(210px, 210px));
  justify-content: center;
}

.product-image-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 170px;
  overflow: hidden;
  padding: 8px 10px 4px;
  background: color-mix(in srgb, var(--theme-section-bg) 70%, transparent);
}

.product-image {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
  margin-inline: auto;
  border-radius: var(--sf-radius-md);
}

.product-subtype-sticker {
  position: absolute;
  top: 8px;
  right: 8px;
  max-width: calc(100% - 16px);
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--theme-primary-btn-border) 70%, transparent);
  background: color-mix(in srgb, var(--theme-primary-btn-bg) 88%, #000 12%);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  z-index: 2;
}

.product-info {
  display: grid;
  gap: 4px;
  align-content: start;
  text-align: center;
  min-height: 92px;
  padding: 8px;
  overflow: visible;
}

.product-name {
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.3;
  display: block;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  word-break: break-word;
}

.product-brand,
.product-price {
  font-size: 0.9rem;
  line-height: 1.25;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  word-break: break-word;
}

.product-brand {
  color: var(--theme-text-secondary);
  font-weight: 400;
}

.product-price {
  color: var(--theme-nav-active);
  font-weight: 700;
}

.product-card {
  opacity: 0;
  transform: translateY(16px);
}

.product-card.is-visible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

@media (max-width: 700px) {
  .products-grid {
    grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
    gap: var(--sf-space-3);
  }

  .product-image-wrapper {
    height: 142px;
    padding: 6px 8px 2px;
  }

  .product-card {
    grid-template-rows: 142px auto;
  }

  .product-info {
    padding: 8px;
  }

  .product-name {
    font-size: 0.9rem;
    line-height: 1.3;
  }

  .product-brand,
  .product-price {
    font-size: 0.8rem;
    line-height: 1.25;
  }

  .product-subtype-sticker {
    top: 6px;
    right: 6px;
    max-width: calc(100% - 12px);
    font-size: 0.66rem;
  }
}

@media (max-width: 460px) {
  .products-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .product-image-wrapper {
    height: 136px;
  }

  .product-card {
    grid-template-rows: 136px auto;
  }
}
