/* ============================================================
   Seventy · Construttore — Formulário de Qualificação
   ============================================================ */

:root {
  --verde-profundo: #272D21;
  --verde-salvia: #859072;
  --azul-petroleo: #01333F;
  --azul-medio: #53828C;
  --bege-areia: #D6D0C4;
  --branco: #FFFFFF;
  --texto-claro: rgba(214, 208, 196, 0.85);

  --font-serif: 'Cardo', Georgia, serif;
  --font-sans: 'Inter Tight', -apple-system, sans-serif;

  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-pop: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-serif);
  background-color: var(--azul-petroleo);
  color: var(--branco);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Textura de granulado sutil sobre todo o fundo */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

button {
  font-family: inherit;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* ============ LOGO ============ */
/* Versão monocromática bege-areia para fundos escuros */
.logo {
  filter: brightness(0) saturate(100%) invert(89%) sepia(6%) saturate(300%) hue-rotate(357deg) brightness(97%) contrast(90%);
}
.logo-cover { width: 72px; height: auto; margin: 0 auto 8px; display: block; }
.logo-small { width: 36px; height: auto; }
.logo-conclusion { width: 56px; height: auto; margin: 0 auto 20px; display: block; }

/* ============ HEADER DO FLUXO (perguntas) ============ */
.flow-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
}
.flow-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 0;
  max-width: 480px;
  margin: 0 auto;
}
.step-label {
  font-family: var(--font-sans);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--texto-claro);
}
.progress-track {
  height: 2px;
  background: rgba(214, 208, 196, 0.15);
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--bege-areia);
  transition: width 0.4s var(--ease-smooth);
}

/* ============ TELAS ============ */
.form-container {
  position: relative;
  min-height: 100dvh;
  z-index: 2;
}

.screen {
  display: none;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  padding: 24px 20px;
  flex-direction: column;
}
.screen.active { display: flex; }

/* Transição em 3 fases — fase 1: tela atual sai */
.screen.exit-left { animation: exitLeft 0.25s ease-in forwards; }
.screen.exit-right { animation: exitRight 0.25s ease-in forwards; }
@keyframes exitLeft { to { transform: translateX(-100%); } }
@keyframes exitRight { to { transform: translateX(100%); } }

/* Fase 3: nova tela entra com fade suave */
.screen.enter-fwd { animation: enterFwd 0.3s ease-out both; }
.screen.enter-back { animation: enterBack 0.3s ease-out both; }
@keyframes enterFwd {
  from { transform: translateX(60px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes enterBack {
  from { transform: translateX(-60px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Fase 2: camada de wipe atravessando a tela */
.transition-wipe {
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: var(--azul-petroleo);
  z-index: 9999;
  pointer-events: none;
  transform: translateX(-100%);
}
.transition-wipe.wipe-ltr { animation: wipeLTR 0.3s ease-in-out forwards; }
.transition-wipe.wipe-rtl { animation: wipeRTL 0.3s ease-in-out forwards; }
@keyframes wipeLTR {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}
@keyframes wipeRTL {
  from { transform: translateX(100%); }
  to { transform: translateX(-100%); }
}

/* Bloqueia cliques durante a transição (evita double-tap) */
.form-container.no-pointer { pointer-events: none; }

/* Campo-proxy do teclado mobile: precisa ser focável, então não pode usar
   display:none nem visibility:hidden. font-size 16px evita o zoom do iOS. */
.kb-proxy {
  position: fixed;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  outline: none;
  opacity: 0;
  font-size: 16px;
  background: transparent;
  pointer-events: none;
  z-index: -1;
}

@media (min-width: 768px) {
  .screen { padding: 40px 20px; }
  .screen > * , .screen .cover-content, .screen .conclusion-content {
    width: 100%;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
  }
}

/* ============ CAPA ============ */
.screen-cover {
  background:
    linear-gradient(to bottom, transparent 30%, rgba(1, 51, 63, 0.85) 65%),
    url('assets/background-1.png') 65% top / cover no-repeat,
    var(--azul-petroleo);
  justify-content: flex-end;
  text-align: center;
}
.cover-content {
  width: 100%;
  padding-bottom: 12px;
}

.cover-title {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(2rem, 8.5vw, 3.2rem);
  letter-spacing: 0.22em;
  margin-right: -0.22em; /* compensa o tracking no centramento */
  line-height: 1.1;
}
.cover-subtitle {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.15rem;
  color: var(--texto-claro);
  margin-top: 2px;
}

.cover-divider {
  width: 48px;
  height: 1px;
  background: rgba(214, 208, 196, 0.35);
  margin: 20px auto;
}

.cover-highlight {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.88rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--bege-areia);
  line-height: 1.7;
}
.cover-info {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--texto-claro);
  line-height: 2;
  margin-top: 14px;
}
.cover-info-minor { margin-top: 6px; }

.cover-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.tagline {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.64rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(214, 208, 196, 0.55);
  margin-top: auto;
  padding-top: 16px;
}

/* Cascade de entrada */
[data-animate] {
  opacity: 0;
}
.fade-slide-up {
  animation: fadeSlideUp 0.7s var(--ease-smooth) forwards;
}
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(22px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============ BOTÕES ============ */
.btn {
  display: block;
  width: 100%;
  padding: 16px 24px;
  min-height: 56px;
  border-radius: 2px;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--bege-areia);
  color: var(--azul-petroleo);
  border: 1px solid var(--bege-areia);
}
.btn-secondary {
  background: transparent;
  color: var(--bege-areia);
  border: 1px solid rgba(214, 208, 196, 0.45);
}

.btn-pulse { animation: btnPulse 2.4s ease-in-out 1.6s infinite; }
@keyframes btnPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(214, 208, 196, 0.35); }
  50% { box-shadow: 0 0 0 10px rgba(214, 208, 196, 0); }
}

/* ============ PERGUNTAS ============ */
.screen-question {
  justify-content: center;
  padding-top: 88px;
  padding-bottom: 48px;
}

.question-image {
  display: block;
  width: 100%;
  height: 200px;
  object-fit: cover;
  object-position: center;
  border-radius: 12px;
  margin-bottom: 24px;
}
@media (min-width: 768px) {
  .question-image { height: 240px; }
}
@keyframes imgReveal {
  from { opacity: 0; transform: scale(1.04); }
  to { opacity: 1; transform: scale(1); }
}

/* ============ CASCATA — só nas perguntas de botões (.has-cards) ============ */

/* Entrada: imagem → pergunta → opções, em sequência */
@keyframes elemIn {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}
.screen.has-cards.cascade-in .question-image {
  animation: imgReveal 0.4s ease-out both;
}
.screen.has-cards.cascade-in .question-title {
  animation: elemIn 0.35s ease-out both;
  animation-delay: 0.12s;
}
.screen.has-cards.cascade-in .option-card {
  animation: elemIn 0.35s ease-out both;
}
.screen.has-cards.cascade-in .option-card:nth-child(1) { animation-delay: 0.20s; }
.screen.has-cards.cascade-in .option-card:nth-child(2) { animation-delay: 0.27s; }
.screen.has-cards.cascade-in .option-card:nth-child(3) { animation-delay: 0.34s; }
.screen.has-cards.cascade-in .option-card:nth-child(4) { animation-delay: 0.41s; }

/* Saída: elementos somem em sequência enquanto a tela desliza */
@keyframes elemOut {
  to { opacity: 0; transform: translateY(-14px); }
}
.screen.has-cards.cascade-out .question-image {
  animation: elemOut 0.18s ease-in both;
}
.screen.has-cards.cascade-out .question-title {
  animation: elemOut 0.18s ease-in both;
  animation-delay: 0.03s;
}
.screen.has-cards.cascade-out .option-card {
  animation: elemOut 0.16s ease-in both;
}
.screen.has-cards.cascade-out .option-card:nth-child(1) { animation-delay: 0.05s; }
.screen.has-cards.cascade-out .option-card:nth-child(2) { animation-delay: 0.08s; }
.screen.has-cards.cascade-out .option-card:nth-child(3) { animation-delay: 0.11s; }
.screen.has-cards.cascade-out .option-card:nth-child(4) { animation-delay: 0.14s; }

.question-title {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(1.4rem, 5vw, 2rem);
  color: var(--branco);
  line-height: 1.3;
  margin-bottom: 28px;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.option-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 56px;
  padding: 16px;
  text-align: left;
  background: rgba(214, 208, 196, 0.04);
  border: 1px solid rgba(214, 208, 196, 0.2);
  border-radius: 2px;
  color: var(--branco);
  transition: all 0.2s ease;
}
.option-card:active { transform: scale(0.97); }
.option-card.selected {
  border-color: var(--bege-areia);
  background: rgba(214, 208, 196, 0.1);
  box-shadow: 0 0 20px rgba(214, 208, 196, 0.15);
}

.option-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  color: var(--azul-medio);
}
.option-icon svg { width: 100%; height: 100%; }
.option-card.selected .option-icon { color: var(--bege-areia); }

.option-text {
  flex: 1;
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.92rem;
  letter-spacing: 0.02em;
}

.check-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  color: var(--bege-areia);
  display: none;
}
.check-icon svg { width: 100%; height: 100%; }
.option-card.selected .check-icon {
  display: block;
  animation: checkPop 0.3s var(--ease-pop);
}
@keyframes checkPop {
  from { transform: scale(0) rotate(-45deg); opacity: 0; }
  to { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* ============ CAMPOS DE TEXTO ============ */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.input-group-reveal {
  margin-top: 14px;
  animation: fadeSlideUp 0.4s var(--ease-smooth);
}

.text-input {
  width: 100%;
  padding: 16px;
  min-height: 56px;
  background: rgba(214, 208, 196, 0.04);
  border: 1px solid rgba(214, 208, 196, 0.2);
  border-radius: 2px;
  font-family: var(--font-serif);
  font-size: 1.1rem;
  color: var(--branco);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
}
.text-input::placeholder { color: rgba(214, 208, 196, 0.4); }
.text-input:focus {
  border-color: var(--bege-areia);
  box-shadow: 0 0 20px rgba(214, 208, 196, 0.12);
}
.text-input.invalid { border-color: rgba(220, 120, 100, 0.8); }

.input-error {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: #E0A090;
  margin-top: -6px;
}

/* ============ TEMA CLARO (perguntas de texto do lead) ============ */

.screen-light { background: var(--branco); }
.screen-light .question-title { color: var(--azul-petroleo); }

.screen-light .text-input {
  background: #F5F4F1;
  border: 1.5px solid var(--bege-areia);
  color: var(--verde-profundo);
  border-radius: 10px;
}
.screen-light .text-input::placeholder { color: rgba(39, 45, 33, 0.35); }
.screen-light .text-input:focus {
  border-color: var(--azul-petroleo);
  box-shadow: 0 0 0 3px rgba(1, 51, 63, 0.12);
}
.screen-light .text-input.invalid { border-color: #B0563F; }
.screen-light .input-error { color: #B0563F; }

.screen-light .btn-primary {
  background: var(--azul-petroleo);
  color: var(--bege-areia);
  border-color: var(--azul-petroleo);
  border-radius: 10px;
}

/* Header adaptado ao tema claro (aplicado via JS no body) */
body.light-theme .progress-track { background: var(--bege-areia); }
body.light-theme .progress-fill { background: var(--azul-petroleo); }
body.light-theme .step-label { color: var(--verde-salvia); }
body.light-theme .logo-small { filter: none; } /* versão original escura da logo */

/* ============ CONCLUSÃO ============ */
.screen-conclusion {
  background:
    linear-gradient(to bottom, rgba(1, 51, 63, 0.6) 0%, rgba(1, 51, 63, 0.92) 100%),
    url('assets/background-2.png') center top / cover no-repeat,
    var(--azul-petroleo);
  justify-content: center;
  text-align: center;
  position: relative;
}

#confetti-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
}

.conclusion-content {
  position: relative;
  z-index: 6;
  width: 100%;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 48px);
  min-height: calc(100dvh - 48px);
  justify-content: center;
}

.conclusion-title {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(1.7rem, 6.5vw, 2.3rem);
  line-height: 1.25;
  margin-bottom: 18px;
}

.star-icon {
  width: 0.6em;
  height: 0.6em;
  color: var(--bege-areia);
  vertical-align: baseline;
  animation: starTwinkle 2.2s ease-in-out infinite;
}
@keyframes starTwinkle {
  0%, 100% { opacity: 1; transform: scale(1) rotate(0deg); }
  50% { opacity: 0.5; transform: scale(0.82) rotate(18deg); }
}

.conclusion-label {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--bege-areia);
  margin-bottom: 16px;
}

.summary-box {
  border-top: 1px solid rgba(214, 208, 196, 0.25);
  border-bottom: 1px solid rgba(214, 208, 196, 0.25);
  padding: 18px 4px;
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
}
.summary-item {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 0.9rem;
  color: var(--texto-claro);
}
.summary-emoji { flex-shrink: 0; font-size: 0.95rem; }

.conclusion-message {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.15rem;
  color: var(--texto-claro);
  line-height: 1.5;
  margin-bottom: 24px;
}

.btn-whatsapp { margin-bottom: 26px; }

/* Estado bloqueado: aguardando a API definir a corretora */
.btn-whatsapp.btn-loading {
  background: var(--azul-medio);
  border-color: var(--azul-medio);
  color: var(--branco);
  pointer-events: none;
  cursor: not-allowed;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.btn-spinner {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  animation: spin 0.8s linear infinite;
}
.btn-spinner circle {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 42;
  stroke-dashoffset: 14;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Estado liberado: URL do WhatsApp pronta — branco pulsando */
.btn-whatsapp.btn-unlocked {
  background: var(--branco);
  border-color: var(--branco);
  color: var(--azul-petroleo);
  pointer-events: auto;
  cursor: pointer;
  animation:
    btnUnlock 0.3s ease-out,
    btnPulseWhite 2.2s ease-in-out 0.3s infinite;
}
@keyframes btnUnlock {
  from { transform: scale(0.97); opacity: 0.6; }
  to { transform: scale(1); opacity: 1; }
}
@keyframes btnPulseWhite {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.5); }
  50% { box-shadow: 0 0 0 14px rgba(255, 255, 255, 0); }
}

.auto-redirect { margin-bottom: 8px; }
.auto-redirect-label {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--texto-claro);
  margin-bottom: 10px;
}
.auto-progress-track {
  height: 2px;
  background: rgba(214, 208, 196, 0.15);
  border-radius: 1px;
  overflow: hidden;
}
.auto-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--bege-areia);
}

/* ============ ACESSIBILIDADE ============ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  [data-animate] { opacity: 1; }
}
