/* ============================================================
   SECCIÓN SERVICIOS
   Depende de las variables CSS definidas en home.css (:root)
   ============================================================ */

.servicios {
  padding: 100px 6vw;
  position: relative;
}

.servicios-header {
  text-align: center;
  margin-bottom: 64px;
}

.servicios-eyebrow {
  display: inline-block;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .28em;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.servicios-title {
  margin: 0;
  font-size: clamp(32px, 3.5vw, 52px);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1.1;
  color: var(--text);
}

.servicios-title span {
  background: linear-gradient(90deg, var(--blue), var(--purple));
  -webkit-background-clip: text;
  color: transparent;
}

/* Grid de tarjetas */
.servicios-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

/* Tarjeta base */
.servicio-card {
  position: relative;
  padding: 32px 28px 28px;
  border-radius: 20px;
  background: rgba(255, 255, 255, .032);
  border: 1px solid rgba(255, 255, 255, .22);
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: hidden;
  cursor: default;
  box-shadow: 0 14px 38px rgba(0, 0, 0, .22);
  transition: border-color .3s ease, scale .3s ease, box-shadow .3s ease;
  scale: 1;

  /* Estado inicial para la animación de entrada */
  opacity: 0;
  transform: translateY(32px);
}

/* Glow de fondo permanente que sale del ícono */
.servicio-card::before {
  content: "";
  position: absolute;
  top: -40px;
  left: -40px;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: var(--card-accent);
  opacity: 0.18;
  filter: blur(60px);
  transition: opacity .4s ease;
  z-index: 0;
  pointer-events: none;
}

.servicio-card:hover::before {
  opacity: 0.25;
}

.servicio-card:hover {
  border-color: rgba(255, 255, 255, .28);
  scale: 1.018;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
}

/* Línea de color en la parte superior de la tarjeta */
.servicio-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--card-accent), transparent);
  opacity: 1;
  transition: opacity .3s ease;
}

/* Animación de entrada — clase añadida por el IntersectionObserver */
.servicio-card.visible {
  animation: cardEntrada .55s cubic-bezier(.22, 1, .36, 1) forwards;
}

@keyframes cardEntrada {
  from {
    opacity: 0;
    transform: translateY(32px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Delay escalonado por tarjeta */
.servicio-card:nth-child(1) { animation-delay: 0ms; }
.servicio-card:nth-child(2) { animation-delay: 90ms; }
.servicio-card:nth-child(3) { animation-delay: 180ms; }
.servicio-card:nth-child(4) { animation-delay: 270ms; }

/* Ícono */
.servicio-icon-wrap {
  position: relative;
  z-index: 1;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--card-accent);
  display: grid;
  place-items: center;
  font-size: 22px;
  color: var(--card-accent);
  flex-shrink: 0;
  transition: background .3s ease, border-color .3s ease;
}

.servicio-card:hover .servicio-icon-wrap {
  background: rgba(255, 255, 255, .10);
}

/* Imagen de servicio (opcional — si existe, reemplaza al ícono) */
.servicio-img {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  object-fit: cover;
  position: relative;
  z-index: 1;
  opacity: .88;
  transition: opacity .3s ease;
}

.servicio-card:hover .servicio-img {
  opacity: 1;
}

/* Placeholder de imagen (mientras no existe el archivo) */
.servicio-img-placeholder {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  background: rgba(255, 255, 255, .04);
  border: 1px dashed rgba(255, 255, 255, .12);
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, .2);
  font-size: 11px;
  letter-spacing: .1em;
  position: relative;
  z-index: 1;
}

/* Contenido textual */
.servicio-body {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.servicio-nombre {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.servicio-desc {
  margin: 0;
  font-size: 14px;
  line-height: 1.65;
  color: var(--muted);
}

/* CTA al fondo de la tarjeta */
.servicio-cta {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding: 10px 18px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  width: fit-content;
  transition: background .25s ease, border-color .25s ease, gap .25s ease;
}

.servicio-cta i {
  font-size: 12px;
  color: var(--card-accent);
  transition: transform .25s ease;
}

.servicio-cta:hover {
  background: rgba(255, 255, 255, .07);
  border-color: rgba(255, 255, 255, .22);
  gap: 12px;
}

.servicio-cta:hover i {
  transform: translateX(3px);
}

/* Acento por tarjeta — misma idea que --accent en los iconos orbitantes */
.card-ads     { --card-accent: #42a5ff; }
.card-content { --card-accent: #b85cff; }
.card-web     { --card-accent: #4fffc1; }
.card-ia      { --card-accent: #ffd166; }

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

@media (max-width: 1100px) {
  .servicios-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .servicio-card:nth-child(3) { animation-delay: 0ms; }
  .servicio-card:nth-child(4) { animation-delay: 90ms; }
}

@media (max-width: 620px) {
  .servicios {
    padding: 70px 24px;
  }

  .servicios-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .servicio-card:nth-child(n) {
    animation-delay: 0ms;
  }
}

@media (prefers-reduced-motion: reduce) {
  .servicio-card,
  .servicio-card::before,
  .servicio-icon-wrap {
    transition: none;
  }

  .servicio-card:hover {
    scale: 1;
  }

  .servicio-card.visible {
    animation: none;
    opacity: 1;
    transform: none;
  }
}
