/* Curea v1.2 — Quiz da Margem Materna
   Design system: papel + tinta + terracota (terra é o único acento).
   Sem gauge, radial, termômetro, semáforo, verde/amarelo/vermelho, porcentagem. */

:root {
  --paper: #f4ede1;        /* fundo papel */
  --paper-2: #efe6d7;      /* papel mais fundo */
  --card: #fbf7ef;         /* cartão */
  --ink: #2c2622;          /* tinta (texto) */
  --ink-soft: #6a5f54;     /* tinta suave */
  --ink-faint: #9a8d7d;    /* auxiliar */
  --terra: #b45f43;        /* terracota (acento único) */
  --terra-deep: #97482f;   /* terracota escuro (hover/foco) */
  --terra-wash: #ecd9cd;   /* terracota lavado (seleção) */
  --line: #ded2be;         /* linhas/bordas */
  --focus: #97482f;
  --radius: 14px;
  --maxw: 40rem;
  --shadow: 0 1px 2px rgba(44, 38, 34, .06), 0 8px 24px rgba(44, 38, 34, .06);
  --serif: "Lora", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.55;
  font-size: 17px;
  /* textura sutil de papel */
  background-image: radial-gradient(rgba(140, 120, 96, .05) 1px, transparent 1px);
  background-size: 22px 22px;
}

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1.25rem 1.15rem 4rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Cabeçalho fino com marca + progresso */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .35rem 0 1rem;
}
.brand {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: .01em;
  color: var(--ink);
  font-size: 1.05rem;
}
.brand span { color: var(--terra); }

.progress {
  flex: 1;
  max-width: 14rem;
}
.progress__track {
  height: 6px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.progress__fill {
  height: 100%;
  width: 0%;
  background: var(--terra);
  transition: width .35s ease;
}
.progress__label {
  font-size: .74rem;
  color: var(--ink-faint);
  margin-top: .3rem;
  text-align: right;
  letter-spacing: .02em;
}

/* Área principal */
main { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.step { animation: fade .35s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .step { animation: none; }
  .progress__fill { transition: none; }
}

/* Tipografia */
h1, h2 { font-family: var(--serif); font-weight: 600; line-height: 1.18; color: var(--ink); }
.h-kicker {
  text-transform: uppercase;
  letter-spacing: .16em;
  font-size: .72rem;
  color: var(--terra);
  font-weight: 600;
  margin: 0 0 .8rem;
}
.title-xl { font-size: clamp(1.7rem, 6vw, 2.4rem); margin: 0 0 .8rem; }
.lead { font-size: 1.08rem; color: var(--ink-soft); margin: 0 0 1.1rem; }
.muted { color: var(--ink-soft); }
.tiny { font-size: .82rem; color: var(--ink-faint); }

.notice {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 3px solid var(--terra);
  border-radius: 10px;
  padding: .85rem 1rem;
  font-size: .92rem;
  color: var(--ink-soft);
  margin: 0 0 1.2rem;
}

/* Cartão de pergunta */
.qcard {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.4rem 1.3rem 1.5rem;
}
.qcard__q {
  font-family: var(--serif);
  font-size: clamp(1.25rem, 4.4vw, 1.55rem);
  line-height: 1.28;
  margin: .2rem 0 1.15rem;
}

/* Opções (escala e contexto) como botões-rádio grandes */
.options { display: flex; flex-direction: column; gap: .55rem; }
.opt {
  display: flex;
  align-items: center;
  gap: .8rem;
  width: 100%;
  text-align: left;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 11px;
  padding: .8rem .9rem;
  font: inherit;
  color: var(--ink);
  cursor: pointer;
  min-height: 48px;
  transition: border-color .15s, background .15s;
}
.opt:hover { border-color: var(--terra); }
.opt__dot {
  flex: 0 0 auto;
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 2px solid var(--ink-faint);
  display: grid; place-items: center;
}
.opt__dot::after {
  content: ""; width: 10px; height: 10px; border-radius: 50%;
  background: transparent; transition: background .15s;
}
.opt[aria-checked="true"] {
  border-color: var(--terra);
  background: var(--terra-wash);
}
.opt[aria-checked="true"] .opt__dot { border-color: var(--terra-deep); }
.opt[aria-checked="true"] .opt__dot::after { background: var(--terra-deep); }
.opt__num {
  flex: 0 0 auto;
  font-family: var(--serif);
  color: var(--terra-deep);
  font-weight: 600;
  width: 1.1rem; text-align: center;
}
.opt:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* Navegação */
.nav {
  display: flex;
  align-items: center;
  gap: .7rem;
  margin-top: 1.25rem;
}
.btn {
  font: inherit;
  font-weight: 600;
  border-radius: 999px;
  padding: .7rem 1.4rem;
  border: 1.5px solid var(--terra);
  cursor: pointer;
  min-height: 46px;
  transition: background .15s, color .15s, border-color .15s, opacity .15s;
}
.btn--primary { background: var(--terra); color: #fff; }
.btn--primary:hover { background: var(--terra-deep); border-color: var(--terra-deep); }
.btn--ghost { background: transparent; color: var(--terra-deep); }
.btn--ghost:hover { background: var(--terra-wash); }
.btn--link {
  border: none; background: none; color: var(--ink-soft);
  text-decoration: underline; padding: .5rem .4rem; min-height: 0;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.nav .spacer { flex: 1; }

/* Bloco agrupado (6 afirmações por tela) */
.blockhead { margin-bottom: .4rem; }
.scale-legend {
  font-size: .82rem; color: var(--ink-faint);
  margin: 0 0 .4rem; letter-spacing: .01em;
}
.stmt {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .9rem 1rem 1rem;
  margin-bottom: .7rem;
}
.stmt__text {
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 1.3;
  margin: 0 0 .7rem;
  color: var(--ink);
}
.stmt--error {
  border-color: var(--terra);
  box-shadow: 0 0 0 2px var(--terra-wash);
}
.scale {
  display: flex;
  gap: .4rem;
  justify-content: space-between;
}
.sc {
  flex: 1 1 0;
  min-width: 0;
  min-height: 46px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  color: var(--terra-deep);
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.05rem;
  cursor: pointer;
  transition: border-color .12s, background .12s, color .12s;
}
.sc:hover { border-color: var(--terra); }
.sc[aria-checked="true"] {
  background: var(--terra);
  border-color: var(--terra-deep);
  color: #fff;
}
.sc:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* Bloco de contexto (todas as 5 numa tela) */
.qcard--ctx { margin-bottom: .9rem; padding: 1.1rem 1.1rem 1.2rem; }
.ctx__q {
  font-family: var(--serif);
  font-size: 1.15rem;
  line-height: 1.3;
  margin: 0 0 .8rem;
}
.qcard--error { border-color: var(--terra); box-shadow: 0 0 0 2px var(--terra-wash); }

/* Erro de validação */
.field-error {
  color: var(--terra-deep);
  font-size: .85rem;
  margin-top: .8rem;
  font-weight: 500;
}

/* Tela de cálculo */
.calc { text-align: center; padding: 2rem 0; }
.calc__spinner {
  width: 42px; height: 42px; margin: 0 auto 1.2rem;
  border: 3px solid var(--line);
  border-top-color: var(--terra);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .calc__spinner { animation: none; } }

/* Tela final (stub do Mapa) */
.result__name {
  font-family: var(--serif);
  font-size: clamp(1.5rem, 5vw, 2rem);
  color: var(--ink);
  margin: .4rem 0 1rem;
  line-height: 1.25;
}
.result__badge {
  display: inline-block;
  font-size: .72rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--terra); font-weight: 600; margin-bottom: .3rem;
}

/* Rodapé + segurança */
.footer {
  margin-top: 2.5rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
  font-size: .8rem;
  color: var(--ink-faint);
}
.footer a { color: var(--ink-soft); }
.safety-toggle {
  background: none; border: none; color: var(--terra-deep);
  text-decoration: underline; cursor: pointer; font: inherit; font-size: .82rem; padding: 0;
}
.safety-box {
  margin-top: .7rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .8rem .9rem;
  font-size: .86rem;
  color: var(--ink-soft);
}
[hidden] { display: none !important; }

/* Painel de debug (só com ?debug=1) */
.debug {
  position: fixed; right: 8px; bottom: 8px; z-index: 50;
  background: #241f1b; color: #f0e7d8;
  font: 12px/1.4 ui-monospace, Menlo, Consolas, monospace;
  padding: .6rem .7rem; border-radius: 8px; max-width: 300px;
  box-shadow: var(--shadow); white-space: pre-wrap;
}

/* Skip link acessibilidade */
.skip {
  position: absolute; left: -999px; top: 0;
  background: var(--terra); color: #fff; padding: .5rem .8rem; border-radius: 0 0 8px 0; z-index: 100;
}
.skip:focus { left: 0; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Caminhos para os documentos legais. Obrigatório: a política precisa estar
   alcançável a partir das páginas que coletam dado. */
.footlinks{margin:0 0 14px;font-size:12.5px;color:var(--muted,#8a867c);line-height:1.9;}
.footlinks a{color:var(--muted,#8a867c);text-decoration:underline;}
.brand{display:inline-block;text-decoration:none;}
