/* ============================================================
   Diagnóstico Dyg · form dinâmico
   Design exclusivo: fio do diagnóstico + orbes migrantes +
   número fantasma + inputs em sublinha editorial.
   Nada aqui reaproveita o layout da LP (só os tokens de marca).
   ============================================================ */

@font-face {
  font-family: 'Geist';
  src: url("assets/fonts/Geist[wght].ttf") format("truetype-variations");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'Geist Mono';
  src: url("assets/fonts/GeistMono[wght].ttf") format("truetype-variations");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --ink-000: #050505;
  --ink-100: #111111;
  --ink-300: #262626;
  --ink-500: #6E6E6E;
  --ink-600: #9B9B9B;
  --ink-900: #F5F5F2;

  --accent:      #1F7FFF;
  --accent-hi:   #4A9CFF;
  --accent-lo:   #0A5BD9;
  --accent-soft: #9CCBFF;
  --accent-glow: rgba(31,127,255,0.45);

  --silver-300: #B4BAC4;
  --silver-600: #6A7280;

  --sans: "Geist", -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", monospace;

  --snap: cubic-bezier(0.2, 0.9, 0.1, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { overflow-x: clip; }
body {
  min-height: 100svh;
  background: var(--ink-000);
  color: var(--ink-900);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
a.btn { text-decoration: none; }
::selection { background: var(--accent); color: #05070A; }

:focus-visible {
  outline: 2px solid rgba(31,127,255,0.75);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---------- ORBES MIGRANTES (fundo vivo, assinatura) ---------- */
.orb {
  position: fixed; z-index: 0; pointer-events: none;
  width: 62vmax; height: 62vmax; border-radius: 50%;
  filter: blur(90px);
  transition: transform 1200ms var(--snap), opacity 1200ms ease;
}
.orb-a {
  background: radial-gradient(circle, rgba(31,127,255,0.14), transparent 65%);
  top: -28vmax; right: -18vmax;
}
.orb-b {
  background: radial-gradient(circle, rgba(74,156,255,0.07), transparent 65%);
  bottom: -30vmax; left: -20vmax;
}
/* a página respira: cada etapa empurra os orbes pra um canto */
body[data-stage="intro"]   .orb-a { transform: translate(0, 0); }
body[data-stage="q1"]      .orb-a { transform: translate(-12vmax, 6vmax); }
body[data-stage="q2"]      .orb-a { transform: translate(-24vmax, 2vmax); }
body[data-stage="q3"]      .orb-a { transform: translate(-30vmax, 12vmax); }
body[data-stage="q4"]      .orb-a { transform: translate(-16vmax, 20vmax); }
body[data-stage="q5"]      .orb-a { transform: translate(-38vmax, 8vmax); }
body[data-stage="q6"]      .orb-a { transform: translate(-46vmax, 16vmax); }
body[data-stage="fim"]     .orb-a { transform: translate(-24vmax, 10vmax) scale(1.2); opacity: 0.9; }
body[data-stage="q2"]      .orb-b { transform: translate(8vmax, -4vmax); }
body[data-stage="q4"]      .orb-b { transform: translate(16vmax, -10vmax); }
body[data-stage="q6"]      .orb-b { transform: translate(22vmax, -14vmax); }
body[data-stage="fim"]     .orb-b { transform: translate(12vmax, -8vmax) scale(1.25); }

/* ---------- grão fino ---------- */
.grain {
  position: fixed; inset: 0; z-index: 60; pointer-events: none;
  opacity: 0.035; mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- HEADER ---------- */
.head {
  position: relative; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px clamp(20px, 5vw, 48px) 0;
}
.head-logo { width: 64px; height: auto; }
.head-count { font-size: 13px; color: var(--ink-600); letter-spacing: 0.08em; }

/* ---------- FIO DO DIAGNÓSTICO ---------- */
.fio {
  position: relative; z-index: 10;
  width: min(600px, calc(100% - 48px));
  margin: 18px auto 0;
  height: 24px;
}
.fio svg { width: 100%; height: 24px; display: block; overflow: visible; }
.fio-base { stroke: var(--ink-300); stroke-width: 2; }
.fio-fill {
  stroke: var(--accent); stroke-width: 2;
  stroke-dasharray: 576;
  stroke-dashoffset: 576;           /* JS anima até a fração da etapa */
  transition: stroke-dashoffset 700ms var(--snap);
  filter: drop-shadow(0 0 6px var(--accent-glow));
}
.no {
  fill: var(--ink-000);
  stroke: var(--ink-300); stroke-width: 2;
  transition: fill 400ms ease, stroke 400ms ease, filter 400ms ease;
}
.no.on {
  fill: var(--accent); stroke: var(--accent);
  filter: drop-shadow(0 0 8px var(--accent-glow));
}
.no.atual {
  stroke: var(--accent-soft);
  animation: no-pulsa 2.2s ease-in-out infinite;
}
@keyframes no-pulsa {
  0%, 100% { stroke-width: 2; }
  50%      { stroke-width: 4; }
}
.fio-pulse {
  fill: var(--accent-soft); opacity: 0;
  filter: drop-shadow(0 0 10px var(--accent-glow));
}
/* pulso final: percorre o fio quando o diagnóstico completa */
.fio.completa .fio-pulse { animation: percorre 900ms var(--snap) forwards; }
@keyframes percorre {
  0%   { opacity: 1; transform: translateX(0); }
  100% { opacity: 0; transform: translateX(576px); }
}

/* ---------- PALCO / TELAS ---------- */
.palco {
  position: relative; z-index: 5;
  flex: 1;
  display: grid;
  width: min(720px, calc(100% - 48px));
  margin: 0 auto;
  padding: clamp(24px, 6vh, 72px) 0;
}
/* o form não cria caixa: as telas participam do grid do palco */
#form { display: contents; }
#form[hidden] { display: none; }

.tela {
  grid-area: 1 / 1;
  position: relative;
  display: flex; flex-direction: column; justify-content: center;
  opacity: 0; visibility: hidden;
  transform: translateY(26px);
  filter: blur(6px);
  transition: opacity 420ms var(--snap), transform 420ms var(--snap),
              filter 420ms var(--snap), visibility 0s linear 420ms;
  pointer-events: none;
}
.tela.is-on {
  opacity: 1; visibility: visible;
  transform: translateY(0);
  filter: blur(0);
  transition-delay: 60ms, 60ms, 60ms, 0s;
  pointer-events: auto;
}
.tela.saiu {
  opacity: 0;
  transform: translateY(-26px);
  filter: blur(6px);
}

/* número fantasma da pergunta (assinatura) */
form .tela::before {
  content: attr(data-num);
  position: absolute;
  right: -0.05em; top: 50%;
  transform: translateY(-52%);
  font-family: var(--mono);
  font-size: clamp(180px, 34vw, 340px);
  font-weight: 500;
  color: transparent;
  -webkit-text-stroke: 1px rgba(180,186,196,0.10);
  letter-spacing: -0.04em;
  pointer-events: none;
  z-index: -1;
}

/* ---------- INTRO ---------- */
.eyebrow {
  font-size: 12px; letter-spacing: 0.14em;
  color: var(--accent); margin-bottom: 20px;
}
.intro-h1 {
  font-size: clamp(34px, 6vw, 60px);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.05;
  max-width: 16ch;
}
.intro-sub {
  margin-top: 20px;
  max-width: 52ch;
  font-size: clamp(16px, 2vw, 18px);
  color: var(--ink-600);
}
.intro-acao { margin-top: 36px; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.intro-lgpd { margin-top: 28px; font-size: 12px; color: var(--ink-500); letter-spacing: 0.04em; }

/* ---------- PERGUNTA / INPUT SUBLINHA ---------- */
.perg {
  display: block;
  font-size: clamp(24px, 4vw, 36px);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  max-width: 22ch;
}
.perg-nome { color: var(--accent-soft); }
.resp {
  margin-top: 28px;
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--silver-600);
  padding: 6px 2px 14px;
  font-family: var(--sans);
  font-size: clamp(22px, 3.4vw, 32px);
  font-weight: 500;
  color: #FFFFFF;
  caret-color: var(--accent);
  border-radius: 0;
  transition: border-color 240ms ease, box-shadow 240ms ease;
}
.resp.mono { font-family: var(--mono); }
.resp::placeholder { color: var(--ink-500); font-weight: 400; }
.resp:focus {
  outline: none;
  border-bottom-color: var(--accent);
  box-shadow: 0 12px 24px -18px var(--accent-glow);
}
.micro { margin-top: 14px; font-size: 12.5px; color: var(--ink-500); letter-spacing: 0.03em; }
.erro { margin-top: 14px; font-size: 12.5px; color: #FF5C64; letter-spacing: 0.03em; }

/* shake curto quando valida e falha */
.tela.treme .resp { animation: treme 320ms ease; }
@keyframes treme {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  60% { transform: translateX(5px); }
}

/* ---------- BOTÕES ---------- */
.acao { margin-top: 32px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--sans);
  font-size: 16px; font-weight: 600; color: #FFFFFF;
  background: linear-gradient(180deg, var(--accent-hi) -40%, var(--accent) 60%);
  border: none; border-radius: 4px; cursor: pointer;
  padding: 14px 26px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18), 0 8px 28px var(--accent-glow);
  transition: transform 180ms var(--snap), box-shadow 180ms ease;
}
.btn:hover  { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.985); }
.btn-ghost {
  display: inline-flex; align-items: center;
  font-family: var(--sans);
  font-size: 15px; font-weight: 500; color: var(--ink-600);
  background: none; border: none; cursor: pointer;
  padding: 14px 8px;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: var(--ink-500);
  transition: color 180ms ease;
}
.btn-ghost:hover { color: var(--ink-900); }
.hint { font-size: 12px; color: var(--ink-500); letter-spacing: 0.05em; }

/* ---------- CARDS DE FATURAMENTO ---------- */
.cards {
  margin-top: 28px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
@media (min-width: 680px) { .cards { grid-template-columns: 1fr 1fr; } }
.card {
  position: relative;
  display: flex; align-items: center; gap: 14px;
  text-align: left;
  background: rgba(17,17,17,0.66);
  border: 1px solid var(--ink-300);
  border-left: 2px solid var(--ink-300);
  border-radius: 4px;
  padding: 15px 16px;
  cursor: pointer;
  color: var(--ink-900);
  font-family: var(--sans);
  transition: border-color 200ms ease, background 200ms ease, transform 200ms var(--snap);
}
.card:hover { border-color: var(--silver-600); border-left-color: var(--accent); transform: translateX(3px); }
.card .card-k {
  flex: none;
  width: 24px; height: 24px;
  display: grid; place-items: center;
  font-size: 12px; color: var(--ink-600);
  border: 1px solid var(--ink-300); border-radius: 3px;
  transition: all 200ms ease;
}
.card .card-t { font-size: 15.5px; font-weight: 500; }
.card[aria-checked="true"] {
  border-color: var(--accent); border-left-color: var(--accent);
  background: rgba(31,127,255,0.10);
}
.card[aria-checked="true"] .card-k {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.hint-teclas { margin-top: 18px; }
@media (hover: none) { .hint-teclas, .intro-acao .hint, .acao .hint { display: none; } }

/* ---------- FECHAMENTOS ---------- */
.fim-h {
  font-size: clamp(36px, 6vw, 60px);
  font-weight: 600; letter-spacing: -0.025em; line-height: 1.04;
}
.fim-p { margin-top: 20px; max-width: 52ch; font-size: clamp(16px, 2vw, 18px); color: var(--ink-600); }
.fim-tag { margin-top: 40px; font-size: 12px; color: var(--ink-500); letter-spacing: 0.06em; }

/* ---------- RODAPÉ ---------- */
.pe {
  position: relative; z-index: 5;
  padding: 18px clamp(20px, 5vw, 48px) 22px;
  font-size: 11.5px; color: var(--ink-500); letter-spacing: 0.05em;
}

/* ---------- honeypot / nojs ---------- */
#hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.nojs { padding: 48px 0; color: var(--ink-600); }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .orb, .tela, .fio-fill, .no, .card, .btn { transition: none; }
  .no.atual, .fio.completa .fio-pulse { animation: none; }
  .tela.treme .resp { animation: none; }
}

/* ============================================================
   OTIMIZAÇÃO MOBILE
   Pergunta sobe pro terço superior (teclado virtual não cobre),
   botões viram alvo cheio, número fantasma recua.
   ============================================================ */
@media (max-width: 679px) {
  .head { padding-top: 14px; }
  .head-logo { width: 56px; }
  .fio { margin-top: 10px; }

  .palco { padding: clamp(16px, 4vh, 40px) 0; }
  .tela {
    justify-content: flex-start;
    padding-top: clamp(20px, 7vh, 64px);
  }
  .tela-intro { padding-top: clamp(28px, 10vh, 96px); }

  .perg { font-size: clamp(24px, 6.6vw, 30px); }
  .resp { margin-top: 22px; font-size: clamp(20px, 5.6vw, 26px); }

  form .tela::before {
    font-size: 46vw;
    top: auto; bottom: 2vh;
    right: -4vw;
    transform: none;
    -webkit-text-stroke-color: rgba(180,186,196,0.07);
  }

  .acao, .intro-acao { margin-top: 26px; }
  .acao .btn, .intro-acao .btn, .acao .btn-ghost { width: 100%; justify-content: center; text-align: center; }
  .cards { margin-top: 22px; gap: 8px; }
  .card { padding: 14px 14px; }
  .fim-h { font-size: clamp(32px, 9vw, 44px); }
  .pe { text-align: center; }
}

/* toque: área mínima confortável */
@media (pointer: coarse) {
  .btn, .card { min-height: 52px; }
}

/* ============================================================
   TEMA LIGHT (versão clara — <html data-theme="light">)
   Mesmo palco, luz invertida: papel, tinta e o azul de sempre.
   ============================================================ */
[data-theme="light"] body,
[data-theme="light"] {
  background: #FAFAF7;
  color: #1A1A1A;
}
[data-theme="light"] .orb-a {
  background: radial-gradient(circle, rgba(31,127,255,0.13), transparent 65%);
}
[data-theme="light"] .orb-b {
  background: radial-gradient(circle, rgba(74,156,255,0.09), transparent 65%);
}
[data-theme="light"] .grain { opacity: 0.025; }

[data-theme="light"] .head-count { color: #6A7280; }

[data-theme="light"] .fio-base { stroke: #D1D6DE; }
[data-theme="light"] .no { fill: #FAFAF7; stroke: #D1D6DE; }
[data-theme="light"] .no.on { fill: var(--accent); stroke: var(--accent); }
[data-theme="light"] .no.atual { stroke: var(--accent); }

[data-theme="light"] .intro-h1,
[data-theme="light"] .fim-h,
[data-theme="light"] .perg { color: #0A0A0A; }
[data-theme="light"] .intro-sub,
[data-theme="light"] .fim-p { color: #475669; }
[data-theme="light"] .intro-lgpd,
[data-theme="light"] .micro,
[data-theme="light"] .hint,
[data-theme="light"] .fim-tag,
[data-theme="light"] .pe { color: #6A7280; }

[data-theme="light"] .resp {
  color: #0A0A0A;
  border-bottom-color: #B4BAC4;
}
[data-theme="light"] .resp::placeholder { color: #94A0B0; }
[data-theme="light"] .resp:focus { border-bottom-color: var(--accent); }
[data-theme="light"] .perg-nome { color: var(--accent-lo); }

[data-theme="light"] .card {
  background: #FFFFFF;
  border-color: #D1D6DE;
  border-left-color: #D1D6DE;
  color: #1A1A1A;
}
[data-theme="light"] .card:hover { border-color: #94A0B0; border-left-color: var(--accent); }
[data-theme="light"] .card .card-k { color: #6A7280; border-color: #D1D6DE; }
[data-theme="light"] .card[aria-checked="true"] {
  border-color: var(--accent); border-left-color: var(--accent);
  background: rgba(31,127,255,0.07);
}
[data-theme="light"] .card[aria-checked="true"] .card-k { color: #fff; }

[data-theme="light"] .btn-ghost { color: #475669; text-decoration-color: #94A0B0; }
[data-theme="light"] .btn-ghost:hover { color: #0A0A0A; }

[data-theme="light"] form .tela::before {
  -webkit-text-stroke-color: rgba(71,86,105,0.14);
}
@media (max-width: 679px) {
  [data-theme="light"] form .tela::before {
    -webkit-text-stroke-color: rgba(71,86,105,0.10);
  }
}

/* ---------- VOLTAR ---------- */
.volta {
  align-self: flex-start;
  background: none; border: none; cursor: pointer;
  font-size: 12px; letter-spacing: 0.06em;
  color: var(--ink-500);
  padding: 6px 0;
  margin-bottom: 14px;
  transition: color 180ms ease, transform 180ms var(--snap);
}
.volta:hover { color: var(--ink-900); transform: translateX(-2px); }
[data-theme="light"] .volta { color: #6A7280; }
[data-theme="light"] .volta:hover { color: #0A0A0A; }
