/* CSS de <ComoTrabajamos /> y <FAQ /> (componentes exclusivos de la home,
   src/pages/index.astro) — ambos below-the-fold: el hero ocupa min-h-screen,
   así que nada de lo que sigue es visible sin hacer scroll. Se carga en
   diferido (preload + swap) para sacarlo del critical path. Ver
   src/components/ComoTrabajamos.astro y src/components/FAQ.astro.
   (BandaCTA y Footer, aunque también aparecen en la home, se usan además en
   otras páginas — no se tocan aquí para no extender el cambio más allá de
   esta única página piloto). */

/* ===== ComoTrabajamos ===== */

/* Red de seguridad: sin la clase js-anim en <html> (añadida por el script
   de ComoTrabajamos como primera acción), estos bloques se ven SIEMPRE
   opacity:1 — si el script no llega a correr, nada queda invisible para
   siempre. CSS plano, no scoped por Astro: no necesita el wrapper :global(). */
html:not(.js-anim) .proceso-step,
html:not(.js-anim) .step-number,
html:not(.js-anim) .dashed-line,
html:not(.js-anim) .traveling-dot,
html:not(.js-anim) .mobile-line,
html:not(.js-anim) .mobile-dot {
  opacity: 1 !important;
  transform: none !important;
  clip-path: none !important;
}

.proceso-step {
  opacity: 0;
  transform: translateY(60px) scale(0.85);
  transition:
    opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1) var(--delay, 0ms),
    transform 0.9s cubic-bezier(0.16, 1, 0.3, 1) var(--delay, 0ms);
}
.proceso-step.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.step-number {
  background: linear-gradient(135deg, #2196c9, #1565a0);
  box-shadow: 0 8px 32px rgba(33, 150, 201, 0.35);
  border: 2px solid white;
  margin-bottom: 24px;
  transform: scale(0);
  transition:
    transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) var(--delay, 0ms),
    box-shadow 0.3s ease;
}
.proceso-step.is-visible .step-number {
  transform: scale(1);
}
.step-number:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 40px rgba(33, 150, 201, 0.45);
}

.dashed-line {
  clip-path: inset(0 100% 0 0);
  transition: clip-path 2s ease-out 0.2s;
}
.connector.is-visible .dashed-line {
  clip-path: inset(0 0 0 0);
}

.traveling-dot {
  position: absolute;
  top: 50%;
  left: 0;
  margin-top: -6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #2196c9;
  box-shadow: 0 0 16px rgba(33, 150, 201, 0.8);
  opacity: 0;
}
.connector.is-visible .traveling-dot {
  animation: dot-travel 2s ease-out 0.8s forwards;
}

@keyframes dot-travel {
  0% {
    left: 0%;
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    left: 100%;
    opacity: 0;
  }
}

.connector-mobile {
  position: absolute;
  left: 30px;
  width: 12px;
  pointer-events: none;
  z-index: 0;
}

.mobile-line {
  position: absolute;
  top: 0;
  left: 50%;
  width: 0;
  height: 100%;
  margin-left: -0.75px;
  border-left: 1.5px dashed #2196c9;
  opacity: 0.3;
  clip-path: inset(0 0 100% 0);
  transition: clip-path 2s ease-out 0.4s;
}

.connector-mobile.is-visible .mobile-line {
  clip-path: inset(0 0 0 0);
}

.mobile-dot {
  position: absolute;
  top: 0;
  left: 50%;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  margin-top: -6px;
  border-radius: 50%;
  background: #2196c9;
  box-shadow: 0 0 16px rgba(33, 150, 201, 0.8);
  opacity: 0;
}

.connector-mobile.is-visible .mobile-dot {
  animation: dot-travel-vertical 2s ease-out 0.8s forwards;
}

@keyframes dot-travel-vertical {
  0% {
    top: 0%;
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    top: 100%;
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .proceso-step,
  .proceso-step .step-number,
  .dashed-line,
  .traveling-dot,
  .mobile-line,
  .mobile-dot {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
    animation: none !important;
    clip-path: none !important;
  }
}

/* ===== FAQ ===== */

html:not(.js-anim) .faq-item {
  clip-path: none !important;
}

.faq-section::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(#2196c9 0.8px, transparent 0.8px);
  background-size: 28px 28px;
  opacity: 0.15;
  pointer-events: none;
  z-index: 0;
}

.faq-cta-icon-floater {
  animation: faq-cta-float 3s ease-in-out infinite;
}
@keyframes faq-cta-float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

.faq-item {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  margin-bottom: 8px;
  box-shadow: 0 2px 8px rgba(10, 61, 92, 0.04);
  clip-path: inset(0 100% 0 0);
  transition:
    background 0.4s cubic-bezier(0.16, 1, 0.3, 1),
    border-color 0.4s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.faq-item.is-visible {
  animation: faq-curtain 0.6s cubic-bezier(0.16, 1, 0.3, 1)
    var(--delay, 0ms) forwards;
}

@keyframes faq-curtain {
  from {
    clip-path: inset(0 100% 0 0);
  }
  to {
    clip-path: inset(0 0% 0 0);
  }
}

.faq-item.is-open {
  border-color: rgba(33, 150, 201, 0.3);
  box-shadow: 0 8px 32px rgba(33, 150, 201, 0.12);
  transform: scale(1.01);
}

.faq-question {
  width: 100%;
  background: none;
  border: none;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  text-align: left;
  cursor: pointer;
}

.faq-number {
  font-family: "DM Serif Display", serif;
  color: rgba(33, 150, 201, 0.4);
  font-size: 0.75rem;
  font-weight: 400;
  line-height: 1;
  flex-shrink: 0;
}

.faq-question-text {
  flex: 1;
  font-family: "DM Sans", sans-serif;
  font-size: 0.975rem;
  font-weight: 600;
  color: #0b2d48;
  transition: color 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.faq-item.is-open .faq-question-text {
  color: #1565a0;
}

.faq-toggle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1.5px solid #e2e8f0;
  background: #ffffff;
  color: #1565a0;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.faq-item.is-open .faq-toggle {
  background: #2196c9;
  color: #ffffff;
  border-color: #2196c9;
  transform: rotate(45deg);
  box-shadow: 0 4px 12px rgba(33, 150, 201, 0.3);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  padding: 0 24px 0 64px;
  border-top: 1px solid transparent;
  transition:
    max-height 0.5s cubic-bezier(0.16, 1, 0.3, 1),
    padding 0.3s ease,
    border-color 0.3s ease;
}

.faq-item.is-open .faq-answer {
  max-height: 500px;
  padding: 16px 24px 24px 64px;
  border-top-color: rgba(226, 232, 240, 0.5);
}

.faq-answer-text {
  font-family: "DM Sans", sans-serif;
  font-size: 0.9rem;
  line-height: 1.82;
  color: #4a5568;
  margin: 0;
}

@media (prefers-reduced-motion: reduce) {
  .faq-section::before,
  .faq-cta-icon-floater {
    animation: none !important;
  }
  .faq-item,
  .faq-question,
  .faq-question-text,
  .faq-toggle,
  .faq-answer {
    animation: none !important;
    transition: none !important;
    clip-path: none !important;
  }
}
