/* =========================================================
   Seção Plataformas: esteira do pagamento + lista de recursos

   A esteira é uma trilha com um tracejado que anda sem parar e um
   "pagamento" (ponto verde com rastro) que a percorre em loop.
   Cada etapa acende quando ele passa por ela.
   Mobile e tablet: esteira vertical. Desktop (1100px+): horizontal.
   Com "reduzir movimento" ligado no sistema, tudo fica parado.
   ========================================================= */

/* Ângulo do anel que gira em volta da etapa KOKU */
@property --flow-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

/* ---------- Container ---------- */

.flow-card {
  position: relative;
  padding: clamp(26px, 4.4vw, 60px) clamp(18px, 4vw, 56px);
  border: 1px solid rgba(10, 10, 11, 0.07);
  border-radius: 32px;
  background:
    radial-gradient(46% 90% at 50% 50%, rgba(0, 223, 162, 0.12), transparent 72%),
    linear-gradient(180deg, var(--white), #F5F9F7);
  box-shadow:
    inset 0 1px 0 var(--white),
    0 1px 2px rgba(10, 10, 11, 0.03),
    0 32px 64px -44px rgba(0, 105, 76, 0.4);
  overflow: hidden;
}

/* Malha de pontos bem discreta, mais visível no centro */
.flow-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(0, 105, 76, 0.2) 1px, transparent 1.4px);
  background-size: 24px 24px;
  background-position: center;
  -webkit-mask-image: radial-gradient(60% 80% at 50% 50%, #000 10%, transparent 78%);
  mask-image: radial-gradient(60% 80% at 50% 50%, #000 10%, transparent 78%);
  pointer-events: none;
}

/* ---------- Palco da esteira ---------- */

.flow-stage {
  --flow-cycle: 5s;                              /* duração de uma volta completa */
  --flow-step: calc(var(--flow-cycle) * 0.21);   /* tempo entre uma etapa e a seguinte */
  --flow-gap: 30px;                              /* espaço entre as etapas (onde a trilha aparece) */
  position: relative;
  max-width: 400px;
  margin-inline: auto;
}

.flow {
  position: relative;
  z-index: 1;
  display: grid;
  gap: var(--flow-gap);
}

/* ---------- Trilha ---------- */

.flow__rail {
  position: absolute;
  top: 36px;
  bottom: 36px;
  left: 50%;
  width: 2px;
  border-radius: 2px;
  background: var(--gray-200);
  transform: translateX(-50%);
}

/* Tracejado verde andando no sentido do fluxo */
.flow__rail::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-image: linear-gradient(to bottom, rgba(0, 196, 142, 0.7) 0 6px, transparent 6px 18px);
  background-size: 2px 18px;
  animation: flow-belt-y 0.9s linear infinite;
}

/* O "pagamento": rastro + ponto luminoso na frente */
.flow__packet {
  position: absolute;
  top: 0;
  left: 50%;
  width: 2px;
  height: 46px;
  border-radius: 2px;
  background: linear-gradient(to bottom, transparent, var(--brand-500));
  transform: translate(-50%, -100%);
  animation: flow-run-y var(--flow-cycle) linear infinite;
}

.flow__packet::after {
  content: "";
  position: absolute;
  bottom: -5px;
  left: 50%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(0, 223, 162, 0.22), 0 0 14px 2px rgba(0, 223, 162, 0.9);
  transform: translateX(-50%);
}

@keyframes flow-belt-y {
  to { background-position: 0 18px; }
}

@keyframes flow-belt-x {
  to { background-position: 18px 0; }
}

@keyframes flow-run-y {
  0% { top: 0; opacity: 0; }
  4% { opacity: 1; }
  84% { top: 100%; opacity: 1; }
  90%, 100% { top: 100%; opacity: 0; }
}

@keyframes flow-run-x {
  0% { left: 0; opacity: 0; }
  4% { opacity: 1; }
  84% { left: 100%; opacity: 1; }
  90%, 100% { left: 100%; opacity: 0; }
}

/* ---------- Etapas ---------- */

.flow__node {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 72px;
  padding: 14px 18px;
  border: 1px solid rgba(10, 10, 11, 0.08);
  border-radius: 20px;
  background: var(--white);
  box-shadow: 0 1px 2px rgba(10, 10, 11, 0.04), 0 14px 28px -20px rgba(10, 10, 11, 0.18);
  animation: flow-node var(--flow-cycle) ease-in-out infinite;
  animation-delay: calc(var(--i) * var(--flow-step));
}

/* Encaixes da etapa na trilha: entrada (::before) e saída (::after) */
.flow__node::before,
.flow__node::after {
  content: "";
  position: absolute;
  z-index: 2;
  left: 50%;
  width: 10px;
  height: 10px;
  border: 2px solid var(--brand-500);
  border-radius: 50%;
  background: var(--white);
  transform: translateX(-50%);
}

.flow__node::before {
  top: -6px;
}

.flow__node::after {
  bottom: -6px;
}

.flow__node:first-child::before,
.flow__node:last-child::after {
  display: none;
}

.flow__icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(10, 10, 11, 0.05);
  border-radius: 14px;
  background: var(--gray-100);
  color: var(--black);
  font-size: 1.0625rem;
  animation: flow-icon var(--flow-cycle) ease-in-out infinite;
  animation-delay: calc(var(--i) * var(--flow-step));
}

.flow__label {
  font-family: var(--font-display);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.35;
  text-transform: uppercase;
}

.flow__step {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--gray-400);
}

/* Quando o pagamento passa pela etapa: borda e brilho verdes por um instante */
@keyframes flow-node {
  0%, 22%, 100% {
    border-color: rgba(10, 10, 11, 0.08);
    box-shadow: 0 1px 2px rgba(10, 10, 11, 0.04), 0 14px 28px -20px rgba(10, 10, 11, 0.18);
  }
  5%, 12% {
    border-color: var(--brand-300);
    box-shadow: 0 0 0 4px rgba(0, 223, 162, 0.14), 0 20px 40px -20px rgba(0, 105, 76, 0.45);
  }
}

@keyframes flow-icon {
  0%, 22%, 100% {
    background-color: var(--gray-100);
    color: var(--black);
    transform: none;
  }
  5%, 12% {
    background-color: var(--brand-100);
    color: var(--brand-800);
    transform: scale(1.08);
  }
}

/* ---------- Etapa KOKU: o motor da operação ---------- */

.flow__node--brand {
  min-height: 86px;
  border-color: transparent;
  border-radius: 22px;
  background: linear-gradient(160deg, #1D2020 0%, var(--black) 62%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 22px 48px -20px rgba(0, 223, 162, 0.6);
  color: var(--white);
  animation-name: flow-brand;
}

.flow__node--brand::before,
.flow__node--brand::after {
  background: var(--black);
}

.flow__node--brand .flow__icon {
  width: 48px;
  height: 48px;
  border: 0;
  background: none;
  animation: none;
}

.flow__node--brand .logo__symbol {
  height: 44px;
}

.flow__node--brand .flow__step {
  color: rgba(255, 255, 255, 0.4);
}

/* Anel de luz verde girando em volta da etapa */
.flow__halo {
  position: absolute;
  inset: -2px;
  padding: 2px;
  border-radius: 24px;
  background: conic-gradient(from var(--flow-angle), transparent 0 58%, var(--brand-500) 82%, #B8FBE6 91%, transparent 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  animation: flow-spin 3.4s linear infinite;
  pointer-events: none;
}

@keyframes flow-spin {
  to { --flow-angle: 360deg; }
}

@keyframes flow-brand {
  0%, 24%, 100% {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 22px 48px -20px rgba(0, 223, 162, 0.6);
  }
  5%, 13% {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 0 0 5px rgba(0, 223, 162, 0.2), 0 28px 60px -18px rgba(0, 223, 162, 0.95);
  }
}

/* ---------- Etapa final: pagamento confirmado ---------- */

.flow__node--done {
  border-color: var(--brand-500);
  background: linear-gradient(180deg, var(--white), var(--brand-50));
  animation-name: flow-done;
}

.flow__node--done .flow__icon {
  border: 0;
  background: linear-gradient(145deg, var(--brand-300), var(--brand-500));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 10px 20px -8px rgba(0, 223, 162, 0.85);
  color: var(--on-primary);
  animation-name: flow-check;
}

.flow__node--done .flow__icon .icon {
  stroke-width: 3;
}

.flow__node--done .flow__step {
  color: var(--brand-700);
}

/* Onda de sucesso quando o pagamento chega */
@keyframes flow-done {
  0%, 34%, 100% {
    box-shadow: 0 0 0 0 rgba(0, 223, 162, 0), 0 14px 28px -20px rgba(0, 105, 76, 0.35);
  }
  4% {
    box-shadow: 0 0 0 0 rgba(0, 223, 162, 0.55), 0 20px 40px -18px rgba(0, 105, 76, 0.5);
  }
  26% {
    box-shadow: 0 0 0 16px rgba(0, 223, 162, 0), 0 20px 40px -18px rgba(0, 105, 76, 0.5);
  }
}

@keyframes flow-check {
  0%, 22%, 100% { transform: none; }
  6% { transform: scale(1.18); }
  12% { transform: scale(0.96); }
}

/* ---------- Desktop: esteira horizontal ---------- */

@media (min-width: 1100px) {
  .flow-stage {
    --flow-gap: clamp(32px, 3.4vw, 52px);
    max-width: none;
  }

  .flow {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: center;
  }

  /* A trilha vai do centro da primeira etapa ao centro da última */
  .flow__rail {
    top: 50%;
    bottom: auto;
    left: calc((100% - 4 * var(--flow-gap)) / 10);
    right: calc((100% - 4 * var(--flow-gap)) / 10);
    width: auto;
    height: 2px;
    transform: translateY(-50%);
  }

  .flow__rail::before {
    background-image: linear-gradient(to right, rgba(0, 196, 142, 0.7) 0 6px, transparent 6px 18px);
    background-size: 18px 2px;
    animation-name: flow-belt-x;
  }

  .flow__packet {
    top: 50%;
    left: 0;
    width: 64px;
    height: 2px;
    background: linear-gradient(to right, transparent, var(--brand-500));
    transform: translate(-100%, -50%);
    animation-name: flow-run-x;
  }

  .flow__packet::after {
    top: 50%;
    right: -5px;
    bottom: auto;
    left: auto;
    transform: translateY(-50%);
  }

  .flow__node {
    flex-direction: column;
    justify-content: center;
    gap: 16px;
    min-height: 156px;
    padding: 30px 12px 24px;
    text-align: center;
  }

  .flow__node::before,
  .flow__node::after {
    top: 50%;
    bottom: auto;
    left: auto;
    transform: translateY(-50%);
  }

  .flow__node::before {
    left: -6px;
  }

  .flow__node::after {
    right: -6px;
  }

  .flow__icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    font-size: 1.1875rem;
  }

  .flow__step {
    position: absolute;
    top: 14px;
    left: 16px;
    margin: 0;
  }

  .flow__node--brand {
    min-height: 184px;
  }

  .flow__node--brand .flow__icon {
    width: 60px;
    height: 60px;
  }

  .flow__node--brand .logo__symbol {
    height: 54px;
  }
}

/* ---------- Recursos ---------- */

.platform__features {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 24px;
}

@media (min-width: 768px) {
  .platform__features {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
  }
}

@media (min-width: 1100px) {
  .platform__features {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

.platform__features li {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--gray-200);
  border-radius: 16px;
  background: var(--white);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.3;
  transition: transform 0.3s var(--ease), border-color 0.3s, box-shadow 0.3s var(--ease);
}

.platform__features li:hover {
  transform: translateY(-3px);
  border-color: var(--brand-500);
  box-shadow: var(--shadow-sm);
}

.platform__features .icon {
  width: 22px;
  height: 22px;
  color: var(--brand-700);
}
