/* ========================================
   CATALOGO DE SERVICIOS  ·  /servicios
   ----------------------------------------
   La rejilla esta agrupada por NECESIDAD del visitante, no por nuestras
   categorias internas: quien llega no sabe si lo suyo es "un CRM" o "una
   automatizacion", sabe que se le va el dia contestando WhatsApp.
   Los filtros de arriba y los grupos son la MISMA taxonomia, por eso filtrar
   esconde grupos enteros en vez de rebarajar tarjetas sueltas.
   ======================================== */

/* ---------- Superficie del catalogo ----------
   Las lineas doradas de fondo son fijas y viven detras de todo (z-index 0).
   En el hero decoran; sobre 18 tarjetas de lectura estorban. El catalogo se
   sienta encima con fondo solido y un degradado que suaviza el corte. */
.cat-section {
  position: relative;
  z-index: 1;
  background: var(--white);
  padding-bottom: 96px;
}
.cat-section::before {
  content: '';
  position: absolute;
  left: 0; right: 0; top: -170px;
  height: 170px;
  background: linear-gradient(to bottom, rgba(255,255,255,0), var(--white));
  pointer-events: none;
}

/* ---------- Barra de filtros ---------- */
.cat-filters {
  position: sticky;
  top: calc(var(--nav-height) + 14px);
  z-index: 30;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  padding: 14px 0;
  margin-bottom: 8px;
}
.cat-filters::before {
  /* velo detras de las pastillas para que el contenido no se lea por debajo
     mientras estan pegadas arriba */
  content: '';
  position: absolute;
  inset: -14px -24px;
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 999px;
  z-index: -1;
}
.cat-pill {
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-600);
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 999px;
  padding: 9px 18px;
  cursor: pointer;
  transition: color .25s, border-color .25s, background .25s;
}
.cat-pill:hover { color: var(--gray-900); border-color: var(--gray-300); }
.cat-pill[aria-pressed="true"] {
  color: var(--white);
  background: var(--gray-950);
  border-color: var(--gray-950);
}
.cat-pill:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Grupo ---------- */
.cat-group { padding: 44px 0 8px; }
.cat-group[hidden] { display: none; }
.cat-group-head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 24px;
}
.cat-group-head h2 {
  font-family: 'Outfit', sans-serif;
  font-size: clamp(22px, 2.6vw, 30px);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--gray-950);
  white-space: nowrap;
}
.cat-group-rule {
  flex: 1;
  height: 1px;
  background: var(--gray-200);
}
.cat-group-link {
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 1px solid transparent;
  transition: border-color .25s;
}
.cat-group-link:hover { border-bottom-color: var(--accent); }

/* ---------- Rejilla ---------- */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

/* ---------- Tarjeta ---------- */
.cat-card {
  position: relative;
  display: block;
  padding: 24px 22px 22px;
  border: 1px solid var(--gray-200);
  border-radius: 16px;
  background: var(--white);
  cursor: pointer;
  transition: border-color .3s, box-shadow .3s, transform .3s cubic-bezier(.22,1,.36,1);
}
.cat-card:hover {
  border-color: var(--gray-300);
  transform: translateY(-3px);
  box-shadow: 0 14px 30px rgba(0,0,0,.06);
}
.cat-card:has(.cat-check:focus-visible) { outline: 2px solid var(--accent); outline-offset: 3px; }

/* El checkbox real vive escondido pero sigue siendo el que manda: teclado y
   lectores de pantalla funcionan sin JS de mas. */
.cat-check {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0;
  pointer-events: none;
}

.cat-mark {
  position: absolute;
  top: 20px; right: 20px;
  width: 24px; height: 24px;
  border: 1.5px solid var(--gray-300);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  transition: border-color .25s, background .25s, color .25s;
}
.cat-mark svg { width: 13px; height: 13px; }
.cat-mark::after {
  /* el "+" en reposo: desaparece cuando entra el check */
  content: '';
  position: absolute;
  width: 10px; height: 10px;
  background:
    linear-gradient(var(--gray-400), var(--gray-400)) center/10px 1.5px no-repeat,
    linear-gradient(var(--gray-400), var(--gray-400)) center/1.5px 10px no-repeat;
  transition: opacity .2s;
}
.cat-card:hover .cat-mark { border-color: var(--accent); }
.cat-card:hover .cat-mark::after {
  background:
    linear-gradient(var(--accent), var(--accent)) center/10px 1.5px no-repeat,
    linear-gradient(var(--accent), var(--accent)) center/1.5px 10px no-repeat;
}

.cat-card h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--gray-950);
  margin: 0 34px 7px 0;
}
.cat-what {
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  line-height: 1.55;
  color: var(--gray-600);
  margin-bottom: 16px;
}
.cat-inc {
  list-style: none;
  border-top: 1px solid var(--gray-100);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.cat-inc li {
  position: relative;
  padding-left: 15px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  line-height: 1.45;
  color: var(--gray-500);
}
.cat-inc li::before {
  content: '';
  position: absolute;
  left: 0; top: 7px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--gray-300);
  transition: background .25s;
}

/* ---------- Estado elegido ---------- */
.cat-card:has(.cat-check:checked) {
  border-color: var(--accent);
  background: rgba(202,138,4,.035);
  box-shadow: 0 0 0 1px var(--accent) inset;
}
.cat-card:has(.cat-check:checked) .cat-mark {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--white);
}
.cat-card:has(.cat-check:checked) .cat-mark::after { opacity: 0; }
.cat-card:has(.cat-check:checked) .cat-inc li::before { background: var(--accent); }

/* ---------- Lo que ya viene incluido ---------- */
.cat-incluido {
  margin-top: 56px;
  border: 1px dashed var(--gray-300);
  border-radius: 18px;
  padding: 30px 32px;
  background: var(--gray-50);
}
.cat-incluido h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--gray-950);
  margin-bottom: 6px;
}
.cat-incluido > p {
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--gray-600);
  max-width: 620px;
  margin-bottom: 20px;
}
.cat-incluido-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px 24px;
}
.cat-incluido-list li {
  position: relative;
  padding-left: 24px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--gray-700);
}
.cat-incluido-list li::before {
  content: '';
  position: absolute;
  left: 0; top: 4px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent);
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'><polyline points='20 6 9 17 4 12'/></svg>") center/11px no-repeat;
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'><polyline points='20 6 9 17 4 12'/></svg>") center/11px no-repeat;
}

/* ---------- Bandeja de seleccion ---------- */
/* Cuando la bandeja esta arriba empuja el pie: si no, tapa lo ultimo de la
   pagina y el visitante cree que ahi se acaba. */
body:has(.cat-tray[data-open="true"]) { padding-bottom: 92px; }

.cat-tray {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translate(-50%, calc(100% + 40px));
  width: min(920px, calc(100vw - 32px));
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 16px 14px 22px;
  border-radius: 18px;
  background: #0f172a;
  border: 1px solid rgba(255,255,255,.1);
  box-shadow: 0 18px 50px rgba(0,0,0,.28);
  transition: transform .45s cubic-bezier(.22,1,.36,1);
}
.cat-tray[data-open="true"] { transform: translate(-50%, 0); }
.cat-tray-count {
  flex-shrink: 0;
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
}
.cat-tray-count span { color: var(--accent-light); }
.cat-tray-chips {
  flex: 1;
  min-width: 0;
  display: flex;
  gap: 7px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px 0;
}
.cat-tray-chips::-webkit-scrollbar { display: none; }
.cat-chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: 'DM Sans', sans-serif;
  font-size: 12.5px;
  color: #e2e8f0;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 999px;
  padding: 5px 7px 5px 12px;
}
.cat-chip button {
  width: 16px; height: 16px;
  border: 0; border-radius: 50%;
  background: rgba(255,255,255,.12);
  color: #cbd5e1;
  font-size: 12px; line-height: 1;
  cursor: pointer;
  transition: background .2s, color .2s;
}
.cat-chip button:hover { background: var(--accent); color: #fff; }
.cat-tray-actions { flex-shrink: 0; display: flex; gap: 8px; }
.cat-tray-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 18px;
  border-radius: 11px;
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .22s, background .22s, border-color .22s;
}
.cat-tray-btn svg { width: 16px; height: 16px; }
.cat-tray-btn--wa { background: var(--accent); color: #fff; }
.cat-tray-btn--wa:hover { background: var(--accent-light); transform: translateY(-1px); }
.cat-tray-btn--call {
  background: transparent;
  color: #e2e8f0;
  border-color: rgba(255,255,255,.18);
}
.cat-tray-btn--call:hover { border-color: rgba(255,255,255,.4); transform: translateY(-1px); }

/* ---------- Responsive ---------- */
@media (max-width: 940px) {
  .cat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .cat-incluido-list { grid-template-columns: repeat(2, 1fr); }
  .cat-filters {
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    margin: 0 -24px;
    padding: 12px 24px;
  }
  .cat-filters::-webkit-scrollbar { display: none; }
  .cat-filters::before { inset: 0; border-radius: 0; }
  .cat-pill { flex-shrink: 0; }
  .cat-group-head { flex-wrap: wrap; gap: 8px 14px; }
  .cat-group-rule { display: none; }
  .cat-group-head h2 { white-space: normal; }
  .cat-incluido { padding: 24px 22px; }
}
@media (max-width: 620px) {
  .cat-grid { grid-template-columns: 1fr; }
  .cat-incluido-list { grid-template-columns: 1fr; }
  .cat-tray {
    flex-wrap: wrap;
    padding: 14px 16px;
    gap: 12px;
    bottom: 12px;
  }
  .cat-tray-chips { order: 3; width: 100%; flex: none; }
  .cat-tray-actions { margin-left: auto; }
  .cat-tray-btn { height: 40px; padding: 0 14px; font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  /* se apaga el movimiento, NUNCA la visibilidad: la bandeja tiene que poder
     entrar igual. */
  .cat-card, .cat-tray, .cat-tray-btn { transition-duration: .01ms; }
  .cat-card:hover { transform: none; }
}
