/*
  Anebi Comunica — Formulário de qualificação de leads
  Tokens espelhados de styles.css (site principal) para manter a identidade.
  Fonts: Cormorant Garamond (Display), DM Sans (Body)
*/

:root {
  /* Colors */
  --color-cream: #F8FAFC;
  --color-beige: #F1F5F9;
  --color-sage-light: #E2E8F0;
  --color-sage: #527EBC;
  /* Azul primário do logo */
  --color-sage-dark: #3E6699;
  --color-moss: #1E293B;
  --color-text-dark: #142346;
  --color-text-body: #475569;
  --color-error: #B4453A;
  --color-whatsapp: #1FA855;
  --color-whatsapp-dark: #17833F;

  /* Typography */
  --font-display: 'Cormorant Garamond', serif;
  --font-body: 'DM Sans', sans-serif;

  /* Shadows & Shapes */
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --shadow-sm: 0 4px 12px rgba(34, 55, 36, 0.05);
  --shadow-lg: 0 20px 40px rgba(82, 126, 188, 0.10);
  --focus-ring: 0 0 0 3px rgba(82, 126, 188, 0.45);

  --grain: url("data:image/svg+xml,%3Csvg width='120' height='120' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");

  /* Transitions */
  --transition-fast: 200ms ease;
  --ease-out: cubic-bezier(0.16, 0.84, 0.44, 1);
}

/* =========================================================================
   RESET & BASE
========================================================================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  color: var(--color-text-body);
  background-color: var(--color-cream);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2 {
  font-family: var(--font-display);
  color: var(--color-text-dark);
  line-height: 1.1;
  font-weight: 600;
}

a {
  color: inherit;
  text-decoration: none;
  transition: var(--transition-fast);
}

img {
  max-width: 100%;
  display: block;
}

.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;
}

/* Scrollbar na identidade */
html {
  scrollbar-width: thin;
  scrollbar-color: var(--color-sage) transparent;
}

::-webkit-scrollbar {
  width: 12px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background-color: var(--color-sage);
  border-radius: 100px;
  border: 3px solid var(--color-cream);
}

/* =========================================================================
   PALCO — fundo creme com halo sage e grão editorial
========================================================================= */
.page {
  position: relative;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  isolation: isolate;
  overflow: hidden;
}

/* Halo azul suave atrás do card — mesma luz do hero, em versão clara */
.page::before {
  content: "";
  position: absolute;
  inset: -20% -10% auto -10%;
  height: 70%;
  background:
    radial-gradient(60% 70% at 50% 0%, rgba(82, 126, 188, 0.18), transparent 70%),
    radial-gradient(40% 60% at 85% 20%, rgba(226, 232, 240, 0.9), transparent 70%);
  z-index: -2;
  pointer-events: none;
}

/* Grão reutilizado do site — textura de papel, quase imperceptível */
.page::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--grain);
  opacity: 0.035;
  mix-blend-mode: multiply;
  z-index: -1;
  pointer-events: none;
}

.shell {
  width: 100%;
  max-width: 680px;
}

/* =========================================================================
   MARCA & RODAPÉ
========================================================================= */
.brand {
  display: block;
  width: fit-content;
  margin: 0 auto 28px;
}

.brand-img {
  height: 40px;
  width: auto;
}

.brand:focus-visible,
a:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}

.footnote {
  margin-top: 24px;
  text-align: center;
  font-size: 0.8125rem;
  color: #94A3B8;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.footnote a:hover {
  color: var(--color-sage-dark);
}

/* =========================================================================
   CARD
========================================================================= */
.card {
  background: #fff;
  border: 1px solid rgba(82, 126, 188, 0.10);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 40px 44px 44px;
}

/* =========================================================================
   BARRA DE PROGRESSO
========================================================================= */
.progress {
  margin-bottom: 36px;
}

.progress-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  font-size: 0.8125rem;
  /* 13px */
}

.progress-step {
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 600;
  color: var(--color-sage-dark);
}

.progress-step b {
  font-weight: 600;
}

.progress-left {
  color: #94A3B8;
  letter-spacing: 0.2px;
}

.progress-track {
  height: 6px;
  border-radius: 100px;
  background: var(--color-sage-light);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 20%;
  border-radius: 100px;
  background: linear-gradient(90deg, var(--color-sage), var(--color-sage-dark));
  transition: width 500ms var(--ease-out);
}

/* =========================================================================
   ETAPAS
========================================================================= */
.step {
  border: 0;
  display: none;
}

.step.is-active {
  display: block;
  animation: stepIn 500ms var(--ease-out) both;
}

@keyframes stepIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.overline {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--color-sage-dark);
  font-weight: 600;
  margin-bottom: 16px;
}

/* Filete editorial — assinatura dos cabeçalhos do site */
.overline::after {
  content: "";
  flex: 0 0 48px;
  height: 1px;
  background: currentColor;
  opacity: 0.4;
}

.step-title {
  font-size: clamp(1.875rem, 4vw, 2.5rem);
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 14px;
}

.step-title em {
  font-style: italic;
  color: var(--color-sage);
}

.step-desc {
  font-size: 1.0625rem;
  color: var(--color-text-body);
  margin-bottom: 32px;
  max-width: 52ch;
}

/* =========================================================================
   CAMPOS
========================================================================= */
.fields {
  display: grid;
  gap: 20px;
}

.field label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text-dark);
  margin-bottom: 8px;
}

input[type="text"],
textarea {
  width: 100%;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--color-text-dark);
  background: var(--color-cream);
  border: 1px solid var(--color-sage-light);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  transition: var(--transition-fast);
}

textarea {
  resize: vertical;
  min-height: 150px;
  line-height: 1.6;
}

input[type="text"]::placeholder,
textarea::placeholder {
  color: #94A3B8;
}

input[type="text"]:hover,
textarea:hover {
  border-color: rgba(82, 126, 188, 0.4);
}

input[type="text"]:focus,
textarea:focus {
  outline: none;
  background: #fff;
  border-color: var(--color-sage);
  box-shadow: var(--focus-ring);
}

.field.has-error input[type="text"],
.field.has-error textarea {
  border-color: var(--color-error);
}

.counter {
  margin-top: 8px;
  text-align: right;
  font-size: 0.8125rem;
  color: #94A3B8;
}

.counter.is-near b {
  color: var(--color-error);
}

.error {
  margin-top: 8px;
  font-size: 0.8125rem;
  color: var(--color-error);
  font-weight: 500;
}

/* =========================================================================
   OPÇÕES (radio como cartão)
========================================================================= */
.options {
  display: grid;
  gap: 10px;
}

.option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  min-height: 60px;
  background: var(--color-cream);
  border: 1px solid var(--color-sage-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-fast);
}

.option:hover {
  border-color: rgba(82, 126, 188, 0.5);
  background: #fff;
  transform: translateY(-1px);
}

.option input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.option-mark {
  flex: 0 0 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid #CBD5E1;
  background: #fff;
  transition: var(--transition-fast);
  position: relative;
}

.option-mark::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: #fff;
  transform: scale(0);
  transition: transform 200ms var(--ease-out);
}

.option-text {
  font-size: 1rem;
  color: var(--color-text-dark);
  line-height: 1.35;
}

/* Marcador via irmão adjacente: funciona mesmo sem suporte a :has() */
.option input:checked~.option-mark {
  border-color: var(--color-sage);
  background: var(--color-sage);
}

.option input:checked~.option-mark::after {
  transform: scale(1);
}

.option input:checked~.option-text {
  font-weight: 500;
}

/* Realce do cartão inteiro (requer :has(), com degradação limpa) */
.option:has(input:checked) {
  border-color: var(--color-sage);
  background: rgba(82, 126, 188, 0.06);
  box-shadow: inset 0 0 0 1px var(--color-sage);
}

.option:has(input:focus-visible) {
  box-shadow: var(--focus-ring);
}

.options.has-error .option {
  border-color: rgba(180, 69, 58, 0.45);
}

/* =========================================================================
   RESUMO (etapa final)
========================================================================= */
.summary {
  display: grid;
  gap: 2px;
  background: var(--color-sage-light);
  border: 1px solid var(--color-sage-light);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 32px;
}

.summary-row {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 16px;
  padding: 14px 20px;
  background: var(--color-cream);
}

.summary-row dt {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  font-weight: 600;
  color: var(--color-sage-dark);
  padding-top: 3px;
}

.summary-row dd {
  font-size: 0.9375rem;
  color: var(--color-text-dark);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.fineprint {
  margin-top: 18px;
  font-size: 0.8125rem;
  color: #94A3B8;
  text-align: center;
}

/* =========================================================================
   BOTÕES
========================================================================= */
.actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 32px;
}

/* Primário sempre à direita; "Voltar" fica encostado à esquerda */
.actions [data-next],
.actions [type="submit"] {
  margin-left: auto;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  min-height: 44px;
  border-radius: 100px;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 1rem;
  line-height: 1.2;
  cursor: pointer;
  border: none;
  transition: var(--transition-fast);
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.btn:active {
  transform: translateY(0) scale(0.97);
  transition-duration: 80ms;
}

.btn-lg {
  padding: 16px 32px;
  font-size: 1.125rem;
}

.btn-primary {
  background-color: var(--color-sage);
  color: #fff;
}

.btn-primary:hover {
  background-color: var(--color-sage-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-body);
  padding-left: 8px;
  padding-right: 8px;
}

.btn-ghost:hover {
  color: var(--color-sage-dark);
}

.btn-whatsapp {
  background-color: var(--color-whatsapp);
  color: #fff;
}

.btn-whatsapp:hover {
  background-color: var(--color-whatsapp-dark);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(31, 168, 85, 0.25);
}

.btn-whatsapp svg {
  flex: 0 0 20px;
}

/* =========================================================================
   RESPONSIVO
========================================================================= */
@media (max-width: 640px) {
  .page {
    padding: 32px 16px;
    align-items: flex-start;
  }

  .card {
    padding: 28px 22px 32px;
    border-radius: var(--radius-lg);
  }

  .progress {
    margin-bottom: 28px;
  }

  .progress-meta {
    font-size: 0.75rem;
  }

  .step-desc {
    font-size: 1rem;
    margin-bottom: 24px;
  }

  .actions {
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 8px;
  }

  /* Empilhado: o primário volta ao topo da pilha e ocupa a largura toda */
  .actions [data-next],
  .actions [type="submit"] {
    margin-left: 0;
    width: 100%;
  }

  .summary-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .option {
    padding: 14px 16px;
  }
}

@media (prefers-reduced-motion: reduce) {

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

/* Bloco de revisão recebe foco por script — sem anel de contorno visível */
.step:focus {
  outline: none;
}
