/* Gate — tema claro (amarelo #ffec36 + fundo cinza claro), mobile-first.
   Regras que não se negociam:
   - CSP sem 'unsafe-inline': nada de style="" nem <style> no HTML.
   - Contraste: texto AA (>= 4,5:1); amarelo puro só em superfície, nunca em texto.
   - Rodapé existe e é alcançável; no celular fica abaixo da dobra. */

:root {
  --amber: #ffb14d;          /* cor pedida: fundo de botão, barra e check */
  --amber-deep: #b26a00;     /* 4,24:1 no branco: arco, bordas, sublinhados */
  --amber-ink: #1a1a2e;      /* 9,46:1 sobre o laranja */
  --ink: #1a1a2e;
  --ink-soft: #5b6672;
  --ink-faint: #666f76;      /* 4,57:1 sobre o cinza do fundo */
  --line: #e6e6e6;
  --surface: #ffffff;
  --paper: #f2f2f2;
  --err: #8a3b2f;
  --ok: #1f6b4f;
  --radius: 18px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background: var(--paper);
}

.wrap {
  width: 100%;
  max-width: 640px;
  margin-inline: auto;
  padding-inline: 16px;
}

.skip { position: absolute; left: -9999px; }
.skip:focus {
  left: 1rem;
  top: 1rem;
  z-index: 30;
  background: var(--surface);
  color: var(--ink);
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  font-weight: 700;
}

main {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  padding-block: 1.2rem;
  /* Tela inteira: no celular o rodapé começa na dobra */
  min-height: 100svh;
}
main .card { margin-block: auto; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.6rem 1.2rem 1.4rem;
  box-shadow: 0 10px 30px rgba(26, 26, 46, 0.07);
  position: relative;
  overflow: hidden;
}

/* ---------- Gate ---------- */
.gate {
  max-width: 380px;
  margin-inline: auto;
  text-align: center;
}

.bar-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: #dcdcdc;
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
}
.bar-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 0 3px 3px 0;
  background: var(--amber);
  transition: width 0.35s ease;
}

.emblem {
  width: 86px;
  height: 86px;
  margin: 1rem auto 0.9rem;
  position: relative;
}
.ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 4px solid #ececec;
  border-top-color: var(--amber-deep);
  animation: spin 1.1s linear infinite;
}
.core {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 54px;
  height: 54px;
  transform: translate(-50%, -50%);
  background: #fffdf0;
  border-radius: 50%;
}
.check {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--amber);
}
.check svg {
  width: 38px;
  height: 38px;
  fill: none;
  stroke: var(--amber-ink);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.gate.done .ring,
.gate.done .core { display: none; }
.gate.done .check { display: flex; animation: pop 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pop {
  0% { transform: scale(0); }
  100% { transform: scale(1); }
}

.msg {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink-soft);
  min-height: 20px;
  margin: 0 0 0.55rem;
}
.msg.ok { color: var(--ok); }
.msg.err { color: var(--err); }

.gate h1 {
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: -0.01em;
  line-height: 1.15;
  margin: 0 0 0.55rem;
}

.info {
  font-size: 0.88rem;
  color: var(--ink-soft);
  line-height: 1.6;
  margin: 0 auto 1.2rem;
  max-width: 300px;
}

.turnstile {
  display: flex;
  justify-content: center;
  margin-bottom: 0.85rem;
}

/* Widget do Turnstile some depois do token: o anel/check do gate é o indicador visível. */
.turnstile.resolvido {
  display: none;
}

.btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 1rem;
  border: 1px solid #e59b3f;
  border-radius: 14px;
  background: var(--amber);
  color: var(--amber-ink);
  font: inherit;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, background 0.2s;
}
.btn:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(168, 143, 0, 0.28);
}
.btn:not(:disabled):active { transform: scale(0.985); }
.btn:disabled {
  background: #ececec;
  border-color: #e0e0e0;
  color: var(--ink-soft);
  cursor: not-allowed;
  box-shadow: none;
}
.btn:disabled .arrow { opacity: 0; }
.btn.busy { opacity: 0.75; }
.btn:focus-visible { outline: 3px solid var(--amber-deep); outline-offset: 2px; }

.arrow { transition: transform 0.2s; }
.btn:not(:disabled):hover .arrow { transform: translateX(3px); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 1.1rem 0 0;
  padding: 0.45rem 1rem;
  border: 2px solid #e5a862;
  border-radius: 30px;
  background: #fff3e2;
  font-size: 0.78rem;
  font-weight: 700;
  color: #6b3a00;
}
.badge svg { width: 15px; height: 15px; fill: #b26a00; }

/* ---------- Documentos ---------- */
.doc h2 {
  font-size: 1.02rem;
  font-weight: 800;
  margin: 1.5rem 0 0.4rem;
}
.doc p, .doc li {
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.7;
}
.doc p { margin: 0 0 0.7rem; }
.doc ul { padding-left: 1.1rem; margin: 0 0 0.7rem; }
.doc li { margin-bottom: 0.3rem; }
.doc h1 { font-size: 1.5rem; font-weight: 900; margin: 0 0 0.6rem; }

.eyebrow {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #8a4b00;
  margin: 0 0 0.3rem;
}

.small { font-size: 0.82rem; color: var(--ink-soft); }

.alert {
  background: #fff3e2;
  border: 1px solid #f0c490;
  border-radius: 10px;
  padding: 0.75rem 0.9rem;
  font-size: 0.85rem;
  color: #6b3a00;
  margin: 0.9rem 0 0;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88rem;
}

/* Retorno das páginas de apoio */
.page-top { padding-block: 0.2rem 0.8rem; }
.back {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 44px;
  padding-inline: 0.95rem;
  border: 1px solid #d9d9d9;
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
}
.back::before { content: "←"; font-weight: 400; }
.back:hover { background: #fafafa; border-color: #c9c9c9; }
.back:focus-visible { outline: 3px solid var(--amber-deep); outline-offset: 2px; }
.doc .back { margin-top: 1.4rem; }

/* ---------- Rodapé ---------- */
.site-footer {
  flex: 0 0 auto;
  margin-top: auto;
  padding-block: 1.3rem 1.5rem;
}
.footer-inner {
  text-align: center;
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--ink-faint);
}
.footer-inner p { margin: 0; }
.footer-safe {
  font-weight: 700;
  color: var(--ink-faint);
  margin-bottom: 0.55rem;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0 0.5rem;
  margin-bottom: 0.6rem;
}
.footer-links a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  color: var(--ink-faint);
  text-decoration: none;
  border-bottom: 1px solid var(--amber-deep);
}
.footer-sep { color: var(--amber-deep); font-size: 0.5rem; line-height: 1; }
.footer-company { margin-bottom: 0.55rem; }
.footer-rights { font-size: 0.76rem; }

/* ---------- Responsivo ---------- */
@media (min-width: 640px) {
  .wrap { max-width: 680px; padding-inline: 20px; }
  main { padding-block: 2rem; min-height: auto; }
  .card { padding: 2rem 2.2rem; }
  .gate { max-width: 400px; padding: 2.2rem 2rem 1.8rem; }
  .gate h1 { font-size: 1.9rem; }
  .info { font-size: 0.94rem; max-width: 330px; }
  .footer-inner { font-size: 0.82rem; }
}

@media (max-width: 344px) {
  .wrap { padding-inline: 10px; }
  .card { padding: 1.4rem 0.9rem 1.2rem; }
  main { padding-block: 0.9rem; }
  .emblem { width: 72px; height: 72px; margin: 0.6rem auto 0.7rem; }
  .core { width: 44px; height: 44px; }
  .gate h1 { font-size: 1.35rem; }
  .info { font-size: 0.84rem; }
  .badge { font-size: 0.72rem; }
}

@media (prefers-reduced-motion: reduce) {
  .ring { animation-duration: 2.4s; }
  .gate.done .check { animation: none; }
  .btn, .arrow, .bar-fill { transition: none; }
}
