/* Archon — formulário de diagnóstico (Bloco 2).
 * Uma pergunta por tela. O traço do A é a barra de progresso.
 * Depende dos tokens de archon.css.
 */

.diag { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }

/* ---------- topo ---------- */
.diag-topo { display: flex; align-items: center; gap: 20px; padding: 18px clamp(16px, 4vw, 40px); }
.diag-contagem { margin-left: auto; color: var(--tinta-3); font-variant-numeric: tabular-nums; }
.diag-sair { font-size: 14px; font-weight: 500; color: var(--tinta-2); text-decoration: none; }
.diag-sair:hover { color: var(--tinta); }
.diag-contagem:empty + .diag-sair { margin-left: auto; }

/* ---------- traço = progresso ---------- */
.diag-traco { position: relative; height: 24px; margin: 0 clamp(16px, 4vw, 40px); }
.diag-traco svg { width: 100%; height: 100%; overflow: visible; }
.diag-traco path { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.traco-base { stroke: var(--linha-2); }
.traco-vivo { stroke: var(--azul); stroke-dasharray: 1; stroke-dashoffset: var(--d, 1); transition: stroke-dashoffset .8s var(--suave); }
.traco-ponto { position: absolute; top: 50%; width: 10px; height: 10px; margin-top: -5px; border-radius: 50%; background: var(--papel); border: 2px solid var(--linha-2); transition: background .4s, border-color .4s, transform .5s var(--suave); }
.traco-inicio { left: -2px; background: var(--azul); border-color: var(--azul); }
.traco-fim { right: -2px; }
.diag-traco.completo .traco-fim { background: var(--azul); border-color: var(--azul); transform: scale(1.3); box-shadow: 0 0 0 4px var(--veu); }

/* ---------- palco ---------- */
.diag-palco { flex: 1; display: flex; justify-content: center; padding: clamp(32px, 9vh, 96px) 16px 24px; }
#diag-form { width: 100%; max-width: 640px; display: flex; flex-direction: column; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }

.passo { animation: passo-entra .5s var(--suave); }
.passo.voltando { animation-name: passo-volta; }
@keyframes passo-entra { from { opacity: 0; transform: translateY(18px); } }
@keyframes passo-volta { from { opacity: 0; transform: translateY(-18px); } }

.pergunta {
  display: block; padding: 0; margin-bottom: 28px;
  font-family: var(--f-display); font-weight: 650; font-stretch: 92%;
  font-size: clamp(28px, 4.2vw, 44px); line-height: 1.08; letter-spacing: -.035em;
  text-wrap: balance; color: var(--tinta);
}
.pergunta [data-nome], .pergunta [data-empresa] { color: var(--azul); }
.dica { color: var(--tinta-2); font-size: var(--t-p); margin: -14px 0 24px; }
.dica-linha { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.dica-linha .dica { margin-bottom: 20px; }

/* ---------- campo de texto ---------- */
.campo {
  width: 100%; padding: 12px 2px; border: 0; border-bottom: 2px solid var(--linha-2); border-radius: 0;
  background: transparent; color: var(--tinta);
  font: 500 clamp(22px, 3vw, 28px)/1.3 var(--f-texto); letter-spacing: -.01em;
  transition: border-color .3s;
}
.campo::placeholder { color: var(--tinta-3); opacity: .6; }
.campo:focus { outline: none; border-color: var(--azul); }
.campo[aria-invalid="true"] { border-color: #C2410C; }

/* ---------- opções ---------- */
.opcoes { display: grid; gap: 10px; }
.opcoes-linha { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.opcao {
  position: relative; display: flex; align-items: center; gap: 14px;
  min-height: 60px; padding: 12px 18px 12px 12px; border-radius: var(--raio-p);
  background: var(--painel); border: 1.5px solid var(--linha);
  font-weight: 500; font-size: var(--t-m); line-height: 1.25; cursor: pointer;
  transition: border-color .25s, background .25s, transform .3s var(--suave), box-shadow .3s;
}
.opcao:hover { border-color: var(--linha-2); transform: translateY(-1px); box-shadow: 0 8px 20px -14px rgba(40, 30, 10, .35); }
.opcao input { position: absolute; opacity: 0; pointer-events: none; }
.opcao span { flex: 1; }
.opcao small { display: block; font-size: 13px; font-weight: 400; color: var(--tinta-3); margin-top: 2px; }
.tecla {
  flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px;
  border: 1px solid var(--linha-2); background: var(--painel-2);
  font: 500 12px/1 var(--f-mono); color: var(--tinta-2); transition: background .25s, color .25s, border-color .25s;
}
.opcao::after {
  content: ""; flex: none; width: 20px; height: 20px; border-radius: 50%;
  border: 1.5px solid var(--linha-2); transition: background .25s, border-color .25s, box-shadow .25s;
}
.opcao:has(input:focus-visible) { outline: 2px solid var(--azul); outline-offset: 2px; }
.opcao:has(input:checked) { border-color: var(--azul); background: var(--veu); }
.opcao:has(input:checked) .tecla { background: var(--azul); border-color: var(--azul); color: #fff; }
.opcao:has(input:checked)::after { background: var(--azul) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M6 10.5l2.6 2.6L14 7.5' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 100% no-repeat; border-color: var(--azul); }
.opcao.piscando { animation: piscar .32s steps(2) 1; }
@keyframes piscar { 50% { background: var(--painel); } }

/* moeda */
.moeda { flex: none; display: inline-flex; padding: 3px; border-radius: 999px; background: var(--pedra); border: 1px solid var(--linha); }
.moeda button { border: 0; background: transparent; padding: 6px 14px; border-radius: 999px; font: 600 14px/1 var(--f-texto); color: var(--tinta-2); cursor: pointer; transition: background .25s, color .25s; }
.moeda button[aria-pressed="true"] { background: var(--painel); color: var(--tinta); box-shadow: 0 1px 2px rgba(20, 22, 26, .1); }

/* ---------- telefone + aceite ---------- */
.telefone { display: flex; gap: 12px; align-items: flex-end; }
.telefone select {
  flex: none; height: 52px; padding: 0 30px 0 12px; border-radius: var(--raio-p);
  border: 1.5px solid var(--linha); background: var(--painel) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%235F6168' stroke-width='1.6'/%3E%3C/svg%3E") right 10px center / 11px no-repeat;
  font: 500 16px/1 var(--f-texto); color: var(--tinta); appearance: none; cursor: pointer;
}
.telefone select:focus-visible { outline: 2px solid var(--azul); outline-offset: 2px; }
.aceite { display: flex; gap: 12px; align-items: flex-start; margin-top: 28px; font-size: var(--t-p); color: var(--tinta-2); line-height: 1.5; cursor: pointer; }
.aceite input { flex: none; width: 22px; height: 22px; margin: 0; accent-color: var(--azul); cursor: pointer; }
.aceite a { color: var(--azul); }

/* ---------- erro + status ---------- */
.erro { min-height: 1.5em; margin-top: 12px; color: #C2410C; font-size: var(--t-p); font-weight: 500; }
.erro:empty { visibility: hidden; }
.envio-status { min-height: 1.5em; margin-top: 8px; color: var(--tinta-2); font-size: var(--t-p); text-align: right; }
.envio-status a { color: var(--azul); }

/* ---------- boas-vindas ---------- */
.conversa { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 40px; }
.avatar { flex: none; width: 64px; height: 64px; border-radius: 50%; object-fit: cover; background: var(--pedra); box-shadow: 0 0 0 4px var(--painel), 0 0 0 5px var(--linha); }
.baloes { display: grid; gap: 10px; }
.balao {
  padding: 16px 20px; border-radius: 6px 22px 22px 22px; background: var(--painel); border: 1px solid var(--linha);
  font-family: var(--f-display); font-size: clamp(20px, 2.6vw, 26px); font-weight: 550; line-height: 1.3; letter-spacing: -.02em;
  box-shadow: var(--sombra); animation: balao .6s var(--suave) both;
}
.balao-2 { border-radius: 22px; animation-delay: .9s; }
@keyframes balao { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.passo-acoes { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 18px; }
.passo[data-passo="boas-vindas"] .passo-acoes { animation: balao .6s 1.5s var(--suave) both; }
.passo-acoes .micro { flex-basis: 100%; }

/* ---------- navegação ---------- */
.diag-nav { display: flex; align-items: center; gap: 16px; margin-top: 36px; }
.diag-voltar { border: 0; background: none; padding: 10px 4px; font: 500 15px/1 var(--f-texto); color: var(--tinta-2); cursor: pointer; }
.diag-voltar:hover { color: var(--tinta); }
.diag-voltar[hidden] { display: none; }
.diag-atalho { margin-left: auto; color: var(--tinta-3); }
#diag-ok { min-width: 120px; }
#diag-ok[disabled] { opacity: .6; cursor: progress; transform: none; }

/* ---------- fim ---------- */
.passo-fim h2 { font-size: clamp(36px, 5vw, 60px); margin: 28px 0 18px; }
.passo-fim h2 [data-nome] { color: var(--azul); }
.passo-fim:focus { outline: none; }
.fim-texto { font-size: var(--t-g); color: var(--tinta-2); max-width: 40ch; margin-bottom: 32px; }
.fim-texto b { color: var(--tinta); font-weight: 600; }
.fim-proximos { border-top: 1px solid var(--linha); margin-bottom: 36px; }
.fim-proximos li { display: flex; gap: 16px; align-items: baseline; padding: 14px 0; border-bottom: 1px solid var(--linha); }
.fim-proximos .mono { color: var(--azul); }
.fim-selo svg { width: 64px; height: 64px; }
.fim-selo circle { fill: var(--azul); transform-origin: center; animation: selo .6s var(--suave) both; }
.fim-selo path { fill: none; stroke: #fff; stroke-width: 4.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: risco .5s .45s var(--suave) forwards; }
@keyframes selo { from { transform: scale(0); } }
@keyframes risco { to { stroke-dashoffset: 0; } }

/* ---------- rodapé ---------- */
.diag-rodape { display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; padding: 20px 16px 28px; color: var(--tinta-3); text-transform: none; letter-spacing: .02em; }
.diag-rodape a { color: var(--tinta-2); }

/* ---------- celular ---------- */
@media (max-width: 640px) {
  .diag-topo { padding: 14px 16px; }
  .diag-sair { display: none; }
  .diag-palco { padding-top: 28px; }
  .tecla, .diag-atalho { display: none; }
  .opcao { padding-left: 16px; }
  .conversa { flex-direction: column; }
  .avatar { width: 56px; height: 56px; }
  .dica-linha { flex-direction: column; gap: 0; }
  .dica-linha .moeda { margin-bottom: 16px; }
  .diag-nav {
    position: sticky; bottom: 0; margin: 28px -16px 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: linear-gradient(to top, var(--papel) 70%, rgba(246, 243, 238, 0));
  }
  #diag-ok { margin-left: auto; }
  .envio-status { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  .passo, .balao, .passo-acoes, .fim-selo circle { animation: none !important; }
  .fim-selo path { animation: none; stroke-dashoffset: 0; }
  .traco-vivo { transition: none; }
  .opcao { transition: none; }
}
