/* ==========================================================================
   Desafios de Negócio — independent capabilities section.
   ========================================================================== */

.challenges {
  --challenges-bg: var(--color-surface-alt);
  --challenges-text: #414141;
  --challenges-text-soft: #646b6d;
  --challenges-teal: var(--color-teal-600);
  --challenges-cyan: var(--color-teal-500);
  --challenges-cyan-soft: var(--color-surface-tint);
  --challenges-divider: color-mix(in srgb, var(--color-teal-500) 42%, transparent);

  min-height: 400px;
  padding: var(--section-space) 0;
  color: var(--challenges-text);
  background: var(--challenges-bg);
}

.challenges-inner {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 308px;
}

.challenges-top {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: clamp(36px, 5vw, 72px);
  align-items: center;
}

.challenges-header {
  position: relative;
  z-index: 1;
  max-width: 700px;
}

.challenges-illustration {
  position: absolute;
  top: calc(50% - 10px);
  right: -10vw;
  width: min(64vw, 1100px);
  margin: 0;
  pointer-events: none;
  transform: translateY(-50%);
}

.challenges-illustration svg {
  width: 100%;
  height: auto;
  overflow: visible;
}

.challenges-wave-layer path,
.challenges-flow-lines path {
  vector-effect: non-scaling-stroke;
  stroke-linecap: round;
}

.challenges-wave-layer path {
  transform-box: fill-box;
  transform-origin: center;
  animation: challenges-curve-oscillation 7s ease-in-out infinite alternate;
}

.challenges-wave-layer path:nth-child(2) {
  animation-duration: 8.5s;
  animation-delay: -2.5s;
}

.challenges-wave-layer path:nth-child(3) {
  animation-duration: 9.5s;
  animation-delay: -5s;
}

.challenges-wave-layer--front path:nth-child(4) {
  animation-duration: 8s;
  animation-delay: -3.5s;
}

.challenges-wave-layer {
  transform-box: fill-box;
  transform-origin: center;
  will-change: transform;
}

.challenges-wave-layer--back {
  animation: challenges-wave-drift-back 10s ease-in-out infinite alternate;
}

.challenges-wave-layer--back path {
  stroke: #37cfc7;
  stroke-width: 1.2;
  opacity: .34;
}

.challenges-wave-layer--back path:nth-child(2) {
  stroke: var(--color-teal-500);
  opacity: .22;
}

.challenges-wave-layer--back path:nth-child(3) {
  stroke: #7edfd8;
  opacity: .28;
}

.challenges-wave-layer--front {
  animation: challenges-wave-drift-front 8s ease-in-out infinite alternate;
}

.challenges-wave-layer--front path {
  stroke: var(--color-teal-500);
  stroke-width: 1.6;
  opacity: .62;
}

.challenges-wave-layer--front path:nth-child(2) {
  stroke: #21bfc2;
  stroke-width: 1.25;
  opacity: .48;
}

.challenges-wave-layer--front path:nth-child(3) {
  stroke: #63d7cf;
  stroke-width: 1.1;
  opacity: .4;
}

.challenges-wave-layer--front path:nth-child(4) {
  stroke: var(--color-teal-600);
  stroke-width: 1;
  opacity: .3;
}

.challenges-flow-lines path {
  stroke: #71e0d8;
  stroke-width: 2;
  stroke-dasharray: 7 26;
  opacity: .48;
  animation: challenges-line-flow 11s linear infinite;
}

.challenges-flow-lines path:nth-child(2) {
  animation-duration: 14s;
  animation-delay: -5s;
}

.challenges-flow-lines path:nth-child(3) {
  animation-duration: 12.5s;
  animation-delay: -8s;
}

.challenges-wave-nodes circle {
  fill: var(--color-teal-500);
  opacity: .72;
  transform-box: fill-box;
  transform-origin: center;
  animation: challenges-node-pulse 3.6s ease-in-out infinite;
}

.challenges-wave-nodes circle:nth-child(3n + 2) {
  fill: #35c9c3;
  animation-delay: -1.2s;
}

.challenges-wave-nodes circle:nth-child(3n) {
  fill: var(--color-teal-600);
  animation-delay: -2.4s;
}

@keyframes challenges-wave-drift-back {
  from { transform: translate3d(-8px, -5px, 0) scaleY(.98); }
  to { transform: translate3d(10px, 6px, 0) scaleY(1.025); }
}

@keyframes challenges-wave-drift-front {
  from { transform: translate3d(8px, 5px, 0) scaleY(1.02); }
  to { transform: translate3d(-10px, -6px, 0) scaleY(.975); }
}

@keyframes challenges-curve-oscillation {
  from { transform: translateY(-4px) scaleY(.99); }
  to { transform: translateY(5px) scaleY(1.015); }
}

@keyframes challenges-line-flow {
  to { stroke-dashoffset: -99; }
}

@keyframes challenges-node-pulse {
  0%, 100% { opacity: .48; transform: scale(.82); }
  50% { opacity: .86; transform: scale(1.18); }
}

.challenges-badge {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 20px;
  border-radius: var(--radius-sm);
  background: var(--challenges-teal);
  color: #fff;
  font-family: var(--font-ui);
  font-size: var(--section-badge-size);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: .055em;
}

.challenges-title {
  margin: var(--space-4) 0 0;
  color: var(--challenges-text);
  font-family: var(--font-display);
  font-size: calc(var(--section-title-size) + var(--section-title-optical));  /* título escuro: compensação óptica */
  font-weight: 800;
  line-height: var(--section-title-leading);
  letter-spacing: -.012em;
}

.challenges-subtitle {
  max-width: 680px;
  margin: var(--space-5) 0 0;
  color: var(--challenges-text-soft);
  font-family: var(--font-display);
  font-size: var(--section-text-size);
  line-height: var(--section-text-leading);
}

.challenges-grid {
  align-self: end;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 64px;
}

.challenge-card {
  min-width: 0;
  padding: 0 clamp(24px, 3vw, 48px);
}

.challenge-card:first-child {
  padding-left: 0;
}

.challenge-card + .challenge-card {
  border-left: 1px solid var(--challenges-divider);
}

.challenge-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--challenges-cyan-soft);
  color: var(--challenges-cyan);
}

.challenge-icon svg {
  width: 23px;
  height: 23px;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.challenge-card h3 {
  margin: var(--space-3) 0 0;
  color: var(--challenges-text);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  line-height: 1.25;
}

.challenge-card p {
  margin: var(--space-2) 0 0;
  color: var(--challenges-text-soft);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.55;
}

@media (max-width: 960px) {
  .challenges {
    min-height: 0;
  }


  .challenges-inner {
    min-height: 0;
  }

  .challenges-top {
    grid-template-columns: minmax(0, 1fr);
    gap: 40px;
  }

  .challenges-illustration {
    position: static;
    justify-self: center;
    width: min(100%, 520px);
    aspect-ratio: 3 / 1;
    transform: none;
  }

  .challenges-illustration svg {
    height: 100%;
  }

  .challenges-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 38px 0;
    margin-top: 56px;
  }

  .challenge-card {
    padding-inline: 0 36px;
  }

  .challenge-card:nth-child(even) {
    padding-inline: 36px 0;
    border-left: 1px solid var(--challenges-divider);
  }

  .challenge-card:nth-child(odd) {
    border-left: 0;
  }
}

@media (max-width: 600px) {

  .challenges-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    margin-top: 48px;
  }

  .challenge-card,
  .challenge-card:nth-child(even) {
    padding: 24px 0;
    border-left: 0;
    border-top: 1px solid var(--challenges-divider);
  }

  .challenge-card:first-child {
    padding-top: 0;
    border-top: 0;
  }
}

/* Movimento reduzido: as ondas continuam vivas, mas bem mais lentas e com
   amplitude menor; os pontos só variam o brilho, sem pulsar de tamanho. */
@media (prefers-reduced-motion: reduce) {
  .challenges-wave-layer--back {
    animation: challenges-wave-drift-back-calm 22s ease-in-out infinite alternate;
  }

  .challenges-wave-layer--front {
    animation: challenges-wave-drift-front-calm 18s ease-in-out infinite alternate;
  }

  .challenges-wave-layer path,
  .challenges-wave-layer path:nth-child(n) {
    animation: challenges-curve-oscillation-calm 16s ease-in-out infinite alternate;
  }

  .challenges-wave-layer path:nth-child(2) { animation-duration: 19s; animation-delay: -6s; }
  .challenges-wave-layer path:nth-child(3) { animation-duration: 21s; animation-delay: -11s; }
  .challenges-wave-layer--front path:nth-child(4) { animation-duration: 17s; animation-delay: -8s; }

  .challenges-flow-lines path { animation-duration: 30s; }
  .challenges-flow-lines path:nth-child(2) { animation-duration: 38s; }
  .challenges-flow-lines path:nth-child(3) { animation-duration: 34s; }

  .challenges-wave-nodes circle {
    animation: challenges-node-glow-calm 7s ease-in-out infinite;
  }

  .challenges-wave-nodes circle:nth-child(3n + 2) { animation-delay: -2.4s; }
  .challenges-wave-nodes circle:nth-child(3n) { animation-delay: -4.8s; }
}

@keyframes challenges-wave-drift-back-calm {
  from { transform: translate3d(-4px, -2px, 0); }
  to { transform: translate3d(5px, 3px, 0); }
}

@keyframes challenges-wave-drift-front-calm {
  from { transform: translate3d(4px, 2px, 0); }
  to { transform: translate3d(-5px, -3px, 0); }
}

@keyframes challenges-curve-oscillation-calm {
  from { transform: translateY(-2px); }
  to { transform: translateY(2px); }
}

@keyframes challenges-node-glow-calm {
  0%, 100% { opacity: .5; }
  50% { opacity: .8; }
}

/* Próxima etapa: botão do WhatsApp abaixo dos blocos (estilo em contact.css) */
.challenges-cta { margin-top: 56px; }
.challenges-cta .contact-whatsapp { margin-top: 0; }

@media (max-width: 600px) {
  .challenges-cta { margin-top: 40px; }
  .challenges-cta .contact-whatsapp { width: 100%; justify-content: center; }
}
