/* --------------------------------------------
   Sección
-------------------------------------------- */

#problemas {
  background: var(--white);
}

#problemas .section-center {
  margin-bottom: 56px;
}

/* --------------------------------------------
   Grid
-------------------------------------------- */

.problems-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px;
  align-items: stretch;
}

/* --------------------------------------------
   Card
-------------------------------------------- */

.problem-card {
  display: flex;
  flex-direction: column;
  align-items: center;

  min-height: 330px;
  padding: 34px 28px;

  text-align: center;

  background: var(--cream);
  border: 1.5px solid transparent;
  border-radius: var(--radius);
  box-shadow: var(--shadow);

  cursor: default;
  overflow: hidden;

  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease,
    background 0.3s ease,
    border-color 0.3s ease;
}

.problem-card:hover {
  background: var(--white);
  border-color: var(--gold-light);
  box-shadow: var(--shadow-hover);
  transform: translateY(-6px);
}

/* --------------------------------------------
   Icono
-------------------------------------------- */

.problem-icon {
  width: 68px;
  height: 68px;
  margin: 0 auto 22px;

  display: flex;
  align-items: center;
  justify-content: center;

  background: linear-gradient(135deg, var(--beige), var(--sand));
  border-radius: 20px;

  transition:
    transform 0.3s ease,
    background 0.3s ease;
}

.problem-card:hover .problem-icon {
  transform: scale(1.08);
}

.problem-icon svg {
  display: block;
}

/* --------------------------------------------
   Texto
-------------------------------------------- */

.problem-card h3 {
  min-height: 58px;
  margin-bottom: 12px;

  color: var(--dark);
  font-size: 1.45rem;
  line-height: 1.15;
}

.problem-text {
  flex: 1;

  margin-bottom: 24px;

  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.75;
}

/* --------------------------------------------
   Botón Ver más
-------------------------------------------- */

.problem-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  margin-top: auto;
  padding: 0;

  font-family: 'Jost', sans-serif;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;

  color: var(--gold);
  background: transparent;
  border: none;

  cursor: pointer;
  text-decoration: none;

  transition:
    color 0.25s ease,
    letter-spacing 0.25s ease;
}

.problem-link:hover,
.problem-link:focus-visible {
  color: var(--terra);
  outline: none;
}

.problem-link::after {
  content: "";
  display: none;
}

/* Si en el HTML dejaste "Ver más →", no agregamos otra flecha.
   Si luego quieres que CSS maneje la flecha, elimina la flecha del HTML
   y cambia display:none por display:inline-block. */

/* ============================================
   MODAL SERVICIOS
   ============================================ */

body.modal-open {
  overflow: hidden;
}

.service-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 30px;

  background: rgba(20, 12, 18, 0.48);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  opacity: 0;
  visibility: hidden;
  pointer-events: none;

  transition:
    opacity 0.35s ease,
    visibility 0.35s ease;
}

.service-modal.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* --------------------------------------------
   Contenedor modal
-------------------------------------------- */

.service-modal-content {
  position: relative;

  width: 100%;
  max-width: 760px;
  max-height: 90vh;
  overflow-y: auto;

  padding: 50px;

  background: var(--white);
  border-radius: 24px;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.18);

  transform: translateY(30px) scale(0.96);

  transition:
    transform 0.35s cubic-bezier(.22,.61,.36,1),
    opacity 0.35s ease;
}

.service-modal.active .service-modal-content {
  transform: translateY(0) scale(1);
  animation: modalAppear 0.4s cubic-bezier(.22,.61,.36,1);
}

.service-modal-content.loading {
  opacity: 0.15;
  transform: translateY(12px) scale(0.98);
}

.service-modal-content::-webkit-scrollbar {
  width: 8px;
}

.service-modal-content::-webkit-scrollbar-thumb {
  background: var(--sand);
  border-radius: 20px;
}

/* --------------------------------------------
   Botón cerrar
-------------------------------------------- */

.modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 2;

  width: 44px;
  height: 44px;

  display: flex;
  align-items: center;
  justify-content: center;

  color: var(--terra);
  background: var(--cream);
  border: none;
  border-radius: 50%;

  font-size: 28px;
  line-height: 1;

  cursor: pointer;

  transition:
    background 0.25s ease,
    color 0.25s ease,
    transform 0.25s ease;
}

.modal-close:hover,
.modal-close:focus-visible {
  color: var(--white);
  background: var(--terra);
  transform: rotate(90deg);
  outline: none;
}

/* --------------------------------------------
   Contenido modal
-------------------------------------------- */

#modalTitle {
  margin-bottom: 18px;

  color: var(--dark);
  font-size: clamp(1.8rem, 3vw, 2.35rem);
  line-height: 1.15;
}

#modalDescription {
  margin-bottom: 28px;

  color: var(--text);
  font-size: 1rem;
  line-height: 1.8;
}

#modalBenefits {
  display: grid;
  gap: 14px;

  margin-bottom: 36px;
}

#modalBenefits .benefit {
  display: flex;
  align-items: flex-start;
  gap: 12px;

  color: var(--text);
  font-size: 0.96rem;
  line-height: 1.6;

  opacity: 0;
  transform: translateX(-14px);
  animation: benefitFade 0.45s forwards;
}

#modalBenefits .benefit svg {
  flex-shrink: 0;
  margin-top: 3px;
}

/* --------------------------------------------
   Botón modal
-------------------------------------------- */

.modal-whatsapp {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 16px 30px;

  color: var(--white);
  background: var(--terra);
  border-radius: 999px;

  font-weight: 600;
  text-decoration: none;

  transition:
    background 0.3s ease,
    transform 0.3s ease,
    box-shadow 0.3s ease;
}

.modal-whatsapp:hover,
.modal-whatsapp:focus-visible {
  background: var(--mid);
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
  outline: none;
}

/* ============================================
   ANIMACIONES
   ============================================ */

@keyframes modalAppear {
  from {
    opacity: 0;
    transform: translateY(40px) scale(0.92);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes benefitFade {
  to {
    opacity: 1;
    transform: none;
  }
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1024px) {
  .problems-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .service-modal-content {
    max-width: 700px;
    padding: 40px;
  }
}

@media (max-width: 768px) {
  #problemas .section-center {
    margin-bottom: 40px;
  }

  .problems-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .problem-card {
    min-height: auto;
    padding: 30px 24px;
  }

  .problem-card h3 {
    min-height: auto;
    font-size: 1.55rem;
  }

  .service-modal {
    align-items: center;
    padding: 18px;
  }

  .service-modal-content {
    max-height: calc(100dvh - 36px);
    padding: 32px 24px;
    border-radius: 24px;
    overscroll-behavior: contain;
  }

  .modal-close {
    position: sticky;
    top: 0;
    right: auto;
    margin-left: auto;
    margin-bottom: -40px;
    width: 40px;
    height: 40px;
  }

  #modalTitle {
    padding-right: 44px;
    font-size: 1.6rem;
  }

  #modalDescription {
    font-size: 0.94rem;
    line-height: 1.75;
  }

  .modal-whatsapp {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .problem-card {
    padding: 28px 20px;
  }

  .problem-icon {
    width: 62px;
    height: 62px;
  }
}
