/* ============================================================
   SILAB 3D · Productos
   Las tarjetas mantienen las clases que usa el catálogo dinámico
   (product-card, product-image, product-footer, btn-comprar…).
   Normas de carteles: MÁRGENES > ESPACIADO, contenido centrado.
   ============================================================ */

.catalog { padding-top: clamp(48px, 6vw, 72px); }

/* ---------- Filtros (se quedan a mano al bajar por el catálogo) ---------- */
.filters {
  position: sticky; top: calc(var(--s3d-header-h) + 10px); z-index: 20;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
  width: fit-content; max-width: 100%;
  margin: 0 auto clamp(28px, 4vw, 40px); padding: 6px;
  background: rgba(255,255,255,.88);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-radius: 999px; box-shadow: 0 0 0 1px var(--s3d-line), 0 8px 24px rgba(34,28,31,.06);
}
.filters .filter-btn { border-color: transparent; }
.filters .filter-btn:hover { border-color: var(--s3d-mist); }
.filter-btn {
  min-height: 40px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--s3d-line); background: var(--s3d-white); color: var(--s3d-ink);
  font: 500 14.5px/1 var(--s3d-sans); cursor: pointer;
  transition: border-color .2s, background-color .2s, color .2s;
}
.filter-btn:hover { border-color: var(--s3d-brand); color: var(--s3d-brand-ink); }
.filter-btn.active { background: var(--s3d-ink); border-color: var(--s3d-ink); color: var(--s3d-white); }
@media (max-width: 640px) {
  .filters {
    flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto;
    width: auto; max-width: none; border-radius: 0; box-shadow: 0 1px 0 var(--s3d-line);
    top: var(--s3d-header-h);
    margin-inline: calc(-1 * var(--s3d-gutter)); padding: 8px var(--s3d-gutter);
    scrollbar-width: none;
  }
  .filters::-webkit-scrollbar { display: none; }
  .filter-btn { flex: none; }
  /* Difuminado a la derecha: indica que hay más categorías deslizando */
  .filters { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 44px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 44px), transparent); }
  .filters.is-end { -webkit-mask-image: none; mask-image: none; }
}

/* ---------- Rejilla y tarjetas ---------- */
/* Catálogo: las tarjetas se centran en la fila (también la última, aunque esté incompleta)
   y sus componentes quedan alineados entre tarjetas: el nombre reserva dos líneas y el
   botón se apoya abajo. Excepción pedida para los catálogos a la norma 4 de carteles. */
.products-grid {
  --producto-margin: 22px; --producto-space: 16px;
  --cols: 4; --gap: 20px;
  display: flex; flex-wrap: wrap; justify-content: center; gap: var(--gap);
}
.product-card {
  flex: 0 1 calc((100% - (var(--cols) - 1) * var(--gap)) / var(--cols));
  min-width: 0;
  display: flex; flex-direction: column; align-items: center;
  gap: var(--producto-space); padding: var(--producto-margin);
  text-align: center;
  background: var(--s3d-white);
  border: 1px solid var(--s3d-line); border-radius: 18px;
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
.product-card:hover { border-color: var(--s3d-mist); box-shadow: var(--s3d-shadow); transform: translateY(-3px); }
.product-card.hidden { display: none; }
.product-image {
  width: 100%; aspect-ratio: 1 / 1; overflow: hidden;
  border-radius: 12px; background: var(--s3d-mist-soft);
}
.product-image img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.product-card:hover .product-image img { transform: scale(1.04); }
.product-card h3 {
  font-size: 17px; font-weight: 600; line-height: 1.3; margin-block: -.15em; color: var(--s3d-ink);
  display: flex; align-items: center; justify-content: center;
}
/* Si algún nombre visible ocupa dos líneas, todos reservan dos para seguir alineados */
.products-grid.names-2 .product-card h3 { min-height: 2.6em; }
.product-card p  { font-size: 14.5px; line-height: 1.5; margin-block: -.25em; color: var(--s3d-muted); }
.product-footer { width: 100%; display: flex; margin-top: auto; }
.btn-comprar, .btn-action, .btn-explorar {
  flex: 1; min-height: 42px; padding: 0 16px; border-radius: 999px; cursor: pointer;
  border: 1.5px solid var(--s3d-mist); background: var(--s3d-white); color: var(--s3d-brand-ink);
  font: 600 14.5px/1 var(--s3d-sans);
  transition: background-color .2s, border-color .2s, color .2s;
}
.btn-comprar:hover, .btn-action:hover, .btn-explorar:hover,
.product-card:hover .btn-comprar, .product-card:hover .btn-action, .product-card:hover .btn-explorar {
  background: var(--s3d-brand); border-color: var(--s3d-brand); color: var(--s3d-white);
}
@keyframes s3d-fade-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.product-card.is-shown { animation: s3d-fade-up .35s ease both; }

@media (max-width: 1100px) { .products-grid { --cols: 3; } }
@media (max-width: 760px)  { .products-grid { --cols: 2; --gap: 14px; } }
@media (max-width: 480px)  {
  .products-grid { --producto-margin: 14px; --producto-space: 12px; --gap: 12px; }
  .product-card h3 { font-size: 15.5px; }
  .product-card p { font-size: 13.5px; }
  .btn-comprar, .btn-action, .btn-explorar { min-height: 38px; font-size: 14px; }
}

/* ---------- A medida ---------- */
.custom-grid {
  --medida-margin: 26px; --medida-space: 16px;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px;
  max-width: 1000px; margin: 0 auto;
}
.custom-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--medida-space); padding: var(--medida-margin); text-align: center;
  background: var(--s3d-white); border: 1px solid var(--s3d-line); border-radius: 18px;
}
.custom-icon {
  width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center;
  background: var(--s3d-mist-soft); color: var(--s3d-brand);
}
.custom-icon .s3d-icon { width: 26px; height: 26px; }
.custom__actions { margin-top: 36px; display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.custom__actions .s3d-btn { min-height: 48px; padding: 0 24px; font-size: 15.5px; }
.custom__actions .s3d-btn--ghost { background: var(--s3d-white); }
@media (max-width: 760px) { .custom-grid { grid-template-columns: 1fr; max-width: 460px; } }
@media (max-width: 480px) { .custom-grid { --medida-margin: 20px; --medida-space: 12px; } }

/* Enlaces del modal de bibliotecas */
.s3d-modal__links a span { display: inline-flex; align-items: center; gap: 6px; }
.s3d-modal__links .s3d-icon { width: 16px; height: 16px; }
