/* ======== GRID PRINCIPAL ======== */
.portfolio {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)); /* 4 columnas reales */
  gap: 1.5rem;
  padding: 2rem;
  margin: 0 auto;
  width: 60%;
  max-width: 1400px;
  box-sizing: border-box;
}

.product-item {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  width: 100%;            /* cada celda ocupa su fracción del grid */
  box-sizing: border-box; /* sin desbordes */
}

.product-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.12);
}

/* ======== IMAGEN ======== */
.product-item img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-bottom: 1px solid var(--color-border);
  transition: opacity 0.3s ease;
  display: block;
}

.product-item:hover img {
  opacity: 0.9;
}

/* ======== NOMBRE Y PRECIO ======== */
.product-name {
  font-size: 1rem;
  font-weight: 600;
  margin: 0.8rem 1rem 0.3rem;
  text-align: center;
  color: var(--color-text);
}

.price-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1rem 1rem;
}

.price {
  font-size: 1.1rem;
  color: var(--color-primary);
  margin: 0;
}

.price-placeholder {
  flex: 1;
}

.key-add-btn {
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
}

.key-add {
  width: 28px;
  height: 28px;
  transition: transform 0.2s ease;
}

.key-add-btn:hover .key-add {
  transform: scale(1.15);
}

/* ======== RESPONSIVE ======== */
@media (max-width: 1200px) {
  .portfolio {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .portfolio {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 1rem;
  }
}

@media (max-width: 600px) {
  .portfolio {
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 1rem;
  }

  .product-item img {
    height: 180px;
  }
}
