/**
 * PRODUCTS - GOMALOR
 * Cards de productos con animaciones hover
 */

/* ============================================
   SECCIÓN PRODUCTOS
   ============================================ */

.products {
  background-color: var(--color-white);
}

/* ============================================
   GRID DE PRODUCTOS
   ============================================ */

.products__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--space-xl);
  margin-top: var(--space-xl);
}

@media (min-width: 768px) {
  .products__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .products__grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ============================================
   PRODUCT CARD
   ============================================ */

.product-card {
  background-color: var(--color-white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: all var(--duration-normal) var(--easing-smooth);
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
}

.product-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-xl);
}

/* ============================================
   IMAGE WRAPPER
   ============================================ */

.product-card__image-wrapper {
  position: relative;
  width: 100%;
  padding-bottom: 100%; /* Aspect ratio 1:1 */
  overflow: hidden;
  background-color: var(--color-gray-lightest);
}

.product-card__image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform var(--duration-slow) var(--easing-smooth);
}

.product-card:hover .product-card__image {
  transform: scale(1.05);
}

/* Overlay sutil en hover */
.product-card__image-wrapper::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    to bottom,
    rgba(45, 80, 22, 0) 0%,
    rgba(45, 80, 22, 0.05) 100%
  );
  opacity: 0;
  transition: opacity var(--duration-normal) var(--easing-smooth);
  pointer-events: none;
  z-index: 1;
}

.product-card:hover .product-card__image-wrapper::after {
  opacity: 1;
}

/* ============================================
   CONTENT
   ============================================ */

.product-card__content {
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.product-card__title {
  font-family: var(--font-headings);
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  color: var(--color-primary);
  margin-bottom: var(--space-sm);
  transition: color var(--duration-normal) var(--easing-smooth);
}

.product-card:hover .product-card__title {
  color: var(--color-primary-light);
}

.product-card__description {
  font-size: var(--text-base);
  color: var(--color-gray-medium);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-md);
  flex-grow: 1;
}

/* ============================================
   LINK "MÁS INFORMACIÓN"
   ============================================ */

.product-card__link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--color-secondary);
  text-decoration: none;
  transition: all var(--duration-normal) var(--easing-smooth);
  margin-top: auto;
  position: relative;
  width: fit-content;
}

.product-card__link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--color-secondary);
  transition: width var(--duration-normal) var(--easing-smooth);
}

.product-card__link:hover {
  color: var(--color-secondary-dark);
  gap: 0.75rem;
}

.product-card__link:hover::after {
  width: 100%;
}

/* ============================================
   BADGE (opcional para destacados/nuevo)
   ============================================ */

.product-card__badge {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  background-color: var(--color-secondary);
  color: var(--color-white);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  text-transform: uppercase;
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-full);
  z-index: 2;
  box-shadow: var(--shadow-md);
}

/* ============================================
   ESTADOS ESPECIALES
   ============================================ */

/* Card destacado */
.product-card.featured {
  border: 2px solid var(--color-primary);
}

.product-card.featured::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
  z-index: 2;
}

/* ============================================
   LOADING STATE
   ============================================ */

.product-card.loading {
  pointer-events: none;
}

.product-card.loading .product-card__image-wrapper {
  background: linear-gradient(
    90deg,
    var(--color-gray-lightest) 0%,
    var(--color-gray-lighter) 50%,
    var(--color-gray-lightest) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.product-card.loading .product-card__title,
.product-card.loading .product-card__description,
.product-card.loading .product-card__link {
  background-color: var(--color-gray-lightest);
  color: transparent;
  border-radius: var(--radius-sm);
  animation: shimmer 1.5s infinite;
}

/* ============================================
   RESPONSIVE - MÓVIL
   ============================================ */

@media (max-width: 767px) {
  .products__grid {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
  }
  
  .product-card__content {
    padding: var(--space-md);
  }
  
  .product-card__title {
    font-size: var(--text-xl);
  }
  
  .product-card__description {
    font-size: var(--text-sm);
  }
  
  .product-card__link {
    font-size: var(--text-sm);
  }
  
  /* En móvil, efecto hover se activa al tocar */
  .product-card:active {
    transform: translateY(-4px);
  }
}

/* ============================================
   ANIMACIONES AOS (Animate On Scroll)
   ============================================ */

.product-card[data-aos] {
  transition-property: transform, opacity, box-shadow;
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
  .products__grid {
    display: block;
  }
  
  .product-card {
    page-break-inside: avoid;
    margin-bottom: var(--space-lg);
    box-shadow: none;
    border: 1px solid var(--color-gray-light);
  }
  
  .product-card:hover {
    transform: none;
  }
  
  .product-card__link {
    color: var(--color-black);
  }
}

/* ============================================
   ACCESIBILIDAD
   ============================================ */

.product-card:focus-within {
  outline: 2px solid var(--color-primary);
  outline-offset: 4px;
}

.product-card__link:focus {
  outline: 2px solid var(--color-secondary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ============================================
   VARIANTES DE DISEÑO (opcional)
   ============================================ */

/* Card horizontal (para layouts alternativos) */
.product-card--horizontal {
  flex-direction: row;
}

@media (min-width: 768px) {
  .product-card--horizontal .product-card__image-wrapper {
    width: 40%;
    padding-bottom: 0;
    position: relative;
  }
  
  .product-card--horizontal .product-card__image {
    position: static;
  }
  
  .product-card--horizontal .product-card__content {
    width: 60%;
  }
}

/* Card minimalista */
.product-card--minimal {
  box-shadow: none;
  border: 1px solid var(--color-gray-light);
}

.product-card--minimal:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
}