/**
 * Products Listing Page Component
 * Styles specific to the products catalog page
 */

.products-page {
  padding: 0 0 var(--space-8) 0;
  min-height: 80vh;
}

.products-page__header {
  text-align: center;
  margin-bottom: var(--space-12);
}

.products-page__title {
  font-size: var(--font-size-4xl);
  font-weight: var(--font-weight-bold);
  color: var(--primary);
  margin-bottom: var(--space-4);
}

.products-page__subtitle {
  font-size: var(--font-size-lg);
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto;
}

/* Products filter styles - uses shared filter-buttons component */


.product-grid {
  
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  width: 100%;
  min-height: 400px;
}


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

@media (min-width: 1024px) {
  .product-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1440px) {
  .product-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}


.product-grid--masonry {
  display: block;
  position: relative;
}


.product-card {
  cursor: pointer;
  opacity: 1;
  transition: opacity 0.3s ease, transform 0.4s ease;
  will-change: transform;
}


.product-grid--masonry .product-card {
  position: absolute;
}


.product-grid--transitioning {
  pointer-events: none;
}

.product-grid--transitioning .product-card {
  transition: left 0.6s cubic-bezier(0.4, 0, 0.2, 1), 
              top 0.6s cubic-bezier(0.4, 0, 0.2, 1), 
              opacity 0.3s ease;
}



.product-card--hidden {
  opacity: 0;
  pointer-events: none;
}

.product-card--visible {
  opacity: 1;
}

.product-card__link {
  display: block;
  text-decoration: none;
  color: inherit;
  height: 100%;
}

.product-card__inner {
  position: relative;
  width: 100%;
  height: auto;
}


.product-card__front,
.product-card__back {
  width: 100%;
  background-color: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: opacity 0.5s ease-in-out, box-shadow var(--transition-base);
}


.product-card__front {
  display: flex;
  flex-direction: column;
}


.product-card__back {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  display: flex;
  flex-direction: column;
  padding: var(--space-6);
  justify-content: center;
  align-items: center;
  text-align: center;
  background-color: var(--acl-accent-gray);
  color: white;
}


.product-card:hover .product-card__back {
  opacity: 1;
}

.product-card:hover .product-card__front,
.product-card:hover .product-card__back {
  box-shadow: var(--shadow-md);
}


.product-card__image {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background-color: var(--background-alt);
  display: block;
}

.product-card__placeholder {
  width: 100%;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--background-alt);
  color: var(--text-muted);
  font-size: var(--font-size-sm);
}


.product-card__content {
  padding: var(--space-3) var(--space-2);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  background-color: var(--acl-accent-gray);
  color: white;
  flex-shrink: 0;
}

.product-card__title {
  font-family: var(--font-primary);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: white;
  margin-bottom: 0;
  line-height: var(--line-height-tight);
  text-align: center;
  text-transform: uppercase;
}

.product-card__category {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}


.product-card__back .product-card__title {
  margin-bottom: var(--space-4);
  color: white;
}

.product-card__description {
  font-size: var(--font-size-base);
  color: white;
  line-height: var(--line-height-relaxed);
  margin-bottom: var(--space-4);
}

.product-card__price {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: var(--accent);
  margin-bottom: var(--space-4);
}

.product-card__cta {
  display: inline-flex;
  align-items: center;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--acl-red);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: color var(--transition-fast);
}

.product-card:hover .product-card__cta {
  color: var(--acl-red);
}


@media (max-width: 1200px) {
  .products-page__title {
    font-size: var(--font-size-3xl);
  }
}

@media (max-width: 768px) {
  .products-page {
    padding: var(--space-6) 0;
  }
  
  .products-page__header {
    margin-bottom: var(--space-8);
  }
  
  .products-page__title {
    font-size: var(--font-size-2xl);
  }
  
  .products-page__subtitle {
    font-size: var(--font-size-base);
  }
  
  .products-filter {
    margin-bottom: var(--space-6);
  }
  
  .product-card__inner {
    min-height: auto;
  }
  
  
  .product-card__title {
    font-size: var(--font-size-base);
  }
  
  .product-card__back {
    padding: var(--space-4);
  }
}


@media (max-width: 480px) {
  .product-card__inner {
    min-height: 280px;
    height: auto !important;
  }
  
  .product-card__content {
    padding: var(--space-4);
  }
  
  
  .product-card:hover .product-card__front {
    opacity: 1;
  }
  
  .product-card__back {
    display: none;
  }
  
  /* Force normal document flow on mobile */
  .product-grid {
    display: block !important;
    position: static !important;
    height: auto !important;
  }
  
  .product-grid--masonry {
    display: block !important;
    position: static !important;
    height: auto !important;
  }
  
  .product-grid--masonry .product-card {
    position: static !important;
    width: 100% !important;
    left: auto !important;
    top: auto !important;
    transform: none !important;
    margin-bottom: var(--space-4);
    height: auto !important;
    display: block !important;
  }
  
  .product-card {
    height: auto !important;
    position: static !important;
  }
  
  .product-card__front {
    height: auto !important;
    min-height: 280px;
    position: relative !important;
  }
  
  .product-card__image {
    flex: 0 0 auto;
    height: 200px;
  }
}

/* Product card animation states for performance optimization */
.product-card--animating {
  opacity: 0;
  transform: translateY(20px);
  transition: none;
}

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

.product-card--hiding {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}
/* Discontinued archive and empty-category notice */
.products-empty {
  color: var(--color-text-muted, #6b7280);
  padding: var(--space-8, 2rem) 0;
  text-align: center;
}

.products-archive {
  border-top: 1px solid var(--color-border, #e5e7eb);
  margin-top: var(--space-12, 3rem);
  padding-top: var(--space-8, 2rem);
}

.products-archive__title {
  font-size: var(--font-size-xl, 1.25rem);
  margin: 0 0 var(--space-2, 0.5rem);
}

.products-archive__intro {
  color: var(--color-text-muted, #6b7280);
  font-size: var(--font-size-sm, 0.875rem);
  margin: 0 0 var(--space-4, 1rem);
}

.products-archive__list {
  display: grid;
  gap: var(--space-2, 0.5rem);
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  list-style: none;
  margin: 0;
  padding: 0;
}

.products-archive__category {
  color: var(--color-text-muted, #6b7280);
  font-size: var(--font-size-sm, 0.875rem);
  margin-left: var(--space-2, 0.5rem);
}

/* Must stay last: the narrow-screen block above forces display:block !important on
   every card to restore normal flow, which outranks the inline display:none the filter
   sets. Same specificity as that rule, so only later source order wins the tie --
   move this up and category filtering silently stops working on phones again. */
.product-grid .product-card--hidden,
.product-grid--masonry .product-card--hidden {
  display: none !important;
}
