/* Fontes hospedadas no próprio site (sem conexão com o Google). Licença: SIL Open Font License 1.1. */
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("fonts/fraunces-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("fonts/inter-latin.woff2") format("woff2");
}

:root {
  --paper: #f4efe8;
  --cream: #e8dfd3;
  --wine: #6a2f35;
  --wine-dark: #3d1d20;
  --gold: #a48663;
  --gold-text: #7a5f40; /* dourado escurecido para texto: contraste 5.2:1 */
  --ink: #1c1917;
  --ink-soft: #57504a;
  --line: #1c191729;
  --white: #fffdf9;
  --error: #a3262f;
  --radius: 18px;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}

main {
  max-width: 600px;
  margin: 0 auto;
  padding: 8px 20px 32px;
  outline: none;
}

/* Cabeçalho: grande na boas-vindas/agradecimento; barra compacta fixa nas etapas e na revisão */
.brand { padding: 28px 20px 12px; }
.brand-inner { max-width: 600px; margin: 0 auto; }
.brand-id { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; }
.brand-name { font: 500 22px/1.2 var(--serif); color: var(--wine); letter-spacing: .01em; }
.brand-sub { font-size: 12px; letter-spacing: .22em; text-transform: uppercase; color: var(--gold-text); }
.brand-step, .brand .progress { display: none; }

/* --topbar-h é medido pelo app.js; 76px é só o valor inicial */
html:has(body.compact) { scroll-padding-top: calc(var(--topbar-h, 76px) + 16px); }
body.compact .brand {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 10px 20px 0;
  background: var(--paper);
  transition: box-shadow .2s;
}
body.compact .brand.scrolled { box-shadow: 0 6px 16px -10px #1c191740; }
body.compact .brand-inner {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  column-gap: 12px;
}
body.compact .brand-id { align-items: flex-start; text-align: left; }
body.compact .brand-name { font-size: 16px; }
body.compact .brand-sub { display: none; }
body.compact .brand-step {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  line-height: 1.25;
  min-width: 0;
}
.brand-count { font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-text); }
.brand-section { font-size: 13px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 52vw; }
body.compact .brand .progress { display: block; grid-column: 1 / -1; margin: 10px 0 0; height: 5px; }
body.compact main { padding-top: 4px; }

h1 {
  font: 500 clamp(26px, 6.5vw, 34px)/1.2 var(--serif);
  color: var(--wine-dark);
  margin: 4px 0 12px;
  outline: none;
}
p { margin: 0 0 14px; }

.eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--gold-text);
  margin: 18px 0 4px;
}
.intro { color: var(--ink-soft); }
.note { color: var(--ink-soft); font-size: 15px; }
.signature { font: 500 20px var(--serif); color: var(--wine); }

.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 20px;
  margin: 16px 0;
  box-shadow: 0 1px 2px #1c19170d, 0 8px 24px -16px #6a2f3533;
}
.hero { padding: 28px 22px; }
.hero .eyebrow { margin-top: 0; }

/* Progresso */
.progress { height: 6px; background: var(--cream); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.progress-bar { height: 100%; background: var(--wine); border-radius: 99px; transition: width .35s ease; }

/* Campos */
.field {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  margin: 14px 0;
  transition: border-color .2s;
}
.field.has-error { border-color: var(--error); }
.field > label, .field legend {
  display: block;
  font-weight: 500;
  margin-bottom: 10px;
  padding: 0;
}
fieldset.field { min-width: 0; }
fieldset.field legend { float: left; width: 100%; }
fieldset.field legend + * { clear: both; }
.num { color: var(--gold-text); font-weight: 600; margin-right: 4px; }
.optional { color: var(--ink-soft); font-weight: 400; font-size: 14px; }

input[type="text"], input[type="tel"], textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 13px 14px;
  min-height: 48px;
  transition: border-color .2s, background .2s;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, textarea:focus { outline: none; border-color: var(--wine); background: var(--white); }

.error-msg { color: var(--error); font-size: 14px; margin: 8px 0 0; }

/* Opções (Sim/Não e escolhas) */
.options { display: flex; flex-wrap: wrap; gap: 10px; }
.options.stack { flex-direction: column; }
.option { position: relative; flex: 1 1 0; min-width: 0; }
.options.stack .option { flex: none; }
/* Sim | Não lado a lado e "Não se aplica" na linha de baixo, inteira (não cabe em 1/3 da largura) */
.options.has-na { display: grid; grid-template-columns: 1fr 1fr; }
.options.has-na .option:nth-child(3) { grid-column: 1 / -1; }
.option input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.option span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 10px 14px;
  border: 1.5px solid var(--cream);
  border-radius: 12px;
  background: var(--paper);
  font-weight: 500;
  text-align: center;
  transition: background .15s, border-color .15s, color .15s;
}
.options.stack .option span { justify-content: flex-start; text-align: left; }
.option input:checked + span { background: var(--wine); border-color: var(--wine); color: #fff; }
.option input:focus-visible + span { outline: 3px solid var(--gold); outline-offset: 2px; }
@media (hover: hover) { .option:hover span { border-color: var(--gold); } }

.detail { margin-top: 12px; }
.detail label { display: block; font-size: 14px; color: var(--ink-soft); margin-bottom: 6px; }

/* Botões */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 12px 24px;
  border-radius: 99px;
  border: 1.5px solid transparent;
  font: 600 16px var(--sans);
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s, transform .1s;
}
.btn:active { transform: scale(.98); }
.btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.btn-primary { background: var(--wine); color: #fff; }
.btn-primary:hover { background: var(--wine-dark); }
.btn-ghost { background: transparent; color: var(--wine); border-color: var(--wine); }
.btn-ghost:hover { background: #6a2f3510; }
.btn-link { background: none; border: none; color: var(--wine); text-decoration: underline; text-underline-offset: 3px; min-height: 44px; padding: 8px 12px; font-weight: 500; }
.btn-block { width: 100%; margin-top: 10px; }
.hero .btn-link { display: block; margin: 8px auto 0; }
.small { font-size: 14px; }

.actions { display: flex; gap: 12px; margin-top: 22px; }
.actions .btn { flex: 1; }

/* Revisão */
.review-section h2 {
  font: 500 20px var(--serif);
  color: var(--wine);
  margin: 0;
}
.review-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.review-head .btn-link { min-height: 36px; padding: 4px 0; }
.review-section dl { margin: 0; }
.review-section dt { font-size: 13px; color: var(--ink-soft); margin-top: 10px; }
.review-section dd { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }

.send { text-align: center; }
.long-warning { font-size: 15px; background: #fff3c4; border-radius: 12px; padding: 12px 14px; text-align: left; }
.copy-status { font-size: 14px; color: var(--wine); margin: 8px 0 0; min-height: 1em; }
.copy-fallback { margin-top: 10px; min-height: 160px; font-size: 13px; }

.footer { text-align: center; padding: 0 20px 32px; }

@media (min-width: 640px) {
  main { padding-top: 16px; }
  .field { padding: 20px 22px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
