/* ============================================================
   CredFácil Autorização — folha de estilos do site
   Identidade: FUNDO VERDE + cartões brancos + ação em LARANJA.
   Tema único (sem claro/escuro). Cores na base :root.
   ============================================================ */

:root {
  color-scheme: light;

  /* Verde da marca (fundo da página) */
  --primary: #0e7a3e;
  --primaryDark: #0a5c2e;
  --primaryLight: #159a4e;

  /* Laranja de ação / destaque */
  --secondary: #f08b4c;
  --secondaryDark: #c96a24;
  --secondaryLight: #fef1e6;
  --onSecondary: #2a1403;

  /* Superfícies */
  --bg: #0e7a3e;            /* fundo da página = verde */
  --bgDeep: #0a5c2e;        /* verde mais escuro: header, rodapé */
  --card: #ffffff;          /* cartões de conteúdo */
  --cardMuted: #f4f8f6;     /* campos de formulário */
  --bgAccent: #e7f3ee;      /* tint verde claro dentro de cartões */
  --line: #e2e9e5;          /* bordas de cartões brancos */
  --greenLine: rgba(255, 255, 255, .22); /* bordas sobre o verde */

  /* Texto */
  --headerColor: #14201b;   /* títulos dentro de cartões */
  --bodyTextColor: #47534d; /* corpo dentro de cartões */
  --muted: #6a766f;
  --onGreen: #ffffff;               /* texto sobre o verde */
  --onGreenSoft: rgba(255, 255, 255, .86);

  --danger: #c23b3b;

  --shadow-sm: 0 4px 14px rgba(6, 40, 22, .16);
  --shadow: 0 20px 45px rgba(5, 35, 18, .28);

  --topperFontSize: clamp(0.8125rem, 1.6vw, 1rem);
  --headerFontSize: clamp(1.9rem, 4.4vw, 3rem);
  --sectionPadding: clamp(2rem, 5vw, 3.75rem) 1rem;
  --maxWidth: 70rem;
  --radius: 20px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 5rem; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--onGreen);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { max-width: 100%; }
a { color: var(--primaryDark); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}

/* -------------------------------- utilidades -------------------------------- */
.container { width: 100%; max-width: var(--maxWidth); margin-inline: auto; padding-inline: 1.25rem; }

/* Logo no topo (cartão branco para os tons da logo lerem sobre o verde) */
.brandbar { display: flex; justify-content: center; padding: 0; }
.brandbar-pill {
  display: inline-flex; align-items: center; justify-content: center;
  background: #fff; border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow-sm); padding: .7rem 1.4rem;
}
.brandbar img { display: block; height: clamp(48px, 12vw, 66px); width: auto; }

/* Tela de carregamento (some quando o body ganha a classe .loaded) */
#loader {
  position: fixed; inset: 0; z-index: 3000;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  opacity: 1; visibility: visible;
  /* Sai mais devagar (.8s) e com a mesma curva da entrada das etapas: depois de 4 s de
     espera, um fade curto lia como corte. */
  transition: opacity .8s cubic-bezier(0, 0, .2, 1), visibility .8s cubic-bezier(0, 0, .2, 1);
}
body.loaded #loader { opacity: 0; visibility: hidden; pointer-events: none; }
.loader-box { display: flex; flex-direction: column; align-items: center; gap: 1.25rem; padding: 1.5rem; }
.loader-logo-pill { background: #fff; border-radius: 16px; padding: .7rem 1.4rem; box-shadow: var(--shadow-sm); }
.loader-logo { display: block; height: 52px; width: auto; }
.loader-spin {
  width: 38px; height: 38px; border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, .28); border-top-color: #fff;
  animation: loader-rot .8s linear infinite;
}
@keyframes loader-rot { to { transform: rotate(360deg); } }
.loader-text { margin: 0; color: var(--onGreenSoft); font-size: .95rem; letter-spacing: .02em; }
@media (prefers-reduced-motion: reduce) { .loader-spin { animation: none; } }

/* Cabeçalhos de seção (ficam sobre o verde -> texto claro) */
.cs-topper {
  font-size: var(--topperFontSize);
  text-transform: uppercase;
  letter-spacing: .1em;
  font-weight: 700;
  color: var(--onGreen);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: .4rem;
  margin-bottom: .5rem;
}
.cs-topper::after { content: ""; width: 100%; height: 2px; border-radius: 2px; background: var(--secondary); }
.cs-title {
  font-size: var(--headerFontSize);
  font-weight: 900;
  line-height: 1.15;
  margin: 0 0 .75rem;
  color: var(--onGreen);
  letter-spacing: -.01em;
}
.cs-text { font-size: 1.05rem; margin: 0; max-width: 46ch; color: var(--onGreenSoft); }
.sec-head { max-width: 44rem; margin-bottom: clamp(1.1rem, 3vw, 1.75rem); }
.sec-head.center { margin-inline: auto; text-align: center; }
.sec-head.center .cs-topper { justify-content: center; }
.sec-head.center .cs-text { margin-inline: auto; }

/* -------------------------------- botões -------------------------------- */
.btn {
  font: inherit;
  font-weight: 700;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  border: 1.5px solid transparent;
  border-radius: 10px;
  padding: 15px 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  transition: transform .05s, background .2s, border-color .2s, color .2s;
}
.btn svg { width: 18px; height: 18px; }
.btn:active { transform: translateY(1px); }

/* Ação: laranja */
.btn-solid { color: var(--onSecondary); background: var(--secondary); position: relative; z-index: 1; overflow: hidden; }
.btn-solid::before {
  content: ""; position: absolute; inset: 0; width: 0;
  background: rgba(0, 0, 0, .18); z-index: -1; border-radius: inherit; transition: width .3s ease;
}
.btn-solid:hover::before { width: 100%; }

/* Secundário sobre o verde: contorno claro */
.btn-ghost { color: var(--onGreen); background: transparent; border-color: rgba(255, 255, 255, .5); }
.btn-ghost:hover { background: rgba(255, 255, 255, .12); border-color: #fff; }

/* Contorno sobre superficie branca (cartoes) */
.btn-outline { color: var(--primaryDark); background: #fff; border-color: var(--line); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

.btn-block { width: 100%; }

/* -------------------------------- cabeçalho / nav -------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bgDeep) 82%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--greenLine);
}
.nav { display: flex; align-items: center; justify-content: space-between; height: 4.5rem; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand .logo {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--primaryLight), var(--secondary)); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 800;
}
.brand b { color: #fff; font-size: 1.05rem; letter-spacing: -.01em; }
.brand small { display: block; font-weight: 500; font-size: .72rem; color: var(--onGreenSoft); letter-spacing: .02em; }

.nav-actions { display: flex; align-items: center; gap: .75rem; }
.nav-cta { padding: 11px 18px; }

/* -------------------------------- seções -------------------------------- */
section.block { padding: var(--sectionPadding); }

/* -------------------------------- formulário (simular) -------------------------------- */
/* Primeira tela: logo + card centralizados, ocupando a altura visivel do celular */
/* Altura estavel (svh nao recalcula ao rolar, entao nao treme). Fica em ~88%
   da tela para as "Duvidas" darem uma espiada embaixo (sensacao de continuidade). */
.simular-fold {
  min-height: 88svh;                     /* fallback se o JS nao rodar */
  min-height: calc(var(--appvh) * 88);   /* altura FIXA medida uma vez (nao treme ao rolar) */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem 1.25rem 1rem;
}
.fold-inner { width: 100%; max-width: 30rem; display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.card-title { text-align: center; font-size: clamp(1.15rem, 4.6vw, 1.4rem); font-weight: 800; color: var(--headerColor); margin: 0 0 1rem; }
.form-wrap { width: 100%; max-width: 30rem; margin-inline: auto; }
/* Menos espaco no topo das Duvidas para o titulo aparecer na "espiada" do rodape da 1a tela */
#duvidas { padding-top: clamp(1.25rem, 4vw, 2rem); }
.cs-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.75rem 1.5rem 1.25rem; margin-top: 0;
}
.steps { display: flex; gap: 6px; margin-bottom: 1.5rem; }
.steps i { flex: 1; height: 5px; border-radius: 999px; background: var(--line); transition: background .2s; }
.steps i.on { background: var(--primary); }

.back {
  background: none; border: 0; cursor: pointer; color: var(--muted);
  font: inherit; font-size: 14px; padding: 4px 2px; margin-bottom: .5rem;
  display: none; align-items: center; gap: 6px;
}
.back.show { display: inline-flex; }
.back svg { width: 16px; height: 16px; }

/* AS QUATRO ETAPAS OCUPAM A MESMA CELULA. Antes cada uma era display:none quando
   inativa — logo, nao ocupava espaco —, e o cartao mudava de altura a cada troca.
   Empilhadas num grid de uma celula so, o container fica sempre com a altura da MAIOR,
   sem numero magico e sem precisar remedir quando muda a tela ou o tamanho da fonte.

   ⚠ display:none NAO SERVE AQUI, e por isso a troca passou a ser por visibility. O
   `visibility: hidden` esconde de verdade: sai da arvore de acessibilidade e da ordem
   de foco (o leitor de tela nao le, o Tab nao alcanca), MAS continua ocupando a celula
   — que e exatamente o que sustenta a altura. */
.screens { display: grid; }
.screen {
  grid-area: 1 / 1;
  text-align: center;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  /* CENTRALIZA NA VERTICAL. Como a celula tem a altura da MAIOR etapa, a mais curta
     (a 2, com so o titulo e dois botoes) ficava colada no topo e com um vazio grande
     embaixo — lia como erro de layout, nao como respiro. Centralizado, a sobra se
     divide em cima e embaixo e a etapa parece proposital. */
  display: flex;
  flex-direction: column;
  justify-content: center;
}
/* Troca de etapa em ~2 s: a antiga sai (.8s) e so entao a nova entra (1.2s).
   ⚠ A duracao da SAIDA tem de casar com MS_SAIDA no script.js. Se uma mudar sem a
   outra, ou a nova entra por cima da antiga, ou fica um vao em branco no meio.

   AS CURVAS SAO DIFERENTES DE PROPOSITO, e e o que faz parecer suave em vez de so
   lento. A saida usa ease-IN (comeca devagar e acelera embora, como quem se retira);
   a entrada usa ease-OUT (chega rapido e desacelera ate parar, como quem se acomoda).
   Duas curvas simetricas dariam a sensacao mecanica de uma gangorra.

   O percurso subiu de 6px para 12px junto com a duracao: movimento curto esticado por
   dois segundos parece travado, nao suave. */
.screen.active {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  animation: fade 1.2s cubic-bezier(0, 0, .2, 1);
}
.screen.saindo {
  /* Visivel durante a saida, mas ja com opacity 0 na base: quando a classe cair, a
     etapa continua escondida sem piscar de volta. */
  visibility: visible;
  animation: fade-sai .8s cubic-bezier(.4, 0, 1, 1) forwards;
  /* Enquanto sai, a tela antiga nao recebe toque. Sem isto o lead alcanca o botao da
     etapa que ja passou durante a animacao — e agora sao 800 ms de janela, nao 400. */
  pointer-events: none;
}
@keyframes fade { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes fade-sai { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(-12px); } }

.screen h3 { font-size: clamp(1.5rem, 6vw, 1.9rem); line-height: 1.2; margin: 0 0 8px; color: var(--headerColor); text-align: center; }
/* Etapa do CPF: titulo extra grande para leitura facil (idosos) */
.screen[data-step="1"] h3 { font-size: clamp(1.95rem, 8.5vw, 2.5rem); }
.screen .lead { color: var(--muted); margin: 0 0 1.4rem; font-size: 15px; }

label { display: block; font-weight: 600; font-size: 14px; margin: 0 0 8px; color: var(--headerColor); }
.field { position: relative; text-align: left; }
input, select {
  width: 100%; font: inherit; color: var(--headerColor); background: var(--cardMuted);
  border: 1.5px solid var(--line); border-radius: 12px; padding: 14px;
  transition: border-color .15s, box-shadow .15s; -webkit-appearance: none; appearance: none;
}
input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--bgAccent); }
input::placeholder { color: var(--muted); opacity: .7; }

.error { color: var(--danger); font-size: 13.5px; font-weight: 600; margin: 8px 2px 0; display: none; }
.field.invalid input, .field.invalid select { border-color: var(--danger); }
.field.invalid + .error { display: block; }

/* Etapa com escolha Sim/Não */
.choice-group { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.choice-group.choice-col { grid-template-columns: 1fr; }
.choice {
  font: inherit; font-weight: 700; font-size: 1rem; cursor: pointer;
  padding: 16px; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--cardMuted); color: var(--headerColor);
  transition: border-color .15s, background .15s, color .15s;
}
.choice:hover { border-color: var(--primary); }
.choice.selected { border-color: var(--primary); background: var(--bgAccent); color: var(--primaryDark); }

.secure-note { display: flex; align-items: center; gap: .5rem; justify-content: center; margin-top: 1.1rem; font-size: 12.5px; color: var(--muted); }
.secure-note svg { width: 15px; height: 15px; color: var(--primary); flex: none; }

/* tela final */
.done { text-align: center; padding: 4px; }
.check {
  width: 66px; height: 66px; margin: 0 auto 18px; border-radius: 50%;
  background: var(--bgAccent); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
}
.check svg { width: 34px; height: 34px; }
.summary { text-align: left; margin-top: 1.4rem; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.summary div { display: flex; justify-content: space-between; gap: 12px; padding: 12px 14px; font-size: 14.5px; }
.summary div + div { border-top: 1px solid var(--line); }
.summary div.is-hidden { display: none; }
.summary span { color: var(--muted); }
.summary b { font-weight: 700; text-align: right; color: var(--headerColor); }

/* -------------------------------- faq -------------------------------- */
.faq { max-width: 46rem; margin-inline: auto; display: grid; gap: .75rem; }
.faq details { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.faq summary {
  list-style: none; cursor: pointer; padding: 1.15rem 1.25rem;
  font-weight: 700; color: var(--headerColor); display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: ""; flex: none; width: 12px; height: 12px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg); transition: transform .2s;
}
.faq details[open] summary::after { transform: rotate(-135deg); }
.faq .answer { padding: 0 1.25rem 1.2rem; font-size: .97rem; color: var(--bodyTextColor); }
.faq .answer a { color: var(--primaryDark); font-weight: 600; }

/* -------------------------------- sobre a empresa -------------------------------- */
.sobre-wrap { display: grid; grid-template-columns: 1.05fr .95fr; gap: 1.5rem; align-items: start; max-width: 52rem; margin-inline: auto; }
.sobre-photo { margin: 0; border-radius: var(--radius); overflow: hidden; border: 3px solid #fff; box-shadow: var(--shadow); }
.sobre-photo.is-empty { display: none; }
.sobre-photo img { display: block; width: 100%; height: auto; }
.sobre-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 1.5rem; }
.sobre-card h3 { color: var(--headerColor); font-size: 1.2rem; margin: 0 0 .5rem; }
.sobre-card p { margin: 0 0 .65rem; color: var(--bodyTextColor); font-size: .95rem; }
.sobre-card .addr { display: flex; gap: .5rem; align-items: flex-start; }
.sobre-card .addr svg { width: 18px; height: 18px; color: var(--primary); flex: none; margin-top: 2px; }
.sobre-links { display: flex; flex-direction: column; gap: .7rem; margin-top: 1.1rem; }
.sobre-links .btn { width: 100%; padding: 12px 18px; font-size: .95rem; }

/* -------------------------------- rodapé -------------------------------- */
.site-footer { background: var(--bgDeep); border-top: 1px solid var(--greenLine); padding: clamp(3rem, 6vw, 4.5rem) 0 2rem; color: var(--onGreenSoft); }
.footer-legal {
  border-top: 1px solid var(--greenLine); margin-top: 2.5rem; padding-top: 1.5rem;
  display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; justify-content: space-between; align-items: center;
  font-size: .82rem; color: rgba(255, 255, 255, .7);
}
.footer-legal a { color: rgba(255, 255, 255, .8); }

/* -------------------------------- páginas de texto (privacidade/termos) -------------------------------- */
.legal-page { padding: var(--sectionPadding); }
.legal-page .container {
  max-width: 48rem; background: var(--card); color: var(--bodyTextColor);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: clamp(1.75rem, 4vw, 3rem);
}
.legal-page h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); color: var(--headerColor); margin: 0 0 .5rem; }
.legal-page .updated { color: var(--muted); font-size: .9rem; margin: 0 0 2rem; }
.legal-page h2 { color: var(--headerColor); font-size: 1.25rem; margin: 2rem 0 .6rem; }
.legal-page p, .legal-page li { font-size: 1rem; color: var(--bodyTextColor); }
.legal-page a { color: var(--primaryDark); font-weight: 600; }
.legal-page ul { padding-left: 1.25rem; }
.note-box {
  background: var(--bgAccent); border: 1px solid var(--line); border-radius: 12px;
  padding: 1rem 1.25rem; margin: 1.5rem 0; font-size: .95rem;
}

/* -------------------------------- bloqueio: somente no celular -------------------------------- */
#mobile-only { display: none; }
body.is-desktop { overflow: hidden; }
body.is-desktop #mobile-only {
  display: flex; position: fixed; inset: 0; z-index: 2000;
  flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 2.5rem 1.5rem;
  background: var(--bg); color: var(--onGreen);
}
#mobile-only .mo-icon {
  width: 96px; height: 96px; border-radius: 28px; margin-bottom: 1.5rem;
  background: rgba(255, 255, 255, .12); border: 1px solid var(--greenLine);
  display: flex; align-items: center; justify-content: center; color: #fff;
}
#mobile-only .mo-icon svg { width: 46px; height: 46px; }
#mobile-only h1 { font-size: 1.6rem; color: #fff; margin: 0 0 .6rem; font-weight: 900; }
#mobile-only p { max-width: 32ch; color: var(--onGreenSoft); margin: 0; font-size: 1.02rem; line-height: 1.55; }
#mobile-only .mo-host {
  margin-top: 1.5rem; font-size: .85rem; font-weight: 700; letter-spacing: .02em; color: #fff;
  background: rgba(255, 255, 255, .12); border: 1px solid var(--greenLine);
  border-radius: 999px; padding: .5rem 1rem;
}

/* -------------------------------- bloqueio: convite invalido -------------------------------- */
/* Mesma mecanica do #mobile-only: a tela cobre tudo e o body trava a rolagem. Reusa as
   classes .mo-icon e .mo-host, entao nao ha estilo novo alem do posicionamento. */
#sem-convite { display: none; }
body.sem-convite { overflow: hidden; }
/* Esconde a pagina INTEIRA, e nao so cobre. Sobrepor com position:fixed esconde dos
   olhos, mas os campos continuam no DOM, na ordem de foco e alcancaveis por Tab ou
   teclado externo — e o audio da etapa 1 tocava por baixo do bloqueio ate 08/09/2026.
   display:none tira do fluxo, do foco e da arvore de acessibilidade de uma vez. */
body.sem-convite main { display: none; }
body.sem-convite #sem-convite {
  display: flex; position: fixed; inset: 0; z-index: 2500;
  flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 2.5rem 1.5rem;
  background: var(--bg); color: var(--onGreen);
}
#sem-convite h1 { font-size: 1.6rem; color: #fff; margin: 0 0 .6rem; font-weight: 900; }
#sem-convite p { max-width: 32ch; color: var(--onGreenSoft); margin: 0; font-size: 1.02rem; line-height: 1.55; }

/* -------------------------------- responsivo -------------------------------- */
/* Telas baixas: encolhe para caber. Ativado pela classe .short-screen (a altura e
   medida UMA vez no JS, no carregamento), e NAO por media query, para nao "piscar"
   quando as barras do navegador in-app aparecem/somem durante a rolagem. */
body.short-screen .brandbar img { height: clamp(34px, 9vw, 44px); }
body.short-screen .fold-inner { gap: .6rem; }
body.short-screen .simular-fold { padding-top: .75rem; padding-bottom: 1rem; }
body.short-screen .cs-card { padding: 1.25rem 1.25rem 1rem; }
body.short-screen .card-title { font-size: 1.1rem; margin-bottom: .6rem; }
body.short-screen .steps { margin-bottom: 1rem; }
body.short-screen .screen h3 { font-size: clamp(1.3rem, 5vw, 1.6rem); }
body.short-screen .screen[data-step="1"] h3 { font-size: clamp(1.7rem, 6.5vw, 2rem); }
body.short-screen .screen .lead { margin-bottom: 1rem; }
body.short-screen .secure-note { margin-top: .8rem; }

@media (max-width: 48rem) {
  .sobre-wrap { grid-template-columns: 1fr; }
}
