/* ==========================================================================
   ACAR™ · Páginas internas (/diagnostico/ e /obrigado/) · pages.css
   Carregado DEPOIS de styles.css. Usa apenas os tokens e componentes já
   existentes (cores, fontes, .btn, .brand, .site-header, .site-footer).
   Nenhuma regra da landing page é alterada aqui.
   Índice
     1. Estrutura da página (fundo, grade técnica, cabeçalho)
     2. Introdução
     3. Aviso de desenvolvimento
     4. Cartão do formulário e indicador de progresso
     5. Campos (texto, select, opções, consentimento) e erros
     6. Ações e mensagens de status
     7. Página de obrigado
     8. Telas pequenas
   ========================================================================== */

/* Nas páginas internas, o atributo hidden sempre vence (botões e avisos
   têm display próprio) */
[hidden] {
  display: none !important;
}

:root {
  --form-error: #F07B6F;        /* vermelho legível sobre fundo escuro */
  --form-field-bg: #0D0F12;
  --form-field-border: #2F3238;
}

/* ---------- 1. Estrutura ---------- */
.page {
  position: relative;
  isolation: isolate;
  min-height: 70vh;
  padding-block: clamp(2.5rem, 6vw, 4.5rem) clamp(4rem, 8vw, 6rem);
  overflow: hidden;
}

/* Grade técnica discreta e luz laranja, como no hero */
.page::before,
.page::after {
  content: "";
  position: absolute;
  inset: calc(var(--header-h) * -1) 0 0;
  z-index: -1;
  pointer-events: none;
}

.page::before {
  background-image:
    linear-gradient(var(--line-faint) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-faint) 1px, transparent 1px);
  background-size: 72px 72px;
  background-position: center top;
  -webkit-mask-image: radial-gradient(ellipse 65% 55% at 50% 25%, #000 15%, transparent 75%);
  mask-image: radial-gradient(ellipse 65% 55% at 50% 25%, #000 15%, transparent 75%);
}

.page::after {
  background:
    radial-gradient(40% 30% at 50% 10%, rgba(255, 106, 42, 0.09), transparent 70%),
    radial-gradient(28% 18% at 0% 100%, rgba(255, 106, 42, 0.12), transparent 75%),
    radial-gradient(28% 18% at 100% 100%, rgba(255, 106, 42, 0.1), transparent 75%);
}

.page__container {
  max-width: calc(46rem + 2 * var(--gutter));
}

/* Botão "Voltar ao início" no cabeçalho */
.site-header__back .btn__icon {
  transform: rotate(-135deg);
}

.site-header__back:hover .btn__icon,
.site-header__back:focus-visible .btn__icon {
  transform: rotate(-135deg) translate(2px, -2px);
}

/* ---------- 2. Introdução ---------- */
.page__intro {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  text-align: center;
}

.page__title {
  max-width: 18em;
  font-size: clamp(2rem, 1.3rem + 2.4vw, 3rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.page__title em {
  font-style: normal;
  color: var(--accent);
}

.page__lead {
  max-width: 36rem;
  font-size: var(--fs-lg);
  line-height: 1.6;
  color: var(--text-muted);
  text-wrap: balance;
}

/* ---------- 3. Aviso de desenvolvimento ---------- */
.dev-notice {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  margin-top: var(--space-6);
  padding: var(--space-4) var(--space-5);
  border: 1px dashed rgba(255, 138, 69, 0.55);
  border-radius: var(--radius-sm);
  background: rgba(255, 106, 42, 0.06);
  font-size: var(--fs-sm);
  line-height: 1.55;
  color: var(--text);
}

.dev-notice__icon {
  flex: none;
  width: 1.15rem;
  height: 1.15rem;
  margin-top: 0.1rem;
  fill: none;
  stroke: var(--accent-bright);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dev-notice strong {
  color: var(--accent-bright);
}

.dev-notice ul {
  margin: var(--space-2) 0 0;
  padding-left: 1.1rem;
}

/* ---------- 4. Cartão do formulário e progresso ---------- */
.form-card {
  margin-top: clamp(2rem, 4vw, 2.75rem);
  padding: clamp(1.5rem, 4vw, 2.75rem);
  background:
    radial-gradient(90% 40% at 50% 0%, rgba(255, 106, 42, 0.07), transparent 70%),
    linear-gradient(180deg, #15171C, var(--surface));
  border: var(--border-hair);
  border-radius: 20px;
  box-shadow: 0 30px 80px -50px rgba(0, 0, 0, 0.8);
  scroll-margin-top: var(--space-6);
}

.stepper {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0 0 clamp(1.75rem, 3.5vw, 2.5rem);
  padding: 0;
  list-style: none;
}

/* Linha de base e linha de progresso entre os círculos */
.stepper::before,
.stepper::after {
  content: "";
  position: absolute;
  top: 1.05rem;
  left: calc(100% / 6);
  height: 1px;
  pointer-events: none;
}

.stepper::before {
  right: calc(100% / 6);
  background: var(--line);
}

.stepper::after {
  width: calc((100% * 2 / 3) * var(--progress, 0));
  background: var(--accent);
  transition: width 0.5s var(--ease-out);
}

.stepper__item {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  text-align: center;
}

.stepper__num {
  display: grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  font-family: var(--font-display);
  font-size: var(--fs-xs);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text-faint);
  box-shadow: 0 0 0 5px var(--surface);
  transition: border-color var(--dur-base) var(--ease-out), color var(--dur-base) var(--ease-out), background-color var(--dur-base) var(--ease-out);
}

.stepper__label {
  font-size: var(--fs-xs);
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-faint);
}

.stepper__item.is-current .stepper__num {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 0 5px var(--surface), 0 0 16px -2px var(--glow);
}

.stepper__item.is-current .stepper__label {
  color: var(--text-strong);
}

.stepper__item.is-done .stepper__num {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
}

.stepper__item.is-done .stepper__label {
  color: var(--text);
}

.form-step {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.form-step__head {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
}

.form-step__count {
  font-size: var(--fs-2xs);
  font-weight: 600;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--accent-bright);
}

.form-step__title {
  font-size: clamp(1.35rem, 1.15rem + 0.8vw, 1.75rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.form-step__title:focus {
  outline: none;
}

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

.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-5);
}

/* ---------- 5. Campos ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
}

.field[hidden] {
  display: none !important;
}

.field__label {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-strong);
}

.field__optional {
  font-weight: 500;
  color: var(--text-faint);
}

.field__hint {
  font-size: var(--fs-xs);
  line-height: 1.5;
  color: var(--text-muted);
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 3.1rem;
  padding: 0.8rem 1rem;
  border: 1px solid var(--form-field-border);
  border-radius: 12px;
  background: var(--form-field-bg);
  color: var(--text-strong);
  font: 500 var(--fs-md)/1.4 var(--font-body);
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
  -webkit-appearance: none;
  appearance: none;
}

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

.input::placeholder,
.textarea::placeholder {
  color: #5C5F66;
}

.select {
  padding-right: 2.75rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23FF8A45' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 1rem;
  cursor: pointer;
}

.select option {
  background: var(--c-surface);
  color: var(--text-strong);
}

.input:hover,
.select:hover,
.textarea:hover {
  border-color: #42464E;
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 106, 42, 0.18);
}

.input[aria-invalid="true"],
.select[aria-invalid="true"],
.textarea[aria-invalid="true"] {
  border-color: var(--form-error);
}

.field__error {
  display: flex;
  gap: 0.4rem;
  align-items: flex-start;
  font-size: var(--fs-xs);
  font-weight: 500;
  line-height: 1.45;
  color: var(--form-error);
}

.field__error::before {
  content: "!";
  display: grid;
  place-items: center;
  flex: none;
  width: 1rem;
  height: 1rem;
  margin-top: 0.05rem;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 0.65rem;
  font-weight: 800;
}

.field__error:empty {
  display: none;
}

/* Grupos de opções (desafio e prazo) */
.choices {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.choices__legend {
  margin-bottom: var(--space-3);
  padding: 0;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-strong);
}

.choices__list {
  display: grid;
  gap: var(--space-3);
}

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

.choice {
  position: relative;
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  padding: 0.9rem 1rem;
  border: 1px solid var(--form-field-border);
  border-radius: 12px;
  background: var(--form-field-bg);
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}

.choice:hover {
  border-color: #42464E;
}

/* O input real fica acessível (teclado e leitores de tela), apenas invisível */
.choice input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.choice__mark {
  position: relative;
  flex: none;
  width: 1.15rem;
  height: 1.15rem;
  margin-top: 0.15rem;
  border: 1.5px solid #5C5F66;
  border-radius: 50%;
  transition: border-color var(--dur-fast) var(--ease-out);
}

.choice__mark::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--accent);
  transform: scale(0);
  transition: transform var(--dur-fast) var(--ease-out);
}

.choice__text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: var(--fs-sm);
  line-height: 1.45;
  color: var(--text);
}

.choice__text strong {
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--text-strong);
}

.choice:has(input:checked) {
  border-color: var(--accent);
  background: rgba(255, 106, 42, 0.07);
}

.choice:has(input:checked) .choice__mark {
  border-color: var(--accent);
}

.choice:has(input:checked) .choice__mark::after {
  transform: scale(1);
}

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

.choices[aria-invalid="true"] .choice {
  border-color: rgba(240, 123, 111, 0.55);
}

/* Consentimento */
.consent {
  position: relative;
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  font-size: var(--fs-sm);
  line-height: 1.55;
  color: var(--text);
}

.consent input {
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
  margin: 0.15rem 0 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.consent a {
  color: var(--accent-bright);
  text-underline-offset: 3px;
}

.consent a:not([href]) {
  text-decoration: underline dotted;
  cursor: help;
}

/* Honeypot anti-spam: fora da tela, invisível para pessoas */
.hp-field {
  position: absolute !important;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ---------- 6. Ações e status ---------- */
.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-top: clamp(2rem, 4vw, 2.5rem);
  padding-top: var(--space-6);
  border-top: var(--border-hair);
}

.form-actions__next {
  margin-left: auto;
}

.btn--ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}

.btn--ghost:hover {
  border-color: #42464E;
  color: var(--text-strong);
}

.btn--ghost .btn__icon {
  transform: rotate(-135deg);
}

.btn--ghost:hover .btn__icon {
  transform: rotate(-135deg) translate(2px, -2px);
}

.btn[disabled] {
  opacity: 0.6;
  cursor: wait;
}

.form-status {
  margin-top: var(--space-5);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  line-height: 1.55;
}

.form-status:empty {
  display: none;
}

.form-status--pending {
  border: 1px dashed rgba(255, 138, 69, 0.55);
  background: rgba(255, 106, 42, 0.06);
  color: var(--text);
}

.form-status--error {
  border: 1px solid rgba(240, 123, 111, 0.5);
  background: rgba(240, 123, 111, 0.08);
  color: var(--text-strong);
}

.form-note {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2) var(--space-4);
  margin-top: var(--space-5);
  font-size: var(--fs-xs);
  line-height: 1.55;
  text-align: center;
  color: var(--text-muted);
}

.link-button {
  /* Área de toque de ~44px sem mudar a aparência nem o espaçamento */
  padding: 0.75rem 0.5rem;
  margin: -0.75rem -0.5rem;
  border: 0;
  background: none;
  font: inherit;
  color: var(--accent-bright);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* ---------- 7. Página de obrigado ---------- */
.thanks {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.thanks__mark {
  width: 3.5rem;
  height: 3.5rem;
  margin-bottom: var(--space-6);
  color: var(--accent-bright);
  --qc-ring-fill: var(--bg);
  filter: drop-shadow(0 0 12px rgba(255, 106, 42, 0.35));
}

.thanks__title {
  max-width: 16em;
  font-size: clamp(2rem, 1.3rem + 2.6vw, 3.25rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.thanks__text {
  max-width: 38rem;
  margin-top: var(--space-5);
  font-size: var(--fs-lg);
  line-height: 1.6;
  color: var(--text-muted);
  text-wrap: balance;
}

.thanks__next {
  display: flex;
  gap: var(--space-4);
  align-items: flex-start;
  max-width: 36rem;
  margin-top: clamp(2rem, 4vw, 2.75rem);
  padding: var(--space-5) var(--space-6);
  border: 1px solid rgba(255, 106, 42, 0.32);
  border-radius: var(--radius-md);
  background: rgba(255, 106, 42, 0.06);
  text-align: left;
  font-size: var(--fs-md);
  line-height: 1.6;
  color: var(--text-strong);
}

.thanks__next svg {
  flex: none;
  width: 1.5rem;
  height: 1.5rem;
  margin-top: 0.1rem;
  fill: none;
  stroke: var(--accent-bright);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.thanks__back {
  margin-top: clamp(2rem, 4vw, 2.75rem);
}

/* ---------- 7b. Política de privacidade ---------- */
.legal__pending {
  margin: 0 0 var(--space-6);
}

.legal__updated {
  font-size: var(--fs-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.legal__body {
  display: flex;
  flex-direction: column;
  gap: clamp(2rem, 4vw, 2.5rem);
  margin-top: clamp(2.5rem, 5vw, 3.5rem);
  padding: clamp(1.5rem, 4vw, 2.5rem);
  border: var(--border-hair);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.legal__body h2 {
  margin-bottom: var(--space-3);
  font-family: var(--font-display);
  font-size: clamp(1.125rem, 1rem + 0.5vw, 1.3125rem);
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-strong);
}

.legal__body p,
.legal__body li {
  font-size: var(--fs-md);
  line-height: 1.7;
  color: var(--text-muted);
}

.legal__body p + p,
.legal__body p + ul,
.legal__body ul + p {
  margin-top: var(--space-3);
}

.legal__body ul {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding-left: 1.2rem;
  list-style: disc;
}

.legal__body li::marker {
  color: var(--accent);
}

.legal__body strong {
  color: var(--text);
}

.legal__fill {
  padding: 0.05em 0.35em;
  border-radius: 4px;
  background: rgba(255, 106, 42, 0.16);
  color: var(--accent-bright);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.legal__inline-btn {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: var(--accent-bright);
  text-decoration: underline;
  text-underline-offset: 0.2em;
  cursor: pointer;
}

.legal__back {
  align-self: center;
  margin: clamp(2rem, 4vw, 2.75rem) auto 0;
  display: flex;
  width: fit-content;
}

/* ---------- 8. Telas pequenas ---------- */
@media (max-width: 640px) {
  .field-row,
  .choices__list--pills {
    grid-template-columns: minmax(0, 1fr);
  }

  .form-actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .form-actions .btn {
    width: 100%;
  }

  .form-actions__next {
    margin-left: 0;
  }

  .stepper__label {
    font-size: 0.6875rem;
  }
}

/* Botões longos podem quebrar linha em telas muito estreitas (320px) */
@media (max-width: 400px) {
  .page .btn,
  .form-actions .btn {
    white-space: normal;
    text-align: center;
  }

  .site-header__back {
    --btn-pad-x: 0.75rem;
  }

  /* Cabeçalho do formulário: rótulo curto ("← Início") para não encostar na marca */
  .site-header .site-header__back .btn__icon {
    display: inline-block;
  }
}

.site-header__back-short {
  display: none;
}

@media (max-width: 400px) {
  .site-header__back-long {
    display: none;
  }

  .site-header__back-short {
    display: inline;
  }
}
