/* ==========================================================================
   como-funciona.css — Seção "Como Funciona": timeline animada de 4 passos
   Importar APÓS sobre.css e ANTES de animations.css.
   ========================================================================== */


/* ==========================================================================
   1. Cabeçalho da seção
   ========================================================================== */

.cf-pre-titulo {
  display: block;
  text-align: center;
  margin-bottom: 0.75rem;
}

.cf-titulo {
  text-align: center;
  text-wrap: balance;
  max-width: 28ch;
  margin-inline: auto;
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
}


/* ==========================================================================
   2. Keyframes
   ========================================================================== */

@keyframes cf-linha-v {
  from { transform: scaleY(0); }
  to   { transform: scaleY(1); }
}

@keyframes cf-linha-h {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

@keyframes cf-badge-in {
  from {
    transform: scale(0.55);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}


/* ==========================================================================
   3. Timeline — wrapper e linha vertical (mobile)
   ========================================================================== */

.cf-timeline {
  position: relative;
}

.cf-passos {
  list-style: none;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Linha conectora vertical (mobile) */
.cf-passos::before {
  content: '';
  position: absolute;
  left: 38px;    /* centro do badge: 76px / 2 */
  top: 38px;     /* arranque no centro do primeiro badge */
  bottom: 38px;  /* termina no centro do último badge */
  width: 2px;
  background: linear-gradient(to bottom, var(--turquesa) 0%, var(--azul-ceu) 100%);
  z-index: 0;
  transform-origin: top center;
  animation: cf-linha-v 0.9s cubic-bezier(.4, 0, .2, 1) both;
}

/* Linha horizontal — só visível no desktop */
.cf-linha {
  display: none;
}


/* ==========================================================================
   4. Passos — layout mobile (coluna + grid)
   ========================================================================== */

.cf-passo {
  display: grid;
  grid-template-columns: 76px 1fr;
  column-gap: 1.25rem;
  align-items: start;
  padding-bottom: clamp(1.75rem, 4vw, 2.5rem);
  position: relative;
}

.cf-passo:last-child {
  padding-bottom: 0;
}


/* ==========================================================================
   5. Badge (ícone + número)
   ========================================================================== */

.cf-passo__visual {
  display: flex;
  justify-content: center;
  position: relative;
  z-index: 1;
}

.cf-badge {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: var(--turquesa);
  /* Anel marfim "apaga" a linha atrás do badge */
  box-shadow: 0 0 0 5px var(--marfim), 0 6px 20px -6px rgba(22, 168, 201, .45);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
  animation: cf-badge-in 0.45s cubic-bezier(.34, 1.56, .64, 1) both;
}

.cf-passo:nth-child(1) .cf-badge { animation-delay: 0.08s;  }
.cf-passo:nth-child(2) .cf-badge { animation-delay: 0.25s;  }
.cf-passo:nth-child(3) .cf-badge { animation-delay: 0.45s;  }
.cf-passo:nth-child(4) .cf-badge { animation-delay: 0.65s;  }

.cf-badge__icone {
  width: 22px;
  height: 22px;
  color: var(--branco);
  flex-shrink: 0;
}

.cf-badge__num {
  font-family: var(--fonte-titulo);
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--branco);
  line-height: 1;
  letter-spacing: 0.04em;
}


/* ==========================================================================
   6. Corpo do passo
   ========================================================================== */

.cf-passo__corpo {
  padding-top: 1rem; /* alinha o texto com o centro visual do badge */
}

.cf-passo__titulo {
  display: block;
  font-family: var(--fonte-titulo);
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--azul-profundo);
  margin-bottom: 0.375rem;
  line-height: 1.25;
}

.cf-passo__desc {
  font-size: 0.9375rem;
  line-height: 1.7;
  color: var(--texto-suave);
  max-width: none;
  margin: 0;
}


/* ==========================================================================
   7. Rodapé — fechamento + CTA coral
   ========================================================================== */

.cf-rodape {
  margin-top: clamp(2.5rem, 5vw, 4rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  text-align: center;
}

.cf-fechamento {
  font-family: var(--fonte-titulo);
  font-size: clamp(1rem, 1.2vw + 0.5rem, 1.125rem);
  font-weight: 600;
  color: var(--azul-profundo);
  max-width: 52ch;
  line-height: 1.65;
  text-wrap: balance;
  margin: 0 auto;
}


/* ==========================================================================
   8. Desktop — layout horizontal (≥ 861px)
   ========================================================================== */

@media (min-width: 861px) {

  /* Esconde linha vertical, mostra horizontal */
  .cf-passos::before {
    display: none;
  }

  .cf-linha {
    display: block;
    position: absolute;
    /* 38px = centro vertical do badge (76px ÷ 2) */
    top: 38px;
    /* 12.5% ≈ centro do 1º e do último coluna (4 colunas iguais) */
    left: 12.5%;
    right: 12.5%;
    height: 2px;
    background: linear-gradient(to right, var(--turquesa) 0%, var(--azul-ceu) 100%);
    z-index: 0;
    transform-origin: left center;
    animation: cf-linha-h 0.9s cubic-bezier(.4, 0, .2, 1) both;
  }

  /* Fileira horizontal dos 4 passos */
  .cf-passos {
    flex-direction: row;
    align-items: flex-start;
    gap: 1rem;
  }

  .cf-passo {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding-bottom: 0;
    gap: 0;
  }

  .cf-passo__visual {
    margin-bottom: 1.25rem;
    width: 100%;
  }

  .cf-passo__corpo {
    padding-top: 0;
    width: 100%;
  }

  .cf-passo__desc {
    max-width: 22ch;
    margin-inline: auto;
  }
}


/* ==========================================================================
   9. Acessibilidade — prefers-reduced-motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .cf-badge,
  .cf-passos::before,
  .cf-linha {
    animation: none;
    opacity: 1;
    transform: none;
  }
}
