/* ── Como funciona — timeline horizontal (scroll vertical → pan horizontal) ── */
.cgd-flow {
  position: relative;
  height: 300vh;
  background: var(--cgd-white-ice);
  padding: 0;
}

.cgd-flow__pin {
  position: sticky;
  top: 0;
  height: 100vh;
  min-height: 600px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: calc(var(--cgd-header-h) + clamp(28px, 6vh, 64px)) 0 clamp(48px, 9vh, 88px);
}

/* Cabeçalho persistente */
.cgd-flow__head {
  flex: 0 0 auto;
  position: relative;
  z-index: 3;
}
.cgd-flow__title {
  font-family: var(--cgd-font-display);
  font-size: clamp(2.75rem, 7vw, 5.5rem);
  font-weight: 600;
  line-height: 0.9;
  letter-spacing: -0.035em;
  color: var(--cgd-green-dark);
  margin-top: 14px;
}

/* Faixa que desliza horizontalmente */
.cgd-flow__viewport {
  flex: 1 1 auto;
  position: relative;
  overflow: hidden;
}
.cgd-flow__track {
  position: absolute;
  inset: 0;
  min-width: 210vw;
  will-change: transform;
}

/* Onda / montanha de barras */
.cgd-flow__wave {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 40%;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0 1.5%;
}
.cgd-flow__bar {
  flex: 0 0 2px;
  width: 2px;
  height: 14%;
  border-radius: 1px;
  background: linear-gradient(to top, rgba(0, 168, 120, 0.65), rgba(0, 168, 120, 0.14));
  transform-origin: bottom;
  will-change: height;
  animation: cgd-flow-bar-in 0.5s var(--cgd-ease-out) backwards;
}
@keyframes cgd-flow-bar-in {
  from { transform: scaleY(0); opacity: 0; }
  to { transform: scaleY(1); opacity: 1; }
}

/* Baseline sutil */
.cgd-flow__viewport::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(11, 63, 54, 0.16), transparent);
  z-index: 2;
}

/* Etapas em alturas variadas */
.cgd-flow__steps {
  position: absolute;
  inset: 0;
  list-style: none;
  margin: 0;
  padding: 0;
  z-index: 2;
}
.cgd-flow__step {
  position: absolute;
  left: var(--x);
  top: var(--y);
  transform: translate(-50%, 0);
  width: 244px;
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  white-space: nowrap;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(11, 63, 54, 0.08);
  box-shadow: 0 1px 2px rgba(11, 63, 54, 0.04);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  transition:
    transform 0.45s var(--cgd-ease-out),
    box-shadow 0.45s var(--cgd-ease-out),
    border-color 0.45s var(--cgd-ease-out),
    background 0.45s var(--cgd-ease-out);
}
.cgd-flow__step.is-active {
  background: #fff;
  border-color: rgba(0, 168, 120, 0.4);
  box-shadow:
    0 22px 48px -20px rgba(11, 63, 54, 0.3),
    0 2px 8px rgba(11, 63, 54, 0.06);
  transform: translate(-50%, -8px);
  z-index: 4;
}
.cgd-flow__num {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--cgd-font-display);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--cgd-green-accent);
}
.cgd-flow__num::before {
  content: '';
  width: 18px;
  height: 2px;
  border-radius: 1px;
  background: var(--cgd-green-accent);
  transition: width 0.45s var(--cgd-ease-out);
}
.cgd-flow__step.is-active .cgd-flow__num::before { width: 30px; }
.cgd-flow__label {
  font-family: var(--cgd-font-display);
  font-size: clamp(1.0625rem, 1.9vw, 1.5rem);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--cgd-green-dark);
  white-space: normal;
  max-width: 100%;
}
.cgd-flow__desc {
  max-width: 100%;
  margin: 6px 0 0;
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--cgd-gray-text);
  white-space: normal;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.5s var(--cgd-ease-out), transform 0.5s var(--cgd-ease-out);
}
.cgd-flow__step.is-active .cgd-flow__desc {
  opacity: 1;
  transform: none;
}

/* Rodapé persistente */
.cgd-flow__foot {
  flex: 0 0 auto;
  text-align: center;
  position: relative;
  z-index: 3;
  margin-top: clamp(32px, 6vh, 64px);
}
.cgd-flow__caption {
  max-width: 640px;
  margin: 0 auto;
  font-size: clamp(0.9375rem, 1.4vw, 1.0625rem);
  line-height: 1.6;
  color: var(--cgd-gray-text);
}
.cgd-flow__foot-link { margin-top: 14px; }

/* Dica de rolagem */
.cgd-flow__hint {
  position: absolute;
  right: max(24px, 4vw);
  bottom: clamp(36px, 6vh, 60px);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--cgd-font-display);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cgd-gray-muted);
  z-index: 3;
  transition: opacity 0.4s;
  opacity: calc(1 - var(--flow-progress, 0) * 3);
  pointer-events: none;
}
.cgd-flow__hint svg { width: 22px; height: 22px; }

/* ── Mobile — layout vertical editorial ── */
@media (max-width: 768px) {
  .cgd-flow { height: auto; }
  .cgd-flow__pin { min-height: 520px; }
  .cgd-flow__track { min-width: 320vw; }
  .cgd-flow__wave { height: 34%; }
  .cgd-flow__hint { display: none; }
}

.cgd-flow--mobile {
  height: auto;
}

.cgd-flow--mobile .cgd-flow__pin {
  position: static;
  height: auto;
  min-height: 0;
  padding: 72px 0;
  overflow: visible;
}

.cgd-flow--mobile .cgd-flow__head {
  margin-bottom: 56px;
}

.cgd-flow--mobile .cgd-flow__title {
  margin-top: 12px;
}

.cgd-flow--mobile .cgd-flow__viewport {
  overflow: visible;
  flex: none;
  min-height: 0;
  padding-left: max(24px, env(safe-area-inset-left));
  padding-right: max(24px, env(safe-area-inset-right));
}

.cgd-flow--mobile .cgd-flow__viewport::after {
  display: none;
}

.cgd-flow--mobile .cgd-flow__track {
  position: static;
  min-width: 0;
  transform: none !important;
}

.cgd-flow--mobile .cgd-flow__wave {
  display: none;
}

.cgd-flow--mobile .cgd-flow__steps {
  position: static;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.cgd-flow--mobile .cgd-flow__step {
  position: static;
  left: auto;
  top: auto;
  transform: none !important;
  width: 100%;
  padding: 32px;
  border-radius: var(--cgd-radius, 14px);
  white-space: normal;
  background: var(--cgd-white, #ffffff);
  border: 1px solid rgba(11, 63, 54, 0.08);
  box-shadow: var(--cgd-shadow, 0 4px 24px rgba(11, 63, 54, 0.08));
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
}

.cgd-flow--mobile .cgd-flow__step.is-active {
  transform: none;
  border-color: rgba(0, 168, 120, 0.25);
  box-shadow: var(--cgd-shadow-lg, 0 20px 60px rgba(11, 63, 54, 0.14));
}

.cgd-flow--mobile .cgd-flow__num {
  display: block;
  font-size: clamp(3rem, 14vw, 4.25rem);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 0.95;
  color: var(--cgd-green-accent);
  margin-bottom: 20px;
}

.cgd-flow--mobile .cgd-flow__num::before {
  display: none;
}

.cgd-flow--mobile .cgd-flow__label {
  font-size: clamp(1.375rem, 5.5vw, 1.625rem);
  line-height: 1.2;
  margin-bottom: 12px;
}

.cgd-flow--mobile .cgd-flow__desc {
  opacity: 1;
  transform: none;
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--cgd-gray-text);
  margin: 0;
}

.cgd-flow--mobile .cgd-flow__foot {
  margin-top: 56px;
}

.cgd-flow--mobile .cgd-flow__caption {
  text-align: left;
  max-width: none;
}

/* ── Fallback: sem JS / movimento reduzido → scroll horizontal nativo ── */
.cgd-flow--static { height: auto; }
.cgd-flow--static .cgd-flow__pin {
  position: static;
  height: auto;
  min-height: 0;
  padding: clamp(56px, 8vh, 96px) 0;
}
.cgd-flow--static .cgd-flow__viewport {
  overflow-x: auto;
  overflow-y: hidden;
  min-height: clamp(380px, 56vh, 520px);
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}
.cgd-flow--static .cgd-flow__step { opacity: 1; scroll-snap-align: center; }
.cgd-flow--static .cgd-flow__hint { display: none; }

@media (prefers-reduced-motion: reduce) {
  .cgd-flow__bar { animation: none; }
}
