/* =========================================================
   CONSTRUAGO — Catálogo (solo estilos nuevos)
   Reusa variables y componentes de styles.css. No los redefine.
   ========================================================= */

/* —— Nav: enlace activo (subrayado verde permanente) —————————— */
.nav__links a.is-active { color: var(--brand); }
.nav__links a.is-active::after { transform: scaleX(1); }

/* —— Encabezado del catálogo ————————————————————————— */
.catalog {
  padding: clamp(96px, 12vw, 140px) 0 var(--pad-y);
}
.catalog__intro {
  font-size: clamp(15px, 1.2vw, 17px);
  line-height: 1.65;
  color: var(--stone);
  max-width: 62ch;
}

/* —— Barra de control: búsqueda + chips + contador ——————————— */
.controls {
  margin: 40px 0 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.controls__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.search {
  position: relative;
  flex: 1 1 360px;
  max-width: 460px;
}
.search__icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--stone-2);
  pointer-events: none;
}
.search__input {
  width: 100%;
  font-family: var(--sans);
  font-size: 15px;
  color: var(--ink);
  padding: 14px 16px 14px 46px;
  border: 1px solid var(--rule);
  border-radius: var(--rad);
  background: var(--paper);
  transition: border-color .25s var(--easing), box-shadow .25s var(--easing);
}
.search__input::placeholder { color: var(--stone-2); }
.search__input:focus {
  outline: none;
  border-color: var(--brand-light);
  box-shadow: 0 0 0 3px rgba(79, 159, 63, 0.15);
}

.results-count {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--stone);
  white-space: nowrap;
}
.results-count strong { color: var(--brand-dark); }

/* —— Chips de filtro por categoría —————————————————————— */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.chip {
  font-family: var(--sans);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1;
  padding: 10px 16px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--paper);
  color: var(--stone);
  cursor: pointer;
  transition: all .25s var(--easing);
  white-space: nowrap;
}
.chip:hover {
  border-color: var(--brand-light);
  color: var(--brand-dark);
}
.chip.is-active {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--paper);
}

/* —— Grid de tarjetas —————————————————————————————— */
.catalog__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 24px;
}

/* —— Tarjeta de producto (hereda lenguaje de .product) ——————————— */
.pcard {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--rad-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: transform .35s var(--easing), box-shadow .35s var(--easing), border-color .35s var(--easing);
}
.pcard::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 0; height: 4px;
  background: var(--brand-light);
  transition: width .4s var(--easing);
  z-index: 2;
}
.pcard:hover {
  border-color: var(--brand-light);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}
.pcard:hover::before { width: 100%; }

.pcard__media {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
  padding: 12px;
}
.pcard__media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.pcard__body {
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}
.pcard__cat {
  font-family: var(--sans);
  font-size: 10.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--brand);
  margin-bottom: 8px;
}
.pcard__title {
  font-family: var(--display);
  font-weight: 600;
  font-size: 16px;
  line-height: 1.3;
  color: var(--ink);
  margin: 0 0 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.6em;
}
.pcard__unit {
  font-size: 13px;
  color: var(--stone);
  margin: 0 0 4px;
}
.pcard__price {
  font-family: var(--display);
  font-size: 17px;
  font-weight: 600;
  color: var(--brand-dark);
  margin: 4px 0 0;
}
.pcard__price span {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  color: var(--stone-2);
}
.pcard__cta {
  margin-top: 16px;
  width: 100%;
  padding: 12px 16px;
  font-size: 14px;
}

/* —— Estado vacío —————————————————————————————————— */
.empty {
  text-align: center;
  padding: 64px 24px;
  color: var(--stone);
}
.empty__title {
  font-family: var(--display);
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 8px;
}
.empty .btn { margin-top: 20px; }

/* —— Aviso / disclaimer obligatorio ————————————————————— */
.catalog__note {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 40px;
  padding: 14px 18px;
  background: var(--brand-tint);
  border-radius: var(--rad);
  color: var(--stone);
  font-size: 13px;
  line-height: 1.5;
}
.catalog__note svg { color: var(--brand); flex-shrink: 0; }

/* —— Fade-in sutil al renderizar (sin observer por tarjeta) ———————— */
.catalog__grid.is-ready .pcard {
  animation: pcard-in .5s var(--easing) both;
  animation-delay: calc(var(--i, 0) * 35ms);
}
@keyframes pcard-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .catalog__grid.is-ready .pcard { animation: none; }
  .pcard:hover { transform: none; }
}

@media (max-width: 600px) {
  /* padding-bottom: aire para que el FAB de WhatsApp (fixed, abajo-derecha)
     no tape el botón "Cotizar" de las últimas tarjetas en pantallas angostas */
  .catalog__grid { grid-template-columns: repeat(2, 1fr); gap: 16px; padding-bottom: 96px; }
  .pcard__body { padding: 14px 14px 16px; }
  .pcard__title { font-size: 14.5px; }
  .controls__row { gap: 12px; }
  .results-count { width: 100%; }
}
/* 1 columna en celulares estándar (≤480px = 390–430px caen aquí), tarjeta más grande */
@media (max-width: 480px) {
  .catalog__grid { grid-template-columns: 1fr; }
}
