/* ============================================================
   Formulário de qualificação — Leger Curadoria
   Direção tirada do feed: claro, quente e editorial. Neutros de baixa
   saturação, nada de preto puro nem branco puro. Cormorant Garamond nas
   perguntas, Jost leve em caixa alta nos rótulos.
   Proposta a validar com a cliente — se existir manual de marca, ele manda.
   ============================================================ */

/* ---------- tokens ---------- */
:root {
  --bg:          #F2EEE7;  /* creme/osso, nunca branco puro */
  --surface:     #FBF9F5;  /* cartão, quase branco quente */
  --fg:          #3A342E;  /* café escuro, nunca preto puro */
  --accent:      #A89078;  /* camel/taupe — progresso e estado marcado */
  --accent-deep: #6B5B4C;  /* marrom profundo — texto de apoio forte */

  --fg-60:    rgba(58, 52, 46, 0.6);
  --fg-40:    rgba(58, 52, 46, 0.4);
  --hairline: rgba(58, 52, 46, 0.14);
  --accent-10: rgba(168, 144, 120, 0.10);
  --accent-18: rgba(168, 144, 120, 0.18);

  /* Vinho, vindo das roupas do feed: só para erro. */
  --erro: #8E4A3E;

  --serif: "Cormorant Garamond", "Cormorant", Georgia, "Times New Roman", serif;
  --sans:  "Jost", -apple-system, system-ui, "Helvetica Neue", Helvetica, sans-serif;

  --shell: 680px;
  --gutter: 24px;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;          /* o formulário não rola: uma pergunta por tela */
  overscroll-behavior: none;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }

button { font: inherit; color: inherit; }

::selection { background: var(--accent-18); color: var(--fg); }
:focus-visible { outline: 1px solid var(--accent-deep); outline-offset: 4px; }

/* ---------- fundo ---------- */
/* Um único degradê de areia, quase imperceptível. Sem halos: o clima é sóbrio. */
.ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 90% 70% at 50% 0%, rgba(214, 198, 176, 0.32), transparent 70%);
}

/* ---------- estrutura ---------- */
.app {
  position: relative;
  z-index: 1;
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

.progresso {
  flex: none;
  height: 2px;
  background: var(--hairline);
}
.progresso__barra {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.6s var(--ease-out);
}

.palco {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
}

/* ---------- telas ---------- */
/* Todas as telas ocupam a mesma célula; só a ativa é exibida. O overflow-y
   é a válvula de escape: em tela muito baixa (celular com teclado aberto) a
   pergunta rola dentro de si mesma em vez de ser cortada. */
.tela {
  display: none;
  width: 100%;
  max-width: calc(var(--shell) + var(--gutter) * 2);
  margin: 0 auto;
  padding: 32px var(--gutter) 96px;
  overflow-y: auto;
  flex-direction: column;
  justify-content: center;
}
.tela--ativa {
  display: flex;
  animation: entrada 0.6s var(--ease-out) both;
}
.tela--centro { text-align: center; align-items: center; }

@keyframes entrada {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
/* Ao voltar, a tela entra de cima — o sentido do movimento confirma a direção. */
.tela--ativa.tela--voltando { animation-name: entradaReversa; }
@keyframes entradaReversa {
  from { opacity: 0; transform: translateY(-16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .tela--ativa { animation: none; }
  .progresso__barra { transition: none; }
}

/* ---------- tipografia das telas ---------- */
/* Rótulos: Jost leve, caixa alta, entreletra aberta — a voz das legendas do feed. */
.tela__eyebrow,
.tela__num,
.outro__rotulo,
.dica {
  font-family: var(--sans);
  font-weight: 400;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.tela__eyebrow {
  color: var(--accent-deep);
  margin-bottom: 28px;
}

.tela__num {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--accent-deep);
  margin-bottom: 18px;
}
.tela__num-n { font-weight: 500; }

/* Perguntas e títulos: Cormorant, com itálico para ênfase. */
.tela__titulo,
.tela__pergunta {
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: -0.005em;
  color: var(--fg);
}
.tela__titulo em,
.tela__pergunta em { font-style: italic; color: var(--accent-deep); }

.tela__titulo {
  font-size: clamp(34px, 6.4vw, 56px);
  line-height: 1.08;
  max-width: 18ch;
}
.tela--centro .tela__titulo { max-width: 18ch; }

.tela__pergunta {
  font-size: clamp(28px, 5vw, 42px);
  line-height: 1.15;
}
.tela__pergunta label { cursor: text; }

.tela__legenda {
  margin-top: 10px;
  font-size: 15px;
  font-weight: 400;
  color: var(--accent-deep);
}

/* Texto corrido em café cheio e peso 400: em 300 e a 60% de opacidade ficava
   claro e fino demais para ler sobre o creme. */
.tela__texto {
  margin-top: 22px;
  font-size: clamp(17px, 2.3vw, 19px);
  font-weight: 400;
  line-height: 1.6;
  color: var(--fg);
  max-width: 46ch;
}
.tela__texto--apoio { margin-top: 14px; color: var(--accent-deep); }
.tela--centro .tela__texto { margin-left: auto; margin-right: auto; }

/* ---------- campos ---------- */
.tela__campo { margin-top: 32px; }

.entrada {
  width: 100%;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--hairline);
  color: var(--fg);
  font-family: var(--sans);
  font-size: clamp(20px, 3.2vw, 24px);
  font-weight: 400;
  padding: 10px 2px;
  border-radius: 0;                 /* iOS arredonda inputs por padrão */
  transition: border-color 0.25s ease;
}
.entrada::placeholder { color: var(--fg-40); font-weight: 300; }
.entrada:focus { outline: none; border-bottom-color: var(--accent); }
.entrada:-webkit-autofill {
  -webkit-text-fill-color: var(--fg);
  -webkit-box-shadow: 0 0 0 1000px var(--bg) inset;
}
.tela--erro .entrada { border-bottom-color: var(--erro); }

/* Texto longo: caixa de fio fino, como as legendas do feed. Cresce com o
   texto até um teto e então rola por dentro — o teto em vh é o que mantém a
   pergunta e o botão OK na tela com o teclado do celular aberto. */
.entrada--longa {
  display: block;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  background: rgba(251, 249, 245, 0.55);
  font-size: 17px;
  line-height: 1.55;
  padding: 14px 16px;
  min-height: 7.5em;
  max-height: 34vh;
  resize: none;
  overflow-y: auto;
}
.entrada--longa:focus { border-color: var(--accent); }
.tela--erro .entrada--longa { border-color: var(--erro); }

.erro {
  margin-top: 12px;
  font-size: 14px;
  font-weight: 400;
  color: var(--erro);
}

/* ---------- opções ---------- */
/* Retângulo de fio fino, sem preenchimento — a forma das caixas de legenda do feed. */
.opcoes {
  margin-top: 28px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.opcao {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  background: transparent;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  padding: 13px 16px;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.opcao:hover { border-color: var(--accent); }
.opcao--marcada {
  border-color: var(--accent);
  background: var(--accent-10);
}

.opcao__tecla {
  flex: none;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 1px solid var(--hairline);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 400;
  color: var(--fg-60);
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}
.opcao--marcada .opcao__tecla,
.opcao:hover .opcao__tecla { border-color: var(--accent); color: var(--accent-deep); }
.opcao--marcada .opcao__tecla { background: var(--accent-18); }

.opcao__texto { font-size: clamp(15px, 2.1vw, 17px); font-weight: 400; line-height: 1.4; }

/* ---------- "Outro" ---------- */
.outro { margin-top: 20px; }
.outro__rotulo { display: block; color: var(--fg-60); margin-bottom: 4px; }
.entrada--outro { font-size: clamp(18px, 2.8vw, 21px); }
.outro .tela__acoes { margin-top: 22px; }

/* ---------- botões ---------- */
.tela__acoes {
  margin-top: 32px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.tela--centro .tela__acoes { justify-content: center; }

.btn {
  background: var(--fg);
  color: var(--bg);
  border: 0;
  text-decoration: none;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 14px 30px;
  border-radius: 100px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: background 0.25s ease, opacity 0.2s ease;
}
.btn:hover { background: var(--accent-deep); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn--lg { padding: 17px 36px; }
.btn__seta { letter-spacing: 0; }

.dica { color: var(--fg-60); font-size: 11px; }
.dica b { font-weight: 500; color: var(--accent-deep); }
@media (hover: none) { .dica { display: none; } }

/* ---------- navegação ---------- */
.nav {
  position: fixed;
  right: 20px;
  bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 3;
  display: flex;
  gap: 0;
}
/* display:flex vence o [hidden] do HTML — sem esta linha a navegação aparece
   na tela de abertura e nas de obrigado. */
.nav[hidden] { display: none; }
.nav__btn {
  width: 40px;
  height: 38px;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--hairline);
  color: var(--fg-60);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}
.nav__btn + .nav__btn { border-left: 0; }
.nav__btn:first-child { border-radius: 6px 0 0 6px; }
.nav__btn:last-child  { border-radius: 0 6px 6px 0; }
.nav__btn:hover:not(:disabled) { background: var(--accent-10); color: var(--fg); }
.nav__btn:disabled { opacity: 0.35; cursor: default; }
.nav__btn svg { width: 20px; height: 20px; }

/* ---------- carregando ---------- */
.carregando { display: flex; gap: 8px; margin-bottom: 18px; }
.carregando span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulso 1.2s ease-in-out infinite;
}
.carregando span:nth-child(2) { animation-delay: 0.18s; }
.carregando span:nth-child(3) { animation-delay: 0.36s; }
@keyframes pulso {
  0%, 80%, 100% { opacity: 0.25; }
  40%           { opacity: 1; }
}

/* ---------- armadilha (honeypot) ---------- */
/* Fora da tela em vez de display:none — alguns robôs ignoram campos ocultos. */
.armadilha {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ---------- celular ---------- */
@media (max-width: 520px) {
  .tela { padding-bottom: 84px; }
  .tela__campo { margin-top: 24px; }
  .opcoes { margin-top: 22px; }
}

/* ---------- telas baixas ---------- */
/* Inclui o celular com o teclado aberto (no Android, graças ao
   interactive-widget do viewport). A pergunta sobe para o topo e tudo aperta. */
@media (max-height: 600px) {
  .tela { padding-top: 20px; padding-bottom: 72px; justify-content: flex-start; }
  .tela__num { margin-bottom: 10px; }
  .tela__acoes { margin-top: 20px; }
  .opcoes { margin-top: 16px; gap: 6px; }
  .opcao { padding: 10px 14px; }
  .tela__pergunta { font-size: clamp(24px, 4.4vw, 34px); }
  .tela__campo { margin-top: 16px; }
  .entrada--longa { min-height: 5em; max-height: 26vh; }
}
@media (max-height: 440px) {
  .tela--longo .tela__pergunta { font-size: 22px; }
  .tela--longo .tela__num { display: none; }
  .entrada--longa { min-height: 4.2em; }
}
