/* ============================================================
   Briefing Fluxo Fantástico — formulário do cliente
   Mobile-first. Tokens em :root, tema escuro por prefers-color-scheme.
   ============================================================ */

:root {
  --brand: #1d4ed8;
  --brand-strong: #1e3a8a;
  --brand-soft: #e0e9ff;
  --accent: #f97316;
  --accent-soft: #ffedd5;

  --bg: #f7f8fc;
  --surface: #ffffff;
  --surface-2: #f1f3f9;
  --border: #d9dde8;
  --border-strong: #b6bccd;

  --text: #16192b;
  --text-muted: #565d75;
  --text-invert: #ffffff;

  --ok: #15803d;
  --ok-soft: #dcfce7;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;

  --shadow-sm: 0 1px 2px rgb(22 25 43 / 6%), 0 1px 3px rgb(22 25 43 / 4%);
  --shadow: 0 4px 16px rgb(22 25 43 / 8%);
  --shadow-lg: 0 18px 40px rgb(22 25 43 / 14%);

  --wrap: 68rem;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --brand: #7aa2ff;
    --brand-strong: #a7c1ff;
    --brand-soft: #1c2745;
    --accent: #fbbf6b;
    --accent-soft: #3a2a17;

    --bg: #0d1018;
    --surface: #161b26;
    --surface-2: #1e2534;
    --border: #2b3345;
    --border-strong: #3d4760;

    --text: #eef1f7;
    --text-muted: #a6aec2;

    --ok: #5ed68d;
    --ok-soft: #16301f;
    --danger: #ff8f8f;
    --danger-soft: #3a1c1c;

    --shadow-sm: 0 1px 2px rgb(0 0 0 / 40%);
    --shadow: 0 4px 16px rgb(0 0 0 / 45%);
    --shadow-lg: 0 18px 40px rgb(0 0 0 / 55%);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 6rem;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  line-height: 1.25;
  margin: 0;
  text-wrap: balance;
}

p {
  margin: 0;
}

a {
  color: var(--brand);
  text-underline-offset: 3px;
}

:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--space-4);
}

.skip-link {
  position: absolute;
  left: -9999px;
  z-index: 100;
  padding: var(--space-3) var(--space-4);
  background: var(--brand);
  color: var(--text-invert);
  border-radius: 0 0 var(--radius) 0;
}

.skip-link:focus {
  left: 0;
  top: 0;
}

/* ---------- Cabeçalho ---------- */

.site-header {
  background: linear-gradient(135deg, var(--brand-strong), var(--brand));
  color: var(--text-invert);
  padding-block: var(--space-5);
}

.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: 0;
  font-weight: 700;
}

.brand__mark {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 10px;
  background: rgb(255 255 255 / 18%);
  border: 1px solid rgb(255 255 255 / 32%);
  font-size: 0.9rem;
  letter-spacing: 0.04em;
}

.brand__name {
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}

.site-header__tagline {
  flex: 1 1 18rem;
  max-width: 34rem;
  font-size: 0.95rem;
  color: rgb(255 255 255 / 88%);
}

/* ---------- Progresso ---------- */

.progress {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding-block: var(--space-3);
}

.progress__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
  font-size: 0.9rem;
  color: var(--text-muted);
}

.progress__count {
  font-weight: 700;
  color: var(--text);
}

.progress__track {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.progress__fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--accent));
  transition: width 0.3s ease;
}

/* ---------- Navegação de seções ---------- */

.section-nav {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  padding: var(--space-3) var(--space-4);
  margin: var(--space-4) 0 0;
  list-style: none;
  scrollbar-width: thin;
}

.section-nav__link {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 0 0 auto;
  max-width: 15rem;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.82rem;
  text-decoration: none;
  transition: border-color 0.2s, color 0.2s;
}

.section-nav__link:hover {
  border-color: var(--brand);
  color: var(--text);
}

.section-nav__link.is-current {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--text-invert);
}

.section-nav__meta {
  font-size: 0.72rem;
  opacity: 0.85;
}

/* ---------- Cartões e estados ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: var(--space-5);
}

.card--error {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.card--success {
  border-color: var(--ok);
  background: var(--ok-soft);
}

.hero {
  padding-block: var(--space-6) var(--space-4);
}

.hero h1 {
  font-size: clamp(1.6rem, 1.2rem + 1.8vw, 2.4rem);
  letter-spacing: -0.02em;
}

.hero p {
  margin-top: var(--space-3);
  color: var(--text-muted);
  max-width: 46rem;
}

.state {
  display: grid;
  place-items: center;
  gap: var(--space-3);
  padding-block: var(--space-7);
  text-align: center;
  color: var(--text-muted);
}

.state__spinner {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--brand);
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- Banner de rascunho ---------- */

.draft-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  border-radius: var(--radius);
  font-size: 0.92rem;
}

/* ---------- Seções e campos ---------- */

.section {
  margin-block: var(--space-6);
  scroll-margin-top: 7rem;
}

.section__head {
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-3);
  border-bottom: 2px solid var(--border);
}

.section__title {
  font-size: clamp(1.25rem, 1.05rem + 0.8vw, 1.6rem);
  letter-spacing: -0.015em;
}

.section__help {
  margin-top: var(--space-2);
  color: var(--text-muted);
}

.field-grid {
  display: grid;
  gap: var(--space-5);
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.field--answered {
  border-color: color-mix(in srgb, var(--ok) 45%, var(--border));
}

.field--invalid {
  border-color: var(--danger);
  background: color-mix(in srgb, var(--danger-soft) 55%, var(--surface));
}

.field__label {
  font-weight: 600;
  letter-spacing: -0.005em;
}

.field__req {
  color: var(--danger);
  margin-left: 2px;
}

.field__help {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.field__error {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--danger);
}

.field__counter {
  align-self: flex-end;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.input,
.textarea {
  width: 100%;
  padding: 0.7rem 0.85rem;
  font: inherit;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input:focus,
.textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent);
}

.textarea {
  min-height: 7rem;
  resize: vertical;
  line-height: 1.55;
}

.field--invalid .input,
.field--invalid .textarea {
  border-color: var(--danger);
}

/* ---------- Radio e checkbox ---------- */

.choices {
  display: grid;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  border: 0;
}

.choice {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 2.75rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.choice:hover {
  border-color: var(--brand);
}

.choice:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.choice:has(input:focus-visible) {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

.choice input {
  width: 1.15rem;
  height: 1.15rem;
  flex: 0 0 auto;
  accent-color: var(--brand);
  margin: 0;
}

/* ---------- Ações ---------- */

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  margin-block: var(--space-6);
  padding-top: var(--space-5);
  border-top: 1px solid var(--border);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 3rem;
  padding: 0.75rem 1.5rem;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.1s, background 0.15s, border-color 0.15s;
}

.btn:hover:not(:disabled) {
  border-color: var(--brand);
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.6;
  cursor: progress;
}

.btn--primary {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--text-invert);
}

.btn--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--brand);
  min-height: 2.75rem;
  padding-inline: var(--space-3);
}

.btn--block {
  width: 100%;
}

.form-error {
  flex: 1 1 100%;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: var(--danger);
  font-weight: 600;
}

/* ---------- Sucesso ---------- */

.success {
  text-align: center;
  padding-block: var(--space-7);
}

.success__badge {
  display: grid;
  place-items: center;
  width: 4rem;
  height: 4rem;
  margin-inline: auto;
  border-radius: 50%;
  background: var(--ok);
  color: var(--text-invert);
  font-size: 1.75rem;
}

/* ---------- Rodapé ---------- */

.site-footer {
  margin-top: var(--space-7);
  padding-block: var(--space-5);
  border-top: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.88rem;
  color: var(--text-muted);
}

.site-footer__meta {
  margin-top: var(--space-3);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: space-between;
}

/* ---------- Honeypot ---------- */

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

/* ---------- ≥ 720px ---------- */

@media (min-width: 720px) {
  .wrap {
    padding-inline: var(--space-5);
  }

  .field-grid--2col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .section-nav {
    padding-inline: var(--space-5);
  }
}

/* ---------- ≥ 1100px ---------- */

@media (min-width: 1100px) {
  .hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 20rem;
    gap: var(--space-6);
    align-items: start;
  }

  .actions {
    justify-content: flex-end;
  }

  .form-error {
    flex-basis: 100%;
  }
}